home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Education Sampler 1992 [NeXTSTEP]
/
Education_1992_Sampler.iso
/
Demos
/
DE_FrameMaker
/
FrameMaker.app
/
fminit2.0
/
next
/
makerbegin.ps
< prev
next >
Wrap
Text File
|
1992-08-24
|
19KB
|
897 lines
%-
%- FrameMaker display server prologue, for use with FrameMaker 3.0
%- Copyright (c) 1986, 87, 88, 89, 90, 91 by Frame Technology, Inc.
%- All rights reserved.
%-
/FMdict 250 dict def
FMdict begin
/myfonts 41 array def % must match c code
3.86 setmiterlimit
/windows 0 def
/mymatrix matrix def
/IPheight -1000 def
/saveipgstate null def
/textgstack null def
/Textwidth 0 def
/Textheight 0 def
/mygstate gstate def
/CACHEX 128 def % size of offscreen cached patterns. must be power of 2
/CACHEY 128 def
%
% Color Handling
%
/PrintInColor true def
PrintInColor {
/HUE 0 def
/SAT 0 def
/BRIGHT 0 def
% array of arrays Hue and Sat values for the separations [HUE BRIGHT]
/Colors [
[0 0 ] % black
[0 0 ] % white
[0.00 1.0] % red
[0.37 1.0] % green
[0.60 1.0] % blue
[0.50 1.0] % cyan
[0.83 1.0] % magenta
[0.16 1.0] % yellow
] def
/K { % num K => - ; use separation NUM
Colors exch get dup
0 get /HUE exch store
1 get /BRIGHT exch store
HUE 0 eq BRIGHT 0 eq and {
1.0 SAT sub setgray
} {
HUE SAT BRIGHT sethsbcolor
} ifelse
} def
% special separation command for text. If it's a 2-bit
% window (see <appkit/graphics.h> for definition of 258)
% don't change the color.
/KT
currentdefaultdepthlimit 258 eq {/pop} {/K} ifelse
load def
/G { % num G => - ; set current gray to NUM
/SAT exch 1.0 exch sub store
HUE 0 eq BRIGHT 0 eq and {
1.0 SAT sub setgray
} {
HUE SAT BRIGHT sethsbcolor
} ifelse
} bind def
} {
/K /pop load def
/KT /pop load def
/G /setgray load def
} ifelse
/F /fill load def
/S /stroke load def
/rc /rectclip load def
/GS /gsave load def
/GR /grestore load def
/SL /setlinewidth load def
/SC /setlinecap load def
/CS { closepath S } bind def
/A /strokepath load def
/TR /translate load def
/L /lineto load def
/M /moveto load def
/D /curveto load def
/C /closepath load def
/xhow /xshow load def
/xyhow /xyshow load def
/smat { mymatrix currentmatrix pop } bind def
/rmat { mymatrix setmatrix } bind def
/sp { P exch get exec } bind def
/T { moveto show } bind def
/BitmapWidths false def
%
% Array of procedures which set the current pattern when executed
%
/P 16 array def
/patoffsetx 0 def
/patoffsety 0 def
/currentpat null def
%
% Find the display size XXXXX
%
/DisplayHeight 850 def
/DisplayWidth 1200 def
% you must protect your current gstate before this call
/createwindowg { % w h ==> graphics stack
/h 1 index def
0 0 4 2 roll Retained window windowdeviceround
initmatrix 0 h TR 1 -1 scale
gstate
} def
%
% Create 4 offscreen canvases for doing dotted lines fast
%
mygstate currentgstate
/HorThickCanvas DisplayWidth 1 createwindowg def
/HorThinCanvas DisplayWidth 1 createwindowg def
/VerThinCanvas 1 DisplayHeight createwindowg def
/VerThickCanvas 1 DisplayHeight createwindowg def
HorThickCanvas setgstate
1 setlinewidth
0.0 setgray
[] 0 setdash
.5 .5 M DisplayWidth .5 lineto stroke
[.001 3] 0 setdash
1.0 setgray
.5 .5 M DisplayWidth .5 lineto stroke
VerThickCanvas setgstate
1 setlinewidth
0.0 setgray
[] 0 setdash
.5 .5 M .5 DisplayHeight lineto stroke
[.001 3] 0 setdash
1.0 setgray
.5 .5 M .5 DisplayHeight lineto stroke
HorThinCanvas setgstate
[.001 3] 0 setdash
0.0 setgray
1 setlinewidth
.5 .5 M DisplayWidth .5 lineto stroke
VerThinCanvas setgstate
[.001 3] 0 setdash
0.0 setgray
1 setlinewidth
.5 .5 M .5 DisplayHeight lineto stroke
setgstate
/FmEncoding [
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /space /exclam /quotedbl
/numbersign /dollar /percent /ampersand /quotesingle /parenleft
/parenright /asterisk /plus /comma /hyphen /period /slash /zero /one
/two /three /four /five /six /seven /eight /nine /colon /semicolon
/less /equal /greater /question /at /A /B /C /D /E /F /G /H /I /J /K
/L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash
/bracketright /asciicircum /underscore /grave /a /b /c /d /e /f /g /h
/i /j /k /l /m /n /o /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar
/braceright /asciitilde /.notdef /Adieresis /Aring /Ccedilla /Eacute
/Ntilde /Odieresis /Udieresis /aacute /agrave /acircumflex /adieresis
/atilde /aring /ccedilla /eacute /egrave /ecircumflex /edieresis
/iacute /igrave /icircumflex /idieresis /ntilde /oacute /ograve
/ocircumflex /odieresis /otilde /uacute /ugrave /ucircumflex
/udieresis /dagger /.notdef /cent /sterling /section /bullet
/paragraph /germandbls /registered /copyright /trademark /acute
/dieresis /.notdef /AE /Oslash /.notdef /.notdef /.notdef /.notdef
/yen /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/ordfeminine /ordmasculine /.notdef /ae /oslash /questiondown
/exclamdown /logicalnot /.notdef /florin /.notdef /.notdef
/guillemotleft /guillemotright /ellipsis /.notdef /Agrave /Atilde
/Otilde /OE /oe /endash /emdash /quotedblleft /quotedblright
/quoteleft /quoteright /.notdef /.notdef /ydieresis /Ydieresis
/fraction /currency /guilsinglleft /guilsinglright /fi /fl /daggerdbl
/periodcentered /quotesinglbase /quotedblbase /perthousand
/Acircumflex /Ecircumflex /Aacute /Edieresis /Egrave /Iacute
/Icircumflex /Idieresis /Igrave /Oacute /Ocircumflex /.notdef /Ograve
/Uacute /Ucircumflex /Ugrave /dotlessi /circumflex /tilde /macron
/breve /dotaccent /ring /cedilla /hungarumlaut /ogonek /caron
] def
/FmEncode {
/basefontdict exch def
/newfontdict basefontdict maxlength 3 add dict def
basefontdict {
exch dup
/FID ne {
dup /Encoding eq {
exch pop FmEncoding
} {
exch
} ifelse
newfontdict 3 1 roll put
} {
pop pop
} ifelse
} forall
newfontdict /BitmapWidths BitmapWidths put
newfontdict
} def
%
% this is the template for a procedure which when execute will set the
% current pattern.
%
/patterninktemplate { %
null % this gets filled in later
/currentpat exch store
} def
%
% make a pattern, and also store it in the array of patterns P for quick
% access.
%
/makecontextpattern { % str inkproc index
1 index 4 -2 roll % index inkproc str inkproc
makermakepattern
cvn load P % index {} P
3 1 roll put
} def
%
% Create a procedure if it already hasn't been defined, which will set the
% current pattern when it gets executed. The pattern is
% created by filling on offscreen canvas.
%
% create offscreen canvas of pattern
%
/makermakepattern { % patternstring inkproc
dup
cvn dup
currentdict exch known { % patternstring inkproc inkprocname
pop pop pop
} {
3 1 roll 0 get (I) 0 get eq % inkprocname patternstring bool
cachepattern % inkprocname canvas
/patterninktemplate load
dup length array copy % name canvas array
dup 3 -1 roll % name array array canvas
0 exch put cvx def
} ifelse
} def
% debug code
/mypstack {
count /w exch def
w copy
w { errfile exch (% ) fprintf } repeat
errfile (\n) writestring
} def
% printout dictionary
/pdict {
dup
{ errfile 3 1 roll (% %\n) fprintf }
forall
} def
% printout array
/parray {
dup errfile exch (parray %\n) fprintf
dup { errfile exch ( %\n) fprintf } forall
} def
% these 2 are used in cachepattern
/copyright {
0 0 w h cgstate w 0 Sover composite
/w w dup add def
} def
/copyup {
0 0 w h cgstate 0 h Sover composite
/h h dup add def
} def
/cachepattern { % patternstring polarity ==> canvas
gstate 3 1 roll
/polarity exch def
/datastr exch def
% create on offscreen graphics context with an offscreen window
CACHEX CACHEY createwindowg /cgstate exch def
0 setgray
% plop the pattern down once
GS
8 8 scale
% we flip the pattern over the x axis here
8 8 polarity [8 0 0 8 0 0] { datastr } imagemask
GR
% spread the pattern around
/w 8 def
/h 8 def
{
h CACHEY eq { exit } if
copyright copyup
} loop
setgstate
cgstate
} def
%
% Fill area with pattern
%
/Z {
GS
pathbbox /uy exch cvi def /ux exch cvi def
/ly exch cvi def /lx exch cvi def
clip
/w lx patoffsetx add cvi 8 mod def
/h uy patoffsety add cvi 8 mod def
/lx lx w sub def
/uy uy h sub def
/ly ly cvi -32 and def
/uy uy cvi -32 and def
lx CACHEX ux {
ly CACHEY uy {
1 index exch % CACHEY add
0 0 CACHEX CACHEY currentpat 7 -2 roll Sover flush composite
} for
pop
} for
GR
newpath
} def
%
% vertical dotted line
%
/vdottedthick { % int x, int y, int h
/vh exch def /vy exch def /vx exch def
0 vy 2 vh VerThickCanvas vx vy Copy composite
% Copy was Sover
} bind def
/vdottedthin { % int x, int y, int h
/vh exch def /vy exch def /vx exch def
0 vy 2 vh VerThinCanvas vx vy Copy composite
% Copy was Sover
} bind def
%
%
% horizontal dotted line
%
/hdottedthick { % int x, int y, int w
0 exch 1 HorThickCanvas % x y 0 w 1 can
5 index 6 -1 roll % x 0 w 1 can x y
Sover composite
} bind def
/hdottedthin { % int x, int y, int w
0 exch 1 HorThinCanvas % x y 0 w 1 can
5 index 6 -1 roll % x 0 w 1 can x y
Sover composite
} bind def
/line { % int x0, int y0, int x1, int y1
M lineto
stroke
} bind def
/grid { % int x, int y, int w, int h, int gridw, int offx, int offy
GS
TR
/step exch def
/h exch def
/w exch def
/y exch def
/x exch def
/w w x add store % w has stop x
/h h y add store % h has stop y
x step idiv step mul
step w
{ y h vdottedline } for
y step idiv step mul
step h
{ x exch w hdottedline } for
GR
} def
/rrectpath { % r x y w h => - (make a round rect path)
smat
4 2 roll TR % r w h
/h exch def /w exch def /r exch def
mark
r 0 M
w 0 w h r arcto w h 0 h r arcto
0 h 0 0 r arcto 0 0 w 0 r arcto C
cleartomark
rmat
} def
/RF { % r x y w h
rrectpath fill
} bind def
/RP { % r x y w h
rrectpath Z
} bind def
/RS { % r x y w h
rrectpath stroke
} bind def
/RQ { % r x y w h
rrectpath A Z
} bind def
/NF { % x y w h
rectfill
} bind def
/NR { % w h x y
newpath M
dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto C
Z
} bind def
/W { % x y w h
currentgray 5 1 roll
1.0 setgray rectfill setgray
} bind def
/invertbox { highbox } bind def
/highbox { % x y w h
currentgray 5 1 roll
0.0 setgray
Highlight compositerect
setgray
} bind def
/PP { % int n
3 1 roll M 1 sub { lineto } repeat
} bind def
/SP { % int n
3 1 roll M 3 div cvi { curveto } repeat
} bind def
% note: this routine requires a GS,GR in the C codee
/myimage { % int dx, int dy, int w, int h, int bytes
/picstr exch string def
/h exch def
/w exch def % dx dy
h add TR
w h neg scale
w h 1
[w 0 0 h neg 0 h]
{currentfile picstr readstring pop }
image
} bind def
/rectpath { % w h x y
M dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto C
} def
/N { % x y w h
rectstroke
} bind def
/NQ { % int w, int h, int x, int y
rectpath A Z
} bind def
%
%
% | y0
% |
% ----- x0,y1
%
%
% make sure our offscreen insert point window is big enough
% variable h must be set
/checkip {
h IPheight gt {
GS mygstate currentgstate saveipgstate null ne { } if
1 h createwindowg /saveipgstate exch def
saveipgstate setgstate
setgstate
GR
/IPheight h store
} if
} def
/drawip { % int y1, int x0, int y0
/y0 exch def
/x0 exch def
/y1 exch def
/h y1 y0 sub 4 add def
checkip
mygstate currentgstate saveipgstate setgstate
x0 y0 1 h 4 index 0 0 Copy composite % saveunder
% Copy was Sover
setgstate
% now draw cursor
currentgray 0 setgray
x0 y0 1 h rectfill
fill
setgray
flushgraphics % XXX
} bind def
/eraseip { % int y1, int x0, int y0
/y0 exch def
/x0 exch def
/y1 exch def
/h y1 y0 sub 4 add def
0 0 1 h saveipgstate x0 y0 Copy composite % restore bits
% Copy was Sover
flushgraphics % XXX
} bind def
%
% Highlight underneath saved area
/highip { % x y w h => -
mygstate currentgstate saveipgstate setgstate
5 1 roll
highbox
setgstate
} bind def
% make sure our offscreen text drawing window is big enough
/checktextsize { %
ScratchHeight Textheight gt ScratchWidth Textwidth gt or {
mygstate currentgstate
initclip 1.0 setgray
ScratchWidth ScratchHeight createwindowg /Textgstate exch def
setgstate
/Textheight ScratchHeight def
/Textwidth ScratchWidth def
} if
} def
% prepare offscreen text drawing for typing in retained windows
/beginscratch { % x y w h => -
/ScratchHeight exch def
/ScratchWidth exch def
/ScratchY exch def
/ScratchX exch def
checktextsize
mygstate currentgstate pop
Textgstate setgstate % Textgstate has white fill and no clip
ScratchX neg ScratchY neg translate
ScratchX ScratchY ScratchWidth ScratchHeight rectfill
0 setgray
} bind def
% Blit textline onto the screen
/endscratch { %
mygstate setgstate
0 0 ScratchWidth ScratchHeight Textgstate ScratchX ScratchY Copy composite
% Copy was Sover
} bind def
/insideedgebox { % w h x y t => -
/t exch def
GS
0 setgray
4 copy rectpath
t add exch t add exch
M % w h
/t t dup add def
t sub exch t sub exch % w h
dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto C
eofill
GR
} bind def
% fill a box with a pattern
/replbox { % string datastring, string proc, int w, int h, int x, int y
M dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto C
currentgray .5 setgray fill setgray pop pop
} def
/graybox { % x y w h => -
currentgray 5 1 roll
.6666666 setgray rectfill setgray
} bind def
/darkgraybox { % x y w h => -
currentgray 5 1 roll
.333333 setgray rectfill setgray
} bind def
/arcpath { % int th, int dth, int w, int h, int x, int y
newpath
TR
/h exch def
/w exch def
/dth exch def
/th exch def
90 th dth add sub 90 th sub % theta1 theta2
dth 0 lt
{ exch } if
1 h w div neg scale
0 0 w 2 div 5 -2 roll arc
} def
/AS { % int th, int dth, int w, int h, int x, int y
smat
arcpath
rmat
stroke
} bind def
/AP { % int th, int dth, int w, int h, int x, int y
smat
arcpath
rmat
A Z
} bind def
/AF { % int th, int dth, int w, int h, int x, int y
smat
arcpath
0 0 lineto
rmat
fill
} bind def
/AQ { % int th, int dth, int w, int h, int x, int y
smat
arcpath
0 0 lineto
rmat
Z
} bind def
/mymakefont { % i name size => -
/size exch def
/name exch def
/i exch def
/myfontdict name cvn findfont def
myfontdict /Encoding get NextStepEncoding eq {
myfontdict FmEncode /gfontdict exch def
/gfontdict (F ) dup 1 i ( ) cvs putinterval cvn
gfontdict definefont def
} {
/gfontdict myfontdict def
} ifelse
/myfonts [ myfonts aload pop null ] def
myfonts i gfontdict [size 0 0 size neg 0 0 ] makefont put
} def
/mymakefontmetric { % i name size printermetrics => -
/BitmapWidths exch 0 eq def % the font reencoding will add this to font
mymakefont
} def
/FF { % i => -
myfonts exch get setfont
} bind def
% close clipping down to this rectangle
/CR { % x y w h => -
initclip
rectclip
} bind def
/CRnotrans { % x y w h => -
mymatrix currentmatrix pop
initmatrix 1 -1 scale
mymatrix setmatrix
} bind def
/cliptowindow {
initclip
} def
/beginprintcode { % -x -y w h scale dx dy => -
GS
newpath 1 setlinewidth 0 setlinecap 0 setlinejoin
[] 0 setdash 0 setgray 10 setmiterlimit
/FMdicttop countdictstack 1 add def % high-water mark of dict stack
/FMoptop count 7 sub def % tricky! 7 params on stack, plus "/FMoptop"
200 dict begin
TR % translate to bottom left
dup neg scale % convert to postscript coordinates
1.0 setgray 2 copy 0 0 4 -2 roll rectfill 0 setgray % clear underneath
0.0 0.0 M
} def
/endprintcode {
count -1 FMoptop {pop pop} for % clear user junk from operand stack
countdictstack -1 FMdicttop {pop end} for % ditto for dict stack
GR
} def
/beginPSInsetprintcode {
/insetsave save def
newpath 1 setlinewidth 0 setlinecap 0 setlinejoin
[] 0 setdash 0 setgray 10 setmiterlimit
/FMdicttop countdictstack 1 add def % high-water mark of dict stack
/FMoptop count def % tricky! +1 in both cases for the 'for' loop.
200 dict begin %
} def
/endPSInsetprintcode {
count -1 FMoptop {pop pop} for % clear user junk from operand stack
countdictstack -1 FMdicttop {pop end} for % ditto for dict stack
insetsave restore
} def
/cacheimage { % destX destY destWidth destHeight w h bps theta flip => -
/flip exch def
/theta exch def
/bps exch def
/h exch def
/w exch def
/destHeight exch def
/destWidth exch def
/destY exch def
/destX exch def
/rowbytes w bps mul 7 add 8 idiv def
/buffer rowbytes string def
GS
destX destY TR
theta rotate
destWidth flip {neg} if destHeight scale
w h bps
[w 0 0 h neg 0 h ]
{ currentfile buffer readstring pop } bind
image
GR
} def
% sbs 910917
/FmHorrible{}def
/FmEndHorrible{}def
/FMBEGINPAGE { } def
/FMENDPAGE { } def
%
% screen capture code
%
/grabdict 50 dict def
grabdict begin
/winx 0 def /winy 0 def
/winw 0 def /winh 0 def
/lastwin null def /mywin null def
/catcherradius 20 def
/mousedownx 0 def /mousedowny 0 def
/curmousex 0 def /curmousey 0 def
/min % a b => min(a, b)
{
2 copy gt {exch} if pop
} bind def
/max % a b => max(a, b)
{
2 copy lt {exch} if pop
} bind def
/abs % a => abs(a)
{
dup 0 lt {neg} if
} bind def
/updatewin % - => didchange
{
/winw winw 1 max def % Warning: no zero-height windows!
/winh winh 1 max def
mywin currentwindowbounds
winh ne exch winw ne or exch winy ne or exch winx ne or dup {
% Warning: keep a window under mouse so we get all clicks!
/lastwin mywin def
/mywin winx winy winw winh Buffered window def
mywin windowdeviceround
100 mywin setwindowlevel
Below lastwin mywin fillwindow
Above 0 mywin orderwindow
lastwin termwindow
} if
} def
/framewin
{
0 1 winw 1 sub winh 1 sub rectstroke
flushgraphics
} def
/getcurmouse
{
mywin currentmouse
/curmousey exch winy add def
/curmousex exch winx add def
} def
/captureloops
{
{
getcurmouse
/winx curmousex catcherradius sub def
/winy curmousey catcherradius sub def
/winw catcherradius catcherradius add def
/winh catcherradius catcherradius add def
updatewin {} if
buttondown {exit} if
} loop
/mousedownx curmousex 1 sub def % Offset mousedown point over our
/mousedowny curmousey 1 sub def % window so we get the click.
{
getcurmouse
/winx mousedownx curmousex min def
/winy mousedowny curmousey min def
/winw mousedownx curmousex sub abs def
/winh mousedowny curmousey sub abs def
mousedownx curmousex gt % Adjust coordinates to
{ % capture pixels under
/winx winx 1 sub def % the current frame.
/winw winw 2 add def
} if
mousedowny curmousey gt % Adjust coordinates to
{ % capture pixels under
/winy winy 1 sub def % the current frame.
/winh winh 2 add def
} if
updatewin {framewin} if
buttondown not {exit} if
} loop
} def
/setcrosshaircursor
{
0 0 16 16 Retained window
windowdeviceround
0 0 16 16 Clear compositerect
7 1 moveto 0 16 rlineto stroke
0 8 moveto 16 0 rlineto stroke
0 16 8 -8 setcursor
currentwindow termwindow
} def
end % grabdict
/docapture % - => w h bps
{
grabdict begin
{
setcrosshaircursor
/mywin 0 0 0 0 Buffered window def
captureloops
Below mywin mywin fillwindow
0 0 winw winh matrix currentmatrix sizeimage pop pop pop
} stopped pop
} def
/cleanupcapture % - => -
{
{
mywin termwindow
} stopped pop
end
} def