/window superclass /tailx -100 def /taily 440 def /minwidth 100 def /minheight 50 def /cursx 0 def /cursy 0 def /dragable false def /savebehind true def /mapbeep true def /triWpath { % -- tailx 0 lt { 0 0 moveto 0 h lineto tailx taily lineto closepath } if } def /triEpath { % -- tailx w gt { w 0 moveto w h lineto tailx taily lineto closepath } if } def /triSpath { % -- taily 0 lt { 0 0 moveto w 0 lineto tailx taily lineto closepath } if } def /triNpath { % -- taily h gt { 0 h moveto w h lineto tailx taily lineto closepath } if } def /canvaspath { % -- triWpath triNpath triEpath triSpath 0 0 w h rectpath } def /Paint { % -- 0 0 w h rectpath BG setcolor fill newpath triNpath BG2 setcolor fill newpath triWpath triEpath taily 0 lt {BG2} {BG3} ifelse setcolor fill newpath triSpath BG3 setcolor fill FG setcolor 2 0 0 w h rectframe eofill 4 [0 0 w h] insetstroke aload pop rectpath stroke } def /warpcursor { % -- gsave framebuffer setcanvas currentcursorlocation 2 array astore dup 0 get /cursx exch promote 1 get /cursy exch promote grestore w 2 div h 4 div setcursorlocation } def /move { % float float -- x 2 index ne true { y 1 index ne } ifelse { x y /mx mx 6 -2 roll mtranslate softpromote tailx x neg 4 -1 roll add add /tailx exch promote taily y neg 3 -1 roll add add /taily exch promote greset } { pop pop } ifelse } def /map { % -- [self] /freeze @parent Send /@freezer null promote //map exec /warpcursor gexec mapbeep {beep} if } def /mapxy { % float float -- gsave transform currentcanvas setcanvas itransform currentcanvas framebuffer setcanvas getcanvaslocation xyadd grestore 2 array astore dup 0 get round cvi exch 1 get round cvi unmap 1 index x sub /tailx exch promote dup y sub /taily exch promote 1 index screenwidth 2 div lt { exch 80 add } { exch w sub 80 sub } ifelse exch 0 3 -1 roll screenwidth w sub min max exch dup screenheight 2 div lt { 40 add } { h sub 40 sub } ifelse 0 exch screenheight h sub min max move map } def /unmap { % -- //unmap exec cursx 0 ne true { cursy 0 ne } ifelse { gsave framebuffer setcanvas cursx cursy setcursorlocation /cursx unpromote /cursy unpromote grestore } if /@freezer unpromote //nullarray /defrost @parent Send } def /owner_open nullproc def /onmenu { % -- edit_mode { //onmenu exec } if } def /Action nullproc def