summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/third/taspresent/t-doubleframe.tex
blob: 1517fcdd0942bb382e6c35f7f5432b7c1e728a7a (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
%D \module
%D   [      file=t-doubleframe,
%D        version=2007.07.17, 
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Module doubleframe,
%D         author=Thomas A. Schmitz,
%D           date=\currentdate,
%D      copyright={Thomas A. Schmitz}]
%C
%C Copyright 2007 Thomas A. Schmitz.
%C This file may be distributed under the GNU General Public License v. 2.0.

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

\writestatus{loading}{module doubleframe}

\startmodule[doubleframe]

\unprotect

%D The taspresentation module provides a skeleton into which different styles
%D can be hooked. It uses a number of variables and macros which have to be set
%D beforehand. Some parts are optional. We begin with the necessary definitions:

%D We start colors:

\setupcolors[state=start]

%D The doubleframe module has parameters of its own; we set them up and use
%D them:

\setupmodule[bottom=square]

\processaction[\currentmoduleparameter{bottom}]
	[      square=>\def\bottommode{squaremode},
               stripe=>\def\bottommode{stripemode},
           \v!unknown=>\def\bottommode{squaremode},
           \v!default=>\def\bottommode{squaremode}]

\enablemode[\bottommode]

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

\define\NormalHeight{.98\textheight}
\define\NormalWidth{.485\textwidth}
\define\PictureFrameHeight{.98\textheight}
\define\PictureFrameWidth{.485\textwidth}

%D The page layout:

\setuplayout [width=fit,
              margin=0.6cm,
              height=fit, 
              header=2.1cm, 
              footer=1.35cm, 
	      footerdistance=0.5cm,
              topspace=0.5cm, 
              backspace=1cm,
              location=singlesided]

%D The macro for typesetting the Slidetitle; this is adapted from a sample
%D document that Brooks Moses published on the wiki:

\definelayer[slidetitle]
    [width=\paperwidth,
    height=\paperheight,
    x=10mm,
    y=3mm]

\define[1]\Slidetitle{\page\setlayer[slidetitle]%
     {\framed[frame=off,width=\textwidth,height=2.1cm,offset=0pt,top=\vss,bottom=\vss]{\switchtobodyfont[\Titlesize]\color[One]{#1}}}}

%D The macro \tex{Maketitle} produces a default title page with the author, the
%D title of the presentation, and the date. Using it is not mandatory.

\define\Maketitle{%
\titback
\switchtobodyfont[\Titlesize]
\null
\vfill
\midaligned{\color[One]{\getvariable{taspresent}{title}}}
\blank[2*line]
\midaligned{\tfx\getvariable{taspresent}{author}}
\blank[line]
\midaligned{\tfx\currentdate}
\vfill
\null\switchtobodyfont[\Normalsize]}

%D The following parts are optional; if you don't use backgrounds and are
%D content with CONTEXT's default itemization, you don't have to set these
%D macros. 

%D We define our colors:

\definecolor [BackgroundColor] [r=.85, g=.85, b=.85]
\definecolor [MyFrameColor]    [r=.42, g=.42, b=.7]
\definecolor [Dark]            [r=.9, g=.9, b=.9]
\definecolor [One]             [r=0, g=0, b=.5]
\definecolor [Two]             [r=0, g=0, b=.55]
\definecolor [Three]           [r=0, g=0, b=.6]
\definecolor [Four]            [r=0, g=0, b=.65]
\definecolor [Five]            [r=0, g=0, b=.7]
\definecolor [Six]             [r=0, g=0, b=.75]
\definecolor [Seven]           [r=0, g=0, b=.8]
\definecolor [Eight]           [r=0, g=0, b=.85]
\definecolor [Nine]            [r=0, g=0, b=.9]
\definecolor [Ten]             [r=0, g=0, b=.95]
\definecolor [Eleven]          [r=0, g=0, b=1]
\definecolor [Item]            [One]

%D We let Metapost calculate the background:

\startmode[squaremode]
\startuseMPgraphic{Bottom09} 
StartPage
numeric a; a = 0.955cm ;
numeric b; b = 0.52cm ;
numeric c; c = 0.8cm ;
path p[] ;
p[2] = unitsquare xyscaled (a,a) shifted (b, c) ;
p[3] = unitsquare xyscaled (a,a) shifted (b+2*a, c) ;
p[4] = unitsquare xyscaled (a,a) shifted (b+4*a, c) ;
p[5] = unitsquare xyscaled (a,a) shifted (b+6*a, c) ;
p[6] = unitsquare xyscaled (a,a) shifted (b+8*a, c) ;
p[7] = unitsquare xyscaled (a,a) shifted (b+10*a, c) ;
p[8] = unitsquare xyscaled (a,a) shifted (b+12*a, c) ;
p[9] = unitsquare xyscaled (a,a) shifted (b+14*a, c) ;
p[10] = unitsquare xyscaled (a,a) shifted (b+16*a, c) ;
p[11] = unitsquare xyscaled (a,a) shifted (b+18*a, c) ;
p[12] = unitsquare xyscaled (a,a) shifted (b+20*a, c) ;
fill p[2] withcolor \MPcolor{One} ;
fill p[3] withcolor \MPcolor{Two} ;
fill p[4] withcolor \MPcolor{Three} ;
fill p[5] withcolor \MPcolor{Four} ;
fill p[6] withcolor \MPcolor{Five} ;
fill p[7] withcolor \MPcolor{Six} ;
fill p[8] withcolor \MPcolor{Seven} ;
fill p[9] withcolor \MPcolor{Eight} ;
fill p[10] withcolor \MPcolor{Nine} ;
fill p[11] withcolor \MPcolor{Ten} ;
fill p[12] withcolor \MPcolor{Eleven} ;
pickup pencircle scaled 2pt ;
if NOfPages = 12:
	for j=2 upto 12:
		if PageNumber=(j):
		draw llcorner p[j] --urcorner p[j] withcolor \MPcolor{BackgroundColor} ;
		fi ;
	endfor ;
fi ;
numeric o; o = NOfPages - 1 ;
numeric i; i = PageNumber - 1 ;
numeric k; k = i/o ;
if NOfPages > 12:
	if i = 1:
		draw llcorner p[2] -- urcorner p[2] withcolor \MPcolor{BackgroundColor} ;
	elseif (k>0.01) and (k<=2/11):
		draw llcorner p[3] -- urcorner p[3] withcolor \MPcolor{BackgroundColor} ;
	elseif (k>2/11) and (k<=3/11):
		draw llcorner p[4] -- urcorner p[4] withcolor \MPcolor{BackgroundColor} ;
	elseif (k>3/11) and (k<=4/11):
		draw llcorner p[5] -- urcorner p[5] withcolor \MPcolor{BackgroundColor} ;
	elseif (k>4/11) and (k<=5/11):
		draw llcorner p[6] -- urcorner p[6] withcolor \MPcolor{BackgroundColor} ;
	elseif (k>5/111) and (k<6/11):
		draw llcorner p[7] -- urcorner p[7] withcolor \MPcolor{BackgroundColor} ;
	elseif (k>6/11) and (k<=7/11):
		draw llcorner p[8] -- urcorner p[8] withcolor \MPcolor{BackgroundColor} ;
	elseif (k>7/11) and (k<=8/11):
		draw llcorner p[9] -- urcorner p[9] withcolor \MPcolor{BackgroundColor} ;
	elseif (k>8/11) and (k<=9/11):
		draw llcorner p[10] -- urcorner p[10] withcolor \MPcolor{BackgroundColor} ;
	elseif (k>9/11) and (k<1):
		draw llcorner p[11] -- urcorner p[11] withcolor \MPcolor{BackgroundColor} ;
	elseif k=1:
		draw llcorner p[12] -- urcorner p[12] withcolor \MPcolor{BackgroundColor} ;
	fi ;
fi
StopPage
\stopuseMPgraphic 
\stopmode

\startmode[stripemode]
\startuseMPgraphic{Bottom09}
StartPage
path p[] ;
p[1] := unitsquare xyscaled(0.95*OverlayWidth,1cm) shifted (0.52cm,0.8cm) ;
linear_shade(p[1],0,\MPcolor{BackgroundColor},\MPcolor{One}) ;
numeric i; i = PageNumber/NOfPages ;
p[2] = ulcorner p[1] -- urcorner p[1] ;
p[3] = llcorner p[1] -- lrcorner p[1] ;
pair o[] ;
o[1] := point i along p[2] ;
o[2] := point i along p[3] ;
p[4] = ulcorner p[1] -- o[1] -- o[2] -- llcorner p[1] -- cycle ;
clip currentpicture to p[4] ;
StopPage
\stopuseMPgraphic
\stopmode

\startuniqueMPgraphic{PicBackground09} 
StartPage ;
fill Page withcolor \MPcolor{BackgroundColor} ; 
draw unitsquare 
xyscaled(OverlayWidth,OverlayHeight) 
enlarged (-.2cm) 
withpen pencircle scaled 4pt 
withcolor \MPcolor{MyFrameColor} ; 
draw unitsquare 
xyscaled(0.448*OverlayWidth,0.815*OverlayHeight) 
shifted (0.528*OverlayWidth, 0.15*OverlayHeight)
withpen pencircle scaled 2pt 
withcolor \MPcolor{MyFrameColor} ; 
StopPage ;
\stopuniqueMPgraphic 

\startuniqueMPgraphic{Background09} 
fill unitsquare 
xyscaled(OverlayWidth,OverlayHeight) 
withcolor \MPcolor{BackgroundColor} ; 
draw unitsquare 
xyscaled(OverlayWidth,OverlayHeight) 
enlarged (-.2cm) 
withpen pencircle scaled 4pt 
withcolor \MPcolor{MyFrameColor} ; 
draw unitsquare 
xyscaled(0.95*OverlayWidth,0.7*OverlayHeight) 
shifted (0.025*OverlayWidth, 0.15*OverlayHeight)
withpen pencircle scaled 2pt 
withcolor \MPcolor{MyFrameColor} ; 
\stopuniqueMPgraphic 

\startuniqueMPgraphic{FancyFrame}
draw unitsquare xyscaled(OverlayWidth-2pt,OverlayHeight-2pt)
withpen pencircle scaled 2pt
withcolor \MPcolor{MyFrameColor} ;
\stopuniqueMPgraphic

%D We define these backgrounds as overlays:

\defineoverlay
[bottom]
[\useMPgraphic{Bottom09}]

\defineoverlay 
[lecbackground] 
[\useMPgraphic{Background09}] 

\defineoverlay 
[picbackground] 
[\useMPgraphic{PicBackground09}] 

\defineoverlay
[FrameFrame]
[\uniqueMPgraphic{FancyFrame}]

%D These are shortcuts to switch backgrounds:

\define\lecback{\setupbackgrounds[page][background={lecbackground,bottom,slidetitle}]\setuplayout[backspace=1cm,header=2.1cm]}
\define\titback{\setupbackgrounds[page][background=lecbackground]\setuplayout[backspace=1cm]}
\define\picback{\setupbackgrounds[page][background={picbackground,bottom}]\setuplayout[backspace=0.5cm,header=0cm]}
\define\noback{\setupbackgrounds[page][background=nobackground]}

%D We use combinations for placing vertical pictures and text side by side, and
%D we want a distance of 1.1 cm between both.

\setupcombinations[distance=1.1cm]

%D The symbol for the first level of itemizations. 

\definesymbol[1][\useMPgraphic{ItSquare}]
\setupitemize[color=One]

\protect
\stopmodule

\endinput