Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias systemcolours {
- if ($window(@SystemColours)) sc.close
- else {
- window -pdfk0w0B +ft @SystemColours -1 -1 320 240 $qt($mircexe) 53
- drawsize @SystemColours 320 240
- %c.w = 320
- %c.h = 240
- window -hk0 @sc.objects
- sc.objects
- sc.draw
- }
- }
- alias -l sc.objects {
- aline @sc.objects 5 20 100 50 $rgb(shadow) shadow
- aline @sc.objects 110 20 100 50 $rgb(hilight) hilight
- aline @sc.objects 5 75 100 50 $rgb(3dlight) 3dlight
- aline @sc.objects 110 75 100 50 $rgb(frame) frame
- aline @sc.objects 5 125 100 50 $rgb(text) text
- }
- alias -l sc.draw {
- drawrect -nrf @SystemColours $rgb(face) 1 0 0 480 320
- drawtext -nr @SystemColours 255 Tahoma -8 5 0 face
- drawtext -nr @SystemColours 255 Tahoma -8 5 225 Drag & drop!
- filter -wk @sc.objects sc.drawobject
- drawdot @SystemColours
- }
- alias -l sc.drawobject {
- tokenize 32 $1
- drawrect -nrf @SystemColours $5 1 $1-4
- drawtext -nr @SystemColours 255 Tahoma -8 $1-2 $6-
- }
- menu @SystemColours {
- sclick: {
- %c.x = $mouse.x
- %c.y = $mouse.y
- %c.s =
- filter -wk @sc.objects sc.checkclick
- if ($fline(@sc.objects,%c.s)) {
- dline @sc.objects $v1
- aline @sc.objects %c.s
- %c.move = $line(@sc.objects,0)
- sc.draw
- }
- else %c.move =
- }
- mouse: {
- if (%c.move) {
- set -l %x $mouse.x
- set -l %y $mouse.y
- tokenize 32 %c.s
- set -l %nx $calc(%x -(%c.x -$1))
- set -l %ny $calc(%y -(%c.y -$2))
- if (%nx < 0) %nx = 0
- elseif ($calc(%nx +$3) > %c.w) %nx = %c.w - $3
- if (%ny < 0) %ny = 0
- elseif ($calc(%ny +$4) > %c.h) %ny = %c.h - $4
- %c.s = %nx %ny $3-
- rline @sc.objects %c.move %c.s
- %c.x = %x
- %c.y = %y
- sc.draw
- }
- }
- uclick:unset %c.move %c.x %c.y %c.s
- leave:unset %c.move %c.x %c.y %c.s
- Reset objects:clear @sc.objects | sc.objects | sc.draw
- -
- Close:sc.close
- }
- alias -l sc.checkclick {
- tokenize 32 $1
- if ($inrect(%c.x,%c.y,$1,$2,$3,$4)) %c.s = $1-
- }
- on *:close:@SystemColours:sc.close
- alias -l sc.close {
- window -c @SystemColours
- window -c @sc.objects
- unset %c.move %c.x %c.y %c.s %c.w %c.h
- }
Advertisement
Add Comment
Please, Sign In to add comment