%! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % @(#)neatwin.ps % % NeatWindow Class pie menu based window manager % Copyright (C) 1988. % By Don Hopkins. % All rights reserved. % % This program is provided for UNRESTRICTED use provided that this % copyright message is preserved on all copies and derivative works. % This is provided without any warranty. No author or distributor % accepts any responsibility whatsoever to any person or any entity % with respect to any loss or damage caused or alleged to be caused % directly or indirectly by this program. This includes, but is not % limited to, any interruption of service, loss of business, loss of % information, loss of anticipated profits, core dumps, abuses of the % virtual memory system, or any consequential or incidental damages % resulting from the use of this program. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % August 28, 1988 Don Hopkins % Made the menus shared by all instances of the class. % Put in a kludge to keep "spin" from trashing everybody's frame menu. % (If you want to learn how to write good NeWS code, don't look at spin.) % Added the DontSetDefaultWindow flag. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% systemdict begin systemdict /PieMenu known not { (NeWS/piemenu.ps) LoadFile pop } if /NeatWindow LiteWindow [] classbegin /stretchtopright { FrameX FrameY BBoxFromUser reshape non-iconic } def /stretchtopleft { FrameX FrameWidth add FrameY BBoxFromUser reshape non-iconic } def /stretchbottomright { FrameX FrameY FrameHeight add BBoxFromUser reshape non-iconic } def /stretchbottomleft { FrameX FrameWidth add FrameY FrameHeight add BBoxFromUser reshape non-iconic } def /stretchtop { /GA_value FrameX def /GA_constraint 0 def FrameX FrameWidth add FrameY BBoxFromUser reshape non-iconic } def /stretchbottom { /GA_value FrameX def /GA_constraint 0 def FrameX FrameWidth add FrameY FrameHeight add BBoxFromUser reshape non-iconic } def /stretchleft { /GA_value FrameY def /GA_constraint 1 def FrameX FrameWidth add FrameY FrameHeight add BBoxFromUser reshape non-iconic } def /stretchright { /GA_value FrameY def /GA_constraint 1 def FrameX FrameY FrameHeight add BBoxFromUser reshape non-iconic } def /movevertical { /GA_constraint 0 def slide } def /movehorizontal { /GA_constraint 1 def slide } def /flipmove { gsave framebuffer setcanvas CurrentEvent begin XLocation YLocation end unmap Iconic? { exch FrameWidth 2 div sub exch FrameHeight 2 div sub /FrameX 2 index def /FrameY 1 index def FrameCanvas } { exch IconWidth 2 div sub exch IconHeight 2 div sub /IconX 2 index def /IconY 1 index def IconCanvas } ifelse setcanvas matrix defaultmatrix setmatrix 2 copy movecanvas flipiconic move slide grestore } def % /flipmove { % gsave % framebuffer setcanvas % /unmap self send % /Iconic? Iconic? not def % CurrentEvent begin XLocation YLocation end % Iconic? { % exch IconWidth 2 div sub exch IconHeight 2 div sub % } { % exch FrameWidth 2 div sub exch FrameHeight 2 div sub % } ifelse % move % map slide % grestore % } def /non-iconic { Iconic? { flipiconic } if } def /reshapefromuser-open { reshapefromuser non-iconic } def /CreateFrameMenu { % - => - (Create frame menu) % Note: Store menu in class to share menus, especially if retained. /FrameMenu ClassFrameMenu def } def /CreateIconMenu { % - => - (Create icon menu) % Note: Store menu in class to share menus, especially if retained. /IconMenu {FrameMenu} def } def %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The menus shared by all instances of the class: /FrameEtcMenu [ /nuke {/destroy ThisWindow send} (userdict) {{userdict browse} errored pop} (Oops!) {currentcursorlocation [( No)(problem!)] popmsg pop} (ThisWindow) {{ThisWindow browse} errored pop} ] /new PieMenu send def FrameEtcMenu /MenuFont /Times-Roman findfont 18 scalefont put FrameEtcMenu /flipstyle {currentdict} put /FrameMoveMenu [ /move_v {/movevertical ThisWindow send} /move {/slide ThisWindow send} /eye {/flipmove ThisWindow send} /move_h {/movehorizontal ThisWindow send} ] /new PieMenu send def FrameMoveMenu /flipstyle {currentdict} put /FrameStretchMenu [ /stretch_h {/stretchtop ThisWindow send} /stretchNE {/stretchtopright ThisWindow send} [/stretch_v 4 0] {/stretchright ThisWindow send} /stretchSE {/stretchbottomright ThisWindow send} /stretch_h {/stretchbottom ThisWindow send} /stretchSW {/stretchbottomleft ThisWindow send} [/stretch_v 4 0] {/stretchleft ThisWindow send} /stretchNW {/stretchtopleft ThisWindow send} ] /new PieMenu send def FrameStretchMenu /flipstyle {currentdict} put /ClassFrameMenu [ [(\255) /Symbol findfont 18 scalefont] {/totop ThisWindow send} /painting_hand {/paint ThisWindow send} (Move\274) FrameMoveMenu (Etc\274) FrameEtcMenu [(\257) /Symbol findfont 18 scalefont] {/tobottom ThisWindow send} (Reshape!) {/reshapefromuser-open ThisWindow send} (Stretch\274) FrameStretchMenu /eye {/flipiconic ThisWindow send} ] /new PieMenu send def ClassFrameMenu /MenuFont /Times-Roman findfont 18 scalefont put % Make a copy of ourselves if somebody tries to change us! % (Yes this is a hack, but otherwise "spin" messes up everybody % else's frame menu, and if you mess with the frame menu you're % asking for trouble anyway.) { /clone&forward { % /msg => - /flipstyle self send ThisWindow dup null eq {pop win} if % Foo on spin... /FrameMenu 2 index put send } def /insertitem { /insertitem clone&forward } def /deleteitem { /deleteitem clone&forward } def /changeitem { /changeitem clone&forward } def } ClassFrameMenu send classend def systemdict /DontSetDefaultWindow known not { /DefaultWindow NeatWindow def % Hack to make ScrollWindow a subclass of NeatWindow. (gross) /ScrollWindow load type /arraytype eq { 10 dict begin /LiteWindow DefaultWindow def ScrollWindow pop end } if } if end % systemdict