Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!TRIPOLI.EES.ANL.GOV!zawada From: zawada@TRIPOLI.EES.ANL.GOV Newsgroups: comp.windows.news Subject: Application Launcher Message-ID: <8911081952.AA06472@tripoli.ees.anl.gov> Date: 9 Nov 89 20:58:49 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 6133 Congratulations on obtaining a copy of EXPRESS!!! This file is an archive which contains: README.express express.ps me.ras.uu ScrollDataItem. To unarchive this file type ar xv 'filename' Special Notes me.ras.uu is a uuencoded raster file which must be de-coded by uudecode me.ras.uu ScrollDataItem. must be renamed to ScrollDataItem.ps ------------- Cut Here --------------- Cut Here ------------ ! README.express 624748393 117 100 100644 2774 ` %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % EXPRESS v1.0 % % Date: October 18, 1989 % Author: % David G. Zawada % EAIS-VIS % Argonne National Laboratory % zawada@athens.ees.anl.gov % % Technical Advisors: % Peter A. Korp % EAIS-VIS % Argonne National Laboratory % korp@athens.ees.anl.gov % % David C. Mak % EAIS-VIS % Argonne National Laboratory % mak@athens.ees.anl.gov % % % Accompanying files: % -> ScrollDataItem.ps % -> me.ras % % EXPRESS is a quick launch facility which displays % a list of user-specified applications in a menu with % a touch of the designated HotKey. % % IMPORTANT !!! % Before running EXPRESS, the environment variable % EXPRESS_HOME must be set to the path specifying the % location of the files me.ras and ScrollDataItem.ps. % To run EXPRESS, simply type 'psh express.ps'. However, % I strongly recommend that you add an item to your NeWS % rootmenu to perform this task. A line, similar to the % following, in your user.ps file will acheive this goal: % % 0 (Activate Express) % { (psh "path to express"/express.ps) forkunix } % /insertitem rootmenu send % % Now, EXPRESS can be launched from a menu selection, % which I prefer since my typing skills are minimal. % Also, EXPRESS is only a mouse click away. % % After launching EXPRESS for the first time, the 'RIGHT' % key is set as the HotKey and the EXPRESS menu contains % the following items: % % Terminal <- Sun psterm window % Cancel <- no action % About Express <- EXPRESS credits % Configure Express <- Allows customization % Disable Express <- Deactivates EXPRESS % % These items are hardcoded and cannot be changed by % EXPRESS itself. The Configure option, however, displays % a control panel which allows for the customization of % the applications accessible through EXPRESS, the fonts % used by EXPRESS, and the HotKey which launches EXPRESS. % Currently, only the F-, L-, and R-function keys, as % well as the LEFT and RIGHT keys, may be designated as % the HotKey. Also, only the Sun3 keyboard layout is % supported at present. % % A neat feature of EXPRESS is that it can be configured % to execute virtually any piece of NeWS/PostScript code. % Suppose there is a file called win.ps which opens a % NeWS window. You can tell EXPRESS how to launch this % program by accessing the Application Customizer and % entering "psh win.ps" in the Application to add field % and setting the Application type CycleItem to NeWS. % EXPRESS will simply fork off the process "psh win.ps". %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% express_pd.ps 626557502 117 100 100644 35994 ` %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % EXPRESS v1.0 % % Date: October 18, 1989 % Author: % David G. Zawada % EAIS-VIS % Argonne National Laboratory % zawada@athens.ees.anl.gov % % Technical Advisors: % Peter A. Korp % EAIS-VIS % Argonne National Laboratory % korp@athens.ees.anl.gov % % David C. Mak % EAIS-VIS % Argonne National Laboratory % mak@athens.ees.anl.gov % % % Accompanying files: % -> ScrollDataItem.ps % -> me.ras % % EXPRESS is a quick launch facility which displays % a list of user-specified applications in a menu with % a touch of the designated HotKey. % % IMPORTANT !!! % Before running EXPRESS, the environment variable % EXPRESS_HOME must be set to the path specifying the % location of the files me.ras and ScrollDataItem.ps. % To run EXPRESS, simply type 'psh express.ps'. However, % I strongly recommend that you add an item to your NeWS % rootmenu to perform this task. A line, similar to the % following, in your user.ps file will acheive this goal: % % 0 (Activate Express) % { (psh "path to express"/express.ps) forkunix } % /insertitem rootmenu send % % Now, EXPRESS can be launched from a menu selection, % which I prefer since my typing skills are minimal. % Also, EXPRESS is only a mouse click away. % % After launching EXPRESS for the first time, the 'RIGHT' % key is set as the HotKey and the EXPRESS menu contains % the following items: % % Terminal <- Sun psterm window % Cancel <- no action % About Express <- EXPRESS credits % Configure Express <- Allows customization % Disable Express <- Deactivates EXPRESS % % These items are hardcoded and cannot be changed by % EXPRESS itself. The Configure option, however, displays % a control panel which allows for the customization of % the applications accessible through EXPRESS, the fonts % used by EXPRESS, and the HotKey which launches EXPRESS. % Currently, only the F-, L-, and R-function keys, as % well as the LEFT and RIGHT keys, may be designated as % the HotKey. Also, only the Sun3 keyboard layout is % supported at present. % % A neat feature of EXPRESS is that it can be configured % to execute virtually any piece of NeWS/PostScript code. % Suppose there is a file called win.ps which opens a % NeWS window. You can tell EXPRESS how to launch this % program by accessing the Application Customizer and % entering "psh win.ps" in the Application to add field % and setting the Application type CycleItem to NeWS. % EXPRESS will simply fork off the process "psh win.ps". %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% systemdict /ScrollDataItem known not % Make sure SDI is available { (EXPRESS_HOME) getenv (/ScrollDataItem.ps) append run } if version (1.1) eq { keyboardtype 3 eq % enable the Left key -- Why does NeWS disable it? { systemdict /keyboard_positions get /FunctionLeft [ 120 systemdict /UI_private get /keyStation get exec /function ] put } if } if systemdict /ExpressDict 100 dict put % put all the Express code in its own dictionary ExpressDict begin /createfile? false def % does the defaults file (.expressapps) need to be created? /expressfile null def /NumDefaultMenuEntries 7 def /HotKey /FunctionRight def /writefile % - > - write out the current EXPRESS settings { pause % Just Being Nice /expressfile ($HOME/.expressapps) (w) file store expressfile ([\n) writestring ExpressMenu /MenuKeys get 0 1 2 index length NumDefaultMenuEntries 1 add sub { expressfile 2 index 3 -1 roll get (\() exch append (\)\n) append writestring } for expressfile (]\n\n) writestring pause % Just Being Nice expressfile ([\n) writestring ExpressMenu /MenuActions get 0 1 2 index length NumDefaultMenuEntries 1 add sub { expressfile 2 index 3 -1 roll get (\() exch append (\)\n) append writestring } for expressfile (]\n) writestring [ ButFnt MenFnt SDIFnt TIFnt ] { (\() exch convertfont (\)\n) append append expressfile exch writestring } forall expressfile (\() HotKey 100 string cvs (\)\n) append append writestring expressfile closefile } def /getfntname % font => string containing fontname and pt_size { 200 string cvs (font\() search pop pop pop (\)) search pop 3 1 roll pop pop ( ) append } def /convertfont % (font&size) => (font size) put space betwn font and size { getfntname dup 0 1 index length 3 sub getinterval ( ) 3 -1 roll dup length 3 sub 3 getinterval append append } def /verifyfile % filename => boolean does filename exist? { { (r) file } stopped { pop pop false } { closefile true } ifelse } def ($HOME/.expressapps) verifyfile % if defaults file exists, read it in { ExpressDict begin ($HOME/.expressapps) run /HotKey exch cvn store /TIFnt exch ( ) search pop findfont 3 1 roll pop cvi scalefont def /SDIFnt exch ( ) search pop findfont 3 1 roll pop cvi scalefont def /MenFnt exch ( ) search pop findfont 3 1 roll pop cvi scalefont def /ButFnt exch ( ) search pop findfont 3 1 roll pop cvi scalefont def /UserMenuActions exch def /UserMenuKeys exch def end % ExpressDict } { % otherwise, set default fonts and ... ExpressDict begin /ButFnt /Times-Bold findfont 14 scalefont def /MenFnt /Helvetica-Bold findfont 12 scalefont def /SDIFnt /Helvetica-Bold findfont 14 scalefont def /TIFnt /Screen-Bold findfont 14 scalefont def end % ExpressDict /createfile? true store % ... indicate default file needs to be created } ifelse gsave % get screen dimensions framebuffer setcanvas clippath pathbbox /ScreenHeight exch def /ScreenWidth exch def pop pop grestore /calc_wincoords % w h => x y w h coords that will center window on screen { 1 index 1 index ScreenHeight exch sub 2 div 4 1 roll ScreenWidth exch sub 2 div 4 1 roll } def %%%%%%%%%%%%%%%%%%%%%% %% About EXPRESS stuff %%%%%%%%%%%%%%%%%%%%%% /aboutEM null def /aboutcan framebuffer newcanvas def aboutcan /Transparent false put aboutcan /Retained true put aboutcan /Mapped false put 0 0 463 313 rectpath aboutcan reshapecanvas /about_express % display EXPRESS credits { ExpressDict begin gsave aboutcan setcanvas 300 dup movecanvas aboutcan canvastotop aboutcan /Mapped true put gsave % scale and load in my picture !!! (kind of Mac-ish, huh?) 463 313 scale pause (EXPRESS_HOME) getenv (/me.ras) append readcanvas imagecanvas grestore newpath 128 8 329 20 rectpath 0 0 0 rgbcolor 1 1 1 rgbcolor ColorDisplay? { pop pop 0 0 1 rgbcolor ColorDict /MediumSpringGreen get } if setcolor fill setcolor newpath 2 128 8 329 20 rectframe eofill /Symbol findfont 14 scalefont setfont 131 14 moveto (\323) show /Helvetica-Bold findfont 12 scalefont setfont 142 14 moveto ( Argonne National Lab by Dave Zawada -- Version 1.0) show /aboutEM % display credits until Left Mouse Button pressed [ PointButton { aboutcan /Mapped false put aboutEM killprocess } /DownTransition aboutcan eventmgrinterest ] forkeventmgr store grestore end % ExpressDict } def %% End About EXPRESS %%%%%%%%%%%%%%%%%%%%%%%%% %% EXPRESS Control Panel %%%%%%%%%%%%%%%%%%%%%%%%% /cpButtonSize 0 def % size of buttons to use -- depends on ButFnt /cpButtonX 10 def /cpitemsEM null def /appsChanges? false def % Changes made to application list? /fntChanges? false def % Changes made to font list? /hkChanges? false def % Change made to HotKey? /cp framebuffer /new SunViewWindow send def { 300 dup 200 400 reshape FrameInterests /FrameMenuEvent undef FrameInterests /ClientMenuEvent undef /PaintClient { ColorDisplay? { ColorDict /LightBlue get fillcanvas } if cpitems paintitems } def /FrameFont /Helvetica-Bold findfont 14 scalefont def /FrameLabel (EXPRESS Control Panel) def /flipiconic {} def /stretchcorner {} def } cp send /cpcan cp /ClientCanvas get def %-------------------- %--- button notifies %-------------------- /abut_notify { /unmap cp send configapps } def % Display Application Customizer /fbut_notify { /unmap cp send configfnt } def % Display Font Customizer /hkbut_notify { /unmap cp send confighk } def % Display HotKey Customizer /sbut_notify { % Save any changes and write them out to the defaults file ExpressDict begin hkChanges? { HotKey unbindkey /HotKey (Function) hkitems /msg get /ItemObject get append cvn store HotKey 20 string cvs (Function) search pop pop pop dup /printstring hkitems /msg get send cvn /CurntHK exch store setHotKey hkcan_notify /hkChanges? false store } if fntChanges? { /ButFnt tmpButFnt store /MenFnt tmpMenFnt store % Bizarre, but must create a NEW menu to reflect the font change { /MenuFont MenFnt store /SaveMenuKeys MenuKeys store /SaveMenuActions MenuActions store } ExpressMenu send /ExpressMenu SaveMenuKeys SaveMenuActions /new DefaultMenu send store adjustmenu /SDIFnt tmpSDIFnt store /TIFnt tmpTIFnt store update_configwin update_hkwin update_cp } if writefile /unmap cp send cpitemsEM null ne { cpitemsEM killprocess /cpitemsEM null store } if end % ExpressDict } def /cbut_notify % - > - cancel ALL changes { can_notify cancel_notify hkcan_notify /unmap cp send cpitemsEM null ne { cpitemsEM killprocess /cpitemsEM null store } if } def /cpitems 5 dict dup begin /abut (Change Installed Applications) /abut_notify cpcan 0 0 /new ButtonItem send dup /ItemFrame 2 put dup /ItemLabelFont ButFnt put 0 0 /move 3 index send def /cpButtonSize abut /ItemWidth get store /fbut (Change Fonts) /fbut_notify cpcan cpButtonSize 0 /new ButtonItem send dup /ItemFrame 2 put dup /ItemLabelFont ButFnt put 0 0 /move 3 index send def /hkbut(Change HotKey) /hkbut_notify cpcan cpButtonSize 0 /new ButtonItem send dup /ItemFrame 2 put dup /ItemLabelFont ButFnt put 0 0 /move 3 index send def /sbut(Save) /sbut_notify cpcan 0 0 /new ButtonItem send dup begin /ItemFrame 2 def /ItemLabelFont ButFnt def /ItemFillColor 1 0 0 rgbcolor def end 0 0 /move 3 index send def /cbut(Cancel) /cbut_notify cpcan 0 0 /new ButtonItem send dup begin /ItemFrame 2 def /ItemLabelFont ButFnt def /ItemFillColor 1 1 0 rgbcolor def end 0 0 /move 3 index send def end % cpitems def /poscpitems % - > - Postion cpitems based on the max button size in cpitems { cpitems begin cpButtonX dup /move sbut send cpButtonX cpButtonSize add cbut /ItemWidth get sub 10 /move cbut send cbut /ItemHeight get cpButtonX dup 1.5 mul 2 index add /move hkbut send cpButtonX dup 2 mul 2 index 2 mul add /move fbut send cpButtonX dup 2.5 mul 3 -1 roll 3 mul add /move abut send end % cpitems } def { cpButtonX 2.5 mul cpButtonSize add cpButtonX 3.5 mul cpitems /cbut get /ItemHeight get 4 mul BorderTop BorderBottom add add add calc_wincoords reshape } cp send poscpitems %% End Control Panel %%%%%%%%%%%%%%%% %% Font Adjuster %%%%%%%%%%%%%%%% /FontChange? false def /tmpButFnt ButFnt def /tmpMenFnt MenFnt def /tmpSDIFnt SDIFnt def /tmpTIFnt TIFnt def /Fonts [ % the fonts to choose from [ (Boston) dup cvn findfont 14 scalefont ] [ (Courier) dup cvn findfont 14 scalefont ] [ (Courier-Bold) dup cvn findfont 14 scalefont ] [ (Courier-BoldOblique) dup cvn findfont 14 scalefont ] [ (Courier-Oblique) dup cvn findfont 14 scalefont ] [ (Helvetica) dup cvn findfont 14 scalefont ] [ (Helvetica-Bold) dup cvn findfont 14 scalefont ] [ (Helvetica-BoldOblique) dup cvn findfont 14 scalefont ] [ (Helvetica-Oblique) dup cvn findfont 14 scalefont ] [ (Screen) dup cvn findfont 14 scalefont ] [ (Screen-Bold) dup cvn findfont 14 scalefont ] [ (Times-Bold) dup cvn findfont 14 scalefont ] [ (Times-BoldItalic) dup cvn findfont 14 scalefont ] [ (Times-Italic) dup cvn findfont 14 scalefont ] [ (Times-Roman) dup cvn findfont 14 scalefont ] ] def /PtSizes [ [(12)] [(14)] [(18)] [(24)] ] def % font point sizes /fwitemsEM null def /fwin framebuffer /new SunViewWindow send def { 200 300 810 240 reshape FrameInterests /FrameMenuEvent undef FrameInterests /ClientMenuEvent undef /PaintClient { ColorDisplay? { ColorDict /LightBlue get fillcanvas } if fwinitems paintitems } def /FrameFont /Helvetica-BoldOblique findfont 14 scalefont def /FrameLabel (EXPRESS Font Customizer for ) (USER) getenv append def /flipiconic {} def /stretchcorner {} def } fwin send /fwcan fwin /ClientCanvas get def /configfnt % - > - configure and display the Font Customizer window { ExpressDict begin /fwitemsEM fwinitems forkitems store fwinitems begin (%) [ tmpButFnt getfntname ] /printf mb send (%) [ tmpMenFnt getfntname ] /printf mm send (%) [ tmpSDIFnt getfntname ] /printf msdi send (%) [ tmpTIFnt getfntname ] /printf mti send end % fwinitems { totop map } fwin send end % ExpressDict } def %-------------------- %--- button notifies %-------------------- /getfontselection % - => font boolean converts string returned by SDI into a font object { fwinitems begin fntSDI /ItemValue get dup null ne { Fonts exch get 0 get cvn findfont PtSizes ptsz /ItemValue get 1 get get 0 get cvi scalefont true } { pop false } ifelse end % fwinitems } def % The following four notify procs update there respective msg items % to reflect font changes. /sti_notify { getfontselection { dup ExpressDict /tmpTIFnt 3 -1 roll put getfntname (%) [ 3 -1 roll ] /printf fwinitems /mti get send ExpressDict /fntChanges? true put } if } def /ssdi_notify { getfontselection { dup ExpressDict /tmpSDIFnt 3 -1 roll put getfntname (%) [ 3 -1 roll ] /printf fwinitems /msdi get send ExpressDict /fntChanges? true put } if } def /sm_notify { getfontselection { dup ExpressDict /tmpMenFnt 3 -1 roll put getfntname (%) [ 3 -1 roll ] /printf fwinitems /mm get send ExpressDict /fntChanges? true put } if } def /sb_notify { getfontselection { dup ExpressDict /tmpButFnt 3 -1 roll put getfntname (%) [ 3 -1 roll ] /printf fwinitems /mb get send ExpressDict /fntChanges? true put } if } def /savfnt_notify % Don't do anything { ExpressDict begin /unmap fwin send fwitemsEM null ne { fwitemsEM killprocess /fwitemsEM null store } if { totop map } cp send end % ExpressDict } def /cancel_notify % Restore previous font settings { ExpressDict begin /fntChanges? false store /tmpButFnt ButFnt store /tmpMenFnt MenFnt store /tmpSDIFnt SDIFnt store /tmpTIFnt TIFnt store /unmap fwin send fwitemsEM null ne { fwitemsEM killprocess /fwitemsEM null store } if { totop map } cp send end % ExpressDict } def % The following update routines will rescale all of the various configure % windows to account for changes made to the fonts to be utilized in % control items. /update_cp { cpitems begin [ abut sbut cbut ] { { % Hokey, but needed to re-center the label /ItemLabelFont ButFnt def /LabelX 0 def /LabelY 0 def 0 0 0 0 reshape } exch send } forall /cpButtonSize abut /ItemWidth get store [ fbut hkbut ] { { % Hokey, but needed to re-center the label /ItemLabelFont ButFnt def /LabelX 0 def /LabelY 0 def 0 0 cpButtonSize 0 reshape } exch send } forall end % cpitems { cpButtonX 2.5 mul cpButtonSize add cpButtonX 3.5 mul cpitems /cbut get /ItemHeight get 4 mul BorderTop BorderBottom add add add calc_wincoords reshape } cp send poscpitems } def /update_configwin { items begin /cfTISize gsave TIFnt setfont (Reference in Menu as: ) stringbbox grestore pop 3 1 roll pop pop 2 mul store /cfSDISize gsave SDIFnt setfont ( Installed Applications ) stringbbox grestore pop 3 1 roll pop pop store { % Hokey, but needed to re-center the label /ItemLabelFont ButFnt def /LabelX 0 def /LabelY 0 def 0 0 0 0 reshape } cancel_but send /cfButtonSize cancel_but /ItemWidth get store [ add_but del_but done_but ] { { % Hokey, but needed to re-center the label /ItemLabelFont ButFnt def /LabelX 0 def /LabelY 0 def 0 0 cfButtonSize 0 reshape } exch send } forall { /ItemFont SDIFnt def /ItemLabelFont SDIFnt def } appsSDI send [ apptoadd appref ] { { /ItemFont TIFnt def /ItemLabelFont TIFnt def /LabelX 0 def /LabelY 0 def /ObjectX 0 def /ObjectY 0 def 0 0 cfTISize 0 reshape TI_resetarray } exch send } forall { /ItemFont TIFnt def /ItemLabelFont TIFnt def /LabelX 0 def /LabelY 0 def /ObjectX 0 def /ObjectY 0 def 0 0 0 0 reshape } filetype send end % items { 30 cfSDISize cfButtonSize cfTISize add add add 30 cfSDISize BorderTop BorderBottom add add add calc_wincoords reshape } configwin send poscfitems } def /update_hkwin { hkitems begin /msg (The current Hot Key is ) ( ) /Right {} hkcan 0 0 /new MessageItem send ColorDisplay? { dup /ItemFillColor ColorDict /LightBlue get put } if dup /ItemFont TIFnt put dup /ItemLabelFont TIFnt put 0 0 /move 3 index send store { /ItemLabelFont ButFnt def /LabelX 0 def /LabelY 0 def 0 0 0 0 reshape } dup save_but send can_but send { % Hokey, but needed to re-center the label /ItemLabelFont ButFnt def /LabelX 0 def /LabelY 0 def 0 0 0 0 reshape } Right send /hkButtonSize Right /ItemWidth get store { /ItemLabelFont ButFnt def /LabelX 0 def /LabelY 0 def 0 0 hkButtonSize dup reshape } 0 index Left send Right send fkeys { { % Hokey, but needed to re-center the label /ItemLabelFont ButFnt def /LabelX 0 def /LabelY 0 def 0 0 hkButtonSize dup reshape } exch cvn cvx exec send } forall end % hkitems { hkButtonSize dup 15 mul exch 6 mul BorderTop BorderBottom add add calc_wincoords reshape } hkwin send poshkitems } def %----------------------- %--- end button notifies %----------------------- /fwinitems 12 dict dup begin /fntSDI fwcan {} /new ScrollDataItem send def { /AllowMultipleSelect? false def /ShowItemSeperators false def /HScrollbar? false def ColorDisplay? { /BufferColor ColorDict /Aquamarine get def /ItemTextColor 0 0 1 rgbcolor def } if /ItemLabel (FONTS) def /ItemLabelFont /Helvetica-Bold findfont 13 scalefont def /ItemLabelColor 0 0 0 rgbcolor def /ItemHighLightColor 0 0 0 rgbcolor def Fonts setdata 10 dup 200 dup reshape } fntSDI send /ptsz ( Point Size ) PtSizes /Bottom {} fwcan 0 0 /new ArrayItem send 225 100 /move 3 index send def /savebut (SAVE) /savfnt_notify fwcan 80 0 /new ButtonItem send dup /ItemRadius 0 put 225 50 /move 3 index send def /canbut (CANCEL) /cancel_notify fwcan 80 0 /new ButtonItem send dup /ItemRadius 0 put 225 10 /move 3 index send def /sb (Set Button Font) /sb_notify fwcan 165 0 /new ButtonItem send 315 160 /move 3 index send def /sm (Set Menu Font) /sm_notify fwcan 165 0 /new ButtonItem send 315 110 /move 3 index send def /ssdi (Set ScrollDataItem Font) /ssdi_notify fwcan 165 0 /new ButtonItem send 315 60 /move 3 index send def /sti (Set TextItem Font) /sti_notify fwcan 165 0 /new ButtonItem send 315 10 /move 3 index send def /mb (Button Font is ) ButFnt getfntname /Right {} fwcan 300 0 /new MessageItem send 490 165 /move 3 index send def /mm (Menu Font is ) MenFnt getfntname /Right {} fwcan 300 0 /new MessageItem send 490 115 /move 3 index send def /msdi (ScrollDataItem Font is ) SDIFnt getfntname /Right {} fwcan 300 0 /new MessageItem send 490 65 /move 3 index send def /mti (TextItem Font is ) TIFnt getfntname /Right {} fwcan 300 0 /new MessageItem send 490 15 /move 3 index send def end def fwinitems { 0 index /ItemFrame 2 put ColorDisplay? { /ItemFillColor ColorDict /LightBlue get put } { pop } ifelse } forall %%% End Font Adjuster %%%%%%%%%%%%%%%%%%%%% %% Set Hot Keys Stuff %%%%%%%%%%%%%%%%%%%%% /HKColor ColorDisplay? { 0 1 1 rgbcolor } { 0.7 0.7 0.7 rgbcolor } ifelse def /HKColorerase 1 1 1 rgbcolor def /CurntHK HotKey 20 string cvs (Function) search pop pop pop cvn def /hkButtonSize 0 def /ButtonX 0 def /ButtonY 0 def /fkeys % The possible HotKey choices [ (L1) (L2) (L3) (L4) (L5) (L6) (L7) (L8) (L9) (L10) (F1) (F2) (F3) (F4) (F5) (F6) (F7) (F8) (F9) (R1) (R2) (R3) (R4) (R5) (R6) (R7) (R8) (R9) (R10) (R11) (R12) (R13) (R14) (R15) ] def /hkitemsEM null def /hkwin framebuffer /new SunViewWindow send def { 200 300 600 320 reshape FrameInterests /FrameMenuEvent undef FrameInterests /ClientMenuEvent undef /PaintClient { ColorDisplay? { ColorDict /LightBlue get fillcanvas } if ExpressDict /hkitems get paintitems } def /FrameFont /Helvetica-BoldOblique findfont 14 scalefont def /FrameLabel (Set the EXPRESS Hot Key for ) (USER) getenv append def /stretchcorner {} def /flipiconic {} def } hkwin send /hkcan hkwin /ClientCanvas get def /confighk % Display the current HotKey and map the HotKey Customizer window { pause ExpressDict begin /hkitemsEM hkitems forkitems store CurntHK 10 string cvs /printstring hkitems /msg get send { /ItemFillColor HKColor def paint } hkitems CurntHK get send { totop map } hkwin send end % ExpressDict } def %------------- %--- Item Notifies %----------------- /hks_notify { ExpressDict begin { /ItemFillColor HKColorerase def paint } hkitems CurntHK get send /CurntHK ItemLabel cvn store { /ItemFillColor HKColor def } hkitems CurntHK get send ItemLabel /printstring hkitems /msg get send end % ExpressDict } def /save_notify % Don't do anything { ExpressDict begin /hkChanges? true store /unmap hkwin send hkitemsEM null ne { hkitemsEM killprocess /hkitemsEM null store } if { totop map } cp send end % ExpressDict } def /hkcan_notify % Reset to previous HotKey { ExpressDict begin /hkChanges? false store /unmap hkwin send { /ItemFillColor HKColorerase def paint } hkitems CurntHK get send /CurntHK HotKey 20 string cvs (Function) search pop pop pop cvn store { /ItemFillColor HKColor def } hkitems CurntHK get send hkitemsEM null ne { hkitemsEM killprocess /hkitemsEM null store } if { totop map } cp send end % ExpressDict } def pause pause % Just Being Nice /hkitems 40 dict dup begin /Right (Right) /hks_notify hkcan 0 hkButtonSize /new ButtonItem send dup begin /ItemLabelFont ButFnt def /ItemFrame 1 def /ItemRadius 0 def /ClientUp { ItemValue { NotifyUser } if false SetButtonValue /ItemValue null store paint StopItem } def end 0 0 /move 3 index send def /hkButtonSize Right /ItemWidth get store { /LabelX 0 def /LabelY 0 def 0 0 hkButtonSize dup reshape } Right send /Left (Left) /hks_notify hkcan hkButtonSize dup /new ButtonItem send dup begin /ItemLabelFont ButFnt def /ItemFrame 1 def /ItemRadius 0 def /ClientUp { ItemValue { NotifyUser } if false SetButtonValue /ItemValue null store paint StopItem } def end 0 0 /move 3 index send def 0 1 fkeys length 1 sub { fkeys exch get dup cvn exch /hks_notify hkcan hkButtonSize dup /new ButtonItem send dup begin /ItemLabelFont ButFnt def /ItemFrame 1 def /ItemRadius 0 def /ClientUp { ItemValue { NotifyUser } if false SetButtonValue /ItemValue null store paint StopItem } def end 0 0 /move 3 index send def } for /msg (The current Hot Key is ) ( ) /Right {} hkcan 0 0 /new MessageItem send ColorDisplay? { dup /ItemFillColor ColorDict /LightBlue get put } if dup /ItemFont TIFnt put dup /ItemLabelFont TIFnt put 0 0 /move 3 index send def /save_but ( Save Change ) /save_notify hkcan 100 0 /new ButtonItem send dup begin /ItemFrame 1 def /ItemLabelFont ButFnt def /ItemFillColor 1 0 0 rgbcolor def end 0 0 /move 3 index send def /can_but ( Cancel ) /hkcan_notify hkcan 100 0 /new ButtonItem send dup begin /ItemFrame 1 def /ItemLabelFont ButFnt def /ItemFillColor 1 1 0 rgbcolor def end 0 0 /move 3 index send def end def pause /poshkitems { % Reposition the buttons /ButtonX 10 store /ButtonY hkButtonSize 4.5 mul store 0 2 9 { ButtonX ButtonY /move hkitems fkeys 5 index get cvn get send ButtonX hkButtonSize 1 sub add ButtonY /move hkitems fkeys 6 -1 roll 1 add get cvn get send /ButtonY ButtonY hkButtonSize 1 sub sub store } for pause /ButtonX 20 hkButtonSize 2 mul add store /ButtonY hkButtonSize 4.5 mul store 10 1 18 { ButtonX ButtonY /move hkitems fkeys 6 -1 roll get cvn get send /ButtonX ButtonX hkButtonSize 1 sub add store } for pause /ButtonX 25 hkButtonSize 11 mul add store /ButtonY hkButtonSize 4.5 mul store 19 3 33 { ButtonX ButtonY /move hkitems fkeys 5 index get cvn get send ButtonX hkButtonSize 1 sub add ButtonY /move hkitems fkeys 5 index 1 add get cvn get send ButtonX hkButtonSize 1 sub 2 mul add ButtonY /move hkitems fkeys 6 -1 roll 2 add get cvn get send /ButtonY ButtonY hkButtonSize 1 sub sub store } for hkitems begin hkButtonSize dup 3 mul exch 0.6 mul /move Left send hkButtonSize dup 10 mul exch 0.6 mul /move Right send { hkButtonSize dup 3.5 mul exch 3.5 mul move } msg send { hkButtonSize dup 2 mul ItemWidth 2 div add exch 2 mul move } save_but send { hkButtonSize dup 10 mul ItemWidth 2 div sub exch 2 mul move } can_but send end % hkitems } def { hkButtonSize dup 15 mul exch 6 mul BorderTop BorderBottom add add calc_wincoords reshape } hkwin send poshkitems /setHotKey % - > - Activate the desired HotKey { HotKey { ExpressDict begin ExpressMenu /MenuCanvas get null ne cp /FrameCanvas get /Mapped get configwin /FrameCanvas get /Mapped get fwin /FrameCanvas get /Mapped get hkwin /FrameCanvas get /Mapped get aboutcan /Mapped get or or or or or not { /showat ExpressMenu send } if end % ExpressDict } bindkey } def %% End Hot Keys %%%%%%%%%%%%%%%%%%%% %% Configure Express %%%%%%%%%%%%%%%%%%%% /cfButtonSize 0 def /cfTISize gsave TIFnt setfont (Reference in Menu as: ) stringbbox grestore pop 3 1 roll pop pop 2.5 mul def /cfSDISize gsave SDIFnt setfont ( Installed Applications ) stringbbox grestore pop 3 1 roll pop pop def /FileType ( forkunix) def /SaveSDIData [] def /SaveMenuItems null def /SaveMenuKeys null def /SaveMenuActions null def /itemsEM null def /configwin framebuffer /new SunViewWindow send def { 250 400 500 220 reshape FrameInterests /FrameMenuEvent undef FrameInterests /ClientMenuEvent undef /PaintClient { ExpressDict begin ColorDisplay? { ColorDict /LightBlue get fillcanvas } if items paintitems 0 setgray TIFnt setfont 10 cfSDISize cfButtonSize 2 mul add add items /cancel_but get /ItemHeight get 3.2 mul moveto (Application type is) show end % ExpressDict } def /FrameFont /Helvetica-BoldOblique findfont 14 scalefont def /FrameLabel (EXPRESS Application Customizer for ) (USER) getenv append def /flipiconic {} def /stretchcorner {} def } configwin send /cwcan configwin /ClientCanvas get def /configapps % Clear the TextItems and map the Application Customizer window { ExpressDict begin /itemsEM items forkitems store { TI_resetarray items /apptoadd get send TI_resetarray items /appref get send totop map } configwin send end % ExpressDict } def %----------------- %--- Item Notifies %----------------- /fil_notify { ExpressDict /FileType ItemValue 0 eq { ( forkunix) } { ( fork_sunview1_tty) } ifelse put } def /TI_resetarray { { gsave ItemCanvas setcanvas restorefocus /LINEKILL ItemText send /ItemPaintedValue () def /ItemValue () def removefocus paint grestore } } def /add_notify { ExpressDict begin /appsChanges? true store items begin apptoadd /ItemValue get () append appref /ItemValue get dup () eq { pop dup (\() 1 index append (\)) append FileType append cvx } { () append dup (\() 4 -1 roll append (\)) append FileType append cvx } ifelse 0 3 1 roll /insertitem ExpressMenu send 0 /additem appsSDI send TI_resetarray apptoadd send TI_resetarray appref send end % items end % ExpressDict } def /del_notify { ExpressDict begin /appsChanges? true store items begin appsSDI /ItemValue get dup null ne { 0 index /deleteitem appsSDI send /deleteitem ExpressMenu send } { pop } ifelse end % items end % ExpressDict } def /can_notify % Restore previous SDI values { ExpressDict begin /appsChanges? false store /unmap configwin send SaveSDIData /setdata items /appsSDI get send { /MenuItems SaveMenuItems def /MenuKeys SaveMenuKeys def /MenuActions SaveMenuActions def /MenuWidth null def } ExpressMenu send itemsEM null ne { itemsEM killprocess /itemsEM null store } if { totop map } cp send end % ExpressDict } def /db_notify % Don't do anything { ExpressDict begin /unmap configwin send itemsEM null ne { itemsEM killprocess } if { totop map } cp send end % ExpressDict } def /items 8 dict dup begin /cancel_but ( Cancel ) ExpressDict /can_notify get cwcan 0 0 /new ButtonItem send dup begin /ItemFrame 2 def ColorDisplay? { /ItemFillColor 1 1 0 rgbcolor def } if /ItemLabelFont ExpressDict /ButFnt get def end 0 0 /move 3 index send def /cfButtonSize cancel_but /ItemWidth get store /add_but ( Add ) ExpressDict /add_notify get cwcan cfButtonSize 0 /new ButtonItem send dup begin /ItemFrame 2 def /ItemLabelFont ExpressDict /ButFnt get def end 0 0 /move 3 index send def /del_but ( Delete ) ExpressDict /del_notify get cwcan cfButtonSize 0 /new ButtonItem send dup begin /ItemFrame 2 def /ItemLabelFont ExpressDict /ButFnt get def end 0 0 /move 3 index send def /done_but ( Done ) ExpressDict /db_notify get cwcan cfButtonSize 0 /new ButtonItem send dup begin /ItemFrame 2 def ColorDisplay? { /ItemFillColor 1 0 0 rgbcolor def } if /ItemLabelFont ExpressDict /ButFnt get def end 0 0 /move 3 index send def /appsSDI cwcan {} /new ScrollDataItem send def { /AllowMultipleSelect? false def /ShowItemSeperators false def /HScrollbar? false def ColorDisplay? { /BufferColor ColorDict /Aquamarine get def /ItemTextColor 0 0 1 rgbcolor def } if /ItemLabel ( Installed Applications ) def /ItemLabelFont ExpressDict /SDIFnt get def /ItemFont ExpressDict /SDIFnt get def /ItemLabelColor 0 0 0 rgbcolor def /ItemHighLightColor 0 0 0 rgbcolor def } appsSDI send /apptoadd (Application to add: ) () /Right {} cwcan cfTISize 0 /new TextItem send dup /ItemFont ExpressDict /TIFnt get put dup /ItemLabelFont ExpressDict /TIFnt get put 0 0 /move 3 index send def /appref (Reference in Menu as: ) () /Right {} cwcan cfTISize 0 /new TextItem send dup /ItemFont ExpressDict /TIFnt get put dup /ItemLabelFont ExpressDict /TIFnt get put 0 0 /move 3 index send def /filetype /cycle [ (NeWS) (SunView) ] /Right /fil_notify cwcan 0 0 /new CycleItem send dup begin /LabelY 0 def /ItemFont ExpressDict /TIFnt get def ColorDisplay? { /ItemFillColor ColorDict /LightBlue get def } if end 0 0 /move 3 index send def end def pause /poscfitems { ExpressDict begin items begin { 10 dup cfSDISize dup reshape 450 SizeAllData reshapebuffer ShowObjectData } appsSDI send 10 cfSDISize cfButtonSize 2 div add add { 0 index 10 move ItemHeight 1.5 mul 5 add } done_but send { 1 index exch move ItemHeight 3 mul } del_but send 1 index exch /move add_but send cfButtonSize 1.5 mul add 10 /move cancel_but send ColorDisplay? { [ apptoadd appref ] { begin /ItemFillColor ColorDict /LightBlue get def ItemText begin /TextFill ItemFillColor store end end } forall } if 10 cfSDISize cfButtonSize 2 div add add dup cancel_but /ItemHeight get 4 mul /move appref send cancel_but /ItemHeight get 4 mul appref /ItemHeight get 10 add add /move apptoadd send 10 cfSDISize cfButtonSize 2.1 mul add add gsave TIFnt setfont (Application type is) stringbbox grestore pop 3 1 roll pop pop add cancel_but /ItemHeight get 3 mul /move filetype send end % items end % ExpressDict } def { 30 cfSDISize cfButtonSize cfTISize add add add 30 cfSDISize BorderTop BorderBottom add add add calc_wincoords reshape } configwin send poscfitems %% End Configure Apps %%%%%%%%%%%%%%%%%%%%% %% Express Menu Stuff %%%%%%%%%%%%%%%%%%%%% /configure % Save current SDI and ExpressMenu settings and { % display the EXPRESS Configuration Control Panel pause ExpressDict begin /SaveSDIData /getdata items /appsSDI get send store /SaveMenuItems ExpressMenu /MenuItems get store /SaveMenuKeys ExpressMenu /MenuKeys get store /SaveMenuActions ExpressMenu /MenuActions get store /cpitemsEM cpitems forkitems store { totop map } cp send end % ExpressDict } def /ExpressMenu % Create default EXPRESS menu [ (Terminal) { (psterm -t sun -f) forkunix } (~~~~~~~~~~~~~) {} (Cancel) {} (~~~~~~~~~~~~~) {} (About Express) ExpressDict /about_express get (Configure Express) ExpressDict /configure get (Disable Express) { ExpressDict begin itemsEM null ne { itemsEM killprocess } if hkitemsEM null ne { hkitemsEM killprocess } if end % ExpressDict ExpressDict { ExpressDict exch undef } forall systemdict /ExpressDict undef HotKey unbindkey keyboardtype 3 eq % deactivate Left key { systemdict /keyboard_positions get /LeftMeta [ 120 systemdict /UI_private get /keyStation get exec /shift_key ] put } if } ] /new DefaultMenu send def pause % Just Being Nice /adjustmenu % - > - Customize the look of ExpressMenu { { ColorDisplay? { /MenuBorderColor ColorDict /MediumBlue get def /MenuFillColor ColorDict /LightBlue get def /MenuTextColor ColorDict /Blue get def } if /MenuFont ExpressDict /MenFnt get def /Frame 3 def /reshape { MenuGSave framebuffer setcanvas 10 0 Border ArrayWidth ArrayHeight rrectpath MenuCanvas reshapecanvas /rtarr /rtarr_m MenuCanvas setstandardcursor grestore } def /PaintBox % [color] value => - { dup null ne { MenuItems exch get begin X Y W H end rectpath dup type /colortype ne { MenuTextColor } if setcolor stroke } { pop } ifelse } def /PaintMenuValue { MenuGSave MenuFillColor PaintedValue PaintBox MenuTextColor MenuValue PaintBox /PaintedValue MenuValue store grestore } def /PaintMenuFrame { MenuFillColor fillcanvas Frame 0 ne { MenuBorderColor setcolor Frame 10 0 Border ArrayWidth ArrayHeight rrectframe eofill } if } def } ExpressMenu send } def %% End Menu Stuff pause adjustmenu createfile? % create the defaults file (.expressapps) if it doesn't exist { writefile [] [] } { % otherwise, load in the stored applications pause 0 1 UserMenuKeys length 1 sub { dup UserMenuKeys exch get dup { ObjectData length additem } items /appsSDI get send UserMenuActions 2 index get cvx /insertitem ExpressMenu send } for } ifelse setHotKey % activate the HotKey end % ExpressDict me.ras.uu 624748972 117 100 100666 201227 ` begin 666 me.ras M6:9JE0 <\ $Y " "-U ! 0 P#_ #]_O_\ /W^__P _ M?[__ #]_O_\ /W^__P _?[__ #]_O_\ /W^__P _?[__ #]_O_\ /W^__P _ M?[__ #]_O_\ /W^__P _?[__ #]_O_\ /W^__P _?[__ #]_O_\ /W^__P _ M?[__ #]_O_\ /W^__P _?[__ #]_O_\ /W^__P _?[__ #]_O_\ /W^__P _ M?[__ #]_O_\ /W^__P _?[__ #]_O_\ /W^__P _?[__ #]_O_\ /W^__P _ M?[__ #]_O_\ /W^__P _?[__ #]_O_\ /W^__P _?[_P#Q&C92;HJFPM\;-U-OBZ?< _P ? M'Q\?'Q\?'Q\?'Q\?'Q\?'Q\?'Q\?'Q\?/S\_/S\_/S\_/S\_/S\_/S\_/S\_ M/S\_/U]?7U]?7U]?7U]?7U]?7U]?7U]?7U]?7U]_?W]_?W]_?W]_?W]_?W]_ M?W]_?W]_?W]_GY^?GY^?GY^?GY^?GY^?GY^?GY^?GY^?G[^_O[^_O[^_O[^_ MO[^_O[^_O[^_O[^_O[_?W]_?W]_?W]_?W]_?W]_?W]_?W]_?W]_?________ M________________________\ \7'R instance % % array,string /setdata => - % Array is an array of the data to be displayed. Each element % of the array can have the following forms... % string -- display a simple string in scroll area. % array -- parse each elemnt of the array in RIGHT % to LEFT order. Each element of the array % can be of the following forms... % string -- display a simple string % array -- parse array righ to left % color -- set color for future commands % font -- set font for future text % x y -- perform a releative move by x y % /name -- display icon called 'name' % A given entry may be as complex as you want with multiple % strings being display in different fonts with different colors % all moved around with respect to each other intermixed with % icons. Even very comples entries are considered as ONE object % for the purposes of selecting it.. % WARNING: markers may NOT be used in the arrays. If the are the % item will stop displaying at that point while leaving trash % on the stack... % % item_number /deleteitem => - % Delete an item from the list of displayable objects. % If the item_number is out of range then the command will % be ignored. item_number is zero referenced. % % array,string item_number /additem => - % Add an item to the list of displayable objects. % The item added will appear BEFORE or above the item forwhich % the item_number is specified. To append an item to the list % you must add the item before the the first item after the % end of the list. No blank nodes will be added. If you add % an item to the list before an item that past the end % of the list then a suffecient number of EMPTY entries will % be added to the list to allow the new entry to be added. % % array,string item_number /changeitem => - % Replace the object associated with an item. If the % item_number is out of range this command is ignored. % % - /getdata => array % Array that has been build up with with setdata and the % change data routines. % % x y w h /reshape => - % Move and reshape the item... % % % Usefull Class and instance variables: % /AllowMultipleSelect? (default false) % If this is set to true then the user can selected move % then one object. If this is false then selecting a different % object unselects the previous one. % WARNING: This command MUST be issued before any data is % downloaded set with /setdata. Else a /DeclareItemValueArray % must be issued. % % /HScrollBar? (default true) % /VScrollBar? (default true) % Should these scroll bars be displayed... % % /BufferColor (default 1 1 1 rgbcolor) % Background color to be used for the scroll area % % /ItemTextColor (default 0 0 0 rgbcolor) % Default color to be used by ites in the scroll area. % % /ItemHighLightColor (default 0 0 0 rgbcolor) % When an item is selected the background behind the item is % filled with this color. The item it then draw with a default % color of 'BufferColor' % % /ItemLabel (default null) % A label used at the top of the item % % /ItemLabelFont (default Times-Roman.12) % The font used to display the item label % % /ItemLabelColor (default 0 0 0 rgbcolor) % The color used to display the item label % % /ShowItemSeperators (default false) % Should seperator lines be draw between items % in the scroll area. % % /ItemSpacing (default 4) % How much extra space should every item in the scroll % area be seperated by. % % /ItemBorderColor (default 0 0 0 rgbcolor) % Color of the item border. % % /ItemFillColor (default 1 1 1 rgbcolor) % Color to be used to fill scroll areas and item label. % % /ItemValue % Value of last item selected. (zero referenced) % Possible values for this variables may include 'null' % which would indicate that nothing has been selected or % 0-x indicating the item selected. % % /ItemValueArray % Array of items selected. This item ONLY exists if % 'AllowMultipleSelect?' is set true. Possible values for % elements of this array include 0 or 'null' indicating % that the item is not selected. A 1 indicates that the % item has been selected. % % For changes to the following variables to be seen a % /ShowObjectData call must be issued: % /BufferColor, /ItemTextColor, /ItemHighLightColor % /ShowItemSeperators, /ItemSpacing % % For changes to the following variables to be seen a % /ReshapeScrollbars or /reshape call must be issued: % /ItemLabel, /ItemLabelFont, /HScrollbar?, /VScrollbar? % % Example: % % % can is assumed to be a predefined canvas. % % /foo can {ItemValue (%\n) printf} /new ScrollDataItem send def % { % /AllowMultipleSelect? true def % /HScrollbar? false def % /BufferColor 1 1 0 rgbcolor def % /ItemTextColor 0 0 1 rgbcolor def % /ItemHighLightColor .7 .7 .7 rgbcolor def % /ItemLabel (This is a TEST []) def % /ItemLabelFont /Times-Bold findfont 24 scalefont def % /ItemLabelColor 1 0 0 rgbcolor def % % calling reshape here means we don't have to call /ReshapeScrollbars % 50 50 200 315 reshape % /ShowItemSeperators true def % } foo send % % /fooa [foo] def % /foom fooa forkitems def % fooa paintitems % % [ % (hello) % [(hello) 20 0 (there)] % [(hello small) /Times-Roman findfont 10 scalefont] % [(hello big) /Times-Bold findfont 30 scalefont] % % [(hello red) 1 0 0 rgbcolor] % % [(hello 1) /Times-Bold findfont 10 scalefont % (hello 2) /Times-Italic findfont 20 scalefont] % % [(hello 3) /Times-Bold findfont 10 scalefont % 20 20 % (hello 4) /Times-Italic findfont 20 scalefont] % [/boy1 /boy2] % [/horse5 0 1 0 rgbcolor] % ] /setdata foo send % % (padding) 30 /additem foo send % } def % % systemdict /SimpleScrollbar known not { (NeWS/liteitem.ps) run} if /PicScrollbar SimpleScrollbar % ptag= dictbegin /MouseInItem? false def /ScrollMonitor null def /ScrollProcess null def /ScrollDelay 1 60 div 20 div def % 1/10 second /LastX null def /LastY null def dictend classbegin /new { /new super send begin /ScrollMonitor createmonitor def currentdict end } def /StartItem { TrackInterests { exch pop /ClientData get begin /MyOwner /MyOwner GetFromCurrentEvent def end } forall /StartItem super send /maketrackinterests self send } def /ClientDown { % - => - CurrentEvent begin XLocation YLocation end /LastY exch def /LastX exch def SetScrollMotion /MouseInItem? true def HiliteItem DoScroll ScrollMonitor { ScrollProcess null ne { ScrollProcess killprocess } if /ScrollProcess { InteractiveScroll } fork def } monitor } def /InteractiveScroll { { ScrollDelay sleep ScrollMonitor { EventInItem? { DoScroll } if } monitor } loop } def /ClientUp { % - => - ScrollMonitor { ScrollProcess null ne { ScrollProcess killprocess } if /ScrollProcess null def } monitor /MouseInItem? false def UnhiliteItem ItemValue ItemInitialValue ne { NotifyUser % This is used when we are using this scroll bar in other items... % NOTE: If we are in the context of an event then the opperand % stack should look like: % |- EventMgrDict ... mark ... % If We are not in the context of an event the % 'GetFromCurrentEvent' will error out after pushing the % first object on the opperand stack onto the stack again. % This will result in pushing an extra mark onto the stack... % Look in 'GetFromCurrentEvent', 'CurrentEvent', % 'EventMgrDict'. /foobar count 1 sub index type /dicttype eq { mark { /Notify /MyOwner GetFromCurrentEvent send } stopped pop cleartomark } if pop } if } def /ClientDrag { % - => - CurrentEvent begin XLocation YLocation end /LastY exch def /LastX exch def CheckItem } def /PaintBar { } def /EraseBox { } def /PaintButtons { /PaintButtons super send } def /PaintBox { % - => - (paint box) gsave 10 dict begin /x 1 def /w ItemWidth 2 sub def % % fill in the whole bar % ItemFillColor setcolor x ButtonSize w ItemHeight ButtonSize dup add sub rectpath fill % % fill in the view_window bar % BarViewPercent 1 gt { .5 setgray x ButtonSize w ItemHeight ButtonSize dup add sub rectpath fill } { ItemValue BarMin sub BarMax BarMin sub div BarViewPercent mul /lower exch def /y ItemValue ValueToY def ItemHeight ButtonSize dup add BoxSize add sub dup lower mul /d exch def BarViewPercent mul /h exch def .5 setgray x y d sub w h BoxSize add rectpath fill } ifelse % % fill in the small scroll box % ItemValue BoxPath BoxFillColor setcolor gsave fill grestore ItemBorderColor setcolor eofill end /ItemPaintedValue ItemValue def grestore NotifyUser % This is used when we are using this scroll bar in other items... % NOTE: If we are in the context of an event then the opperand % stack should look like: % |- EventMgrDict ... mark ... % If We are not in the context of an event the % 'GetFromCurrentEvent' will error out after pushing the % first object on the opperand stack onto the stack again. % This will result in pushing an extra mark onto the stack... % Look in 'GetFromCurrentEvent', 'CurrentEvent', 'EventMgrDict'. /foobar count 1 sub index type /dicttype eq { mark { /Notify /MyOwner GetFromCurrentEvent send } stopped pop cleartomark } if pop } def /EventInItem? { % - => bool ScrollMotion { /ScrollAbsolute { false } /ScrollPageForward % top { LastX dup 0 ge exch ButtonSize le LastY ItemValue ValueToY ButtonSize add ge LastY ItemHeight ButtonSize sub le and and and } /ScrollPageBackward % bottom { LastX dup 0 ge exch ButtonSize le LastY ButtonSize ge LastY ItemValue ValueToY le and and and } /ScrollLineForward % top { LastX 0 ge LastX ButtonSize le LastY ItemHeight ButtonSize sub ge LastY ItemHeight le and and and } /ScrollLineBackward % bottom { LastX 0 ge LastX ButtonSize le LastY 0 ge LastY ButtonSize le and and and } } case } def /CheckItem { ScrollMotion { /ScrollAbsolute { DoScroll } /ScrollPageForward % top { /MouseInItem? EventInItem? def } /ScrollPageBackward % bottom { /MouseInItem? EventInItem? def } /ScrollLineForward % top { EventInItem? dup { MouseInItem? not { HiliteItem } if } { MouseInItem? { UnhiliteItem } if } ifelse /MouseInItem? exch def } /ScrollLineBackward % bottom { EventInItem? dup { MouseInItem? not { HiliteItem } if } { MouseInItem? { UnhiliteItem } if } ifelse /MouseInItem? exch def } } case } def /HiliteItem { ScrollMotion { /ScrollAbsolute { } /ScrollPageForward { } /ScrollPageBackward { } /ScrollLineForward % top { 0 ItemHeight ButtonSize ButtonSize neg rectpath 5 setrasteropcode fill } /ScrollLineBackward % bottom { 0 0 ButtonSize ButtonSize rectpath 5 setrasteropcode fill } } case } def /UnhiliteItem { gsave ScrollMotion { /ScrollAbsolute {} /ScrollPageForward {} /ScrollPageBackward {} /ScrollLineForward % top { 0 ItemHeight ButtonSize sub ButtonSize ButtonSize rectpath clip PaintButtons } /ScrollLineBackward % bottom { 0 0 ButtonSize ButtonSize rectpath clip PaintButtons } } case grestore } def classend def /ScrollRegionItem Item % ptag= dictbegin /BufferCanvas null def /BufferWidth 0 def /BufferHeight 0 def /HScrollbar null def /VScrollbar null def /HScrollbar? true def /VScrollbar? true def /HScrollWidth 0 def /VScrollWidth 0 def /ScrollWidth 16 def /ZoomFactor 1 def /LabelHeight 0 def % this gets set in 'ReshapeScrollbars'... dictend classbegin /ItemLabel null def /ItemLabelColor 0 0 0 rgbcolor def /ItemLabelFont /Times-Roman findfont 12 scalefont def % /fontoffset { % font => offset % dup fontheight exch /FontBBox get 0 get mul neg % } def /NotifyUserDown { % x y => - pop pop } def /NotifyUserUp { % x y => - pop pop } def /NotifyUserDrag { % x y => - pop pop } def /NotifyUserEnter { % x y => - pop pop } def /NotifyUserExit { % x y => - pop pop } def /new { % parentcanvas width height => instance /new super send begin /BufferHeight ItemHeight def /BufferWidth ItemWidth def CreateScrollbars CreateBuffer currentdict end } def /destroy { % HScrollbar null ne { % null /setowner HScrollbar send % } if % VScrollbar null ne { % null /setowner VScrollbar send % } if %% BufferCanvas /Mapped false put %% /BufferCanvas null def } def /setzoom { % zoomfactor => - /ZoomFactor exch def } def /reshape { % x y w h => - /reshape super send ReshapeScrollbars } def /reshapebuffer { % w h => - /BufferHeight exch def /BufferWidth exch def ReshapeBuffer ReshapeScrollbars } def /getcanvas { BufferCanvas } def /updatecanvas { PaintBuffer } def /makestartinterests { /makestartinterests HScrollbar send /makestartinterests VScrollbar send [ exch aload length 2 add -1 roll aload pop ] % join 2 arrays dup { /MyOwner self PutInEventMgrInterest } forall /makestartinterests super send [ exch aload length 2 add -1 roll aload pop ] % join 2 arrays } def /PaintItem { gsave PaintBuffer /paint VScrollbar send /paint HScrollbar send % paint the outline ItemCanvas setcanvas ItemBorderColor setcolor 0 HScrollWidth 1 add ItemWidth VScrollWidth sub ItemHeight HScrollWidth sub LabelHeight sub 1 sub rectpath stroke ItemLabel null ne { % paint the label area ItemFillColor setcolor 0 ItemHeight LabelHeight sub 2 sub ItemWidth LabelHeight 2 add rectpath fill % paint the label outline ItemBorderColor setcolor 0 ItemHeight LabelHeight sub 2 sub ItemWidth 1 sub LabelHeight 2 add rectpath stroke % paint the label text ItemLabelColor setcolor ItemLabelFont setfont ItemWidth ItemLabel stringwidth pop sub 2 div ItemHeight LabelHeight sub ItemLabelFont fontdescent add 1 sub moveto ItemLabel show } if grestore } def /Notify { % (picture got notified\n) [] dbgprintf NotifyUser PaintBuffer } def /PaintBuffer { % (PaintBuffer begin \n) [ ] dbgprintf gsave ItemCanvas setcanvas % % compute clipping region % 1 HScrollWidth 1 add ItemWidth VScrollWidth sub 2 sub LabelHeight 0 ne { ItemHeight HScrollWidth sub LabelHeight sub 4 sub } { ItemHeight HScrollWidth sub 2 sub } ifelse rectpath % (clip to % % % %\n) [ pathbbox ] dbgprintf clip % % Clear the item.... % /BufferColor where { pop BufferColor fillcanvas } if % % compute translation % BufferWidth ZoomFactor mul ItemWidth sub VScrollWidth add neg dup 0 lt { 1 /getvalue HScrollbar send sub mul } { pop 0 } ifelse BufferHeight ZoomFactor mul ItemHeight sub HScrollWidth add LabelHeight add neg dup 0 lt { 1 /getvalue VScrollbar send sub mul } { } ifelse HScrollWidth add % 2 copy (translate by % %\n) [ 4 2 roll ] dbgprintf translate BufferWidth BufferHeight % 2 copy (scale by % %\n) [ 4 2 roll ] dbgprintf scale ZoomFactor dup scale pause BufferCanvas imagecanvas pause grestore % (PaintBuffer end\n) [ ] dbgprintf } def /CreateBuffer { % - => - /BufferCanvas framebuffer newcanvas def BufferCanvas /Retained true put BufferCanvas /Opaque true put ReshapeBuffer } def /ReshapeBuffer { % - => - gsave framebuffer setcanvas 0 0 BufferWidth BufferHeight rectpath BufferCanvas reshapecanvas grestore } def /CreateScrollbars { % - => - % (begin CreateScrollbars\n) [] dbgprintf /HScrollWidth HScrollbar? { ScrollWidth } { 0 } ifelse def /VScrollWidth VScrollbar? { ScrollWidth } { 0 } ifelse def ItemWidth VScrollWidth le { /VScrollWidth ItemWidth 2 div def } if ItemHeight HScrollWidth le { /HScrollWidth ItemHeight 2 div def } if /HScrollbar [1 0 .01 .1 ItemWidth VScrollWidth sub BufferWidth div ] 1 {} ItemCanvas /new PicScrollbar send dup /BarVertical? false put def /VScrollbar [1 0 .01 .1 ItemHeight HScrollWidth sub BufferHeight div ] 0 {} ItemCanvas /new PicScrollbar send def % self /setowner HScrollbar send % self /setowner VScrollbar send % (end CreateScrollbars\n) [] dbgprintf } def /ReshapeScrollbars { /HScrollWidth HScrollbar? { ScrollWidth } { 0 } ifelse def /VScrollWidth VScrollbar? { ScrollWidth } { 0 } ifelse def /LabelHeight ItemLabelFont null ne ItemLabel null ne and {ItemLabelFont fontheight} {0} ifelse def ItemWidth VScrollWidth le { /VScrollWidth ItemWidth 2 div def } if ItemHeight HScrollWidth le { /HScrollWidth ItemHeight 2 div def } if ItemHeight LabelHeight HScrollWidth add le { /LabelHeight ItemHeight 4 div def } if 10 dict begin /h ItemHeight def /w ItemWidth def [1 0 .01 .1 ItemWidth VScrollWidth sub BufferWidth div ] /setrange HScrollbar send [1 0 .01 .1 ItemHeight HScrollWidth sub LabelHeight sub BufferHeight div ] /setrange VScrollbar send HScrollbar? { 0 0 w VScrollWidth sub HScrollWidth } { 0 0 0 0 } ifelse % 4 copy (hscroll % % % %\n) [ 6 2 roll ] dbgprintf /reshape HScrollbar send LabelHeight 0 ne { VScrollbar? { w VScrollWidth sub HScrollWidth VScrollWidth h HScrollWidth sub LabelHeight sub 2 sub} { 0 0 0 0 } ifelse } { VScrollbar? { w VScrollWidth sub HScrollWidth VScrollWidth h HScrollWidth sub} { 0 0 0 0 } ifelse } ifelse % 4 copy (vscroll % % % %\n) [ 6 2 roll ] dbgprintf end /reshape VScrollbar send } def /ClientDown { % (Picture ClientDown\n) [] dbgprintf % compute translation % BufferWidth ZoomFactor mul ItemWidth sub VScrollWidth add neg dup 0 lt { 1 /getvalue HScrollbar send sub mul } { pop 0 } ifelse BufferHeight ZoomFactor mul ItemHeight sub HScrollWidth add LabelHeight add neg dup 0 lt { 1 /getvalue VScrollbar send sub mul } { } ifelse HScrollWidth add % translatex translatey CurrentEvent /YLocation get sub neg exch CurrentEvent /XLocation get sub neg exch 2 copy /tmpy exch def /tmpx exch def % tmpx tmpy (tmpx % tmpy %\n) printf % (n: % %\n) [ tmpx tmpy ] dbgprintf { /NotifyUserDown self send } fork } def /ClientUp { % (Picture ClientUp\n) [] dbgprintf CurrentEvent begin XLocation YLocation end /NotifyUserUp self send } def /ClientDrag { % (client drag\n) [] dbgprintf CurrentEvent begin XLocation YLocation end /NotifyUserDrag self send } def /ClientEnter { %% (client enter\n) [] dbgprintf CurrentEvent begin XLocation YLocation end /NotifyUserEnter self send } def /ClientExit { %% (client exit\n) [] dbgprintf CurrentEvent begin XLocation YLocation end /NotifyUserExit self send } def classend def /ScrollDataItem ScrollRegionItem % ptag= dictbegin /ObjectData [] def /ObjectSizes [] def /ObjectOffsets [] def /LocalUserNotify {} def /NumItems 0 def /LastSelect null def /ItemValueArray [] def dictend classbegin % Class variables /BufferColor 1 1 1 rgbcolor def /AllowMultipleSelect? false def /ItemHighLightColor 0 0 0 rgbcolor def /ItemSpacing 4 def /ShowItemSeperators false def % Methods /new { % parent_canvas notify => instence exch 1 1 /new super send begin /LocalUserNotify exch def currentdict end } def /setdata { % array => - /ObjectData exch def /SizeAllData self send 450 exch /reshapebuffer self send AllowMultipleSelect? { /DeclareItemValueArray self send } { /LastSelect null def } ifelse /ShowObjectData self send } def /getdata { % - => array ObjectData } def % if item_number is out of bounds for the data then % the command will be ignored.. % item_number is zero referenced. /deleteitem { % item_number => - 10 dict begin /foo exch def /fool ObjectData length def foo 0 lt foo fool ge or not { % delete an item out of the ObjectData array /fooa fool 1 sub array def ObjectData 0 foo getinterval fooa copy pop ObjectData foo 1 add fool foo sub 1 sub getinterval fooa exch foo exch putinterval currentdict fooa end /ObjectData exch def begin % delete an item out of the ItemValueArray array AllowMultipleSelect? { /fooa fool 1 sub array def ItemValueArray 0 foo getinterval fooa copy pop ItemValueArray foo 1 add fool foo sub 1 sub getinterval fooa exch foo exch putinterval currentdict fooa end /ItemValueArray exch def begin } { ItemValue foo eq { /ItemValue null store /LastSelect null store } if } ifelse end /SizeAllData self send 450 exch /reshapebuffer self send /ShowObjectData self send } { end } ifelse } def % add an item to the list % if we are adding past the end of the list then we expand % the list with empty strings to add the item. % item_number is zero referenced. % This is all very convluted code put hopefully we can deal with % anysized array. We should never load the array in part or in % in whole onto the operand stack... /additem { % item_label item_number => - 10 dict begin % some helpfull constants /foon exch def /fooi exch def /fool ObjectData length def % if we are out of bounds then don't do anything foon 0 lt not { % check to see if we need to extend the array with % null strings. foon fool gt { /fooa foon array def ObjectData fooa copy pop currentdict fooa end /ObjectData exch def begin /fool foon def AllowMultipleSelect? { /fooa foon array def ItemValueArray fooa copy pop currentdict fooa end /ItemValueArray exch def begin } if } if % if we are inserting before the first element after % the end of the list then just append to the list foon fool eq { % append to list /fooa fool 1 add array def ObjectData fooa copy pop fooa fool fooi put currentdict fooa end /ObjectData exch def begin AllowMultipleSelect? { /fooa fool 1 add array def ItemValueArray fooa copy pop currentdict fooa end /ItemValueArray exch def begin } if } { % move the list down and insert an item. /fooa fool 1 add array def ObjectData 0 foon getinterval fooa copy pop ObjectData foon fool foon sub getinterval fooa exch foon 1 add exch putinterval fooa foon fooi put currentdict fooa end /ObjectData exch def begin AllowMultipleSelect? { /fooa fool 1 add array def ItemValueArray 0 foon getinterval fooa copy pop ItemValueArray foon fool foon sub getinterval fooa exch foon 1 add exch putinterval currentdict fooa end /ItemValueArray exch def begin } if } ifelse end /SizeAllData self send 450 exch /reshapebuffer self send /ShowObjectData self send } { end } ifelse } def % Change an item.. % If item does not allready exist then add it.. % If item was selected is will remain selected.. /changeitem { % item_label item_number => - 10 dict begin /foon exch def /fooi exch def /fool ObjectData length def % are we out of bounds? foon 0 ge { % should we call additem? foon fool ge { % call additem. fooi foon end /additem self send } { % just change the item ObjectData foon fooi put end /SizeAllData self send 450 exch /reshapebuffer self send /ShowObjectData self send } ifelse } { end } ifelse } def /DeclareItemValueArray { % - => - /ItemValueArray ObjectData length array def ObjectData length 0 ne { 0 1 ObjectData length 1 sub { ItemValueArray exch 0 put } for } if } def /SizeAllData { % - => total_size /ObjectSizes ObjectData length array def /ObjectOffsets ObjectData length array def 10 dict begin /t ItemSpacing def ObjectData length 0 ne { gsave ItemFont setfont ObjectData length 1 sub -1 0 { /i exch def ObjectOffsets i t put ObjectData i get /ThingSize self send exch pop dup ObjectSizes i 3 -1 roll put t add ItemSpacing add /t exch def } for grestore } if t end } def /ShowObjectData { % - => - gsave % First we are going to fix up the buffer. % set up the defaults BufferCanvas setcanvas BufferColor fillcanvas ItemTextColor setcolor ItemFont setfont % loop over all the data items writing them out ObjectData length 0 ne { 0 1 ObjectData length 1 sub { PutItemText } for } if % go through and hilight those items that have been % selected. AllowMultipleSelect? { % Redraw all the multiple selected stuff. % Are the arrays the same length and are they % none zero. This is a sanity check. ItemValueArray length ObjectData length eq ObjectData length 0 ne and { % Loop over all the items finding highlighed % items and redrawing them. 10 dict begin 0 1 ObjectData length 1 sub { /i exch def ItemValueArray i get 1 eq { ItemHighLightColor setcolor i FillItemBox BufferColor setcolor i PutItemText } if } for end } if } { % Redraw the single highlighted item. LastSelect null ne { ItemHighLightColor setcolor LastSelect FillItemBox BufferColor setcolor LastSelect PutItemText } if } ifelse grestore % Now that we are finished with the buffer paint the % the buffer and the items as a whole onto the canvas. /PaintItem self send } def /ShowThingDict 20 dict dup begin /fonttype {setfont dup type exec} def /colortype {setcolor dup type exec} def /integertype {rmoveto dup type exec} def /realtype {rmoveto dup type exec} def /stringtype { 0 currentfont fontdescent rmoveto show 0 currentfont fontdescent neg rmoveto dup type exec } def /nametype { gsave iconfont setfont icondict exch get cvis dup show stringbbox 4 2 roll pop pop pop grestore 0 rmoveto dup type exec } def /arraytype { dup xcheck { /paint exch exec dup type exec } { aload pop dup type exec } ifelse } def /dicttype {/paint exch send dup type exec} def /marktype { pop } def /nulltype { pop dup type exec} def end def /ShowThing { % object => - gsave ShowThingDict begin mark exch dup type exec end grestore } def /ThingSizeDict 20 dict dup begin /x 0 def /y 0 def /mx 0 def /my 0 def /fonttype {setfont dup type exec} def % /colortype {setcolor dup type exec} def % color shouldn't affect size. /colortype {pop dup type exec} def /integertype { y exch add /y exch def y my gt { /my y def } if x exch add /x exch def x mx gt { /mx x def } if dup type exec } def /realtype { y exch add /y exch def y my gt { /my y def } if x exch add /x exch def x mx gt { /mx x def } if dup type exec } def /stringtype { stringwidth pop x exch add /x exch def x mx gt { /mx x def } if currentfont fontheight y exch add dup my gt { /my exch def } { pop } ifelse dup type exec } def /nametype { gsave iconfont setfont icondict exch get cvis stringbbox % x y w h y exch add % x y w y+h 3 -1 roll % x w y+h y neg dup % x w y+h -y -y 3 1 roll add % x w -y y+h+(-y) 1 add dup my gt { /my exch def } { pop } ifelse y exch add /y exch def x exch add % ... x x+w exch neg add % ... x+w+(-x) /x exch def x mx gt { /mx x def } if grestore dup type exec } def /arraytype { dup xcheck { % x y /size => x y mx my x y /size 4 -1 roll exec /my exch def /mx exch def /y exch def /x exch def dup type exec } { aload pop dup type exec } ifelse } def /dicttype { % x y /size => x y mx my x y /size 4 -1 roll send /my exch def /mx exch def /y exch def /x exch def dup type exec } def /marktype { pop } def /nulltype { pop dup type exec} def end def /ThingSize { % object => xoff yoff gsave ThingSizeDict begin /x 0 def /y 0 def /mx 0 def /my 0 def mark exch dup type exec mx my end grestore } def /PutItemText { % item_number => - dup ObjectOffsets exch get 5 exch moveto dup ObjectData exch get /ShowThing self send ShowItemSeperators { ObjectOffsets exch get 0 exch ItemSpacing 2 div sub moveto 450 0 rlineto stroke } { pop } ifelse } def /FillItemBox { % item_number => - dup ObjectOffsets exch get 0 exch ItemSpacing 2 div sub 1 sub moveto 450 0 rlineto ObjectSizes exch get 0 exch ItemSpacing add rlineto -450 0 rlineto closepath fill } def /NotifyUserDown { % x y => - gsave /FindItem self send BufferCanvas setcanvas ItemFont setfont AllowMultipleSelect? not { LastSelect null ne { BufferColor setcolor LastSelect FillItemBox ItemTextColor setcolor LastSelect PutItemText } if dup LastSelect eq { pop /LastSelect null def /ItemValue null def } { dup /LastSelect exch def /ItemValue exch def ItemValue null ne { ItemHighLightColor setcolor ItemValue FillItemBox BufferColor setcolor ItemValue PutItemText } if } ifelse } { /ItemValue exch def ItemValue null ne { ItemValueArray ItemValue get 1 eq { BufferColor setcolor ItemValue FillItemBox ItemTextColor setcolor ItemValue PutItemText ItemValueArray ItemValue 0 put } { % 0 BufferHeight ItemValue 1 add 18 mul sub % 3 sub 450 18 rectpath ItemHighLightColor setcolor ItemValue FillItemBox BufferColor setcolor ItemValue PutItemText ItemValueArray ItemValue 1 put } ifelse } if } ifelse grestore /updatecanvas self send /LocalUserNotify self send } def /FindItem { % x y => item_number 10 dict begin exch pop /y exch def y 0 lt y BufferHeight gt or not ObjectData length 0 gt and { /a null def 0 1 ObjectData length 1 sub { /i exch def ObjectOffsets i get y le { /a i def exit } if } for a } { null } ifelse end } def classend def