s-present-balls.mkiv /size: 5422 b    last modification: 2021-10-28 13:51
1%D \module
2%D   [      file=s-present-balls, % s-pre-15,
3%D        version=1999.09.01,
4%D          title=\CONTEXT\ Style File,
5%D       subtitle=Presentation Environment Balls,
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\startmodule[present-balls]
15
16%D This is one of the styles I made for the presentation on the \NTS\ project at
17%D Euro\TeX\ 1998. You need balls to let \TEX\ typeset graphics, but this style
18%D demonstrates that it can be done.
19%D
20%D This presentation is meant for presentations that build up an idea stepwise.
21%D
22%D \starttyping
23%D \TitlePage{Do you know \TEX ?}
24%D
25%D \StartIdea
26%D   \StartItem We use \TEX\ for typesetting       \unknown \StopItem
27%D   \StartItem mathematical text                  \unknown \StopItem
28%D   \StartItem but also for text that has no math \unknown \StopItem
29%D   \StartItem or presentations like this         \unknown \StopItem
30%D   \StartItem and whatever you can come up with!          \StopItem
31%D \StopIdea
32%D \stoptyping
33%D
34%D The basic layout is rather simple and used as much of the screen as possible.
35
36\setuppapersize
37  [S6][S6]
38
39\setuplayout
40  [backspace=25pt,
41   topspace=25pt,
42   width=middle,
43   height=middle,
44   header=0pt,
45   footer=0pt]
46
47\setupinteraction
48  [state=start,
49   display=new,
50   color=LineColor,
51   contrastcolor=LineColor,
52   click=no]
53
54\setupinteractionscreen
55  [option=max]
56
57\startmode[asintended,atpragma] \setupbodyfont[lucidaot] \stopmode
58
59\setupbodyfont[14.4pt]
60
61%D We use a lot of color. You can remap them if you want different ones. The ideas
62%D circulate over the colors.
63
64\definecolor[TextColor][s=.8]
65\definecolor[PageColor][s=.6]
66\definecolor[LineColor][s=.4]
67
68\definecolor[red]  [r=.4]        \definecolor[cyan]   [g=.4,b=.4]
69\definecolor[green][g=.4]        \definecolor[magenta][r=.4,b=.4]
70\definecolor[blue] [b=.4]        \definecolor[yellow] [r=.4,g=.4]
71
72\definecolor[linecolor 1][red]   \definecolor[linecolor 5][cyan]
73\definecolor[linecolor 2][green] \definecolor[linecolor 6][magenta]
74\definecolor[linecolor 3][blue]  \definecolor[linecolor 4][yellow]
75
76%D We use variables to make sure that the graphics are reused but unique.
77
78\setupMPvariables[pageframe][pagecolor=PageColor,linecolor=LineColor]
79\setupMPvariables[textframe][textcolor=TextColor,linecolor=LineColor]
80
81\setupbackgrounds
82  [page]
83  [background={pageframe,nextpage}]
84
85\defineoverlay [pageframe] [\uniqueMPgraphic{pageframe}]
86\defineoverlay [textframe] [\uniqueMPgraphic{textframe}]
87\defineoverlay [nextpage]  [\overlaybutton{forward}]
88
89\startuniqueMPgraphic{pageframe}{pagecolor,linecolor}
90    path p ; p := fullsquare xyscaled (OverlayWidth,OverlayHeight) ;
91    pickup pencircle scaled 10pt ;
92    fill p withcolor \MPvar{pagecolor} ;
93    draw p withcolor \MPvar{linecolor} ;
94\stopuniqueMPgraphic
95
96\startuniqueMPgraphic{textframe}{textcolor,linecolor}
97    path p ; p := fullcircle xyscaled (OverlayWidth,OverlayHeight) ;
98    pickup pencircle scaled 10pt ;
99    fill p withcolor \MPvar{textcolor} ;
100    draw p withcolor \MPvar{linecolor} ;
101\stopuniqueMPgraphic
102
103%D The rest of the file implements the nasty part: typesetting text embedded in a
104%D graphic. The text is collected in a box so that we can reuse it.
105
106\newbox  \CollectedIdeas
107\newcount\CurrentTopic
108
109\unexpanded\def\StartItem
110  {\setbox\CollectedIdeas=\hbox\bgroup
111     \ifdim\wd\CollectedIdeas>\zeropoint
112        \unhbox\CollectedIdeas
113        \hskip25pt
114     \fi
115     \setbox\scratchbox=\hbox\bgroup
116       \framed
117         [width=160pt,
118          height=160pt,
119          align=middle,
120          frame=off,
121          background=textframe,
122          offset=15pt,
123          top=\vfill,
124          bottom=\vfill]
125        \bgroup}
126
127\unexpanded\def\StopItem
128  {\egroup
129   \egroup
130   \setbox\scratchbox=\hbox{\lower.5\ht\scratchbox\box\scratchbox}%
131   \ht\scratchbox=.5\ht\scratchbox
132   \dp\scratchbox=  \ht\scratchbox
133   \box\scratchbox
134   \egroup
135   \startstandardmakeup
136     \dontcomplain
137     \leftskip       0pt plus 50pt
138     \rightskip      0pt plus 50pt
139     \parfillskip    0pt
140     \baselineskip 100pt
141     \unhcopy\CollectedIdeas
142   \stopstandardmakeup}
143
144\unexpanded\def\StartIdea
145  {\ifnum\CurrentTopic=6
146     \global\CurrentTopic\plusone
147   \else
148     \global\advance\CurrentTopic\plusone
149   \fi
150   \definecolor[LineColor][linecolor \number\CurrentTopic]
151   \setbox\CollectedIdeas\null}
152
153\unexpanded\def\StopIdea
154  {}
155
156\unexpanded\def\StartTitlePage
157  {\startstandardmakeup
158   \setupalign[middle]
159   \enforced\protected\def\\{\vfil\bfb\setupinterlinespace}
160   \bfd\setupinterlinespace
161   \vfil}
162
163\unexpanded\def\StopTitlePage
164  {\vfil\vfil
165   \stopstandardmakeup}
166
167\unexpanded\def\TitlePage#1%
168  {\StartTitlePage#1\StopTitlePage}
169
170\startsetups document:start
171    \StartTitlePage
172        \documentvariable{title}
173        \doifsomething {\documentvariable{subtitle}} {
174            \\
175            \documentvariable{subtitle}
176        }
177        \doifsomething {\documentvariable{location}} {
178            \\
179            \documentvariable{location}
180        }
181    \StopTitlePage
182\stopsetups
183
184\startsetups document:stop
185    %
186\stopsetups
187
188\stopmodule
189
190\continueifinputfile{s-present-balls.mkiv}
191
192\usemodule[present-common]
193
194\inputpresentationfile{examples/present-balls-001.tex}
195