s-present-grow.mkiv /size: 4750 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [      file=s-present-grow, % was s-pre-10
3%D        version=unknown,
4%D          title=\CONTEXT\ Style File,
5%D       subtitle=Presentation Environment Grow,
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%D This style is derived from the ninth style, which was used first at \EUROTEX\ 99
15%D and later at \TUG\ 2000. This alternative builds up a page.
16
17\usemodule[present-windows] % not that much used
18
19\startmodule[present-grow]
20
21%D We use blue colors instead of yellow ones. Since we have used symbolic names, we
22%D can easily overload the existing scheme.
23
24\definecolor[LineColor][r=.40,g=.40,b=1.00]
25
26%D Here we don't use fixed dimensions, but fit the sample windows and derive the
27%D text windows's width from this one.
28
29\setupframedtexts
30  [SampleText]
31  [width=fit,height=fit,
32   background={background,nextpage}]
33
34%D The topic goes to the top right corner of the screen which means that it is
35%D positioned left down to the reference point. Watch how we make data on this layer
36%D (here only the topic but it can be more) persistent.
37
38\setuplayer
39  [topic]
40  [y=0pt,x=\makeupwidth,
41   location=lb,
42   state=repeat,
43   hoffset=-\FrameSkip,
44   voffset=\FrameSkip]
45
46%D Clicking on the page brings us back.
47
48\setupbackgrounds
49  [page]
50  [background={previouspage,color,topic}]
51
52%D All layers end up on the text area. This could have been the page area too since
53%D these have the same dimensions.
54
55\setupbackgrounds
56  [text]
57  [background={common,sample,text}]
58
59%D We overload this one (\MKIV):
60
61\defineoverlay [samepage] [\overlaybutton{nextpage}]
62
63%D Because we build up the text window step by step, we will separate the entries by
64%D white space.
65
66\startsetups [always]
67    \setupwhitespace[big]
68    \setupblank[big]
69\stopsetups
70
71%D The \type {\Topic} commands can be simplified to:
72
73\unexpanded\def\Topic#1%
74  {\resetlayer[topic]
75   \setlayer[topic]{\bfb\setstrut\color[TextColor]{#1}}}
76
77%D We also provide a way to erase the topic.
78
79\unexpanded\def\NoTopic
80  {\resetlayer[topic]}
81
82%D We have to redefine the structuring commands to support the resetting of buffer
83%D counters.
84
85\newcounter\TextN
86
87\unexpanded\def\StartSample
88  {\doglobal\newcounter\TextN
89   \dostartbuffer[sample][StartSample][StopSample]}
90
91\unexpanded\def\StartText
92  {\doglobal\newcounter\TextN
93   \dostartbuffer[text][StartText][StopText]}
94
95\unexpanded\def\StartSubText
96  {\doglobal\increment\TextN
97   \dostartbuffer[text-\TextN][StartSubText][StopSubText]}
98
99\unexpanded\def\StopText
100  {\startstandardmakeup
101     \DoSampleText{text}{common}{nextpage}
102   \stopstandardmakeup}
103
104\unexpanded\def\StopSubText
105  {\startstandardmakeup
106     \DoSampleText{text}{common}{nextpage}
107   \stopstandardmakeup}
108
109%D The \type {\DoSampleText} command is adapted to support addition of subtexts
110%D (each subtext goes into its own buffer).
111
112\unexpanded\def\DoSampleText#1#2#3%
113  {\setupframedtexts[SampleText][background={background,#3}]
114   \bgroup
115   \setups[#1]%
116   \setups[always]%
117   \setbox\nextbox=\hbox
118     {\startSampleText[none]
119        \getbuffer[#1]\par
120        \doif{#1}{text}
121          {\dorecurse{\TextN}{\getbuffer[text-\recurselevel]\par}}
122      \stopSampleText}
123   \xdef\SampleTextWidth{\the\wd\nextbox}
124   \setlayer[#2]{\box\nextbox}%
125   \egroup}
126
127%D Since we are no longer swapping windows, we end up with a much simplier \type
128%D {\Stopidea} macro. We don't reset samples at the inner level.
129
130\unexpanded\def\StartIdea
131  {\bgroup
132   \let\StopSample \relax
133   \let\StopText   \relax
134   \let\StopSubText\relax
135   \def\StartSample{\dostartbuffer[sample][StartSample][StopSample]}}
136
137\unexpanded\def\StopIdea
138  {\startstandardmakeup
139     \DoSampleText{sample}{sample}{nextpage}
140     \SetTextWidth
141     \DoSampleText{text}  {text}  {nextpage}
142   \stopstandardmakeup
143   \egroup}
144
145%D Here we determine the width of the text window. It is derived from the width of
146%D the sample and stays the same within a sequence.
147
148\unexpanded\def\SetTextWidth
149  {\ifnum\TextN<1 % yes or no, may change
150     \scratchdimen=\makeupwidth
151     \advance\scratchdimen by -\SampleTextWidth
152     \advance\scratchdimen by  \FrameSkip
153     \xdef\SampleWidth{\the\scratchdimen}%
154   \fi
155   \setupframedtexts
156     [SampleText]
157     [width=\SampleWidth]}
158
159%D We use the (already implemented) second alternative of the titlepage graphic.
160%D Please don't change this.
161
162\defineoverlay[joke] [\useMPgraphic{joke}{n=1}] % not to be changed !
163
164\stopmodule
165
166\continueifinputfile{s-present-grow.mkiv}
167
168\usemodule[present-common]
169
170\inputpresentationfile{examples/present-grow-001.tex}
171
172