%D \module %D [ file=scrn-nav, %D version=1998.01.15, %D title=\CONTEXT\ Screen Macros, %D subtitle=Navigation, %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 / Navigation} \unprotect %D Support for interactive document is very present in %D \CONTEXT\ and interwoven in many modules. This means that in %D this module, where we deal with some common navigational %D features, there will be quite some forward references. %D %D The current support in \MKIV\ is mostly the same as in %D \MKII\ and the old files have some more detailed %D (sometimes historic) information. %D There is no interaction at all unless enabled by saying: %D %D \starttyping %D \setupinteraction[state=start] %D \stoptyping %D %D The other settings are: %D %D \showsetup{setupinteraction} % use with care, no checking done \def\setinteractionparameter#1#2% {\expandafter\def\csname\??ia#1\endcsname{#2}} \def\resetinteractionparameter#1% {\expandafter\let\csname\??ia#1\endcsname\empty} \newtoks\everysetupinteraction \unexpanded\def\setupinteraction {\dosingleargument\dodosetupinteraction} \def\dodosetupinteraction[#1]% % \dosetupinteraction == special {\getparameters[\??ia][#1]% \the\everysetupinteraction} % todo, move partial append to where the action happens \appendtoks \doifelse\@@iastate\v!start {\iflocation\else \showmessage\m!interactions2{\ifusepagedestinations\space(PAGE)\fi}% \global\locationtrue \fi}% {\iflocation \showmessage\m!interactions3{\ifusepagedestinations\space(PAGE)\fi}% \global\locationfalse \fi}% \iflocation \setsystemmode \v!interaction \else \resetsystemmode\v!interaction \fi \doifsomething\@@iacalculate {\doregistercalculationset\@@iacalculate}% \doifelse\@@iastrut \v!yes \settrue \setfalse \uselocationstrut \doifelse\@@iaclick \v!yes \settrue \setfalse \highlighthyperlinks \doifelse\@@iadisplay\v!new \settrue \setfalse \gotonewwindow \doifelse\@@iapage \v!yes \settrue \setfalse \usepagedestinations \to \everysetupinteraction \def\synchronizebackendidentity {\ctxlua{backends.codeinjections.setupidentity{ title = \!!bs\@@iatitle\!!es, subject = \!!bs\@@iasubtitle\!!es, author = \!!bs\@@iaauthor\!!es, creator = \!!bs ConTeXt - \contextversion\!!es, date = \!!bs\@@iadate\!!es, keywords = \!!bs\@@iakeyword\!!es, }}} \appendtoks \synchronizebackendidentity \to \everyfirstshipout %D We have to make sure of some settings: \def\dolocationstartup {\iflocation \donefalse \ifx\@@iaopenaction\empty \else \donetrue \ctxlua{jobreferences.checkopendocumentactions("\@@iaopenaction")}% \ctxlua{jobreferences.expandcurrent()}% \fi \ifx\@@iacloseaction\empty \else \donetrue \ctxlua{jobreferences.checkclosedocumentactions("\@@iacloseaction")}% \ctxlua{jobreferences.expandcurrent()}% \fi \ifdone \ctxlua{jobreferences.flushdocumentactions()}% \fi \global\let\dolocationstartup\relax \fi} \def\dolocationpagecheck {\iflocation \donefalse \ifx\@@iaopenpageaction\empty \else \donetrue \ctxlua{jobreferences.checkopenpageactions("\@@iaopenpageaction")}% \ctxlua{jobreferences.expandcurrent()}% \fi \ifx\@@iaclosepageaction\empty \else \donetrue \ctxlua{jobreferences.checkclosepageactions("\@@iaclosepageaction")}% \ctxlua{jobreferences.expandcurrent()}% \fi \ifdone \ctxlua{jobreferences.flushpageactions()}% \fi \fi} \appendtoks \dolocationstartup \to \everyshipout \appendtoks \dolocationpagecheck \to \everyshipout %D As long as there a natural feeling of what can be considered %D hyper active or not, we have to tell users where they can %D possibly click. We've already seen a few macros that deal %D with this visualization, something we definitely do not let %D up to the viewer. One way of telling is using a distinctive %D typeface, another way is using color. %D %D There are two colors involved: one for normal hyperlinks, %D and one for those that point to the currentpage, the %D contrast color. \definecolor [interactioncolor] [r=0, g=.6, b=0] \definecolor [interactioncontrastcolor] [r=.8, g=0, b=0] \definecolor [interactiekleur] [interactioncolor] \definecolor [interactiecontrastkleur] [interactioncontrastcolor] %D The next few macros are responsible for highlighting hyper %D links. The first one, \type{\showlocation}, is used in those %D situations where the typeface is handled by the calling %D macro. %D When we're dealing with pure page references, contrast %D colors are used when we are already at the page mentioned. \def\setlocationcolor#1% not grouped ! {\ifnum\referencepagestate=\plusone \edef\askedcontrastcolor{\csname#1\c!contrastcolor\endcsname}% \ifx\askedcontrastcolor\empty \dosetcolorattribute{#1}\c!color \else \dosetcolorattribute{#1}\c!contrastcolor \fi \else % we could just set and if > 0 set again \dosetcolorattribute{#1}\c!color \fi} \def\setlocationfont#1% {\dosetfontattribute{#1}\c!style} \def\setlocationattributes#1% {\ifnum\referencepagestate=\plusone \edef\askedcontrastcolor{\csname#1\c!contrastcolor\endcsname}% \ifx\askedcontrastcolor\empty \dosetcolorattribute{#1}\c!color \else \dosetcolorattribute{#1}\c!contrastcolor \fi \else % we could just set and if > 0 set again \dosetcolorattribute{#1}\c!color \fi \dosetfontattribute{#1}\c!style} \def\setlocationcolorspec#1% \resolver {\ifnum\referencepagestate=\plusone \edef\askedcontrastcolor{#1\c!contrastcolor}% \ifx\askedcontrastcolor\empty \doactivatecolor{#1\c!color}% \else \doactivatecolor\askedcontrastcolor \fi \else \doactivatecolor{#1\c!color}% \fi} %D delayed ... \def\enableinteractivereferences {\ifproductionrun \ctxlua{jobreferences.enable_interaction()}% \globallet\enableinteractivereferences\relax \fi} \appendtoks \enableinteractivereferences \to \everysetupinteraction %D More tokens are spend when we want both typeface and color %D highlighting. \def\@@iatimestamp {\the\normalyear \ifnum\normalmonth<10 0\fi\the\normalmonth \ifnum\normalday <10 0\fi\the\normalday} \setupinteraction % start fit page and reset form [\c!state=\v!stop, \c!page=\v!no, \c!click=\v!yes, \c!display=, \c!openaction=, \c!closeaction=, \c!openpageaction=, \c!closepageaction=, \c!display=\v!normal, \c!focus=\v!fit, \c!menu=\v!off, \c!style=\v!bold, \c!calculate=, \c!strut=\v!yes, \c!split=\v!yes, \c!color=interactioncolor, \c!contrastcolor=interactioncontrastcolor, \c!symbolset=, \c!width=1em, \c!height=\!!zeropoint, \c!depth=\!!zeropoint, \c!title=\jobname, % needed for fdf/x \c!subtitle=, \c!author=, \c!keyword=, \c!date=\@@iatimestamp] %D XMP support: \setupinteraction [xmpfile=] \appendtoks % this will move as it is a backend issue \doifsomething\@@iaxmpfile {\ctxlua{if lpdf then lpdf.setxmpfile("\@@iaxmpfile") end}% \globallet\@@iaxmpfile\empty}% \to \everysetupinteraction \protect \endinput