gerber@salt.uucp (Andrew Gerber) (09/30/88)
I've hacked up my user.ps file to display images from $NEWSHOME/smi in the background. (Replacing the boring blue background). The following code from user.ps is really only good for color Suns (I have a color 4/110). Running this stuff on a b/w 3/50 is agonizingly slow. Thanks to whoever posted the screendump stuff; I snarfed part of that code for this. Note that I aviod the -hires files; they seem to cause NeWS to crash with timeout errors. The code below also shows how to modify your menus. Note that you may have to change the directory path in /setback if your NeWS files do not live in /usr/NeWS. Also this code contains the patch to RepaintAll that fixes the problems repainting on color workstations. At the very end of the file, Nterm defaults are set. I happen to like a smaller font and a blue window background. The last line brings up the saturn image if you are running on a color workstation. ----------------------------------------------------------------------------- Andrew S. Gerber | McDonnell Douglas Communication Industry Systems uunet!salt!gerber | 5299 DTC Blvd, Englewood, CO 80111 salt!gerber@uunet.uu.net | (303) 220 6231 ----------------------------------------------------------------------------- -----------------------Cut Here--------------------------------------- % USER.PS file will be executed by init.ps % Your user.ps file allows you to over-ride all the standard defaults % and to do your own initialization. % Make sure to "protect" your defaults via the following: % /Foo where { pop % Foo begin % < changes to Foo's defaults % /mymenu [ % (Foo =>) foomenu % (Test!) {(test) forkunix} % (Color Wheel!) {(colorwheel) forkunix} % ] /new DefaultMenu send def % 0 (My Menu =>) mymenu /insertitem rootmenu send %/DebuggingServer? false def % set true in your user.ps if you're debugging. % Initialization % Main is run by PS as soon as it has processed init.ps % The default main starts up the root event mgr and starts % an executive if debugging. If you are using telnet to talk % to your PS server, make sure to use the executive: % Note that the default 144 can by changing NeWS_socket in your user.ps %/NeWS_socket % { (NEWSSOCKET) getenv } stopped % { pop (%socketl144) } if % def /blue { systemdict begin /PaintRoot { gsave framebuffer setcanvas DefaultRootGrayOrColor dup type /colortype eq {setcolor} {setgray} ifelse clippath fill grestore } def end PaintRoot {/paint self send} AllWin } def /setback { systemdict begin % You may have to change the following line if your NeWS % files do not live in /usr/NeWS (/usr/NeWS/smi/) exch append (.im8) append /ImageFileName exch def /PaintRoot { gsave fboverlay setcanvas framebuffer setcanvas 1152 900 scale ImageFileName readcanvas imagecanvas grestore } def end PaintRoot {/paint self send} AllWin (switcher -e 0) forkunix } def % STARTUP.PS file first one read in by init.ps (NeWS/litemenu.ps) LoadFile { % Default Root Menu; here so user.ps can over-ride & modify. /ntermmenu [ % Console gets autolinewrap turned on and 400 lines (VT102 Console) { (nterm -C -aw -sl 400) forkunix } (VT102) { (nterm) forkunix } ] /new DefaultMenu send def /fixedterminalmenu [ (sun) { (psterm -f -t sun) forkunix } (Console) { (psterm -f -C -t h19) forkunix } (H19) { (psterm -f -t h19) forkunix } (bitgraph) { (psterm -f -t bitgraph) forkunix } (vt100) { (psterm -f -t vt100) forkunix } (wyse) { (psterm -f -t wyse) forkunix } (tvi925) { (psterm -f -t tvi925) forkunix } ] /new DefaultMenu send def /terminalmenu [ (sun) { (psterm -t sun) forkunix } (Console) { (psterm -C -t h19) forkunix } (Fixed Startup =>) fixedterminalmenu (H19) { (psterm -t h19) forkunix } (bitgraph) { (psterm -t bitgraph) forkunix } (vt100) { (psterm -t vt100) forkunix } (wyse) { (psterm -t wyse) forkunix } (tvi925) { (psterm -t tvi925) forkunix } ] /new DefaultMenu send def /clockmenu [ (Plain) { (roundclock) RunDemoProgram } (Plain (seconds)) { (roundclock -s) RunDemoProgram } (Fancy) { (roundclock -f) RunDemoProgram } (Fancy (seconds)) { (roundclock -f -s) RunDemoProgram } ] /new DefaultMenu send def /applicationsmenu [ (Load Average) { (psload) forkunix } (Calculator) { (calcul) RunDemoPshScript } (Journal) { (journalling) RunDemoPshScript } (Clocks =>) clockmenu ] /new DefaultMenu send def /AllWin { % proc => - (Distributes proc to all windows!!) createevent dup begin /Name /DoItEvent def /Action /Window def /ClientData 2 index def end sendevent pop } def /backgroundmenu [ (angel) { (angel) setback} (bf) { (bf) setback} (bryce) { (brice) setback} (blue) { blue } (cherries) { (cherries) setback } (ermine) { (ermine) setback } (fuji) {(fuji) setback } (geese) {(geese) setback } (harem) {(harem) setback } (joshua) {(joshua) setback } (lady) {(lady) setback } (lascruces) {(lascruces) setback } (man) {(man) setback } (mona) {(mona) setback } (new_york) {(new_york) setback } (pagosa) {(pagosa) setback } (puppet) {(puppet) setback } (saturn) {(saturn) setback } (shroom) {(shroom) setback } (snow) {(snow) setback } (stjerome) {(stjerome) setback } (stormy) {(stormy) setback } (sun3110) {(sun3110) setback } (sun350) {(sun350) setback } (taj) {(taj) setback } (virgin) {(virgin) setback } (virgino) {(virgino) setback } (vla) {(vla) setback } (washing) {(washing) setback } (writing) {(writing) setback } (zion) {(zion) setback } ] /new DefaultMenu send def /repairmenu [ (Repaint All) { PaintRoot {/paint self send} AllWin (switcher -e 0) forkunix } (Reset Input) { createevent dup begin /Name UserProfile /ViewStop known { UserProfile /ViewStop get } { 16#6f01 % default to L1 } ifelse def /Action /DownTransition def end dup sendevent createevent copy dup /Action /UpTransition put sendevent } ] /new DefaultMenu send def /exitcleanly { % Destroy all windows that know /destroy {/destroy self send} AllWin % Wait 3 seconds for console to die 0.05 sleep % Clear the screen framebuffer setcanvas 1 setgray clippath fill % Terminate the server ^C } def /exitnewsmenu [ (Yes, really!) { exitcleanly } (No, not really.) {} ] /new DefaultMenu send def /rootmenu [ (Applications =>) applicationsmenu (Terminals =>) fixedterminalmenu (Scrolling Prototype =>) ntermmenu (Background =>) backgroundmenu (Repair =>) repairmenu (Exit NeWS) { exitcleanly } ] /new DefaultMenu send def } if (NeWS/litewin.ps) LoadFile { % Demo menus loaded here because of window dependancies. (NeWS/demomenu.ps) LoadFile pop } if UserProfile begin /NtermFontName /Screen def /NtermFillColor .56 .35 1 hsbcolor def /NtermTextColor 0 0 0 rgbcolor def /NtermFontHeight 12 def end currentcanvas /Color get {(saturn) setback} if