%! % % Date: Wed, 11 May 88 02:31:51 EDT % To: NeWS-makers@brillig.umd.edu % Subject: class NeatWindow % From: Don Hopkins % % Here is a window class with window managment menus designed to work % well with pie menus. You should of course have piemenu.ps loaded up % before running this. Just psh it into your environment, and the % DefaultWindow will be set up so that the next window you get will be a % NeatWindow! Fire up a clock or something, pop up the frame menu, and % play around! I am not including any instructions right now, because I % would like to hear what you think of it after trying to figure out % what the menus do on your own. (heh heh heh -- the code is free but % you gotta be a guinea pig!) This is experimental, so I'll be coming % out with a more refined version later. If you'd care to answer the % following questions after playing around with the NeatWindow menus, % I'd really appreciate it! % % - Which functions were obvious by their direction, or their labeling? % % - How would you change the labels to make their meanings clearer? % % - Why do you think the selections are arranged the way they are? % % - What mnemonic tricks can you think of to remember the selection % directions? % % - After using them for a while, which selections do you find yourself % mousing into without looking at the menu? % % Enjoy! % % -Don %! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % @(#)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 % Fixed to use flipiconic. -deh /flipmove { gsave flipiconic framebuffer setcanvas 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 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 ClassIconMenu def } def %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The menus shared by all instances of the class: /FrameZapMenu [ /nuke {/destroy ThisWindow send} (No!) {} (No!) {} (No!) {} ] /new PieMenu send def FrameZapMenu /MenuFont /Times-BoldItalic findfont 24 scalefont put FrameZapMenu /flipstyle {currentdict} put /FrameMoveMenu [ /move_v {/movevertical ThisWindow send} /move {/slide ThisWindow send} /eye3 {/flipmove ThisWindow send} /move_h {/movehorizontal ThisWindow send} ] /new PieMenu send def FrameMoveMenu /flipstyle {currentdict} put /IconMoveMenu [ /move_v {/movevertical ThisWindow send} /move {/slide ThisWindow send} /eye {/flipmove ThisWindow send} /move_h {/movehorizontal ThisWindow send} ] /new PieMenu send def IconMoveMenu /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 (Zap?) FrameZapMenu [(\257) /Symbol findfont 18 scalefont] {/tobottom ThisWindow send} (Reshape!) {/reshapefromuser-open ThisWindow send} (Stretch\274) FrameStretchMenu /eye3 {/flipiconic ThisWindow send} ] /new PieMenu send def ClassFrameMenu /MenuFont /Times-Roman findfont 18 scalefont put /ClassIconMenu [ [(\255) /Symbol findfont 18 scalefont] {/totop ThisWindow send} /painting_hand {/paint ThisWindow send} (Move\274) IconMoveMenu (Zap?) FrameZapMenu [(\257) /Symbol findfont 18 scalefont] {/tobottom ThisWindow send} (Reshape!) {/reshapefromuser-open ThisWindow send} (Stretch\274) FrameStretchMenu /eye {/flipiconic ThisWindow send} ] /new PieMenu send def ClassIconMenu /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 } dup ClassFrameMenu send ClassIconMenu 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 NeatWindow def ScrollWindow pop end } if } if end % systemdict