marantz@porthos.rutgers.edu (Roy Marantz) (05/13/88)
Here is a little class to provide scrollable "client" windows. I use it for scrolling around large graphics with a (much) smaller window. As you can see it isn't to hard, but maybe someone else won't have to "reinvent the wheel". You'll probably want to modify this since it is setup to demo the package. You also might want to "install" it into the systemdict like the rest of the window classes. Roy ===========================cut here================================= % % ScrollClientWindow 1.0 12-May-88 % % Roy Marantz (marantz@aramis.rutgers.edu) % Rutgers University % % Simple scrollable client window. See the testing code (below) for an % example of it's use % currentdict /ScrollClientWindow known not { systemdict /ScrollWindow known not { (NeWS/litewin.ps) run } if /ScrollClientWindow ScrollWindow dictbegin /PictureWidth 0 def % for translating the client window /PictureHeight 0 def /LDivisions 10 def % number of scroll bad pieces/whole /PDivisions 3 def % number of scroll bad pieces/whole dictend classbegin /Resize { % width height => - size the backround canvas /PictureHeight exch def /PictureWidth exch def [0 PictureWidth ClientWidth sub dup dup LDivisions div exch PDivisions div null] /setrange HScrollbar send [0 PictureHeight ClientHeight sub dup dup LDivisions div exch PDivisions div null] /setrange VScrollbar send } def /SetNotifiers { % Hnotifier Vnotifier => - VScrollbar /NotifyUser 3 -1 roll put HScrollbar /NotifyUser 3 -1 roll put } def classend def true { % true for testing package /window framebuffer /new ScrollClientWindow send def /reshapefromuser window send { /FrameLabel (Testing) def /PaintClient { gsave ClientCanvas setcanvas HScrollbar /ItemValue get neg VScrollbar /ItemValue get neg translate 1 fillcanvas % erase everything 0 setgray % black 0 0 moveto 1000 1000 lineto 0 1000 moveto 1000 0 lineto stroke grestore } def } window send /map window send 1000 1000 /Resize window send {/paintclient window send} {/paintclient window send} /SetNotifiers window send } if } if % currentdict /ScrollClientWindow know not { -- uucp: {ames, cbosgd, harvard, moss}!aramis.rutgers.edu!marantz arpa: marantz@aramis.rutgers.edu