summaryrefslogtreecommitdiff
path: root/macros/context/contrib/context-simpleslides/tex/context/third/simpleslides/s-simpleslides-Swoosh.tex
blob: 9ea77624a988203b723161a6f04f997c5da478e9 (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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
%D \module
%D   [      file=simpleslides-s-Swoosh,
%D        version=2009.03.30
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Module -- Swoosh Style,
%D         author=Aditya Mahajan and Thomas A. Schmitz,
%D           date=\currentdate,
%D      copyright={Aditya Mahajan and Thomas A. Schmitz}]
%C
%C Copyright 2009 Aditya Mahajan and Thomas A. Schmitz
%C This file may be distributed under the GNU General Public License v. 2.0.

%D This file provides the \quotation{Swoosh} style for the presentation
%D module. It is loaded at runtime.

\writestatus{simpleslides}{loading Swoosh style}

\startmodule[simpleslides-s-Swoosh]

\unprotect

%D The "counter" parameter controls which kind of counter will be used:

\startsetups simpleslides:setup:randomizeyes
\startuseMPgraphic{simpleslides:MP:randomize}
if condition = 1:
  qw := qw shifted (-5pt - c*0.1*uniformdeviate(10), 0) ; 
elseif condition = 2:
  qw := qw shifted (0, c*0.1*uniformdeviate(10)) ; 
fi ;
\stopuseMPgraphic
\stopsetups

\startsetups simpleslides:setups:dot
\setuplayout [simpleslides:layout:horizontal][header=3cm,footer=0cm]
\startuseMPgraphic{simpleslides:MP:counter}
if NOfPages > 1:
  numeric prog ; prog = PageNumber/NOfPages - 0.005 ;
fi ;
if PageNumber > 1:
  if condition = 1:
    z11 = (prog * PaperWidth, PaperHeight) ;
    z12 = (x11, 0) ;
    z13 = (z11 -- z12) intersectionpoint qw ;
    draw z13 withcolor \MPcolor{simpleslides:altcontrastcolor} ;
  elseif condition = 2:
    z14 = (0, (PaperHeight - prog * PaperHeight)) ;
    z15 = (PaperWidth, y14) ;
    z16 = (z14 -- z15) intersectionpoint qw ;
    draw z16 withcolor \MPcolor{simpleslides:altcontrastcolor} ;
  fi ;
fi ;
\stopuseMPgraphic
\stopsetups

\startsetups simpleslides:setups:circle
\setuplayout [simpleslides:layout:horizontal][header=3cm]
\startuseMPgraphic{simpleslides:MP:counter}
save b, s, t, p, circcenter, theta, pic ;
path p[] ;
pair t[] ;
pair s[] ;
pair circcenter ; circcenter = lrcorner Page shifted (-1cm, 1cm) ;
pair zt, zr, zb, zl ;
picture pic ;
b = 1.5cm ;
if PageNumber > 1:
	theta = (PageNumber - 1)/(NOfPages - 1) ;
 	p[4] = fullcircle scaled b rotated 90 ;
	p[4] := p[4] shifted circcenter ;
 	fill p[4] withcolor \MPcolor{simpleslides:altcontrastcolor} ;
 	t[0] = center p[4] ;
 	t[1] = point 1 along p[4] ;
 	t[2] = point -theta along p[4] ;
 	t[3] = point -theta/2 along p[4] ;
 	p[5] = t[0] -- t[1] .. t[3] .. t[2] -- cycle ;
 	fill p[5] withcolor \MPcolor{simpleslides:contrastcolor} ;
 	for i = 1 upto NOfPages :
 		s[i] = point i/(NOfPages -1) along p[4] ;
 		pickup pencircle scaled 1pt ;
 		draw s[i] -- t[0] withcolor \MPcolor{simpleslides:backgroundcolor} ;
 	endfor ;
 	zt = t[0] shifted (0, b * 0.2) ;
	zr = t[0] shifted (b * 0.2, 0) ;
	zb = t[0] shifted (0, -b * 0.2) ;
	zl = t[0] shifted (-b * 0.2, 0) ;
	p[3] = zt .. zr .. zb .. zl .. cycle ;
 	fill p[3] withcolor  \MPcolor{simpleslides:contrastcolor} ;
 	draw p[3] withcolor \MPcolor{simpleslides:backgroundcolor} ;
 	label(textext("\switchtobodyfont[10pt]\startcolor[simpleslides:backgroundcolor]\pagenumber\stopcolor"),center p[3]) ;
fi ;
\stopuseMPgraphic 
\stopsetups

\doifsetupselse{simpleslides:setups:\moduleparameter{simpleslides}{counter}}
    {\setups{simpleslides:setups:\moduleparameter{simpleslides}{counter}}}
    {\setups{simpleslides:setups:circle}}

\doif%
  {\moduleparameter{simpleslides}{randomize}}
  {yes}
  {\setups{simpleslides:setup:randomizeyes}}

%D First we change the page layout, adding more space on the top.

\setuplayout [width=fit,
              margin=0cm,
              height=fit,
              header=3cm, 
              footer=0.8cm, 
              topspace=.6cm, 
              backspace=1cm,
              location=singlesided]

\setuplayout [simpleslides:layout:vertical]  [header=0.8cm]
\setuplayout [simpleslides:layout:title]     [header=0.8cm]

%D We also specify the position of the slidetitle.

\setuplayer[simpleslides:layer:slidetitle]
    [x=10mm,y=2mm]

\setupcombinations[distance=1.85cm]

%D These macros are used for placing figures/pictures:

\define\NormalHeight        {\textheight}
\define\NormalWidth         {.45\textwidth}
\define\PictureFrameHeight  {\textheight}
\define\PictureFrameWidth   {.45\textwidth}

\defineframed[simpleslides:framed]
             [frame=off,offset=0pt,
              top=\vss,bottom=\vss]

%D We define our color scheme:

\definecolor [simpleslides:backgroundcolor]     [r=.88,g=.92,b=.95]
\definecolor [simpleslides:contrastcolor]	[r=.4,g=.6,b=.8]
\definecolor [simpleslides:altcontrastcolor]	[r=.1,g=.1,b=.4]
\definecolor [simpleslides:itemize:color]       [simpleslides:contrastcolor]
\definecolor [simpleslides:textcolor]  		[simpleslides:altcontrastcolor] 

\setupcolors[textcolor=simpleslides:textcolor]

%D We use \METAPOST\ to draw backgrounds.

\startuseMPgraphic{simpleslides:MP:horizontal} 
StartPage ;
fill Page withcolor \MPcolor{simpleslides:backgroundcolor} ;
numeric c ; c = PaperWidth * 0.4 ;
numeric d ; d = 2.2cm ;
numeric e ; e = PaperWidth / 46.9 ;
numeric condition ; condition = 1 ;
save ql, qr, qt, qw, qnw, qc ; path ql, qr, qt, qw, qnw, qc ;
ql = ulcorner Page -- llcorner Page ;
qr = lrcorner Page -- urcorner Page ;
qt = urcorner Page -- ulcorner Page ;
pickup pencircle scaled 4pt ;
z1 = ulcorner Page ;
z2 = (x1, y1 - d - 2*e) ;
z3 = (x1 + 4pt, y2) ;
z4 = (x3 + c, y2 + 2*e) ;
z5 = (x4 + c, y2) ;
z6 = (x5 + c, y2 + 2*e) ;
z7 = (x6 + c, y2) ;
z8 = (x7, y1) ;
qw = z2 .. z3 .. z4 .. z5 .. z6 .. z7 ;
\includeMPgraphic{simpleslides:MP:randomize} ;
z9 = ql intersectionpoint qw ;
z10 = qr intersectionpoint qw ;
qw := qw cutbefore z9 cutafter z10 ;
fill qr & qt & ql -- qw -- cycle withcolor \MPcolor{simpleslides:contrastcolor} ; 
draw qw withcolor white ;
\includeMPgraphic{simpleslides:MP:counter} ;
StopPage ;
\stopuseMPgraphic 

\startuseMPgraphic{simpleslides:MP:vertical} 
StartPage ;
fill Page withcolor \MPcolor{simpleslides:backgroundcolor} ;
numeric c ; c = PaperHeight * 0.4 ;
numeric d ; d = 2.2cm ;
numeric e ; e = PaperHeight / 46.9 ;
if NOfPages > 1:
  numeric prog ; prog = PageNumber/NOfPages - 0.005 ;
fi ;
numeric condition ; condition = 2 ;
save ql, qr, qt, qw, qc, qu, qb ; path ql, qr, qt, qw, qc, qu, qb ;
pickup pencircle scaled 4pt ;
z1 = ulcorner Page ;
z3 = center Page ;
z4 = (x3 - 2*e, y1) ;
z6 = (x3 + 2*e, y4 - c) ;
z7 = (x3 - 2*e, y6 - c) ;
z8 = (x3 + 2*e, y7 - c) ;
z9 = (x3 - 2*e, y8 - c) ;
qw = z4 .. z6 .. z7 .. z8 .. z9 ;
qt = ulcorner Page -- urcorner Page ;
ql = llcorner Page -- ulcorner Page ;
qb = llcorner Page -- lrcorner Page ;
\includeMPgraphic{simpleslides:MP:randomize} ;
z10 = qt intersectionpoint qw ;
qu = ulcorner Page -- z10 ;
z11 = qb intersectionpoint qw ;
qr = z11 -- llcorner Page ;
qw := qw cutbefore z10 cutafter z11 ;
fill qw -- qr & ql & qu -- cycle withcolor \MPcolor{simpleslides:contrastcolor} ;
draw qw withcolor white ;
\includeMPgraphic{simpleslides:MP:counter} ;
StopPage ;
\stopuseMPgraphic 

%D We define these backgrounds as overlays:

\defineoverlay 
  [simpleslides:background:title] 
  [\useMPgraphic{simpleslides:MP:horizontal}] 

\defineoverlay 
  [simpleslides:background:horizontal] 
  [\useMPgraphic{simpleslides:MP:horizontal}] 

\defineoverlay 
  [simpleslides:background:vertical] 
  [\useMPgraphic{simpleslides:MP:vertical}] 

\defineoverlay
  [simpleslides:background:ornament]
  [\useMPgraphic{simpleslides:MP:ornament}]

\setupTitle
  [\c!headcolor={simpleslides:altcontrastcolor}]

%D We want the title to placed in a framed box. We redefine all the keys of
%D \type{\setupTitle}, so that the module is easier to maintain.

\setupSlideTitle
  [\c!alternative=layer,
   \c!color=white,
   \c!align=\v!center,
   \c!width=\textwidth,
   \c!height=2cm,
   \c!after=]


\setupTitle
  [\c!title=,
   \c!author=,
   \c!date=\currentdate,
   \c!headstyle=,
   \c!headcolor={simpleslides:altcontrastcolor},
   \c!align=\v!middle,
   \c!before=\vfill,
   \c!after=\vfill,
   \c!title\c!style={\switchtobodyfont[\TitleSize]},
   \c!title\c!color=simpleslides:altcontrastcolor,
   \c!title\c!align=\v!middle,
   \c!author\c!style=,
   \c!author\c!color=simpleslides:altcontrastcolor,
   \c!author\c!align=\v!middle, 
   \c!date\c!style=,
   \c!date\c!color=simpleslides:altcontrastcolor,
   \c!date\c!align=\v!middle,
   \c!before\c!title=,
   \c!before\c!author=,
   \c!before\c!date=,
   \c!after\c!title={\blank[1*line]},
   \c!after\c!author={\blank[2*line]},
   \c!after\c!date=]

% 
% %D We want the title to be of a specific height
% 
% \setuphead[SlideTitle]
%    [\c!after=,
%     \c!alternative=\v!text,
%     \c!color=white,
%     \c!command=\doSlideTitle]
% 
% \define[2]\doSlideTitle
%   {\setlayer[simpleslides:layer:slidetitle]%
%      {\getvalue{simpleslides:framed}[\c!width=\textwidth,\c!height=1.1cm,
%                 \c!align=\v!right]
%                {#1#2}}} 

%D The symbol for the first level of itemizations. 

\definesymbol[1][\useMPgraphic{simpleslides:itemize:square}]
\setupitemize[1][color=simpleslides:itemize:color]

\protect
\stopmodule

\endinput