summaryrefslogtreecommitdiff
path: root/tex/context/base/s-pre-71.mkii
blob: db65c8e28195831522a2f03afbb8422c85c8268e (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
% engine=luatex

%D \module
%D   [      file=s-pre-71,
%D        version=2008.08.05,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Environment 71,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%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 I might improve this module so consider it experimental.

% \enablemode[numbers]
% \enablemode[paper]

\usemodule[pre-60,abr-02]

\setupinteraction[state=start,click=off]

\definepapersize[wide][width=900pt,height=600pt]

\setuppapersize[wide][wide]

\setuplayout[page]

% \setupbodyfont[15pt]

\usetypescriptfile[type-hgz]
\usetypescript[palatino-informal]
\setupbodyfont[palatino-informal,15pt]

\setupsorting[logo][style=]

\startnotmode[paper]
    \setupbackgrounds[page][background=color,backgroundcolor=black]
\stopnotmode

\TransparencyHack

\definelayer[page][width=\paperwidth,height=\paperheight]

\definecolor[TopicColor-1][r=.3,g=.4,b=.5]
\definecolor[TopicColor-2][r=.3,g=.5,b=.4]
\definecolor[TopicColor-3][r=.4,g=.3,b=.5]
\definecolor[TopicColor-4][r=.4,g=.5,b=.3]
\definecolor[TopicColor-5][r=.5,g=.3,b=.4]
\definecolor[TopicColor-6][r=.5,g=.4,b=.3]
\definecolor[TopicColor-7][r=.35,g=.35,b=.6]
\definecolor[TopicColor-8][r=.6,g=.35,b=.35]
\definecolor[TopicColor-9][r=.35,g=.6,b=.35]

\definecolor[TopicColor-0][t=.5,a=1,s=.5]
\definecolor[TopicColor]  [s=1]

\setupcolors[state=start]
\setupcolors[textcolor=TopicColor]

\startluacode
    local locations = {
        'lefttop',
        'middletop',
        'righttop',
        'middleleft',
        'middle',
        'middleright',
        'leftbottom',
        'middlebottom',
        'rightbottom',
    }
    local done, current, previous, n = table.tohash(locations,false), 0, 0, 0
    function document.reset_locations()
        done, current, previous, n = table.tohash(locations,false), 0, 0, 0
    end
    function document.next_location(loc)
        previous = current
        n = n + 1
        loc = loc and loc ~= "" and tonumber(loc)
        while true do
            current = loc or math.random(1,#locations)
            if not done[current] then
                done[current] = true
                break
            end
        end
    end
    function document.current_location()
        tex.print(locations[current] or "")
    end
    function document.previous_location()
        tex.print(locations[previous] or "")
    end
    function document.current_n()
        tex.print(tostring(current))
    end
    function document.previous_n()
        tex.print(tostring(previous))
    end
    function document.step()
        tex.print(tostring(n))
    end
\stopluacode

\def\StartTopics
  {\startstandardmakeup
   \ctxlua{document.reset_locations()}
   \doifnotmode{paper}{\StartLocalSteps}}

\def\StopTopics
  {\doifnotmode{paper}{\StopLocalSteps}
   \flushlayer[page]
   \stopstandardmakeup}

\def\StartTopic
  {\dosingleempty\doStartTopic}

\def\doStartTopic[#1]%
  {\doifnotmode{paper}{\NextStep}
   \ctxlua{document.next_location("#1")}
   \startnotmode[paper]
     \doifnothing{#1}
       {\ifcase\ctxlua{document.previous_n()}\else
          \setlayer
            [page]
            [preset=\ctxlua{document.previous_location()}]
             \bgroup
               \doifnotmode{paper}{\startproperty[\StepLayer]}%
               \framed
                 [offset=20pt,
                  strut=no,
                  align=normal,
                  frame=off,
                  height=\dimexpr\paperheight/3\relax,
                  width=\dimexpr\paperwidth/3\relax,
                  background=color,
                  backgroundcolor=TopicColor-0]
                 {}%
               \doifnotmode{paper}{\stopproperty}%
             \egroup
         \fi}
   \stopnotmode
   \setlayer
     [page]
     [preset=\ctxlua{document.current_location()}]
     \bgroup
       \doifnotmode{paper}{\startproperty[\StepLayer]}%
       \framed
         [offset=20pt,
          strut=no,
          align=\expdoifelse{#1}{}{normal}{middle,lohi},
          align=\expdoifelse{#1}{}{flushleft,verytolerant}{middle,lohi},
          frame=off,
          height=\dimexpr\paperheight/3\relax,
          width=\dimexpr\paperwidth/3\relax,
          background=color,
          backgroundcolor=TopicColor-\ctxlua{document.current_n()}]
         \bgroup
         \ignorespaces}

\def\StopTopic
  {\removeunwantedspaces
   \egroup
   \doifnotmode{paper}{\stopproperty}%
   \egroup
   \startmode[numbers]
   \setlayerframed
     [page]
     [preset=\ctxlua{document.current_location()}]
     [height=\dimexpr\paperheight/3\relax,
      width=\dimexpr\paperwidth/3\relax,
      frame=off,
      foregroundstyle=\bfa,
      align={flushright,low}]
     {\doifnotmode{paper}{\startproperty[\StepLayer]}%
      \ctxlua{document.step()}\kern\strutdepth
      \doifnotmode{paper}{\stopproperty}}
   \stopmode}

\logo [METAPOST] {MetaPost}

\definefont[TitleFont][SansBold at 60pt]
\definefont[TempFont] [SansBold at 12pt]

\let\StartText\starttext
\let\StopText \stoptext

\doifnotmode{demo}{\endinput}

\starttext

\StartTopics
    \StartTopic[1] A \StopTopic
    \StartTopic[5] B \StopTopic
    \StartTopic[9] C \StopTopic
\StopTopics

\StartTopics
    \StartTopic A \StopTopic
    \StartTopic B \StopTopic
    \StartTopic C \StopTopic
    \StartTopic D \StopTopic
    \StartTopic E \StopTopic
    \StartTopic F \StopTopic
    \StartTopic G \StopTopic
    \StartTopic H \StopTopic
    \StartTopic I \StopTopic
\StopTopics

\stoptext