x-res-50.mkiv /size: 9989 b    last modification: 2020-07-01 14:35
1
%D \module
2
%D [ file=x-res-50,
3
%D version=2004.02.18,
4
%D title=\CONTEXT\ Style File,
5
%D subtitle=Multimedia Presentation,
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
%D The xml mapping has to be redone!
15 16
\endinput
17 18
%D This is a preliminary module, using a preliminary xml media format that
19
%D looks as follows (record is embedded in resource library element):
20
%D
21
%D \starttyping
22
%D <rl:mediaclip label="sample 1">
23
%D <rl:name>Sample One</rl:name>
24
%D <rl:mime>application/x-shockwave-flash</rl:mime>
25
%D <rl:file>http://localhost/mb.swf</rl:file>
26
%D <rl:width>8cm</rl:width>
27
%D <rl:height>6cm</rl:height>
28
%D <rl:text>Nothing special to be said.</rl:text>
29
%D <rl:picture>cow.pdf</rl:picture>
30
%D </rl:mediaclip>
31
%D
32
%D <rl:mediaclip label="sample 2">
33
%D <rl:name>Sample Two</rl:name>
34
%D <rl:mime>audio/mpeg</rl:mime>
35
%D <rl:file>mb.mp3</rl:file>
36
%D <rl:picture>mb.jpg</rl:picture>
37
%D </rl:mediaclip>
38
%D \stoptyping
39
%D
40
%D \starttyping
41
%D texexec --pdf --use=med-show yourfile.xml
42
%D \stoptyping
43
%D
44
%D Bonus:
45
%D
46
%D \starttyping
47
%D --arg="url=http://localhost:8881/e:/media"
48
%D \stoptyping
49 50
% output=pdftex
51 52
% \nopdfcompression
53 54
% bugs in recognizing embedded stream cq. player
55
% bugs in layers + hide/vide
56
% bugs in save javascripts
57
% bugs all over the place
58 59
% in principe kan menu overal hetzelfde zijn als we via JS per pagina de clip var zetten,
60
% hoewel, misschien zal het menu gaan afhangen van de soort clip
61 62
% viewerlayer (eigenschap) aan framed en layer
63 64
\usemodule
[
meta
-
dum
]
\usemodule
[
contml
]
\autoXMLnamespace
[
context
]
65 66
\doifelsevariable
{
environment
}{
url
}
67
{
\setvariables
[
mediaclip
][
url
=
\getvariable
{
environment
}{
url
}
/
]
}
68
{
\setvariables
[
mediaclip
][
url
=]
}
69 70
\startmode
[
silent
]
71 72
\setvariables
[
mediaclip
:
option
][
start
=]
73 74
\stopmode
75 76
\startnotmode
[
silent
]
77 78
\setvariables
[
mediaclip
:
option
][
start
=
auto
]
79 80
\stopnotmode
81 82
\chardef
\XMLtokensreduction
=
1
\dontcomplain
% \showframe \pdfcompresslevel=0
83 84
\setuppapersize
85
[
S
6
][
S
6
]
86 87
\definemeasure
[
GapSize
]
[
\dimexpr
(
1
5
pt
)]
88
\definemeasure
[
EdgeWidth
]
[
\dimexpr
(
1
0
0
pt
)]
89
\definemeasure
[
TextWidth
]
[
\dimexpr
(
.
5
\textwidth
)]
90
\definemeasure
[
RenderingWidth
]
[
\dimexpr
(
\textwidth
)]
91
\definemeasure
[
RenderingHeight
]
[
\dimexpr
(
\textheight
)]
92 93
% \XMLflush{rl:ratio}\dimexpr(.75\textwidth),
94 95
\setuplayout
96
[
backspace
=
\measure
{
GapSize
}
,
97
topspace
=
\measure
{
GapSize
}
,
98
header
=
0
pt
,
99
footer
=
0
pt
,
100
margin
=
0
pt
,
101
edgedistance
=
2
\measure
{
GapSize
}
,
102
rightedge
=
\measure
{
EdgeWidth
}
,
103
bottomdistance
=
2
\measure
{
GapSize
}
,
104
bottom
=
2
\measure
{
GapSize
}
,
105
height
=
fit
,
106
width
=
fit
]
107 108
\setupinteraction
109
[
state
=
start
,
110
color
=
lightgray
,
111
contrastcolor
=
lightgray
,
112
openaction
=
PresetFields
,
113
closeaction
=
ForgetChanges
,
114
menu
=
on
,
115
click
=
no
]
116 117
\setupinteractionscreen
118
[
option
=
max
]
119 120
\setupcolors
121
[
state
=
start
]
122 123
\usetypescript
124
[
palatino
][
texnansi
]
125 126
\setupbodyfont
127
[
palatino
]
128 129
\definecolor
[
darkgray
]
[
s
=
.
2
]
130
\definecolor
[
mediumgray
][
s
=
.
5
]
131
\definecolor
[
lightgray
]
[
s
=
.
8
]
132
\definecolor
[
transgray
]
[
s
=
1
,
t
=
.
9
,
a
=
1
]
133 134
\setupbackgrounds
135
[
page
]
136
[
backgroundoffset
=
\measure
{
GapSize
}
,
137
background
=
{
color
,
pagebutton
}
,
138
backgroundcolor
=
black
]
139 140
\definelayer
141
[
main
]
142
[
width
=
\textwidth
,
143
height
=
\textheight
]
144 145
\definelayer
146
[
extra
]
147
[
width
=
\rightedgewidth
,
148
height
=
\bottomheight
]
149 150
\setupbackgrounds
151
[
text
]
152
[
backgroundoffset
=
0
pt
,
153
background
=
main
]
154 155
\setupbackgrounds
156
[
bottom
][
rightedge
]
157
[
backgroundoffset
=
0
pt
,
158
background
=
extra
]
159 160
% java scripts
161 162
\startJSpreamble
{
handy
}
used
now
163 164
function
ForgetChanges
()
165
{
this
.
dirty
=
false
}
166 167
function
PresetFields
()
168
{
this
.
syncAnnotScan
()
}
169 170
\stopJSpreamble
171 172
\definereference
[
PresetFields
]
[
JS
(
PresetFields
)]
173
\definereference
[
ForgetChanges
][
JS
(
ForgetChanges
)]
174 175
% layers
176 177
\defineviewerlayer
[
menulayer
]
[
title
=
menulayer
]
178
\defineviewerlayer
[
textlayer
]
[
title
=
textlayer
,
state
=
stop
]
179
\defineviewerlayer
[
datalayer
]
[
title
=
datalayer
,
state
=
stop
]
180 181
\setupfield
182
[
rollbutton
]
183
[
fieldlayer
=
menulayer
]
184 185
\setupfield
186
[
rollbutton
]
187
[
option
=
auto
]
188 189
\definepalet
190
[
rollover
]
191
[
n
=
darkgray
,
192
r
=
lightgray
,
193
d
=
darkgray
]
194 195
% list
196 197
\definelist
198
[
clips
]
199
[
expansion
=
yes
,
200
criterium
=
text
,
201
alternative
=
f
]
202 203
% navigation
204 205
\defineoverlay
[
pagebutton
][
\overlaybutton
{
HideLayer
{
textlayer
}
,
HideLayer
{
datalayer
}
,
ToggleLayer
{
menulayer
}}
]
206
\defineoverlay
[
textbutton
][
\overlaybutton
{
HideLayer
{
textlayer
}
,
HideLayer
{
datalayer
}}
]
207
\defineoverlay
[
databutton
][
\overlaybutton
{
HideLayer
{
textlayer
}
,
HideLayer
{
datalayer
}}
]
208 209
% clips
210 211
\defineXMLenvironment
212
[
rl
:
mediaclip
]
213
{
\setups
[
mediaclip
:
start
]
}
214
{
\setups
[
mediaclip
:
stop
]
}
215 216
\newcounter
\MediaClip
217 218
\startsetups
[
mediaclip
:
start
]
219 220
\bgroup
\startXMLignore
221 222
% no \startstandardmakeup here since we need the dsta in the menuconstruction
223 224
\defineXMLsave
[
rl
:
name
]
225
\defineXMLsave
[
rl
:
visualization
]
226
\defineXMLsave
[
rl
:
file
]
227
\defineXMLsave
[
rl
:
mime
]
228
\defineXMLsave
[
rl
:
picture
]
[
backgroundcolor
=
lightgray
]
229 230
\defineXMLsavecontent
[
rl
:
text
]
{
No
additional
info
.
}
231
\defineXMLsavecontent
[
rl
:
width
]
{
\measure
{
RenderingWidth
}}
232
\defineXMLsavecontent
[
rl
:
height
]
{
\measure
{
RenderingHeight
}}
233
\defineXMLsavecontent
[
rl
:
aspect
]
{
1
}
234 235
\stopsetups
236 237
\startsetups
[
mediaclip
:
stop
]
238 239
\startstandardmakeup
240 241
\doifXMLdataelse
{
rl
:
file
}
242
{
\setups
[
mediaclip
:
file
:
yes
]
}
243
{}
244 245
\doifXMLdataelse
{
rl
:
picture
}
246
{
\doifelse
{
\XMLflush
{
rl
:
picture
}}{
self
}
247
{
\setups
[
mediaclip
:
picture
:
self
]
}
248
{
\setups
[
mediaclip
:
picture
:
yes
]
}}
249
{
\setups
[
mediaclip
:
picture
:
no
]
}
250 251
\doifXMLdata
{
rl
:
text
}
252
{
\setups
[
mediaclip
:
text
]
}
253 254
\setlayerframed
255
[
extra
]
256
[
preset
=
rightbottom
]
257
[
frame
=
off
,
offset
=
overlay
,
width
=
fit
,
background
=
databutton
,
align
=
left
]
258
{
\startviewerlayer
[
datalayer
]
\setups
[
mediaclip
:
data
]
\stopviewerlayer
}
259 260
\doifXMLdataelse
{
rl
:
name
}
261
{
\writetolist
[
clips
]
{}{
\XMLflush
{
rl
:
name
}}}
262
{
\writetolist
[
clips
]
{}{
\XMLpar
{
rl
:
mediaclip
}{
label
}{
unknown
}}}
263 264
\stopstandardmakeup
265 266
\stopXMLignore
\egroup
267 268
\stopsetups
269 270
\setuptabulate
271
[
before
=
,
272
after
=]
273 274
\def
\rlCleanupFileName
#
1
%
275
{
\bgroup
276
\def
\cleanup
##
1
##
2
{
\ifnum
##
1
##
2
=
2
0
\space
\else\char
\octnumber
{
##
1
##
2
}
\fi
}
%
277
\defineactivecharacter
3
7
{
\cleanup
}
%
278
\scantokens
{
#
1
}
%
279
\egroup
}
280 281
\startsetups
[
mediaclip
:
data
]
282 283
\noindent
\buttonframed
284
[
framecolor
=
lightgray
,
285
foregroundcolor
=
lightgray
]
286
{
\bf
\expanded
{
\rlCleanupFileName
{
\XMLflush
{
rl
:
file
}}}}
287 288
\vskip
.
7
5
\measure
{
GapSize
}
289 290
\noindent
\buttonframed
291
[
framecolor
=
lightgray
,
292
foregroundcolor
=
lightgray
]
293
{
\bf
\XMLflush
{
rl
:
mime
}}
294 295
\stopsetups
296 297
\startsetups
[
mediaclip
:
picture
:
self
]
298 299
\definerenderingwindow
300
[
mediaclip
]
301
[
width
=
\XMLflush
{
rl
:
width
}
,
302
height
=
\XMLflush
{
rl
:
height
}
,
303
frame
=
off
,
304
openpageaction
=
StartCurrentRendering
,
305
closepageaction
=
StopCurrentRendering
]
306 307
\setlayer
308
[
main
]
309
{
\placerenderingwindow
[
mediaclip
][
mediaclip
-
\MediaClip
]
}
310 311
\stopsetups
312 313
\startsetups
[
mediaclip
:
picture
:
yes
]
314 315
\setlayer
316
[
main
]
317
{
\externalfigure
318
[
\XMLflush
{
rl
:
picture
}
]
319
[
background
=
color
,
320
backgroundcolor
=
\XMLpar
{
rl
:
picture
}{
backgroundcolor
}{
lightgray
}
,
321
factor
=
max
,
322
width
=
\XMLflush
{
rl
:
width
}
,
323
height
=
\XMLflush
{
rl
:
height
}
]
}
324 325
\stopsetups
326 327
\startsetups
[
mediaclip
:
picture
:
no
]
328 329
\setlayer
330
[
main
]
331
{
\externalfigure
332
[
dummy
]
333
[
width
=
\XMLflush
{
rl
:
width
}
,
334
height
=
\XMLflush
{
rl
:
height
}
]
}
335 336
\stopsetups
337 338
\startsetups
[
mediaclip
:
file
:
yes
]
339 340
\doglobal
\increment
\MediaClip
341 342
\useexternalrendering
343
[
mediaclip
-
\MediaClip
]
344
[
\XMLflush
{
rl
:
mime
}
]
345
[
\getvariable
{
mediaclip
}{
url
}
\XMLflush
{
rl
:
file
}
]
346
[
\getvariable
{
mediaclip
:
option
}{
start
}
]
347 348
\stopsetups
349 350
\defineinteractionmenu
351
[
navigation
]
[
right
]
352 353
\defineinteractionmenu
354
[
control
]
[
bottom
]
355 356
\setupinteractionmenu
357
[
navigation
,
control
]
358
[
state
=
start
,
359
frame
=
on
,
360
middle
=
\hskip
.
5
\measure
{
GapSize
}
,
361
inbetween
=
\vskip
.
5
\measure
{
GapSize
}
]
362 363
\setupinteractionmenu
364
[
right
,
bottom
]
365
[
distance
=
overlay
]
366 367
\startinteractionmenu
[
navigation
]
368
\rob
[
HideLayer
{
textlayer
}
,
FirstPage
]
First
Page
\\
369
\rob
[
HideLayer
{
textlayer
}
,
PreviousPage
]
Previous
Page
\\
370
\rob
[
HideLayer
{
textlayer
}
,
NextPage
]
Next
Page
\\
371
\rob
[
HideLayer
{
textlayer
}
,
LastPage
]
Last
Page
\\
372
\rob
[
HideLayer
{
textlayer
}
,
clips
]
List
Of
Clips
\\
373
\rob
[
ForgetChanges
,
CloseDocument
]
Close
Document
\\
374
\stopinteractionmenu
375 376
\startinteractionmenu
[
control
]
377
\rob
[
StartRendering
{
mediaclip
-
\MediaClip
}
]
Start
\\
378
\rob
[
StopRendering
{
mediaclip
-
\MediaClip
}
]
Stop
\\
379
\rob
[
PauseRendering
{
mediaclip
-
\MediaClip
}
]
Pause
\\
380
\rob
[
ResumeRendering
{
mediaclip
-
\MediaClip
}
]
Resume
\\
381
\rob
[
ToggleLayer
{
datalayer
}
]
Info
\\
382
\doifXMLdata
{
rl
:
text
}{
\rob
[
HideLayer
{
datalayer
}
,
ToggleLayer
{
textlayer
}
]
Text
\\
}
383
\stopinteractionmenu
384 385
\startsetups
[
mediaclip
:
text
]
386 387
\setlayer
388
[
extra
]
389
[
preset
=
rightbottom
]
390
{
\startviewerlayer
[
textlayer
]
391
\framed
392
[
align
=
normal
,
393
frame
=
off
,
394
width
=
\measure
{
TextWidth
}
,
395
foregroundcolor
=
darkgray
,
396
background
=
{
color
,
textbutton
}
,
397
backgroundcolor
=
lightgray
]
398
{
\XMLflush
{
rl
:
text
}}
399
\stopviewerlayer
}
400 401
\stopsetups
402 403
\setupcolors
[
textcolor
=
lightgray
]
404 405
\startsetups
[
library
:
start
]
406 407
\starttext
408 409
\setupinteractionmenu
[
control
][
state
=
stop
]
410 411
\title
[
clips
]
{
List
of
Media
Clips
}
412 413
\placelist
[
clips
]
\page
414 415
\setupinteractionmenu
[
control
][
state
=
start
]
416 417
\stopsetups
418 419
\startsetups
[
library
:
stop
]
420 421
\stoptext
422 423
\stopsetups
424 425
\defineXMLenvironment
[
rl
:
resourcelibrary
]
426
{
\setups
[
library
:
start
]
}
427
{
\setups
[
library
:
stop
]
}
428 429
\doifelsenothing
{
\inputfilename
}
430
{
\processXMLfile
{
mediaclient
.
xml
}}
431
{
\processXMLfile
{
\inputfilename
}}
432