s-present-fuzzy.mkiv /size: 5416 b    last modification: 2021-10-28 13:51
1%D \module
2%D   [      file=s-present-fuzzy, % was s-pre-05
3%D        version=1998.12.12,
4%D          title=\CONTEXT\ Style File,
5%D       subtitle=Presentation Environment Fuzzy,
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\usemodule[present-general]
15
16\startmodule[present-fuzzy]
17
18%D As all styles sofar, this one has the same structuring commands.
19
20\doifelsemode {asintended} {
21    \setupbodyfont[ludicaot,14.4pt]
22} {
23    \setupbodyfont[pagella,14.4pt]
24}
25
26\definecolor [BackgroundColor] [s=.95]
27\definecolor [OrnamentColor]   [r=.6,g=.7,b=.8]
28
29\setuppapersize
30  [S6][S6]
31
32\setuplayout
33  [width=430pt,
34   height=400pt,
35   header=0pt,
36   footer=0pt,
37   margin=0pt,
38   backspace=25pt,
39   topspace=25pt,
40   rightedgedistance=20pt,
41   rightedge=110pt]
42
43\setupinteractionscreen
44  [option=max]
45
46\setupbackgrounds
47  [state=repeat]
48
49\setupbackgrounds
50  [page]
51  [backgroundcolor=white]
52
53\setupbackgrounds
54  [text][text]
55  [background={HashFrameA,NextPage},
56   backgroundoffset=20pt]
57
58\defineoverlay
59  [HashFrameA]
60  [\useMPgraphic{HashFrameA}]
61
62\defineoverlay
63  [HashFrameB]
64  [\useMPgraphic{HashFrameB}]
65
66\setupinteraction
67  [state=start,
68   menu=on,
69   color=OrnamentColor,
70   contrastcolor=OrnamentColor]
71
72%D Watch how we use a list alternative that matches the menu.
73
74\setupinteractionmenu
75  [right]
76  [background=HashFrameB,
77   style=smallbold,
78   frame=off,
79   offset=10pt,
80   height=35pt,
81   before=,
82   after=,
83   inbetween=\endgraf,
84   width=\rightedgewidth]
85
86\startinteractionmenu[right]
87  \placelist
88    [Topic]
89    [criterium=all,
90     alternative=right,
91     maxwidth=.8\rightedgewidth,
92     interaction=all,
93     before=,
94     after=]
95  \vfill
96  \setupinteractionmenu
97    [right]
98    [height=30pt]
99  \but [CloseDocument] Close \\
100\stopinteractionmenu
101
102\setupwhitespace
103  [big]
104
105\setupblank
106  [big]
107
108%D \macros
109%D   {TitlePage}
110%D
111%D Now the main layout and navigational definitions are done, it makes sense to
112%D define and tune some structuring commands. First we build the titlepage.
113
114\defineoverlay [TitleGraphic] [\useMPgraphic{TitleGraphic}]
115\defineoverlay [NextPage]     [\overlaybutton{forward}]
116
117\unexpanded\def\StartTitlePage
118  {\setupbackgrounds[page][background={color,TitleGraphic,NextPage}]
119   \setupbackgrounds[text][text][background=]
120   \setupinteraction[menu=off]
121   \setupinteractionbar[state=stop]
122   \setuplayout[width=550pt,rightedge=0pt]
123   \startstandardmakeup
124   \switchtobodyfont[24pt]
125   \bfd\setupinterlinespace
126   \setupalign[middle]
127   \vfil
128   \enforced\let\\\vfil}
129
130\unexpanded\def\StopTitlePage
131  {\vfil\vfil\vfil
132   \stopstandardmakeup
133   \setuplayout[width=430pt,rightedge=110pt]
134   \setupinteraction[menu=on]
135   \setupinteractionbar[state=start]
136   \setupbackgrounds[page][background=color]
137   \setupbackgrounds[text][text][background={HashFrameA,NextPage}]}
138
139\unexpanded\def\TitlePage#1%
140  {\StartTitlePage#1\StopTitlePage}
141
142%D \macros
143%D   {Topics,Subjects}
144%D
145%D Because the lists are in the menu, we don't honor list placement macros.
146
147\unexpanded\def\Topics#1{}
148\unexpanded\def\Subjects{}
149
150%D \macros
151%D   {Topic, Nopic, Subject}
152%D
153%D Since this style is meant for rather flat structured documents, only \type
154%D {\Topic} makes sense.
155
156\definehead [Topic]   [chapter]
157\definehead [Nopic]   [title]
158\definehead [Subject] [section]
159
160\setuphead
161  [Topic, Nopic]
162  [after={\blank[3*medium]},
163   number=no,
164   style=\tfb,
165   page=yes,
166   alternative=middle]
167
168\setuphead
169  [Subject]
170  [after=\blank,
171   number=no,
172   page=yes,
173   continue=no,
174   style=\tfa]
175
176%D We use only one kind of base graphic, which is sligthly
177%D tuned for the different usage.
178
179\startMPdefinitions
180    def random_hash_frame (expr width, height, offset, linewidth ) =
181
182        def delta = ((uniformdeviate .5offset) + .25offset) enddef ;
183        x1 := offset ; y1 := offset ; x2 := width-offset ; y2 := height-offset ;
184
185        drawoptions(withpen pencircle scaled linewidth withcolor \MPcolor{BackgroundColor}) ;
186        fill z1--(x2,y1)--z2--(x1,y2)--cycle ;
187
188        drawoptions(withpen pencircle scaled linewidth withcolor \MPcolor{OrnamentColor}) ;
189        draw (x1-delta,y1)--(x2+delta,y1) ;
190        draw (x2,y1-delta)--(x2,y2+delta) ;
191        draw (x2+delta,y2)--(x1-delta,y2) ;
192        draw (x1,y2+delta)--(x1,y1-delta) ;
193
194        drawoptions();
195        setbounds currentpicture to unitsquare xscaled width yscaled height ;
196    enddef ;
197\stopMPdefinitions
198
199\startuseMPgraphic{HashFrameA}
200    random_hash_frame(OverlayWidth,OverlayHeight,15pt,2pt) ;
201\stopuseMPgraphic
202
203\startuseMPgraphic{HashFrameB}
204    random_hash_frame(OverlayWidth,OverlayHeight, 5pt,2pt) ;
205\stopuseMPgraphic
206
207\startuseMPgraphic{TitleGraphic}
208    numeric offset, width, height ;
209    for i=1 upto 300 :
210        offset := uniformdeviate 10pt ;
211        width  := 2*offset + 30pt + uniformdeviate 30pt ;
212        height := 2*offset + 10pt + uniformdeviate 10pt ;
213        addto currentpicture also
214            image(random_hash_frame(width,height,offset,1pt)) shifted
215            (uniformdeviate OverlayWidth, uniformdeviate OverlayHeight) ;
216    endfor ;
217\stopuseMPgraphic
218
219\stopmodule
220
221\continueifinputfile{s-present-fuzzy.mkiv}
222
223\usemodule[present-common]
224
225\inputpresentationfile{examples/present-fuzzy-001.tex}
226