s-pre-00.tex /size: 5851 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [      file=s-pre-00,
3%D        version=1997.07.22,
4%D          title=\CONTEXT\ Style File,
5%D       subtitle=Presentation Environment 0,
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% This might go away!
15
16%D This module provides some non core functionality that can
17%D be used in the presentations styles. This module contains
18%D experimental macros.
19%D
20%D The presentation environments are independent of each other.
21%D Although they have much in common, and in many cases can be
22%D exchanged, the common components are not collected in this
23%D file. That way they can serve as examples of style
24%D definitions.
25
26\unprotect
27
28\newbox     \presentationstack
29\newcounter \presentationcounter
30\newdimen   \presentationheight
31
32\appendtoks\doglobal\newcounter\presentationcounter\to\everyshipout
33
34\defineframedtext
35  [presentationshield]
36
37\setupframedtexts
38  [presentationshield]
39  [\c!background=\v!color,
40   \c!backgroundcolor=StepColor,
41   \c!offset=\v!overlay,
42   \c!frame=\v!off]
43
44\definecolor[StepColor][white]
45
46\def\enablepresentationstep%
47  {\let\enablepresentationstep\relax
48   \useJSpreamblenow{presentation}%
49   \setuptexttexts
50     [\vbox to \textheight
51        {\dopresentationstep1\box\presentationstack\vfill}]}
52
53\def\presentationstep
54  {\dopresentationstep0}
55
56\def\dopresentationstep#1% not ok yet
57  {\global\setbox\presentationstack=\vbox
58     {\ifnum\presentationcounter=0
59        \global\presentationheight=\!!zeropoint
60      \fi
61      \ifcase#1\relax
62        \scratchdimen=\pagetotal
63      \else
64        \scratchdimen=\textheight
65      \fi
66      \advance\scratchdimen by -\presentationheight
67      \edef\presentationstepheight{\the\scratchdimen}
68      \global\presentationheight=\pagetotal
69      \forgetall
70      \offinterlineskip
71      \dontcomplain
72      \box\presentationstack
73      \doglobal\increment\presentationcounter
74      \scratchcounter=\realpageno \multiply\scratchcounter by 100
75      \advance\scratchcounter by \presentationcounter
76      \edef\presentationtag{presentation:\the\scratchcounter}
77      \setupfield
78        [presentation]
79        [\c!width=\v!fit,\c!height=\v!fit,\c!offset=\v!overlay,
80         \c!strut=\v!no,\c!frame=\v!off,\c!option=\v!readonly]
81      \definesymbol
82        [\presentationtag]
83        [\presentationshade]
84      \def\presentationshade
85        {\presentationshield
86           [\c!width=\textwidth,\c!height=\presentationstepheight]{}}
87      \definefield[\presentationtag][check][presentation][\presentationtag,\v!none][\presentationtag]
88      \fitfield[\presentationtag]}}
89
90\startJSpreamble {presentation} used later
91  var presentation = new Array() ;
92  for (i=1;i<=\lastpage;i++)
93    { presentation[i] = 0 }
94  this.dirty = false ;
95  function NextPresentation (pagenumber)
96    { % ++presentation[pagenumber] ;
97      presentation[pagenumber] = presentation[pagenumber] + 1 ;
98      var dummy = 100*pagenumber + presentation[pagenumber] ;
99      var v = this.getField("presentation:"+dummy) ;
100      if (v)
101        { v.hidden = true }
102      % { v.display = display.hidden }
103      else
104        { ++pagenumber ;
105          if (pagenumber<=\lastpage)
106            { presentation[pagenumber] = presentation[pagenumber] + 1 ;
107              dummy = 100*(pagenumber) + presentation[pagenumber] ;
108              v = this.getField("presentation:"+dummy) ;
109              if (v) { v.hidden = true }
110            % if (v) { v.display = display.hidden }
111              ++this.pageNum } }
112      this.dirty = false }
113\stopJSpreamble
114
115\definereference[NextStep][JS(NextPresentation{\realfolio})]
116
117%D \macros
118%D   {presentationstep}
119%D
120%D The macro \type {\presentationstep} provides a basic slide
121%D show functionality. It sort of records pieces of the page
122%D that will show up stepwise. It can be used like:
123%D
124%D \starttyping
125%D \startitemize
126%D \item eerste
127%D \item tweede
128%D \stopitemize
129%D
130%D \presentationstep
131%D
132%D \startformula
133%D   ax^2+bx+c
134%D \stopformula
135%D
136%D \presentationstep
137%D \stoptyping
138%D
139%D When the document is opened, the two text fragments are
140%D covered by a shield. Each page has its own shield stack. The
141%D logical reference \type {NextStep} can be used to hide the
142%D shield.
143%D
144%D \starttyping
145%D \setupfootertexts[{\button{Show Up}[NextStep]}]
146%D \stoptyping
147%D
148%D In case of presentation style 2, you can say:
149%D
150%D \starttyping
151%D \definereference[Whatever][JS(NextPresentation{\realfolio})]
152%D \stoptyping
153%D
154%D Depending of the viewer, you need to reset the fields at
155%D startup:
156%D
157%D \starttyping
158%D \setupinteraction[openaction=ResetForm]
159%D \stoptyping
160%D
161%D Fixed spacing give you the best results:
162%D
163%D \starttyping
164%D \setupwhitespace[fixed]
165%D \setupblank[fixed]
166%D \stoptyping
167%D
168%D Sometimes you need to set the color of the background, as
169%D with style 2:
170%D
171%D \starttyping
172%D \definecolor[StepColor][Page]
173%D \stoptyping
174%D
175%D Special effects can be reached with:
176%D
177%D \starttyping
178%D \setupframedtexts
179%D   [presentationshield]
180%D   [background=color,backgroundcolor=red]
181%D \stoptyping
182%D
183%D There is also:
184%D
185%D \starttyping
186%D \autopresentationsteptrue
187%D \stoptyping
188%D
189%D One can enable this feature as \type {step} mode.
190
191\newif\ifautopresentationstep
192
193\appendtoks \ifautopresentationstep\presentationstep\fi \to \everypar
194
195\doifmode{step}                             {\enablepresentationstep}
196\doifmode{autostep}{\autopresentationsteptrue\enablepresentationstep}
197
198%D When in \type {comment} mode, embedded page comments are
199%D processed and put below the page. The default space of
200%D 5cm should be adequate but can of course be changed.
201
202\doifmode{comment}{\setuppagecomment[state=start,location=bottom]}
203
204\protect \endinput
205