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\startmode[asintended] \setupbodyfont[lbr] \stopmode
34
35\setupbodyfont[14.4pt]
36
37
38
39\setuppapersize
40 [S6][S6]
41
42\setuplayout
43 [topspace=0cm,
44 backspace=0cm,
45 header=0pt,
46 footer=0pt,
47 width=middle,
48 height=middle]
49
50
51
52
53\setupcolors
54 [state=start]
55
56\definecolor[PageColor] [s=.50]
57\definecolor[TextColor] [s=.80]
58\definecolor[DoneColor] [s=.65]
59
60\definecolor[TopColor] [r=.5,g=.6,b=.7]
61\definecolor[BotColor] [r=.6,g=.7,b=.5]
62\definecolor[DotColor] [r=.7,g=.5,b=.6]
63
64
65
66
67
68\setupinteraction
69 [state=start,
70 color=,
71 contrastcolor=]
72
73
74
75\setupinteractionscreen
76 [option=max,
77 delay=5]
78
79\setuppagetransitions
80
81
82
83\setupsystem
84 [random=medium]
85
86
87
88
89\defineoverlay [shape] [\uniqueMPgraphic{shape}]
90\defineoverlay [page] [\reuseMPgraphic{page}]
91
92\startreusableMPgraphic{page}
93 StartPage ;
94 filldraw Page withcolor \MPcolor{PageColor} ;
95 pickup pencircle scaled .375cm ;
96 for i=1 upto 200 :
97 drawdot center Page randomized (PaperWidth,PaperHeight)
98 withcolor \MPcolor {DotColor} ;
99 endfor ;
100 StopPage ;
101\stopreusableMPgraphic
102
103\startuniqueMPgraphic{shape}
104 path p ;
105 p := unitsquare xyscaled(OverlayWidth,OverlayHeight) superellipsed .90 ;
106 draw p withpen pencircle scaled .50cm withcolor \MPcolor{PageColor} ;
107 fill p withcolor OverlayColor ;
108 draw p withpen pencircle scaled .25cm withcolor OverlayLineColor ;
109 currentpicture := currentpicture xysized(OverlayWidth,OverlayHeight) ;
110\stopuniqueMPgraphic
111
112
113
114
115
116
117\defineoverlay [forward] [\overlaybutton{forward}]
118
119
120
121\definelayer [main] \defineoverlay [main] [\composedlayer{main}]
122\definelayer [temp] \defineoverlay [temp] [\composedlayer{temp}]
123
124
125
126
127
128\setuplayer
129 [main]
130 [state=repeat]
131
132
133
134\setupbackgrounds
135 [page]
136 [background={page,forward,main,temp}]
137
138
139
140
141
142
143\initializeboxstack{Summary}
144\initializeboxstack{Subtext}
145
146
147
148
149
150
151
152\doglobal\newcounter\CurrentSummary
153
154\def\StartSummary
155 {\dodoublegroupempty\doStartSummary}
156
157\def\doStartSummary#1#2
158 {\doglobal\increment\CurrentSummary
159 \setbox\scratchbox=\hbox{\strut#1}
160 \getrandomseed\RandomSeed
161 \setlayer[main]
162 {\RandomSubtextBox{DoneColor}{BotColor}{BotColor}}
163 \setrandomseed\RandomSeed
164 \savebox{Subtext}{\CurrentSummary}
165 {\RandomSubtextBox{TextColor}{BotColor}{black}}
166 \setbox\scratchbox=\hbox \bgroup
167 \setbox\scratchbox=\hbox{\bfb\setstrut\strut\quad#2\quad}
168 \SetAcceptableWidth
169 \framed [offset=0pt,width=fit,frame=off,align=middle,strut=no]
170 \bgroup \setupwhitespace[big]
171 \doifsomething{#2}{\noindent\box\scratchbox\blank}}
172
173\def\StopSummary
174 {\egroup \egroup
175 \getrandomseed\RandomSeed
176 \setlayer[main]
177 {\RandomSummaryBox{DoneColor}{TopColor}{TopColor}}
178 \setrandomseed\RandomSeed
179 \savebox{Summary}{\CurrentSummary}
180 {\RandomSummaryBox{TextColor}{TopColor}{black}}}
181
182
183
184
185
186
187
188
189
190
191\def\SetAcceptableWidth
192 {\scratchdimen=.5\makeupwidth
193 \ifdim\wd\scratchbox>.5\makeupwidth
194 \getrandomdimen\hsize{\wd\scratchbox}{.8\makeupwidth}
195 \else
196 \getrandomdimen\hsize{.5\makeupwidth}{.7\makeupwidth}
197 \fi}
198
199
200
201
202\def\RandomSubtextBox#1#2#3
203 {\vbox to \makeupheight
204 {\vfill
205 \hbox to \makeupwidth
206 {\hfill
207 \button
208 [offset=2ex,frame=off,background=shape,strut=no,
209 backgroundcolor=#1,framecolor=#2,foregroundcolor=#3]
210 {\copy\scratchbox}
211 [previouspage]
212 \getrandomdimen\scratchdimen{.5cm}{2.5cm}
213 \hskip\scratchdimen}
214 \getrandomdimen\scratchdimen{.5cm}{1.5cm}
215 \vskip \scratchdimen}}
216
217
218
219
220
221\definereference[thispage][page(\CurrentSummary)]
222
223\def\RandomSummaryBox#1#2#3
224 {\vbox to \makeupheight
225 {\getrandomdimen\scratchdimen{.5cm}\makeupheight
226 \vskip 0pt plus \scratchdimen
227 \hbox to \makeupwidth
228 {\getrandomdimen\scratchdimen{.5cm}\makeupwidth
229 \hskip 0pt plus \scratchdimen
230 \button
231 [offset=3ex,frame=off,background=shape,strut=no,
232 backgroundcolor=#1,framecolor=#2,foregroundcolor=#3]
233 {\copy\scratchbox}
234 [thispage]
235 \getrandomdimen\scratchdimen{.5cm}\makeupwidth
236 \hskip 0pt plus \scratchdimen}
237 \getrandomdimen\scratchdimen{.5cm}\makeupheight
238 \vskip 0pt plus \scratchdimen
239 \vskip.2\makeupheight}}
240
241
242
243
244
245\def\BuildPage
246 {\dorecurse{\CurrentSummary}
247 {\startstandardmakeup
248 \setlayer[temp]{\foundbox{Summary}\recurselevel}
249 \setlayer[temp]{\foundbox{Subtext}\recurselevel}
250 \stopstandardmakeup}}
251
252
253
254\appendtoks \BuildPage \to \everystoptext
255
256
257
258\def\TitlePage
259 {\dodoublegroupempty\doTitlePage}
260
261\long\def\doTitlePage#1#2
262 {\ifsecondargument
263 \MakeTitlePage{#1}{#2}
264 \else\iffirstargument
265 \MakeTitlePage{\currentdate}{#1}
266 \else
267 \MakeTitlePage{\currentdate}{Welcome}
268 \fi\fi}
269
270\def\MakeTitlePage#1#2
271 {\StartSummary{#1}{#2}\StopSummary}
272
273
274
275\long\def\StartTopic#1\StopTopic{\StartSummary#1\StopSummary}
276
277\doifnotmode{demo}{\endinput}
278
279
280
281\starttext
282
283\TitlePage{Indeed}{The Title Page}
284
285\StartSummary{Alpha}{Title}
286 A simple and not too long text just to show the topic.
287 A simple and not too long text just to show the topic.
288 A simple and not too long text just to show the topic.
289\StopSummary
290
291\StartSummary{Beta and Gamma}{Another Title}
292 A simple and not too long text just to show the topic.
293 A simple and not too long text just to show the topic.
294\StopSummary
295
296\StartSummary{Delta}{Some Title}
297 A simple and not too long text just to show the topic.
298\StopSummary
299
300\StartSummary{Epsilon}{What A Title}
301 A simple and not too long text just to show the topic.
302 A simple and not too long text just to show the topic.
303 A simple and not too long text just to show the topic.
304\StopSummary
305
306\StartSummary{Zeta, Eta and Theta}{Eh, A Title}
307 A simple and not too long text just to show the topic.
308 A simple and not too long text just to show the topic.
309 A simple and not too long text just to show the topic.
310\StopSummary
311
312\StartSummary{Omega}
313 A simple and not too long text just to show the topic.
314 A simple and not too long text just to show the topic.
315 A simple and not too long text just to show the topic.
316 A simple and not too long text just to show the topic.
317\StopSummary
318
319\stoptext
320 |