summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv/s-present-balls.mkiv
blob: 6774b83407f54463856ee0e98ff59e38aa4fe56a (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
%D \module
%D   [      file=s-present-balls, % s-pre-15,
%D        version=1999.09.01,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Environment Balls,
%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.

\startmodule[present-balls]

%D This is one of the styles I made for the presentation on the \NTS\ project at
%D Euro\TeX\ 1998. You need balls to let \TEX\ typeset graphics, but this style
%D demonstrates that it can be done.
%D
%D This presentation is meant for presentations that build up an idea stepwise.
%D
%D \starttyping
%D \TitlePage{Do you know \TEX ?}
%D
%D \StartIdea
%D   \StartItem We use \TEX\ for typesetting       \unknown \StopItem
%D   \StartItem mathematical text                  \unknown \StopItem
%D   \StartItem but also for text that has no math \unknown \StopItem
%D   \StartItem or presentations like this         \unknown \StopItem
%D   \StartItem and whatever you can come up with!          \StopItem
%D \StopIdea
%D \stoptyping
%D
%D The basic layout is rather simple and used as much of the screen as possible.

\setuppapersize
  [S6][S6]

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

\setupinteraction
  [state=start,
   display=new,
   color=LineColor,
   contrastcolor=LineColor,
   click=no]

\setupinteractionscreen
  [option=max]

\startmode[asintended,atpragma] \setupbodyfont[lucidaot] \stopmode

\setupbodyfont[14.4pt]

%D We use a lot of color. You can remap them if you want different ones. The ideas
%D circulate over the colors.

\definecolor[TextColor][s=.8]
\definecolor[PageColor][s=.6]
\definecolor[LineColor][s=.4]

\definecolor[red]  [r=.4]        \definecolor[cyan]   [g=.4,b=.4]
\definecolor[green][g=.4]        \definecolor[magenta][r=.4,b=.4]
\definecolor[blue] [b=.4]        \definecolor[yellow] [r=.4,g=.4]

\definecolor[linecolor 1][red]   \definecolor[linecolor 5][cyan]
\definecolor[linecolor 2][green] \definecolor[linecolor 6][magenta]
\definecolor[linecolor 3][blue]  \definecolor[linecolor 4][yellow]

%D We use variables to make sure that the graphics are reused but unique.

\setupMPvariables[pageframe][pagecolor=PageColor,linecolor=LineColor]
\setupMPvariables[textframe][textcolor=TextColor,linecolor=LineColor]

\setupbackgrounds
  [page]
  [background={pageframe,nextpage}]

\defineoverlay [pageframe] [\uniqueMPgraphic{pageframe}]
\defineoverlay [textframe] [\uniqueMPgraphic{textframe}]
\defineoverlay [nextpage]  [\overlaybutton{forward}]

\startuniqueMPgraphic{pageframe}{pagecolor,linecolor}
    path p ; p := fullsquare xyscaled (OverlayWidth,OverlayHeight) ;
    pickup pencircle scaled 10pt ;
    fill p withcolor \MPvar{pagecolor} ;
    draw p withcolor \MPvar{linecolor} ;
\stopuniqueMPgraphic

\startuniqueMPgraphic{textframe}{textcolor,linecolor}
    path p ; p := fullcircle xyscaled (OverlayWidth,OverlayHeight) ;
    pickup pencircle scaled 10pt ;
    fill p withcolor \MPvar{textcolor} ;
    draw p withcolor \MPvar{linecolor} ;
\stopuniqueMPgraphic

%D The rest of the file implements the nasty part: typesetting text embedded in a
%D graphic. The text is collected in a box so that we can reuse it.

\newbox  \CollectedIdeas
\newcount\CurrentTopic

\unexpanded\def\StartItem
  {\setbox\CollectedIdeas=\hbox\bgroup
     \ifdim\wd\CollectedIdeas>\zeropoint
        \unhbox\CollectedIdeas
        \hskip25pt
     \fi
     \setbox\scratchbox=\hbox\bgroup
       \framed
         [width=160pt,
          height=160pt,
          align=middle,
          frame=off,
          background=textframe,
          offset=15pt,
          top=\vfill,
          bottom=\vfill]
        \bgroup}

\unexpanded\def\StopItem
  {\egroup
   \egroup
   \setbox\scratchbox=\hbox{\lower.5\ht\scratchbox\box\scratchbox}%
   \ht\scratchbox=.5\ht\scratchbox
   \dp\scratchbox=  \ht\scratchbox
   \box\scratchbox
   \egroup
   \startstandardmakeup
     \dontcomplain
     \leftskip       0pt plus 50pt
     \rightskip      0pt plus 50pt
     \parfillskip    0pt
     \baselineskip 100pt
     \unhcopy\CollectedIdeas
   \stopstandardmakeup}

\unexpanded\def\StartIdea
  {\ifnum\CurrentTopic=6
     \global\CurrentTopic\plusone
   \else
     \global\advance\CurrentTopic\plusone
   \fi
   \definecolor[LineColor][linecolor \number\CurrentTopic]
   \setbox\CollectedIdeas\null}

\unexpanded\def\StopIdea
  {}

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

\unexpanded\def\StopTitlePage
  {\vfil\vfil
   \stopstandardmakeup}

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

\startsetups document:start
    \StartTitlePage
        \documentvariable{title}
        \doifsomething {\documentvariable{subtitle}} {
            \\
            \documentvariable{subtitle}
        }
        \doifsomething {\documentvariable{location}} {
            \\
            \documentvariable{location}
        }
    \StopTitlePage
\stopsetups

\startsetups document:stop
    %
\stopsetups

\stopmodule

\continueifinputfile{s-present-balls.mkiv}

\usemodule[present-common]

\inputpresentationfile{examples/present-balls-001.tex}