scrn-ref.mklx /size: 3611 b    last modification: 2023-12-21 09:44
1%D \module
2%D   [       file=scrn-ref,
3%D        version=1998.01.15,
4%D          title=\CONTEXT\ Screen Macros,
5%D       subtitle=References, % moved code
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\writestatus{loading}{ConTeXt Screen Macros / References}
15
16\registerctxluafile{scrn-ref}{autosuffix}
17
18\unprotect
19
20\appendtoks
21    \ifempty{\interactionparameter\c!calculate}\else
22        \clf_setfieldcalculationset{\interactionparameter\c!calculate}%
23    \fi
24    \ifcstok{\interactionparameter\c!click}\v!yes
25        \highlighthyperlinks\conditionaltrue
26    \else
27        \highlighthyperlinks\conditionalfalse
28    \fi
29    \ifcstok{\interactionparameter\c!display}\v!new
30        \gotonewwindow\conditionaltrue
31    \else
32        \gotonewwindow\conditionalfalse
33    \fi
34    \ifcstok{\interactionparameter\c!page}\v!no\else
35        \scrn_reference_enable_page_destinations
36    \fi
37\to \everysetupinteraction
38
39\def\scrn_reference_enable_page_destinations % no reset
40  {\clf_setreferencelinkmethod{\interactionparameter\c!page}}
41
42\setupinteraction % start fit page and reset form
43  [\c!page=\v!no,
44   \c!click=\v!yes,
45   \c!display=\v!normal,
46   \c!focus=\v!fit,
47  %\c!focusoffset=\zeropoint, % when tested with al views it will become 5\points
48   \c!focusoffset=5\points,
49   \c!calculate=,
50   % rendering:
51   \c!width=\emwidth,
52   \c!height=\zeropoint,
53   \c!depth=\zeropoint,
54   \c!symbolset=]
55
56% for now here, might become per link
57
58\appendtoks
59    \enabledirectives[destinations.offset=\the\dimexpr\interactionparameter\c!focusoffset\relax]%
60\to \everysetupinteraction
61
62\mutable\lettonothing\currentinteractioncloseaction
63\mutable\lettonothing\currentinteractionclosepageaction
64\mutable\lettonothing\currentinteractionopenaction
65\mutable\lettonothing\currentinteractionopenpageaction
66
67%D We have to make sure of some settings:
68
69\def\scrn_reference_set_text_actions
70  {\iflocation
71     \edef\currentinteractionopenaction {\interactionparameter\c!openaction }%
72     \edef\currentinteractioncloseaction{\interactionparameter\c!closeaction}%
73     \ifempty\currentinteractionopenaction \else
74       \clf_setopendocumentaction{\currentinteractionopenaction}%
75     \fi
76     \ifempty\currentinteractioncloseaction \else
77       \clf_setclosedocumentaction{\currentinteractioncloseaction}%
78     \fi
79     \glet\scrn_reference_set_text_actions\relax
80   \fi}
81
82\def\scrn_reference_set_page_actions
83  {\iflocation
84     \edef\currentinteractionopenpageaction {\interactionparameter\c!openpageaction }%
85     \edef\currentinteractionclosepageaction{\interactionparameter\c!closepageaction}%
86     \ifempty\currentinteractionopenpageaction \else
87       \clf_setopenpageaction{\currentinteractionopenpageaction}%
88     \fi
89     \ifempty\currentinteractionclosepageaction \else
90       \clf_setclosepageaction{\currentinteractionclosepageaction}%
91     \fi
92   \fi}
93
94\appendtoks \scrn_reference_set_text_actions \to \everyshipout
95\appendtoks \scrn_reference_set_page_actions \to \everyshipout
96
97%D delayed ...
98
99% \def\scrn_reference_enable_references
100%   {\ifproductionrun
101%      \clf_enableinteraction % only once anyway
102%      \glet\scrn_reference_enable_references\relax
103%    \fi}
104%
105% \appendtoks
106%     \scrn_reference_enable_references
107% \to \everysetupinteraction
108
109\setupinteraction % start fit page and reset form
110  [\c!openaction=,
111   \c!closeaction=,
112   \c!openpageaction=,
113   \c!closepageaction=]
114
115\protect \endinput
116