| Global mx1a:Int, my1a:Int Global mx1_old:Int, my1_old:Int Global xsize_old:Int, ysize_old:Int Global MaxCursorSize:Int=128 Global CursorResize:int=false |
| Case EVENT_MOUSEDOWN Process_MouseDownEvent |
| Function Process_MouseDownvent:Int() Select EventSource() Case Canvas1 Select EventData() Case MOUSE_LEFT If CursorResize=False 'We are not normal mode CursorResize=True 'user click left mouse xsize_old=xsize ysize_old=ysize mx1_Old=mx1 my1_Old=my1 MoveMouse(mx1+xsize,my1+ysize) Else 'We are in change size mode, so back out CursorResize=False xsize=mx1a-mx1_Old ysize=my1a-my1_Old If xsize>MaxCursorSize Then xsize=MaxCursorSize If xsize>MaxCursorSize Then xsize=MaxCursorSize MoveMouse(mx1_Old,my1_Old) EndIf End Select 'eventdata() RedrawGadget(Canvas1) End Select 'eventsource() End Function |
| Function Process_GadgetPaintEvent:Int() Select EventSource() Case Canvas1 SetGraphics CanvasGraphics (Canvas1) Cls DrawPixmap Pix,0,0 If MouseInCanvas1 Then DrawCursor(mx1,my1,xsize, ysize) If CursorResize=True SetColor 255,0,0 DrawCursor(mx1_old,my1_old,xsize_old, ysize_old) SetColor 0,0,0 EndIf RedrawGadget(Canvas2) EndIf Flip Case Canvas2 SetGraphics CanvasGraphics(Canvas2) Cls If MouseInCanvas1=True Then If CursorResize=False Then DrawPixUnderCursor(Canvas2,Pix,mx1,my1) Else DrawPixUnderCursor(Canvas2,Pix,mx1_Old,my1_Old) EndIf EndIf Flip End Select 'EventSource() End Function |
| Function Process_MouseMoveEvent:Int() Select EventSource() Case Canvas1 If CursorResize=False mx1=EventX() my1=EventY() Else mx1a=EventX() my1a=EventY() xsize=EventX()-mx1_Old ysize=EventY()-my1_Old EndIf RedrawGadget(Canvas1) End Select End Function |
| Function Process_MouseEnterEvent:Int() Select EventSource() Case Canvas1 HideMouse() MouseInCanvas1=True CursorResize=False RedrawGadget(Canvas1) End Select End Function |