1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
%D \module
%D [ file=s-pre-05,
%D version=1998.12.12,
%D title=\CONTEXT\ Style File,
%D subtitle=Presentation Environment 5,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
\usemodule[pre-general]
%D As all styles sofar, this one has the same structuring
%D commands.
\startmode[asintended] \setupbodyfont[ludicaot] \stopmode
\setupbodyfont[14.4pt]
\setupcolors [state=start]
\definecolor [BackgroundColor] [s=.95]
\definecolor [OrnamentColor] [r=.6,g=.7,b=.8]
\setuppapersize
[S6][S6]
\setuplayout
[width=430pt,
height=400pt,
header=0pt,
footer=0pt,
margin=0pt,
backspace=25pt,
topspace=25pt,
rightedgedistance=20pt,
rightedge=110pt]
\setupinteractionscreen
[option=max]
\setupbackgrounds
[state=repeat]
\setupbackgrounds
[page]
[backgroundcolor=white]
\setupbackgrounds
[text][text]
[background={HashFrameA,NextPage},
backgroundoffset=20pt]
\defineoverlay
[HashFrameA]
[\useMPgraphic{HashFrameA}]
\defineoverlay
[HashFrameB]
[\useMPgraphic{HashFrameB}]
\setupinteraction
[state=start,
menu=on,
color=OrnamentColor,
contrastcolor=OrnamentColor]
%D Watch how we use a list alternative that matches the
%D menu.
\setupinteractionmenu
[right]
[background=HashFrameB,
style=smallbold,
frame=off,
offset=10pt,
height=35pt,
before=,
after=,
inbetween=\endgraf,
width=\rightedgewidth]
\startinteractionmenu[right]
\placelist
[Topic]
[criterium=all,
alternative=right,
maxwidth=.8\rightedgewidth,
interaction=all,
before=,
after=]
\vfill
\setupinteractionmenu
[right]
[height=30pt]
\but [CloseDocument] Close \\
\stopinteractionmenu
\setupwhitespace
[big]
\setupblank
[big]
%D \macros
%D {TitlePage}
%D
%D Now the main layout and navigational definitions are
%D done, it makes sense to define and tune some structuring
%D commands. First we build the titlepage.
\defineoverlay [TitleGraphic] [\useMPgraphic{TitleGraphic}]
\defineoverlay [NextPage] [\overlaybutton{forward}]
\unexpanded\def\StartTitlePage
{\setupbackgrounds[page][background={color,TitleGraphic,NextPage}]
\setupbackgrounds[text][text][background=]
\setupinteraction[menu=off]
\setupinteractionbar[state=stop]
\setuplayout[width=550pt,rightedge=0pt]
\startstandardmakeup
\switchtobodyfont[24pt]
\bfd\setupinterlinespace
\setupalign[middle]
\vfil
\let\\=\vfil}
\unexpanded\def\StopTitlePage
{\vfil\vfil\vfil
\stopstandardmakeup
\setuplayout[width=430pt,rightedge=110pt]
\setupinteraction[menu=on]
\setupinteractionbar[state=start]
\setupbackgrounds[page][background=color]
\setupbackgrounds[text][text][background={HashFrameA,NextPage}]}
\unexpanded\def\TitlePage#1%
{\StartTitlePage#1\StopTitlePage}
%D \macros
%D {Topics,Subjects}
%D
%D Since the lists are in the menu, we don't honor list
%D placement macros.
\unexpanded\def\Topics#1{}
\unexpanded\def\Subjects{}
%D \macros
%D {Topic, Nopic, Subject}
%D
%D Since t his style is meant for rather flat structured
%D documents, only \type {\Topic} makes sense.
\definehead [Topic] [chapter]
\definehead [Nopic] [title]
\definehead [Subject] [section]
\setuphead
[Topic, Nopic]
[after={\blank[3*medium]},
number=no,
style=\tfb,
page=yes,
alternative=middle]
\setuphead
[Subject]
[after=\blank,
number=no,
page=yes,
continue=no,
style=\tfa]
%D We use only one kind of base graphic, which is sligthly
%D tuned for the different usage.
\startMPinclusions
def random_hash_frame (expr width, height, offset, linewidth ) =
def delta = ((uniformdeviate .5offset) + .25offset) enddef ;
x1 := offset ; y1 := offset ; x2 := width-offset ; y2 := height-offset ;
drawoptions(withpen pencircle scaled linewidth withcolor \MPcolor{BackgroundColor}) ;
fill z1--(x2,y1)--z2--(x1,y2)--cycle ;
drawoptions(withpen pencircle scaled linewidth withcolor \MPcolor{OrnamentColor}) ;
draw (x1-delta,y1)--(x2+delta,y1) ;
draw (x2,y1-delta)--(x2,y2+delta) ;
draw (x2+delta,y2)--(x1-delta,y2) ;
draw (x1,y2+delta)--(x1,y1-delta) ;
drawoptions();
setbounds currentpicture to unitsquare xscaled width yscaled height ;
enddef ;
\stopMPinclusions
\startuseMPgraphic{HashFrameA}
random_hash_frame(OverlayWidth,OverlayHeight,15pt,2pt) ;
\stopuseMPgraphic
\startuseMPgraphic{HashFrameB}
random_hash_frame(OverlayWidth,OverlayHeight, 5pt,2pt) ;
\stopuseMPgraphic
\startuseMPgraphic{TitleGraphic}
for i=1 upto 300 :
offset := uniformdeviate 10pt ;
width := 2*offset + 30pt + uniformdeviate 30pt ;
height := 2*offset + 10pt + uniformdeviate 10pt ;
addto currentpicture also
image(random_hash_frame(width,height,offset,1pt)) shifted
(uniformdeviate OverlayWidth, uniformdeviate OverlayHeight) ;
endfor ;
\stopuseMPgraphic
\continueifinputfile{s-pre-05.tex}
%D The (rather silly) demo section.
\starttext
\TitlePage{Title Page\\pre-fuzzy}
\Topics{Some Nice Quotes}
\Topic{A Few}
\Subject{Knuth} \input knuth
\Subject{Tufte} \input tufte
\Topic{Some More}
\Subject{Zapf} \input zapf
\Subject{Bryson} \input bryson
\stoptext
|