don@BRILLIG.UMD.EDU (Don Hopkins) (08/28/88)
%!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% @(#)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
/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 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