s-present-dark.mkiv /size: 9105 b    last modification: 2020-07-01 14:35
1
%D \module
2
%D [ file=s-present-dark, % tug-2001
3
%D version=2018.09.25, % 2000.*.*
4
%D title=\CONTEXT\ Style File,
5
%D subtitle=Presentation Environment Dark,
6
%D author=Hans Hagen,
7
%D date=\currentdate,
8
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9
%C
10
%C This module is part of the \CONTEXT\ macro||package and is
11
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12
%C details.
13 14
\startmodule
[
present
-
dark
]
15 16
%D The original document dates from 2000 and was meant for a presentation at \TUG\
17
%D 2001. It used widgets and in particular check fields and push buttons.
18
%D \JAVASCRIPT\ was used to show or hide them when rolling over, and appearances
19
%D changed in a subtle way. It actually worked quite well at that time.
20
%D
21
%D However, over time these widgets proved to be sort of unstable. For instance we
22
%D used the parent|-|child model of which (inheritance and appearance) behaviour
23
%D changed over time. We're talking of a few decades ago when \TEX\ was one of the
24
%D few (maybe only) tools that could actually support everything that the manual
25
%D introduced: the \quote {standard} seemed to be ahead of the viewer. Anyway, we
26
%D adapted but it meant that old document in principle were not always future proof.
27
%D
28
%D We used in this document a push button in the background of the menu so that it
29
%D could become visible when rolled over. There were no layers in \PDF\ at that
30
%D time! Nowadays such a trick doesn't work well because of the way a viewer
31
%D intercepts regions. One gets kind of erratic behaviour when applying \JAVASCRIPT.
32
%D
33
%D I spent quite some time to test if we could still do the same without side
34
%D effects and in the process also noticed that some functionality in \JAVASCRIPT\
35
%D seems broken (or changed due to maybe security issues). So, in the end I decided
36
%D to simplify the approach and use layers to pop up the menu when the mouse goes
37
%D over it but no longer hide it when the mouse leaves that area. It just doesn't
38
%D work too well otherwise.
39 40
%D We start with the layout. We basically have three areas: edge, margin and text.
41
%D Each are more or less the same width.
42 43
\setuppapersize
44
[
S
6
][
S
6
]
45 46
\setuplayout
47
[
backspace
=
3
8
0
pt
,
48
topspace
=
2
0
pt
,
49
leftedge
=
1
0
0
pt
,
50
leftedgedistance
=
1
0
pt
,
51
leftmargin
=
2
3
0
pt
,
52
leftmargindistance
=
2
0
pt
,
53
header
=
0
pt
,
54
footer
=
0
pt
,
55
width
=
2
0
0
pt
,
56
backspace
=
3
6
0
pt
,
57
width
=
2
2
0
pt
,
58
leftmargin
=
2
1
0
pt
,
59
height
=
middle
]
60 61
%D The bodyfont is the Latin Modern Variable (of course at that time we used
62
%D the Computer Modern predecessors). We still apply protrusion and expansion.
63
%D The new \quotation {Modern Latin} look also works ok on screen.
64 65
\definefontfeature
66
[
default
]
67
[
default
]
68
[
expansion
=
pure
,
69
protrusion
=
pure
]
70 71
\setupalign
72
[
verytolerant
,
stretch
,
hanging
]
% space
73 74
\setupbodyfont
75
[
modernvariable
,
1
1
pt
]
76 77
% \setupbodyfont
78
% [modernlatin,11pt]
79 80
\setupinmargin
81
[
style
=
,
82
color
=]
83 84
%D We use some predefined \JAVASCRIPT\ functions. These are rather old helpers.
85
%D Normally only the libraries (sets of functions) that are used will be
86
%D embedded.
87 88
\useJSscripts
[
fld
]
89
\useJSscripts
[
nav
]
90 91
%D The remarks that will pop up. By default they are not visible. Clicking
92
%D on the page (or menu item) will show them step by step.
93 94
\newcounter
\bofremarks
95
\newcounter
\nofremarks
96 97
\setupfield
98
[
remark
]
99
[
offset
=
overlay
,
100
option
=
{
readonly
,
hidden
}
,
101
color
=
,
102
style
=
,
103
frame
=
off
]
104 105
\defineframed
106
[
remarkable
]
107
[
frame
=
off
,
108
backgroundcolor
=
white
,
109
background
=
RollBackground
]
110 111
\starttexdefinition
unexpanded
remark
#
1
#
2
112 113
\doglobal
\increment
\nofremarks
114 115
\definesymbol
116
[
remark
:
x
:
\nofremarks
]
117
[
\remarkable
{
#
1
}
]
118 119
\definesymbol
120
[
remark
:
y
:
\nofremarks
]
121
[
\remarkable
{
#
2
}
]
122 123
\definefield
124
[
remark
:
x
:
\nofremarks
][
check
][
remark
]
125
[
remark
:
x
:
\nofremarks
]
126
[
remark
:
x
:
\nofremarks
]
127 128
\definefield
129
[
remark
:
y
:
\nofremarks
][
check
][
remark
]
130
[
remark
:
y
:
\nofremarks
]
131
[
remark
:
y
:
\nofremarks
]
132 133
\inleft
134
[
scope
=
local
]
135
{
136
\hpack
to
\hsize
{
137
\hss
138
\linebox
{
139
\fitfield
[
remark
:
y
:
\nofremarks
]
140
}
141
}
142
}
143 144
\bgroup
145 146
\setbox
\scratchbox
\hbox
{
147
#
1
148
}
149 150
\hpack
to
\wd
\scratchbox
{
151
\wd
\scratchbox
\zeropoint
152
\box
\scratchbox
153
\hss
154
\linebox
{
155
\fitfield
[
remark
:
x
:
\nofremarks
]
156
}
157
\hss
158
}
159 160
\egroup
161 162
\stoptexdefinition
163 164
%D We use lots of backgrounds. The \METAPOST\ graphics are a bit overkill
165
%D but we keep them.
166 167
\setupbackgrounds
168
[
text
]
169
[
background
=
StepFields
]
170 171
\defineoverlay
172
[
StepFields
]
173
[
\directsetup
{
syncrefs
}
\overlaybutton
{
ShowRemark
}
]
174 175
\setupbackgrounds
176
[
page
]
177
[
background
=
PageBackground
]
178 179
%D Just look in \type {java-imp-fld.mkiv} how \type {HideFields} and
180
%D alike are defined. They are defined references to \JAVASCRIPT\ calls.
181 182
\setupinteraction
183
[
state
=
start
,
184
click
=
no
,
185
menu
=
on
,
186
style
=
,
187
color
=
,
188
frame
=
off
,
189
contrastcolor
=]
190 191
\setupinteractionscreen
192
[
option
=
max
]
193 194
\setupbackgrounds
195
[
paper
]
196
[
background
=
color
,
197
backgroundcolor
=
black
]
198 199
\defineoverlay
200
[
PageBackground
]
201
[
\useMPgraphic
{
PageBackground
}
]
202 203
\startuseMPgraphic
{
PageBackground
}
204
StartPage
;
205
numeric
w
;
w
:
=
1.25
*
PaperWidth
;
206
numeric
n
;
n
:
=
2.50
*
PageNumber
;
207
numeric
d
;
d
:
=
(
1
+
(
PageNumber
-1
)
/
5
)
*
5
pt
;
208
fill
Page
209
withcolor
black
;
210
for
i
=
1
upto
500
:
211
draw
212
center
Page
213
randomized
w
214
rotatedaround
(
center
Page
,
n
)
215
withpen
pencircle
216
scaled
(
uniformdeviate
d
)
217
withcolor
218
(
yellow
randomized
(
.3
,
.8
)
)
219
;
220
endfor
;
221
StopPage
;
222
\stopuseMPgraphic
223 224
\defineoverlay
225
[
TextBackground
]
226
[
\uniqueMPgraphic
{
TextBackground
}
]
227 228
\startuniqueMPgraphic
{
TextBackground
}
229
fill
230
OverlayBox
231
withcolor
black
;
232
draw
233
OverlayBox
234
withpen
pencircle
scaled
1
pt
235
withcolor
OverlayColor
;
236
\stopuniqueMPgraphic
237 238
\defineoverlay
239
[
RollBackground
]
240
[
\uniqueMPgraphic
{
RollBackground
}
]
241 242
\startuniqueMPgraphic
{
RollBackground
}
243
fill
244
OverlayBox
245
withcolor
black
;
246
draw
247
OverlayBox
248
withpen
pencircle
scaled
1
pt
249
withcolor
OverlayColor
;
250
\stopuniqueMPgraphic
251 252
\setupinteractionmenu
253
[
left
]
254
[
state
=
start
,
255
width
=
\leftedgewidth
,
256
frame
=
on
,
257
framecolor
=
white
,
258
rulethickness
=
1
pt
,
259
foregroundcolor
=
white
,
260
background
=
RollBackground
]
261 262
\startsetups
syncrefs
263
\normalexpanded
{
264
\definereference
265
[
ShowRemark
]
266
[
StepFields
{
remark
:
x
,
\bofremarks
,
\nofremarks
}
,
267
StepFields
{
remark
:
y
,
\bofremarks
,
\nofremarks
}
]
268
}
269
\stopsetups
270 271
%D The menu buttons used to be rollover buttons but are now normal simple
272
%D ones (more predictable).
273 274
\defineviewerlayer
275
[
buttons
]
276 277
\startinteractionmenu
[
left
]
278
\vfill
279
\directsetup
{
syncrefs
}
280
\startviewerlayer
[
buttons
]
281
\startbut
[
previouspage
,
HideFields
]
Previous
\stopbut
282
\startbut
[
nextpage
,
HideFields
]
Next
\stopbut
283
\startbut
[
ShowRemark
]
Remark
\stopbut
284
\startbut
[
HideFields
]
Reset
\stopbut
285
\startbut
[
CloseDocument
,
HideFields
]
Quit
\stopbut
286
\stopviewerlayer
287
\stopinteractionmenu
288 289
\setupinteraction
290
[
closeaction
=
ForgetChanges
,
291
openpageaction
=
{
HideFields
,
HideLayer
{
buttons
}}
,
292
closepageaction
=
{
HideFields
,
HideLayer
{
buttons
}}
]
293 294
\defineoverlay
295
[
ShowMenu
]
296
[
\overlayrollbutton
{
VideLayer
{
buttons
}}{}
]
297 298
\setupbackgrounds
299
[
text
][
leftedge
]
300
[
backgroundoffset
=
1
0
pt
,
301
background
=
ShowMenu
]
302 303
%D The environment has been adapted a bit. Instead of taking two
304
%D arguments we now use a key|-|value approach. The remark is shown
305
%D when one rolls over the title (author).
306 307
\defineframedtext
308
[
MainText
]
309
[
frame
=
off
,
310
offset
=
1
0
pt
,
311
width
=
\textwidth
,
312
before
=
,
313
after
=
,
314
color
=
,
315
foregroundcolor
=
white
,
316
background
=
TextBackground
,
317
backgroundcolor
=
white
]
318 319
\starttexdefinition
unexpanded
StartIdea
320
\dosingleempty
{
\texdefinition
{
StartIdeaIndeed
}}
321
\stoptexdefinition
322 323
\starttexdefinition
StartIdeaIndeed
[#
1
]
324
\let
\bofremarks
\nofremarks
325
\increment
\bofremarks
326
\startstandardmakeup
327
\setvariables
[
Idea
][#
1
]
328
\startMainText
329
\setupalign
[
verytolerant
,
stretch
,
hanging
]
330
\stoptexdefinition
331 332
\starttexdefinition
unexpanded
StopIdea
333
\doifvariable
{
Idea
}
{
text
}
{
334
\blank
335
\rightaligned
{
336
\doifelsevariable
{
Idea
}
{
remark
}
{
337
\tooltip
338
[
left
]
339
{
\getvariable
{
Idea
}{
title
}}
340
{
\getvariable
{
Idea
}{
remark
}}
341
}
{
342
\getvariable
{
Idea
}{
title
}
343
}
344
}
345
}
346
\stopMainText
347
\vfill
348
\stopstandardmakeup
349
\stoptexdefinition
350 351
\stopmodule
352 353
\continueifinputfile
{
s
-
present
-
dark
.
mkiv
}
354 355
\usemodule
[
present
-
common
]
356 357
\inputpresentationfile
{
tug
/
2
0
0
1
/
tug
-
2
0
0
1
-
ideas
.
tex
}
358