% % OpenLook drawing routines... % dictbegin gsave /GraphicFont /olglyph findfont 12 scalefont def GraphicFont setfont % % Temporary constants % /CW {stringbbox pop 3 1 roll pop pop cvi} def /CH {stringbbox 4 1 roll pop pop pop cvi} def /OLArrowW (\60) CW def /OLArrowH (\60) CH def /OLElevatorButH (\303) CH 1 sub def % % Constants % /OLButW (\63) CW def /OLButH (\63) CH def /OLButtonCapW (\030\034) CW 2 idiv def /OLButtonCapW2 (\030\034) CW def /OLButtonH (\042) CH 1 add def /OLMenuButtonCapW2 OLButtonCapW2 OLArrowW add def /OLSettingH OLButtonH def /OLMoreArrowW OLArrowW def /OLMoreArrowH OLArrowH def /OLScrollW (\067) CW def /OLAnchorH 5 def /OLElevatorH (\067) CH def /OLElevH (\206) CH def /OLCableGap 2 def /OLCableW 4 def /OLCableOff OLScrollW OLCableW sub 2 div def /OLPinW (\144) CW def /OLPinH (\144) CH def /OLReshapeW (\130) CW def /OLReshapeH (\130) CH def /OLScrollButW (\064) CW def /OLScrollButH (\064) CH def /OLCaretW (\321) CW def /OLCaretH (\321) CW def % Draw Flat /DF { % x y s1 s2 s3 color -- currentfont 7 1 roll setcolor //GraphicFont setfont 4 index 4 index moveto show 3 index 3 index moveto show 3 1 roll moveto show setfont } def % Draw Up /DU { % x y s1 s2 s3 -- currentfont 6 1 roll //GraphicFont setfont BG setcolor 4 index 4 index moveto show BG3 setcolor 3 index 3 index moveto show BG0 setcolor 3 1 roll moveto show setfont } def % Draw Down /DD { % x y s1 s2 s3 -- currentfont 6 1 roll //GraphicFont setfont BG2 setcolor 4 index 4 index moveto show BG0 setcolor 3 index 3 index moveto show BG3 setcolor 3 1 roll moveto show setfont } def % % 3D rectangles and lines % /OLRect { % down? x y w h -- matrix currentmatrix 6 1 roll 4 2 roll 1 add translate 1 1 xysub scale dup {BG2} {BG} ifelse setcolor 0 0 moveto 0 1 lineto 1 1 lineto 1 0 lineto closepath fill dup {BG0} {BG3} ifelse setcolor 0 0 moveto 1 0 lineto 1 1 lineto stroke {BG3} {BG0} ifelse setcolor 0 0 moveto 0 1 lineto 1 1 lineto stroke setmatrix } def /OLBox { % down? x y w h -- matrix currentmatrix 6 1 roll 4 2 roll translate 0 1 moveto 0 1 index 1 sub rlineto 1 index 1 sub 0 rlineto 1 2 moveto 1 index 3 sub 0 rlineto 0 1 index 3 sub rlineto 2 index {BG3} {BG0} ifelse setcolor stroke 1 2 moveto 0 1 index 3 sub rlineto 1 index 2 sub 0 rlineto 1 1 moveto exch 2 sub 0 rlineto 0 exch 2 sub rlineto {BG0} {BG3} ifelse setcolor stroke setmatrix } def /OLHLine { % down? x y len -- newpath 3 1 roll 4 copy moveto 1 0 rmoveto 2 sub 0 rlineto 0 1 rlineto {BG0} {BG3} ifelse setcolor stroke moveto 0 1 rlineto 2 sub 0 rlineto {BG3} {BG0} ifelse setcolor stroke } def /OLVLine { % down? x y len -- newpath 3 1 roll 4 copy moveto -1 1 rmoveto 1 0 rlineto 0 exch 2 sub rlineto {BG0} {BG3} ifelse setcolor stroke moveto -1 2 rmoveto 0 exch 2 sub rlineto 1 0 rlineto {BG3} {BG0} ifelse setcolor stroke } def % % More arrow % /OLMoreArrow { % -- currentpoint 1 //OLArrowH xyadd (\060) (\061) (\062) BG3 //DF exec } def % % Abreviated buttons.. % /OLbut { % down? x y -- //OLButH add (\063) (\064) (\065) 6 -1 roll //DD //DU ifelse } def /OLBut { % down? -- 0 0 //OLbut exec } def % % abrrivated scroll buttons % /X OLButW OLArrowW sub 2 div def /Y OLButH OLArrowH sub 2 div OLArrowH add def /OLScrollButRight { % down? x y -- 3 copy //OLbut exec //X //Y xyadd (\060) (\061) (\062) BG3 //DF exec pop } def /OLScrollButLeft { % down? x y -- 3 copy //OLbut exec //X //Y xyadd (\315) (\316) (\317) BG3 //DF exec pop } def /OLScrollButDown { % down? x y -- 3 copy //OLbut exec //X //Y xyadd (\055) (\056) (\057) BG3 //DF exec pop } def /OLScrollButUp { % down? x y -- 3 copy //OLbut exec //X //Y xyadd (\312) (\313) (\314) BG3 //DF exec pop } def % % abbreviated menu buttons % /OLMenuBut { % menudown? down? -- 0 0 //OLbut exec //X //Y 3 -1 roll {(\055) (\056) (\057)} {(\060) (\061) (\062)} ifelse //DD exec } def % % check box % /OLCheckBox { % checked? down? -- dup 0 0 //OLbut exec not and { currentfont //GraphicFont setfont 0 //OLButH moveto FG setcolor (\165) show setfont } if } def % % pin % /OLPin { % pinned? x y -- //OLPinH add 3 -1 roll {(\147) (\150) (\151)} {(\144) (\145) (\14d)} ifelse //DU exec %3 -1 roll {(\147) (\150) (\151)} {(\267) (\270) (\271)} ifelse //DU exec } def % % reshape corners % /OLReshapeNW { % down? x y -- (\130) (\131) (\132) 6 -1 roll //DD //DU ifelse } def /OLReshapeNE { % down? x y -- //OLReshapeW 0 xysub (\133) (\134) (\135) 6 -1 roll //DD //DU ifelse } def /OLReshapeSE { % down? x y -- //OLReshapeW neg //OLReshapeH xyadd (\136) (\137) (\140) 6 -1 roll //DD //DU ifelse } def /OLReshapeSW { % down? x y -- //OLReshapeH add (\141) (\142) (\143) 6 -1 roll //DD //DU ifelse } def % % Scrollbar elevator % /OLElevatorStatesV dictbegin /null {pop pop pop} def /ElevatorUp { % abbrev? x y -- 3 -1 roll //OLElevH //OLElevatorH ifelse add (\302) (\303) (\070) //DD exec } def /ElevatorDown { % abbrev? x y -- //OLElevatorButH add 1 add (\302) (\303) (\073) //DD exec pop } def /ElevatorDrag { % abbrev? x y -- 3 -1 roll {pop pop} { //OLElevatorButH dup add add 1 add (\304) (\305) //nullstring //DD exec } ifelse } def dictend def /OLElevatorStatesH dictbegin /null {pop pop pop} def /ElevatorUp { % abbrev? x y -- 3 -1 roll //OLElevH 1 add //OLElevatorH ifelse //OLScrollW neg xysub (\310) (\311) (\212) //DD exec } def /ElevatorDown { % abbrev? x y -- //OLElevatorButH 1 add //OLScrollW neg xysub (\310) (\311) (\207) //DD exec pop } def /ElevatorDrag { % abbrev? x y -- 3 -1 roll {pop pop} { //OLElevatorButH dup add //OLScrollW neg 1 sub xysub (\304) (\305) //nullstring //DD exec } ifelse } def dictend def /OLElevator { % down-active? up-active? abbrev? vert? -- { currentpoint //OLScrollW 3 index //OLElevH //OLElevatorH ifelse rect BG setcolor fill 2 index //OLElevH //OLElevatorH ifelse add 2 copy 4 index {(\205) (\206)} {(\066) (\067)} ifelse //nullstring //DU exec % down up abbrev? x y -- 4 -1 roll { } if 4 -1 roll { } if } { currentpoint 2 index //OLElevH //OLElevatorH ifelse neg //OLScrollW rect BG setcolor fill 2 index //OLElevH //OLElevatorH ifelse neg //OLScrollW xyadd 2 copy 4 index {(\210) (\211)} {(\071) (\072)} ifelse //nullstring //DU exec 4 -1 roll { } if 4 -1 roll { } if } ifelse pop pop pop } def /OLElevatorHilite { % name|null abbrev? vert? -- currentpoint 3 -1 roll //OLElevatorStatesV //OLElevatorStatesH ifelse 5 -1 roll get exec } def /OLElevatorWhere { % x' y' abrrev? vert? -- name|null 4 2 roll currentpoint xysub 3 -1 roll not {exch neg} if exch dup 0 lt exch //OLScrollW ge or {pop pop null} { dup 0 lt {pop pop /PageDown} { dup //OLElevatorButH lt {pop pop /ElevatorDown} { exch {//OLElevH gt /PageUp /ElevatorUp ifelse} { dup //OLElevatorH gt {pop /PageUp} { //OLElevatorH exch sub //OLElevatorButH lt /ElevatorUp /ElevatorDrag ifelse } ifelse } ifelse } ifelse } ifelse } ifelse } def /OLAnchor { % down? vert? -- {currentpoint //OLScrollW //OLAnchorH} {currentpoint //OLAnchorH 0 xysub //OLAnchorH //OLScrollW} ifelse OLRect } def % % Buttons % /AP { % s1 s2 -- 2 copy length exch length add string dup 3 index length 4 -1 roll putinterval dup 0 4 -1 roll putinterval } def /MS { % dict key endstr s1 s2 s4 s8 s16 s32 s64 beginstr width -- dup 4 1 roll 64 idiv {1 index //AP exec} repeat exch pop 3 -1 roll 2 index 32 and 0 ne //AP {pop} ifelse 3 -1 roll 2 index 16 and 0 ne //AP {pop} ifelse 3 -1 roll 2 index 8 and 0 ne //AP {pop} ifelse 3 -1 roll 2 index 4 and 0 ne //AP {pop} ifelse 3 -1 roll 2 index 2 and 0 ne //AP {pop} ifelse 3 -1 roll 2 index 1 and 0 ne //AP {pop} ifelse exch pop exch //AP exec 2 index dup length exch maxlength eq { 2 index [1 index {pop} forall] 0 1 index length 2 idiv getinterval {2 copy undef pop} forall pop } if put } def /D1 32 dict def /D2 32 dict def /D3 32 dict def /D4 32 dict def /OLButton { % down? w -- 0 //OLButtonH 3 -1 roll //OLButtonCapW2 sub cvi //D1 1 index 2 copy known not { 2 copy (\034) (\036) (\037) (\040) (\041) (\042) (\042\042) (\042\042\042\042) (\030) 9 index //MS exec } if get //D2 2 index 2 copy known not { 2 copy (\033) (\043) (\044) (\045) (\046) (\047) (\047\047) (\047\047\047\047) (\031) 9 index //MS exec } if get //D3 4 -1 roll 2 copy known not { 2 copy (\035) (\050) (\051) (\052) (\053) (\054) (\054\054) (\054\054\054\054) (\032) 9 index //MS exec } if get 6 -1 roll //DD //DU ifelse } def /X OLButtonCapW OLArrowW 2 div add 2 add def /Y OLButtonH OLArrowH sub 2 div OLArrowH add def /OLMenuButton { % menudown? down? w -- 2 copy OLButton exch pop //X sub //Y 3 -1 roll {(\055) (\056) (\057)} {(\060) (\061) (\062)} ifelse //DD exec } def /OLButtonDefault { % w -- 0 //OLButtonH 3 -1 roll //OLButtonCapW2 sub cvi //D4 exch 2 copy known not { 2 copy (\153) (\154) (\155) (\156) (\157) (\160) (\160\160) (\160\160\160\160) (\152) 9 index //MS exec } if get //nullstring exch //nullstring //DU exec } def % % Settings % /OLSetting { % down? w -- 0 0 3 -1 roll //OLSettingH OLRect } def /OLSettingDefault { % w -- newpath BG3 setcolor 2 3 3 -1 roll 5 sub //OLSettingH 5 sub rectpath stroke } def % % Text carets % /OLCaret { % active? -- currentfont exch //GraphicFont setfont FG setcolor { -2 0 rmoveto (\320) show } { -3 0 rmoveto (\321) show } ifelse setfont } def /OLShow { % displayitem x y w h -- 4 index DISize pop 2 index gt 2 index //OLMoreArrowW gt and { 5 copy exch //OLMoreArrowW sub 1 sub exch DIPaintLeft //OLMoreArrowH sub 2 div xyadd //OLMoreArrowW 0 xysub moveto OLMoreArrow pop } {DIPaintLeft} ifelse } def % % Stipple utillities % /OLStippleFont dup dictbegin /FontType 3 def /FontMatrix [1 0 0 1 0 0] def /FontBBox [0 0 1 1] def /Encoding [/OLStip 255 {/.notdef} repeat] def /CharProcs dictbegin /.notdef nullproc def /OLStip { 32 32 true matrix < aaaaaaaa55555555aaaaaaaa55555555aaaaaaaa55555555aaaaaaaa55555555 aaaaaaaa55555555aaaaaaaa55555555aaaaaaaa55555555aaaaaaaa55555555 aaaaaaaa55555555aaaaaaaa55555555aaaaaaaa55555555aaaaaaaa55555555 aaaaaaaa55555555aaaaaaaa55555555aaaaaaaa55555555aaaaaaaa55555555 > imagemask } def dictend def /BuildChar { % font char => - exch begin 32 0 0 0 32 32 setcachedevice Encoding exch get CharProcs exch get exec end } def dictend definefont def /OLStipple { % -- gsave //OLStippleFont setfont clip pathbbox points2rect 4 2 roll translate exch 32 div ceiling cvi string exch 32 div ceiling cvi { 0 0 moveto dup show 0 32 translate } repeat pop grestore newpath } def %currentdict /OLbut undef %currentdict /GraphicFont undef %currentdict /OLStippleFont undef %currentdict /DU undef %currentdict /DD undef %currentdict /MS undef %currentdict /AP undef %currentdict /D1 undef %currentdict /D2 undef %currentdict /D3 undef %currentdict /D4 undef %currentdict /CW undef %currentdict /CH undef %currentdict /X undef %currentdict /Y undef %currentdict /OLElevatorStatesV undef %currentdict /OLElevatorStatesH undef %currentdict /OLElevatorButH undef %currentdict /OLArrowW undef %currentdict /OLArrowH undef grestore dictend readonly