aUCBLogo Demos and Tests / mousepaint
be mousepaint
setPenSize [3 3]
disableLineSmooth ;because of flood fill!!
PenUp
running=true
::rubber=false
OnMouseLeftDown
[ setPos butLast MousePos
PenDown
]
OnMouseLeftUp
[ PenUp
]
OnMouseRightDown
[ ::rubber=true
]
OnMouseRightUp
[ ::rubber=false
]
OnMouseMotion
[ if PenDown?
[ setPos butLast MousePos
]
if ::rubber
[ local [c]
c=PenColor
setFloodColor "white
fillCircle 10
setPenColor c
]
updateGraph
]
f=Frame [][PaintTools]
wxframe_tool_window+wxcaption+wxclose_box
+wxsystem_menu+wxresize_border+wxtab_traversal+wxstay_on_top
[400 500][-1 -1]
FrameSetBackgroundColor f [.9 .9 .85]
FrameSetClientSize f 100 30*7
bcs=Button f [&clearScreen]
[ clearScreen
updateGraph
]
bpc=Button f [&PenColor]
[ setPenColor getColorFromUser PenColor
updateGraph
]
bfc=Button f [F&loodColor]
[ setFloodColor getColorFromUser FloodColor
updateGraph
]
bfill=Button f [&fill]
[ fill
updateGraph
]
bps=IntControl f [&PenSize] 1 first PenSize 100
[ s=IntControlValue
setPenSize list s s
]
bclose=(Button f "
[ destroyAll
] 0 [-1 -1][-1 -1] wxid_close)
bs=BoxSizer wxvertical
BoxSizerAdd bs bcs 1 wxexpand 0
BoxSizerAdd bs bpc 1 wxexpand 0
BoxSizerAdd bs bfc 1 wxexpand 0
BoxSizerAdd bs bfill 1 wxexpand 0
BoxSizerAdd bs bps 1 wxexpand 0
BoxSizerAdd bs bclose 1 wxexpand 0
FrameSetSizer f bs
while [running]
[ waitMS 20
dispatchMessages
]
be destroyAll
er [[][f bcs bpc bfc bfill bps bclose bs]]
OnChar []
OnMouseMotion []
GC
running=false
end
end