summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/scrn-ref.mkvi
blob: df395e5505b8940d5e112894b00af4d5c9d651a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
%D \module
%D   [       file=scrn-ref,
%D        version=1998.01.15,
%D          title=\CONTEXT\ Screen Macros,
%D       subtitle=References, % moved code
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%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 / References}

\registerctxluafile{scrn-ref}{}

\unprotect

\appendtoks
    \doifsomething{\interactionparameter\c!calculate}%
        {\clf_setfieldcalculationset{\interactionparameter\c!calculate}}%
    \doifelse{\interactionparameter\c!click  }\v!yes
        \settrue\setfalse\highlighthyperlinks
    \doifelse{\interactionparameter\c!display}\v!new
        \settrue\setfalse\gotonewwindow
    \doifnot {\interactionparameter\c!page}\v!no
        \scrn_reference_enable_page_destinations
\to \everysetupinteraction

\def\scrn_reference_enable_page_destinations % no reset
  {\clf_setreferencelinkmethod{\interactionparameter\c!page}}

\setupinteraction % start fit page and reset form
  [\c!page=\v!no,
   \c!click=\v!yes,
   \c!display=\v!normal,
   \c!focus=\v!fit,
  %\c!focusoffset=\zeropoint, % when tested with al views it will become 5\points
   \c!focusoffset=5\points,
   \c!calculate=,
   % rendering:
   \c!width=\emwidth,
   \c!height=\zeropoint,
   \c!depth=\zeropoint,
   \c!symbolset=]

% for now here, might become per link

\appendtoks
    \enabledirectives[destinations.offset=\the\dimexpr\interactionparameter\c!focusoffset\relax]%
\to \everysetupinteraction

%D We have to make sure of some settings:

\def\scrn_reference_set_text_actions
  {\iflocation
     \edef\currentinteractionopenaction {\interactionparameter\c!openaction }%
     \edef\currentinteractioncloseaction{\interactionparameter\c!closeaction}%
     \ifx\currentinteractionopenaction\empty \else
       \clf_setopendocumentaction{\currentinteractionopenaction}%
     \fi
     \ifx\currentinteractioncloseaction\empty \else
       \clf_setclosedocumentaction{\currentinteractioncloseaction}%
     \fi
     \glet\scrn_reference_set_text_actions\relax
   \fi}

\def\scrn_reference_set_page_actions
  {\iflocation
     \edef\currentinteractionopenpageaction {\interactionparameter\c!openpageaction }%
     \edef\currentinteractionclosepageaction{\interactionparameter\c!closepageaction}%
     \ifx\currentinteractionopenpageaction\empty \else
       \clf_setopenpageaction{\currentinteractionopenpageaction}%
     \fi
     \ifx\currentinteractionclosepageaction\empty \else
       \clf_setclosepageaction{\currentinteractionclosepageaction}%
     \fi
   \fi}

\appendtoks \scrn_reference_set_text_actions \to \everyshipout
\appendtoks \scrn_reference_set_page_actions \to \everyshipout

%D delayed ...

% \def\scrn_reference_enable_references
%   {\ifproductionrun
%      \clf_enableinteraction % only once anyway
%      \glet\scrn_reference_enable_references\relax
%    \fi}
%
% \appendtoks
%     \scrn_reference_enable_references
% \to \everysetupinteraction

\setupinteraction % start fit page and reset form
  [\c!openaction=,
   \c!closeaction=,
   \c!openpageaction=,
   \c!closepageaction=]

\protect \endinput