*** /home/newswin/NeWS1.1/clientsrc/client/psview.cps Mon Feb 22 19:00:45 1988 --- psview.cps Thu Sep 21 10:03:49 1989 *************** *** 33,64 **** /BG 1 1 1 rgbcolor def /errordict 10 dict def errordict /rangecheck { stop } put ! systemdict /settransfer /pop load def /settransfer {pop} def /currenttransfer { { } } def /currentscreen { 0 0 { } } def /setscreen { pop pop pop } def /definefont { exch dup type /keywordtype ne { ( ) cvs cvn } if ! exch definefont } def /StandardEncoding magic:AdobeSequence def magic:fontdict /Encoding StandardEncoding put ! /PGC { } def /DoBox true def /privudict 200 dict def /@Dicts 0 array def ! /ps_paint { ! PSCanvas setcanvas ! initmatrix ! clippath pathbbox h div exch w div min dup scale pop pop pathbbox 2 div exch 2 div exch translate pop pop cx neg cy neg translate FG setcolor ! DoBox { cx w 2 div sub cy h 2 div sub moveto w h rect stroke } if ! /paint PSItem send FrameBorderColor strokecanvas ! startmatrix concat ! PGC } def [1 0 0 1 0 0] setmatrix cdef ps_ditroff_fix() --- 33,83 ---- /BG 1 1 1 rgbcolor def /errordict 10 dict def errordict /rangecheck { stop } put ! % systemdict /settransfer /pop load put /settransfer {pop} def /currenttransfer { { } } def /currentscreen { 0 0 { } } def /setscreen { pop pop pop } def /definefont { exch dup type /keywordtype ne { ( ) cvs cvn } if ! exch //definefont } def /StandardEncoding magic:AdobeSequence def magic:fontdict /Encoding StandardEncoding put ! /PGC { ! cx cy moveto ! /Times-Roman findfont 20 scalefont setfont ! (Please Wait) cshow ! } def /DoBox true def + /PrologDone false def + /PSPageW w def + /PSPageH h def /privudict 200 dict def /@Dicts 0 array def ! /ps_scale { % canvas => - scale and translate canvas ! setcanvas initmatrix clippath pathbbox h div exch w div min dup scale pop pop pathbbox 2 div exch 2 div exch translate pop pop cx neg cy neg translate + PSScale PSPageX PSPageY translate dup scale + startmatrix concat + } def + /ps_paint { + PSCanvas ps_scale FG setcolor ! PrologDone { ! DoBox { cx w 2 div sub cy h 2 div sub moveto ! w h rect stroke } if ! /paint PSSlider send ! /paint PSHbar send /paint PSVbar send ! /paint PScycle send FrameBorderColor strokecanvas ! } if ! % startmatrix concat ! {PGC} stopped { ! cx cy moveto ! /Times-Roman findfont 20 scalefont setfont ! (Page Display Error) cshow ! } if } def [1 0 0 1 0 0] setmatrix cdef ps_ditroff_fix() *************** *** 82,89 **** /new_page { % new page number => - dup /PageCount exch store PAGE_TAG tagprint typedprint ! PSItem /ItemValue PageCount put ! /paint PSItem send } def /NEXT { PageCount 1 add dup MAX gt {pop} { new_page } ifelse } def --- 101,108 ---- /new_page { % new page number => - dup /PageCount exch store PAGE_TAG tagprint typedprint ! PSSlider /ItemValue PageCount put ! /paint PSSlider send } def /NEXT { PageCount 1 add dup MAX gt {pop} { new_page } ifelse } def *************** *** 92,98 **** --- 111,163 ---- /REDIS { PageCount new_page } def /FIRST { MIN new_page } def /LAST { MAX new_page } def + /new_scale { /PSPageX PSHbar /ItemValue get + PSScale 1 sub 0 max PSPageW mul mul neg def + /PSPageY PSVbar /ItemValue get + PSScale 1 sub 0 max PSPageH mul mul neg def + } def + /ENLARGE { {PSScale 1.41 mul /PSScale exch def + new_scale paint} win send + } def + /REDUCE { {PSScale 1.41 div /PSScale exch def + new_scale paint} win send + } def + /NORMAL { {/PSScale 1 def /PSPageX 0 def /PSPageY 0 def + paint} win send + } def + /LEFT { {PScycle /ItemValue get 0 ne + {gsave + PSOverlay ps_scale currentcursorlocation 2 copy + {y0 sub exch x0 sub exch rect + x0 y0 x y points2rect /PSdisplay win send} getanimated + waitprocess aload pop points2rect + /PSBoxH exch def /PSBoxW exch def + /PSBoxY exch def /PSBoxX exch def + /PSBoxP PageCount def paintov + grestore} {NEXT} ifelse} win send + } def + /MIDDLE { {PScycle /ItemValue get 0 ne PSBoxP PageCount eq and + {gsave + PSOverlay ps_scale currentcursorlocation 2 copy + {y0 sub PSBoxY add exch x0 sub PSBoxX add exch + 2 copy moveto PSBoxW PSBoxH rect + PSBoxW PSBoxH /PSdisplay win send} getanimated + waitprocess aload pop + PSBoxY add exch PSBoxX add + 4 -1 roll sub /PSBoxX exch def + exch sub /PSBoxY exch def paintov + grestore} if} win send + } def /EXIT { EXIT_TAG tagprint } def + /clearov { PSOverlay ps_scale erasepage } def + /paintov { clearov + PScycle /ItemValue get 0 ne PSBoxP PageCount eq and { + PSBoxX PSBoxY PSBoxW PSBoxH rectpath stroke + PSBoxX PSBoxY PSBoxW PSBoxH PSdisplay + } { + () /printstring PSmessage send + } ifelse + } def /paintfr { win /FrameLabel fr_label put /paint win send *************** *** 101,116 **** /fr_data name def % /PSWindow DefaultWindow ! /PSCanvas null def % the 2 sub windows ! /PSItem null def % /PageCount 1 def % current page number, initially = 1 /MIN 1 def % MIN always = 1, MAX sent by client % dictbegin /FrameLabel fr_label def ! /PaintClient { ps_paint } def /FrameFillColor BG def /IconHeight 15 def % % gsave % IconFont setfont --- 166,196 ---- /fr_data name def % /PSWindow DefaultWindow ! /PSCanvas null def % the image sub window ! /PSScale 1 def % image scale ! /PSPageX 0 def % image translation (in) ! /PSPageY 0 def ! /PSOverlay null def % box overlay ! /PSBoxX 0 def ! /PSBoxY 0 def ! /PSBoxW 0 def ! /PSBoxH 0 def ! /PSBoxP -1 def ! /PSSlider null def % page slider ! /PSHbar null def % scroll bars ! /PSVbar null def % scroll bars ! /PScycle null def % box cycle ! /PSmessage null def % box message /PageCount 1 def % current page number, initially = 1 /MIN 1 def % MIN always = 1, MAX sent by client % dictbegin /FrameLabel fr_label def ! /PaintClient { clearov ps_paint paintov } def /FrameFillColor BG def /IconHeight 15 def + /HbarLen 0 def + /VbarLen 0 def % % gsave % IconFont setfont *************** *** 131,136 **** --- 211,219 ---- % (Redisplay) { REDIS } (First Page) { FIRST } (Last Page) { LAST } + (Enlarge) { ENLARGE } + (Reduce) { REDUCE } + (Normal Size) { NORMAL } (Quit) { EXIT } ] /new DefaultMenu send def dictend *************** *** 147,176 **** { page new_page } ifelse dictend } def % Override two methods: the Client create & shape methods /CreateClientCanvas { % create the ClientCanvas: /CreateClientCanvas super send % Create the slider item: ! /Item_len 200 def ! /PSItem (Page Number: ) [ MIN MAX PageCount ] /Right {ItemValue /PSset win send} ! ClientCanvas Item_len 0 /new SliderItem send dup /ItemFrame 1 put ! 20 5 /move 3 index send store ! % Activate the slider: ! [PSItem] forkitems pop % Create the PostScript subwindow: /PSCanvas ClientCanvas newcanvas store PSCanvas /Mapped true put } def /ShapeClientCanvas { % [Re] Shape the ClientCanvas: /ShapeClientCanvas super send ClientCanvas setcanvas ! % Move the slider: ! 20 5 /move PSItem send % [Re] Shape the PostScript subwindow: gsave ClientCanvas setcanvas clippath pathbbox --- 230,324 ---- { page new_page } ifelse dictend } def + /PSHscroll { % frac => - + PSScale 1 sub 0 max PSPageW mul mul neg + dup PSPageX eq + {pop} {/PSPageX exch def paint} ifelse + } def + /PSVscroll { % frac => - + PSScale 1 sub 0 max PSPageH mul mul neg + dup PSPageY eq + {pop} {/PSPageY exch def paint} ifelse + } def + /PSdisplay { % x0 y0 x y => - + PScycle /ItemValue get { % scale values + 1 {4 {1.389 mul cvi 100 div 4 1 roll} repeat} %inches + 2 {4 {cvi 4 1 roll} repeat} %points + 3 {4 {3.527 mul cvi 100 div 4 1 roll} repeat} %centimetres + } case + (X=% Y=% W=% H=%) [6 2 roll] /printf PSmessage send + } def % Override two methods: the Client create & shape methods /CreateClientCanvas { % create the ClientCanvas: /CreateClientCanvas super send + % ClientCanvas /Transparent false put + % ClientCanvas /Mapped true put + % set up width factors: + /SliderLen 150 def + /HbarLen 200 def + /VbarLen 200 def + /CycleLen 60 def + /MessageLen 225 def + % Create the slider item: ! /PSSlider (Page: ) [ MIN MAX PageCount ] /Right {ItemValue /PSset win send} ! ClientCanvas SliderLen 0 /new SliderItem send dup /ItemFrame 1 put ! % PSInset 5 /move 3 index send ! store ! % create scrollbars ! /PSHbar [0 1 .01 .1 null] 0 {ItemValue /PSHscroll win send} ! ClientCanvas 0 HbarLen /new SimpleScrollbar send ! dup /BarVertical? false put ! % PSInset VbarLen PSInset add /move 3 index send ! store ! ! /PSVbar [0 1 .01 .1 null] 1 {ItemValue /PSVscroll win send} ! ClientCanvas 0 VbarLen /new SimpleScrollbar send ! % HbarLen PSInset add PSItemHeight /move 3 index send ! store ! ! % create box cycle ! /PScycle (Box: ) [(off) (in) (pt) (cm)] ! /Right {/paintov win send} ! ClientCanvas CycleLen 0 /new CycleItem send ! dup /ItemFrame 1 put ! % PSInset HbarLen add CycleLen 2 div sub 5 /move 3 index send ! store ! ! % create message box ! /PSmessage () () /Right {} ! ClientCanvas MessageLen 0 /new MessageItem send ! % HbarLen 2 div PSInset add MessageLen 2 div sub 5 /move 3 index send ! store ! ! % Activate the controls ! [PSSlider PSHbar PSVbar PScycle PSmessage] forkitems pop % Create the PostScript subwindow: /PSCanvas ClientCanvas newcanvas store PSCanvas /Mapped true put + /PSOverlay PSCanvas createoverlay store } def /ShapeClientCanvas { % [Re] Shape the ClientCanvas: /ShapeClientCanvas super send ClientCanvas setcanvas ! % Move the controls ! gsave ! ClientCanvas setcanvas clippath pathbbox points2rect ! PSInset sub PSItemHeight sub /VbarLen exch def ! PSInset 2 mul sub /HbarLen exch def ! pop pop ! grestore ! PSInset 5 /move PSSlider send ! PSInset VbarLen PSItemHeight add HbarLen 16 /reshape PSHbar send ! HbarLen PSInset add PSItemHeight 16 VbarLen /reshape PSVbar send ! PSInset HbarLen add CycleLen sub 5 /move PScycle send ! PSInset HbarLen add CycleLen sub MessageLen sub PSInset sub 5 ! /move PSmessage send % [Re] Shape the PostScript subwindow: gsave ClientCanvas setcanvas clippath pathbbox *************** *** 177,182 **** --- 325,332 ---- PSInset PSItemHeight translate PSItemHeight sub PSInset sub exch PSInset 2 mul sub exch rectpath PSCanvas reshapecanvas + % PSCanvas setcanvas clippath PSOverlay reshapecanvas + /PSOverlay PSCanvas createoverlay store grestore } def classend def *************** *** 197,205 **** 62 { LAST } def % '>' 46 { LAST } def % ',' 36 { LAST } def % '$' 3 { EXIT } def % ^C 113 {EXIT } def % 'q' ! /LeftMouseButton {NEXT} def end { % done as a separate process so the file reading --- 347,359 ---- 62 { LAST } def % '>' 46 { LAST } def % ',' 36 { LAST } def % '$' + 101 { ENLARGE } def % 'e' + 114 { REDUCE } def % 'r' + 110 { NORMAL } def % 'n' 3 { EXIT } def % ^C 113 {EXIT } def % 'q' ! /LeftMouseButton {LEFT} def ! /MiddleMouseButton {MIDDLE} def end { % done as a separate process so the file reading *************** *** 214,219 **** --- 368,374 ---- /Name 200 dict dup begin 0 1 127 { dup def } for /LeftMouseButton dup def + /MiddleMouseButton dup def end def /Action /DownTransition def /Canvas currentcanvas def *************** *** 242,247 **** --- 397,406 ---- { countdictstack @DictHeight le { exit } if end } loop def + cdef ps_dvips_fix() + {PSCanvas ps_scale} win send + cdef ps_prolog_done() + /PrologDone true def cdef ps_startprolog() /@DictHeight countdictstack def privudict begin