summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkii/s-pre-03.mkii
blob: 19a11d24e5dd7c89bb4fb633b6c3eceae9a021c6 (plain)
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
%D \module
%D   [      file=s-pre-03,
%D        version=1998.09.06,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Environment 3,
%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.

%D This is the third environment for typesetting interactive
%D presentations. I used this style for a talk on \TEX\ and
%D \JAVASCRIPT\ at \TUG98, mainly because I didn't want to
%D use the same style three times. Therefore this is a rather
%D simple, silly style.

\usemodule[pre-general]

%D \macros
%D  {setupbodyfont}
%D
%D We use a large bodyfont. Combined with the fancy
%D background, this does not leave that much room for text, but
%D presentations should use much text anyway.

\startmode[asintended] \setupbodyfont[lbr] \stopmode

\setupbodyfont[14.4pt]

%D \macros
%D   {setuppapersize,setuplayout,setupinteractionscreen}
%D
%D The page dimensions are set to size \type {S6}, being
%D 600pt by 450pt. We use wide margins and discard headers
%D and footers. We also launch the document full screen.

\setuppapersize
  [S6][S6]

\setuplayout
  [width=middle,
   height=middle,
   topspace=75pt,
   backspace=100pt,
   header=0pt,
   footer=0pt]

\setupinteractionscreen
  [option=max]

%D \macros
%D   {setupcolors,definecolor}
%D
%D Next, color support is turned on and a dark red color is
%D defined. Other red shades will be derived from this one
%D color.

\setupcolors
  [state=start]

\definecolor [PageColor]       [black]
\definecolor [BackgroundColor] [s=.85]
\definecolor [OrnamentColor]   [r=.75]

%D \macros
%D   {setupinteraction}
%D
%D We turn on interaction mode and use the same color for
%D hyperlinks and redundant hyperlinks (the ones that point
%D to the current page).

\setupinteraction
  [state=start,
   contrastcolor=OrnamentColor,
   color=OrnamentColor]

%D \macros
%D   {defineoverlay, setupbackgrounds}
%D
%D The joke in this presentation is the elliptical shape of
%D which the bottom part includes a page indication.

\defineoverlay
  [PageShape][\useMPgraphic{PageShape}]

% \startuseMPgraphic{PageShape}
%   lin := 20pt ; off := .75lin ;
%   wid := \overlaywidth ; hei := \overlayheight ;
%   pos := \currentpage ; tot := \lastpage ;
%   path bb; bb := unitsquare xscaled wid yscaled hei ;
%   filldraw bb withcolor \MPcolor{PageColor} ;
%   pickup pencircle xscaled .5lin yscaled lin rotated 45 ;
%   pair r, t, l, b ;
%   r := (wid-off,.5hei) ; t := (.5wid,hei-off) ;
%   l := (off,.5hei) ; b := (.5wid,off) ;
%   path p; p := superellipse(r,t,l,b,.8) ;
%   fill p withcolor \MPcolor{Backgroundcolor} ;
%   draw p withcolor \MPcolor{OrnamentColor} ;
%   color contrastcolor ; contrastcolor = 2/3 * \MPcolor{OrnamentColor} ;
%   if (pos>0) and (tot>0):
%     pair pa ; pa := point 5 of p ;
%     pair pb ; pb := point 7 of p ;
%     draw pa withcolor contrastcolor ;
%     draw pb withcolor contrastcolor ;
%     len := 2/tot ;
%     pair pa ; pa := point (5+len*pos) of p ;
%     pair pb ; pb := point (5+len*(pos-1)) of p ;
%     p := p cutafter pa ;
%     p := p cutbefore pb ;
%     draw p withcolor contrastcolor ;
%   fi ;
%   setbounds currentpicture to bb ;
% \stopuseMPgraphic

\startuseMPgraphic{PageShape}
  StartPage ;
    path p ; pair pa, pb ; numeric len ; color contrastcolor ;
    fill Page withcolor \MPcolor {PageColor} ;
    pickup pencircle rotated 45 xscaled 10pt yscaled 20pt ;
    p := Page enlarged (-10pt,-15pt) superellipsed .8 ;
    p := p shifted (-1.5pt,0) ; % looks better
    fill p withcolor \MPcolor{BackgroundColor} ;
    draw p withcolor \MPcolor{OrnamentColor} ;
    contrastcolor = 2/3 * \MPcolor{OrnamentColor} ;
    if (PageNumber>0) and (NOfPages>0):
      draw point 5 of p withcolor contrastcolor ;
      draw point 7 of p withcolor contrastcolor ;
      len := 2/NOfPages ;
      pa := point (5+len*PageNumber) of p ;
      pb := point (5+len*(PageNumber-1)) of p ;
      draw (p cutafter pa) cutbefore pb
        withcolor contrastcolor ;
    fi ;
  StopPage ;
\stopuseMPgraphic

%D We use the viewer provided feature to go to the previous or
%D next page.

\defineoverlay[PrevButton][\overlaybutton{PreviousPage}]
\defineoverlay[NextButton][\overlaybutton{NextPage}]

\setupbackgrounds
  [page]
  [background={PageShape,PrevButton}]

\setupbackgrounds
  [text][text]
  [background=NextButton]

% or using hard coded next/prev pages:
%
% \defineoverlay[PrevButton][\overlaybutton{previouspage}]
% \defineoverlay[NextButton][\overlaybutton{nextpage}]
%
% \setupbackgrounds[state=repeat]
% \setupbackground[text][text][background=NextButton]
%
% or simply (using an repeated layer):
%
% \setupbackground[text][background=NextButton]

%D \macros
%D   {definehead, setuphead}
%D
%D Like the other presentation styles, we use \type {\Topic}
%D instead of \type {\chapters}. This time we don't provide
%D an additional sectioning. So we have:
%D
%D \starttyping
%D \TitlePage{How nice}
%D
%D \Topics{This is about ...}
%D
%D \Topic{The first one}
%D
%D \Topic{Another one}
%D \stoptyping

\definehead [Topic] [chapter]
\definehead [Nopic] [title]

\setuphead
  [Topic,Nopic]
  [after={\blank[3*medium]},
   number=no,
   style=\tfb,
   page=yes,
   alternative=middle]

\setuplist
  [Topic]
  [alternative=g,
   interaction=all,
   before=,
   after=]

\def\Subject
  {\Topic}

%D The tables of contents is associated with \type
%D {\Topics}.

\def\Topics#1%
  {\Nopic[Topics]{#1}
   \placelist[Topic][criterium=all]}

\def\Subjects
  {}

%D Instead of \type {\TitlePage}, one can use the pair
%D \type {\StartTitlePage} -- \type {\StopTitlePage}:
%D
%D \starttyping
%D \StartTitlePage
%D A Self Made Title
%D \StopTitlePage
%D \stoptyping

\def\StartTitlePage%
  {\startstandardmakeup
   \bfd\setupinterlinespace
   \setupalign[middle]
   \vfil
   \def\\{\vfil\bfb\setupinterlinespace}}

\def\StopTitlePage%
  {\vfil\vfil\vfil
   \stopstandardmakeup}

\def\TitlePage#1%
  {\StartTitlePage#1\StopTitlePage}

\doifnotmode{demo}{\endinput}

%D The (rather silly) demo section.

\starttext

\TitlePage{Title Page\\pre-funny}

\Topics{Some Nice Quotes}

\Topic{A Few}

\Subject{Knuth} \input knuth
\Subject{Tufte} \input tufte

\Topic{Some More}

\Subject{Zapf}   \input zapf
\Subject{Bryson} \input bryson

\stoptext