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
|
%D \module
%D [ file=s-pre-00,
%D version=1997.07.22,
%D title=\CONTEXT\ Style File,
%D subtitle=Presentation Environment 0,
%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.
% This might go away!
%D This module provides some non core functionality that can
%D be used in the presentations styles. This module contains
%D experimental macros.
%D
%D The presentation environments are independent of each other.
%D Although they have much in common, and in many cases can be
%D exchanged, the common components are not collected in this
%D file. That way they can serve as examples of style
%D definitions.
\unprotect
\newbox \presentationstack
\newcounter \presentationcounter
\newdimen \presentationheight
\appendtoks\doglobal\newcounter\presentationcounter\to\everyshipout
\defineframedtext
[presentationshield]
\setupframedtexts
[presentationshield]
[\c!background=\v!color,
\c!backgroundcolor=StepColor,
\c!offset=\v!overlay,
\c!frame=\v!off]
\definecolor[StepColor][white]
\def\enablepresentationstep%
{\let\enablepresentationstep\relax
\useJSpreamblenow{presentation}%
\setuptexttexts
[\vbox to \textheight
{\dopresentationstep1\box\presentationstack\vfill}]}
\def\presentationstep
{\dopresentationstep0}
\def\dopresentationstep#1% not ok yet
{\global\setbox\presentationstack=\vbox
{\ifnum\presentationcounter=0
\global\presentationheight=\!!zeropoint
\fi
\ifcase#1\relax
\scratchdimen=\pagetotal
\else
\scratchdimen=\textheight
\fi
\advance\scratchdimen by -\presentationheight
\edef\presentationstepheight{\the\scratchdimen}
\global\presentationheight=\pagetotal
\forgetall
\offinterlineskip
\dontcomplain
\box\presentationstack
\doglobal\increment\presentationcounter
\scratchcounter=\realpageno \multiply\scratchcounter by 100
\advance\scratchcounter by \presentationcounter
\edef\presentationtag{presentation:\the\scratchcounter}
\setupfield
[presentation]
[\c!width=\v!fit,\c!height=\v!fit,\c!offset=\v!overlay,
\c!strut=\v!no,\c!frame=\v!off,\c!option=\v!readonly]
\definesymbol
[\presentationtag]
[\presentationshade]
\def\presentationshade
{\presentationshield
[\c!width=\textwidth,\c!height=\presentationstepheight]{}}
\definefield[\presentationtag][check][presentation][\presentationtag,\v!none][\presentationtag]
\fitfield[\presentationtag]}}
\startJSpreamble {presentation} used later
var presentation = new Array() ;
for (i=1;i<=\lastpage;i++)
{ presentation[i] = 0 }
this.dirty = false ;
function NextPresentation (pagenumber)
{ % ++presentation[pagenumber] ;
presentation[pagenumber] = presentation[pagenumber] + 1 ;
var dummy = 100*pagenumber + presentation[pagenumber] ;
var v = this.getField("presentation:"+dummy) ;
if (v)
{ v.hidden = true }
% { v.display = display.hidden }
else
{ ++pagenumber ;
if (pagenumber<=\lastpage)
{ presentation[pagenumber] = presentation[pagenumber] + 1 ;
dummy = 100*(pagenumber) + presentation[pagenumber] ;
v = this.getField("presentation:"+dummy) ;
if (v) { v.hidden = true }
% if (v) { v.display = display.hidden }
++this.pageNum } }
this.dirty = false }
\stopJSpreamble
\definereference[NextStep][JS(NextPresentation{\realfolio})]
%D \macros
%D {presentationstep}
%D
%D The macro \type {\presentationstep} provides a basic slide
%D show functionality. It sort of records pieces of the page
%D that will show up stepwise. It can be used like:
%D
%D \starttyping
%D \startitemize
%D \item eerste
%D \item tweede
%D \stopitemize
%D
%D \presentationstep
%D
%D \startformula
%D ax^2+bx+c
%D \stopformula
%D
%D \presentationstep
%D \stoptyping
%D
%D When the document is opened, the two text fragments are
%D covered by a shield. Each page has its own shield stack. The
%D logical reference \type {NextStep} can be used to hide the
%D shield.
%D
%D \starttyping
%D \setupfootertexts[{\button{Show Up}[NextStep]}]
%D \stoptyping
%D
%D In case of presentation style 2, you can say:
%D
%D \starttyping
%D \definereference[Whatever][JS(NextPresentation{\realfolio})]
%D \stoptyping
%D
%D Depending of the viewer, you need to reset the fields at
%D startup:
%D
%D \starttyping
%D \setupinteraction[openaction=ResetForm]
%D \stoptyping
%D
%D Fixed spacing give you the best results:
%D
%D \starttyping
%D \setupwhitespace[fixed]
%D \setupblank[fixed]
%D \stoptyping
%D
%D Sometimes you need to set the color of the background, as
%D with style 2:
%D
%D \starttyping
%D \definecolor[StepColor][Page]
%D \stoptyping
%D
%D Special effects can be reached with:
%D
%D \starttyping
%D \setupframedtexts
%D [presentationshield]
%D [background=color,backgroundcolor=red]
%D \stoptyping
%D
%D There is also:
%D
%D \starttyping
%D \autopresentationsteptrue
%D \stoptyping
%D
%D One can enable this feature as \type {step} mode.
\newif\ifautopresentationstep
\appendtoks \ifautopresentationstep\presentationstep\fi \to \everypar
\doifmode{step} {\enablepresentationstep}
\doifmode{autostep}{\autopresentationsteptrue\enablepresentationstep}
%D When in \type {comment} mode, embedded page comments are
%D processed and put below the page. The default space of
%D 5cm should be adequate but can of course be changed.
\doifmode{comment}{\setuppagecomment[state=start,location=bottom]}
\protect \endinput
|