summaryrefslogtreecommitdiff
path: root/tex/context/base/scrn-int.mkiv
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2011-03-25 19:20:25 +0200
committerMarius <mariausol@gmail.com>2011-03-25 19:20:25 +0200
commit1455dd60b68c9140db1b9977c9e5ce372b772ec8 (patch)
treed2b7060a4d9891966a056dcf143ef20d43390561 /tex/context/base/scrn-int.mkiv
parent2a9554684f61df8db63dec6d4e874f49b25a212b (diff)
downloadcontext-1455dd60b68c9140db1b9977c9e5ce372b772ec8.tar.gz
beta 2011.03.25 18:03
Diffstat (limited to 'tex/context/base/scrn-int.mkiv')
-rw-r--r--tex/context/base/scrn-int.mkiv613
1 files changed, 0 insertions, 613 deletions
diff --git a/tex/context/base/scrn-int.mkiv b/tex/context/base/scrn-int.mkiv
deleted file mode 100644
index cc25f48b2..000000000
--- a/tex/context/base/scrn-int.mkiv
+++ /dev/null
@@ -1,613 +0,0 @@
-%D \module
-%D [ file=scrn-int,
-%D version=1995.01.01,
-%D title=\CONTEXT\ Core Macros,
-%D subtitle=Interaction,
-%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.
-
-\writestatus{loading}{ConTeXt Screen Macros / Interaction}
-
-\registerctxluafile{scrn-int}{1.001}
-
-\unprotect
-
-%D This is an update of \MKII\ code. In the process profiles and versions
-%D were removed as I never used them (although they were kind of cool at
-%D that time).
-
-% a bit complex due to papercomment (see imposition code)
-
-\newtoks\everysetupinteractionscreen
-
-\unexpanded\def\setupinteractionscreen
- {\dosingleempty\dosetupinteractionscreen}
-
-\def\dosetupinteractionscreen[#1]%
- {\getparameters[\??sc][#1]%
- \the\everysetupinteractionscreen}
-
-\def\synchronizepaperdimensionssimple % simple version
- {\bgroup
- \ifx\@@ppleft \empty
- \ifx\@@ppright \empty
- \ifx\@@pptop \empty
- \ifx\@@ppbottom \empty
- \ifx\@@pcstate\v!start
- \locationfalse\fi\else
- \locationfalse\fi\else
- \locationfalse\fi\else
- \locationfalse\fi\else
- \locationfalse\fi
- \iflocation % without screen settings
- \ctxlua{backends.codeinjections.setupcanvas {
- paperwidth = \number\paperwidth,
- paperheight = \number\paperheight
- }}%
- \else
- \ctxlua{backends.codeinjections.setupcanvas {
- paperwidth = \number\printpaperwidth,
- paperheight = \number\printpaperheight
- }}%
- \fi
- \egroup}
-
-\def\synchronizepaperdimensionscomplex % complex version
- {\bgroup
- \edef\@@scwidth {\@@scwidth}%
- \edef\@@scheight{\@@scheight}%
- \ifx\@@scwidth\v!fit
- \!!widtha\leftcombitotal
- \ifdim\backspace>\!!widtha\ifdim\backspace>\zeropoint\relax
- \advance\backspace -\!!widtha
- \fi\fi
- \advance\!!widtha\dimexpr\rightcombitotal+2\dimexpr\@@scbackspace+\@@schoroffset\relax\relax
- \else\ifx\@@scwidth\v!max
- \!!widtha\printpaperwidth
- \else
- \!!widtha\@@scwidth
- \fi\fi
- \ifx\@@scheight\v!fit
- \!!heighta\dimexpr\topheight+\topdistance\relax
- \ifdim\topspace>\!!heighta\ifdim\topspace>\zeropoint\relax
- \advance\topspace -\!!heighta
- \fi\fi
- \advance\!!heighta\dimexpr\makeupheight+\bottomdistance+\bottomheight+2\dimexpr\@@sctopspace+\@@scveroffset\relax\relax
- \else\ifx\@@scheight\v!max
- \!!heighta\printpaperheight
- \else
- \!!heighta\@@scheight
- \fi\fi
- \doif\@@scdelay\v!none{\let\@@scdelay\zerocountervalue}%
- \ifdim\!!widtha>\paperwidth\ifdim\!!widtha>\zeropoint
- \paperwidth\!!widtha
- \fi\fi
- \ifdim\!!heighta>\paperheight\ifdim\!!heighta>\zeropoint
- \paperheight\!!heighta
- \fi\fi
- \ctxlua{backends.codeinjections.setupcanvas {
- mode = "\@@scoption",
- % doublesided = \ifsinglesided false\else\ifdoublesided true\else false\fi\fi,
- singlesided = \ifsinglesided true\else false\fi,
- doublesided = \ifdoublesided true\else false\fi,
- leftoffset = \number\dimexpr\backoffset\relax,
- topoffset = \number\dimexpr\topoffset \relax,
- width = \number\dimexpr\!!widtha \relax,
- height = \number\dimexpr\!!heighta \relax,
- paperwidth = \number\paperwidth,
- paperheight = \number\paperheight
- }}%
- \egroup}
-
-\let\synchronizepaperdimensions \synchronizepaperdimensionscomplex
-
-\appendtoks
- \ifproductionrun
- \doifelse\@@pcstate\v!start
- {\let\synchronizepaperdimensions\synchronizepaperdimensionssimple}
- {\let\synchronizepaperdimensions\synchronizepaperdimensionscomplex}%
- \fi
-\to \everysetupinteractionscreen
-
-\appendtoks \synchronizepaperdimensions \to \everyshipout
-
-%D The next mechanism, linked lists, is quite old and
-%D is \MKIV'd for completeness. I will finish the
-%D confuguration part when I need it.
-
-% todo: a kind of button that gets a tag passed (\??tk)
-
-% \starttext
-% \setupinteraction[state=start]
-% \definelinkedlist[demo]
-% \dorecurse{10}{\linkedlistelement[demo]{link \recurselevel} \page}
-% \stoptext
-
-\def\linkedlistparameter #1{\csname\dolinkedlistparameter{\??lk\currentlinkedlist}#1\endcsname}
-\def\dolinkedlistparameter #1#2{\ifcsname#1#2\endcsname#1#2\else\expandafter\dolinkedlistparentparameter\csname#1\s!parent\endcsname#2\fi}
-\def\dolinkedlistparentparameter#1#2{\ifx#1\relax\s!empty\else\dolinkedlistparameter#1#2\fi}
-
-\unexpanded\def\definelinkedlist{\dodoubleargument\dodefinelinkedlist}
-\unexpanded\def\setuplinkedlist {\dodoubleargument\dosetuplinkedlist }
-\unexpanded\def\setuplinkedlists{\dosingleargument\dosetuplinkedlists}
-
-\def\dodefinelinkedlist[#1][#2]%
- {\ctxlua{interactions.linkedlists.define("#1")}%
- \getparameters[\??lk#1][\s!parent=\??lk,#2]}
-
-\def\dosetuplinkedlist[#1][#2]%
- {\getparameters[\??lk#1][#2]}
-
-\def\dosetuplinkedlists[#1]%
- {\getparameters[\??lk][#1]}
-
-\def\setlinkproperties#1#2#3#4#5#6%
- {\def\currentlink {#1}%
- \def\noflinks {#2}%
- \def\firstlink {#3}%
- \def\previouslink{#4}%
- \def\nextlink {#5}%
- \def\lastlink {#6}}
-
-\def\linkedlistelement[#1]#2% currently no view support
- {\dontleavehmode\hbox\bgroup
- #2%
- \iflocation
- \edef\currentlinkedlist{#1}%
- \ifcsname\??lk\currentlinkedlist\s!parent\endcsname
- \hskip\linkedlistparameter\c!distance
- \ctxlua{interactions.linklists.add("\currentlinkedlist")}%
- \expanded{\ctxlatelua{interactions.linklists.enhance("\currentlinkedlist",\currentlink)}}%
- \dogotosomepage {\??lk\currentlinkedlist}\gotobegincharacter \firstlink
- \ifnum\noflinks>\plustwo
- \dogotosomepage{\??lk\currentlinkedlist}\gobackwardcharacter\previouslink
- \dogotosomepage{\??lk\currentlinkedlist}\goforwardcharacter \nextlink
- \fi
- \dogotosomepage {\??lk\currentlinkedlist}\gotoendcharacter \lastlink
- \else
- \writestatus\m!interactions{no such linked list: \currentlinkedlist}%
- \fi
- \fi
- \egroup}
-
-\setuplinkedlists
- [\c!distance=.25em,
- \c!width=\v!fit,
- \c!location=\v!low,
- \c!color=\@@iacolor,
- \c!frame=\v!off,
- \c!background=,
- \c!backgroundcolor=]
-
-\def\koppeling {\linkedlistelement}
-\def\stelkoppelingenin {\setuplinkedlists}
-\def\definieerkoppeling{\definelinkedlist}
-
-%D Conditional page breaks:
-
-\def\screen
- {\dosingleempty\doscreen}
-
-\def\doscreen[#1]%
- {\iflocation\page[#1]\fi}
-
-%D Page transitions:
-
-\let\askedpagetransitions\empty
-
-\unexpanded\def\setuppagetransitions
- {\dosingleempty\dosetuppagetransitions}
-
-\def\dosetuppagetransitions[#1]%
- {\edef\askedpagetransitions{#1}}
-
-\def\setpagetransition
- {\iflocation \ifx\askedpagetransitions\empty \else
- \ctxlua{backends.codeinjections.setpagetransition{ n = "\askedpagetransitions", delay = "\@@scdelay" }}%
- \fi \fi}
-
-\prependtoks \setpagetransition \to \everyshipout
-
-\setuppagetransitions
- [\v!reset]
-
-%D Comments:
-
-\newbox\commentcollection
-\newbox\commentbox
-\newbox\commentboxone
-\newbox\commentboxtwo
-
-\def\raisedcommentanchors#1#2{#1{\hbox{\raise\strutht#2}}}
-
-\setvalue{\??cc:\c!location:\v!inmargin }{\raisedcommentanchors\inmargin }
-\setvalue{\??cc:\c!location:\v!leftedge }{\raisedcommentanchors\inleftedge }
-\setvalue{\??cc:\c!location:\v!rightedge }{\raisedcommentanchors\inrightedge }
-\setvalue{\??cc:\c!location:\v!leftmargin }{\raisedcommentanchors\inleftmargin }
-\setvalue{\??cc:\c!location:\v!rightmargin}{\raisedcommentanchors\inrightmargin}
-
-\let\flushcommentanchors\relax
-
-\def\doflushcommentanchors
- {\global\let\flushcommentanchors\relax
- \ifvoid\commentbox\else\dodoflushcommentanchors\fi} % in everypar so indirect
-
-\def\dodoflushcommentanchors
- {\executeifdefined{\??cc:\c!location:\@@cclocation}\hbox{\box\commentbox}}
-
-\unexpanded\def\setupcomment
- {\dodoubleargument\getparameters[\??cc]}
-
-\unexpanded\def\placecomments{\box\commentcollection} % when option=buffer
-
-\def\doinsertcomment#1%
- {\begingroup
- \doifelse\@@ccoption\v!max{\let\@@ccopen\s!true}{\let\@@ccopen\s!false}%
- \ctxlua{backends.codeinjections.presetsymbollist("\@@ccsymbol")}%
- % in between predefined symbols are dealt with
- \ctxlua{backends.codeinjections.registercomment {
- title = "\@@cctitle",
- width = \number\dimexpr\@@ccwidth \relax,
- height = \number\dimexpr\@@ccheight\relax,
- colormodel = \number\currentcolormodel,
- colorvalue = \thecolorattribute{\@@cccolor},
- open = \@@ccopen,
- symbol = "\@@ccsymbol",
- buffer = "#1",
- layer = "\@@cctextlayer"
- }}%
- \box\commentboxone
- \doif\@@ccoption\v!buffer
- {\setbox\scratchbox\vbox to \@@ccheight{\forgetall\vss\box\commentboxtwo}%
- \wd\scratchbox\@@ccwidth
- \global\setbox\commentcollection\vbox
- {\startoverlay{\box\commentcollection}{\box\scratchbox}\stopoverlay}}%
- \endgroup}
-
-\setvalue{\e!start\v!comment}{\dodoubleempty\dostartcomment}
-
-\def\dostartcomment[#1][#2]%
- {\bgroup
- \doifassignmentelse{#1}{\getparameters[\??cc][#1]}{\getparameters[\??cc][\c!title=#1,#2]}%
- \dostartbuffer[\v!comment\v!buffer][\v!comment\v!buffer][\e!start\v!comment][\e!stop\v!comment]}
-
-\unexpanded\def\stopcomment
- {\doif\@@ccstate\v!start
- {\global\let\flushcommentanchors\doflushcommentanchors
- \global\setbox\commentbox\frozenhbox
- {\hbox to \zeropoint{\struttedbox{\tbox{\doinsertcomment{\v!comment\v!buffer}}}\hss}%
- \hskip\ifvoid\commentbox\@@ccmargin\else\@@ccdistance\fi
- \box\commentbox}}%
- \egroup}
-
-\def\comment
- {\dodoubleempty\docomment}
-
-\def\docomment[#1][#2]#3%
- {\doif\@@ccstate\v!start
- {\hbox to \zeropoint
- {\doifassignmentelse{#1}{\getparameters[\??cc][#1]}{\getparameters[\??cc][\c!title=#1,#2]}%
- \hskip-\@@ccmargin
- \ctxlua{buffers.assign("\v!comment\v!buffer", \!!bs\detokenize{#3}\!!es)}%
- \struttedbox{\tbox{\doinsertcomment{\v!comment\v!buffer}}\hss}}}%
- \ignorespaces}
-
-% test
-%
-% \startcomment
-% hello beautiful\\world
-% \stopcomment
-%
-% test
-%
-% \startcomment[hello]
-% hello << eerste >>
-% beautiful
-% world
-% \stopcomment
-%
-% test
-%
-% \startcomment[hello][color=green,width=10cm,height=3cm]
-% hello \leftguillemot\ \'e\'erste \rightguillemot\
-% beautiful
-% world
-% \stopcomment
-%
-% test
-%
-% \startcomment[hello][color=red,width=4cm,height=3cm]
-% hello \leftguillemot\ \'e\'erste \rightguillemot\ test
-%
-% beautiful
-%
-% world
-% \stopcomment
-%
-% test
-%
-% \startcomment[symbol=Balloon]
-% Do we want this kind of rubish? And, why isn't this and
-% some more features related to text annotations so poorly
-% (actually not) documented? Anyhow, by providing this
-% functionality we demonstrate that \pdfTeX\ can do it. By
-% the way, it's funny that when in Acrobat we scale up the
-% text, the symbols scale down.
-% \stopcomment
-%
-% test
-%
-% \definesymbol [comment-normal][{\externalfigure[cow.pdf]}]
-% \definesymbol [comment-down] [{\externalfigure[cow.pdf]}]
-%
-% \def\CowSymbol#1#2%
-% {\scale
-% [\c!height=#1]
-% {\startMPcode
-% loadfigure "koe.mp" number 1 ;
-% refill currentpicture withcolor #2 ;
-% \stopMPcode}}
-%
-% \definesymbol [comment-normal]
-% [\CowSymbol{4ex}{red}]
-%
-% \definesymbol [comment-down]
-% [\CowSymbol{4ex}{green}]
-%
-% \setupcomment
-% [\c!symbol={comment-normal,comment-down},
-% \c!option=\v!buffer]
-%
-% \startcomment[hello]
-% oeps
-% \stopcomment
-%
-% test
-%
-% \setupcomment
-% [\c!symbol=normal,
-% \c!option=max,width=10cm]
-%
-% \startcomment[hello]
-% oeps
-% \stopcomment
-%
-% test
-
-\setupcomment
- [\c!state=\v!start,
- \c!margin=2.5em,
- \c!distance=1em,
- \c!width=.3\textwidth,
- \c!height=.2\textheight,
- \c!color=\@@iacolor,
- \c!title=,
- \c!space=\v!no,
- \c!symbol=\v!normal,
- \c!location=\v!inmargin,
- \c!option=,
- \c!textlayer=]
-
-%D Attachments:
-
-% \setupinteraction[state=start]
-%
-% \useattachment[test.tex]
-% \useattachment[whatever][test.tex]
-% \useattachment[whatever][newname][test.tex]
-% \useattachment[whatever][title][newname][test.tex]
-%
-% % \setupattachments[\c!symbol={symbol-normal,symbol-down}]
-%
-% \starttext \attachment[whatever] \stoptext
-
-\def\useattachment
- {\doquadrupleempty\douseattachment}
-
-\def\douseattachment[#1][#2][#3][#4]% tag title newname filename
- {\iffourthargument
- \dodouseattachment{#1}{#2}{#3}{#4}%
- \else\ifthirdargument
- \dodouseattachment{#1}{#2}{#2}{#3}%
- \else\ifsecondargument
- \dodouseattachment{#1}{#2}{#2}{#2}%
- \else
- \dodouseattachment{#1}{#1}{#1}{#1}%
- \fi\fi\fi}
-
-\def\dodouseattachment#1#2#3#4% tag title newname filename
- {\ctxlua{interactions.attachments.register{label="#1",title="#2",newname="#3",filename="#4"}}}
-
-\def\attachment
- {\dodoubleempty\doattachment}
-
-\def\doattachment[#1][#2]% [tag] [settings]
- {\iflocation
- \doif\@@atstate\v!start
- {\bgroup
- \setupattachments[#2]%
- \ctxlua{backends.codeinjections.presetsymbollist("\@@atsymbol")}%
- % we cannot yet ask for the wd/ht/dp of an xform else we could use those
- \setbox\scratchbox\hbox{\symbol[\lastpredefinedsymbol]}%
- \doif\@@atwidth \v!fit{\edef\@@atwidth {\the\wd\scratchbox}}%
- \doif\@@atheight\v!fit{\edef\@@atheight{\the\ht\scratchbox}}%
- \doif\@@atdepth \v!fit{\edef\@@atdepth {\the\dp\scratchbox}}%
- %
- \setbox\scratchbox\hbox
- {\getvalue{\??at:\@@atalternative}{\ctxlua{backends.codeinjections.attachfile{
- label = "#1",
- width = \number\dimexpr\@@atwidth \relax,
- height = \number\dimexpr\@@atheight\relax,
- depth = \number\dimexpr\@@atdepth \relax,
- color = "\@@atcolor",
- symbol = "\@@atsymbol",
- layer = "\@@attextlayer",
- }}}}%
- \wd\scratchbox\@@atwidth
- \ht\scratchbox\@@atheight
- \dp\scratchbox\@@atdepth
- \box\scratchbox
- \egroup}%
- \fi}
-
-\setvalue{\??at:\v!high}#1{\struttedbox{\tbox{#1}}}
-
-\unexpanded\def\setupattachments
- {\dodoubleempty\getparameters[\??at]}
-
-\setupattachments
- [\c!state=\v!start,
- \c!color=\@@iacolor,
- \c!textlayer=,
- \c!width=\v!fit,
- \c!height=\v!fit,
- \c!depth=\v!fit,
- \c!alternative=\v!high,
- \c!symbol=]
-
-%D Defining sound tracks:
-%D
-%D \starttyping
-%D \useexternalsoundtrack[label][file]
-%D \stoptyping
-%D
-%D associated actions: StartSound StopSound PauseSound ResumeSound
-%D
-%D Todo: like external figures, also search on path,
-%D although, they need to be present ar viewing time, so ...
-
-\def\useexternalsoundtrack
- {\dodoubleargument\douseexternalsoundtrack}
-
-\def\douseexternalsoundtrack[#1][#2]%
- {\ctxlua{interactions.soundclips.register{ label="#1", filename="#2" }}}
-
-\def\checksoundtrack#1% yet untested in mkiv (also move management to lua)
- {\iflocation
- \ctxlua{backends.nodeinjections.insertsound{
- label = "#1",
- repeat = "\@@sdoption", % not entirely ok but works
- }}%
- \fi}
-
-\unexpanded\def\setupexternalsoundtracks
- {\dodoubleargument\getparameters[\??sd]}
-
-\setupexternalsoundtracks
- [\c!option=]
-
-%D Multi Media:
-
-% todo: multiple instances, dus indirect
-
-\let\currentrendering\empty
-
-\definereference[StartCurrentRendering] [\v!StartRendering {\currentrendering}]
-\definereference[StopCurrentRendering] [\v!StopRendering {\currentrendering}]
-\definereference[PauseCurrentRendering] [\v!PauseRendering {\currentrendering}]
-\definereference[ResumeCurrentRendering][\v!ResumeRendering{\currentrendering}]
-
-\newcounter\nofexternalrenderings
-
-\def\useexternalrendering{\doquadrupleempty\douseexternalrendering}
-\def\setinternalrendering{\dodoubleempty \dosetinternalrendering}
-
-\def\douseexternalrendering[#1][#2][#3][#4]% tag mime file options
- {\ctxlua{interactions.renderings.register {
- kind = "external",
- label = "#1",
- mime = "#2",
- filename = "#3",
- options = "#4",
- }}}
-
-\def\dosetinternalrendering[#1][#2]% tag options {content}
- {\bgroup
- \dowithnextbox
- {\ctxlua{interactions.renderings.register {
- kind = "internal",
- label = "#1",
- mime = "IRO",
- filename = "#1",
- options = "#2",
- }}%
- \let\objectoffset\zeropoint
- \setobject{IRO}{#1}\hbox{\box\nextbox}%
- \egroup}%
- \hbox}
-
-\def\renderingtype #1{\ctxlua{interactions.renderings.var("#1","kind")}}
-\def\renderingoptions#1{\ctxlua{interactions.renderings.var("#1","options")}}
-
-\def\renderingwidth {8cm}
-\def\renderingheight {6cm}
-
-\unexpanded\def\definerenderingwindow
- {\dodoubleempty\dodefinerenderingwindow}
-
-\def\dodefinerenderingwindow[#1][#2]%
- {\presetlocalframed[\??rw#1]%
- \getparameters
- [\??rw#1]%
- [\c!openpageaction=,\c!closepageaction=,%
- \c!width=\renderingwidth,\c!height=\renderingheight,%
- #2]}
-
-\unexpanded\def\setuprenderingwindow
- {\dodoubleargument\dosetuprenderingwindow}
-
-\def\dosetuprenderingwindow[#1]%
- {\getparameters[\??rw#1]}
-
-\unexpanded\def\placerenderingwindow
- {\dodoubleempty\doplacerenderingwindow}
-
-\def\doplacerenderingwindow[#1][#2]%
- {\bgroup
- \edef\currentrendering{\ifsecondargument#2\else#1\fi}%
- \doifelse{\renderingtype\currentrendering}{internal} % an object
- {\getobjectdimensions{IRO}\currentrendering
- \edef\renderingheight{\the\dimexpr\objectheight+\objectdepth\relax}%
- \edef\renderingwidth{\objectwidth}%
- \dogetobjectreferencepage{IRO}\currentrendering\renderingpage}%
- {\def\renderingheight{\vsize}%
- \def\renderingwidth{\hsize}%
- \def\renderingpage{\realpageno}}%
- % create fall back if needed
- \ifcsname\??rw#1\c!width\endcsname
- \def\currentrenderingwindow{#1}%
- \else
- \let\currentrenderingwindow\s!default
- \definerenderingwindow[\currentrenderingwindow]%
- \fi
-% todo
-% \handlereferenceactions{\getvalue{\??rw\currentrenderingwindow\c!openpageaction }}\dosetuprenderingopenpageaction
-% \handlereferenceactions{\getvalue{\??rw\currentrenderingwindow\c!closepageaction}}\dosetuprenderingclosepageaction
- \localframed
- [\??rw\currentrenderingwindow][\c!offset=\v!overlay]%
- {\vfill
- \ctxlua{backends.codeinjections.insertrenderingwindow {
- label = "\currentrendering",
- width = \number\dimexpr\renderingwidth\relax,
- height = \number\dimexpr\renderingheight\relax,
- options = "\renderingoptions\currentrendering",
- page = \number\renderingpage,
- }}\hfill}%
- \egroup}
-
-\setupinteractionscreen
- [\c!width=\printpaperwidth,
- \c!height=\printpaperheight,
- \c!horoffset=\!!zeropoint,
- \c!veroffset=\!!zeropoint,
- \c!backspace=\backspace,
- \c!topspace=\topspace,
- \c!option=\v!auto,
- \c!delay=\v!none]
-
-\protect \endinput