summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/page-inf.mkiv
blob: 6c220fb310c7d1594e159a39382f2cdeee00de0e (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
103
104
105
106
%D \module
%D   [       file=page-inf,   % moved from page-ini
%D        version=2011.12.07, % 2000.10.20,
%D          title=\CONTEXT\ Page Macros,
%D       subtitle=Tracing Info,
%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 Page Macros / Tracing Info}

% this needs a real cleanup .. will be a more detailed list

\unprotect

\installcorenamespace{layoutinfo}

\newtoks\everyresetversion
\newtoks\everysetupversion

\let\currentversioninfo\empty

\def\setupversion
  {\dosingleargument\page_info_setup}

\let\version\setupversion

\let\page_info_add_to_box\gobbleoneargument

\def\page_info_setup[#1]%
  {\the\everyresetversion
   \ifcsname\??layoutinfo#1\endcsname
     \edef\currentversioninfo{#1}%
     \let\page_info_add_to_box\page_info_add_to_box_indeed
   \else
     \let\currentversioninfo\empty
     \let\page_info_add_to_box\gobbleoneargument
   \fi
   \the\everysetupversion}

\unexpanded\def\page_info_place_info % at the bottom of the page
  {\csname\??layoutinfo\currentversioninfo\endcsname}

\unexpanded\def\installversioninfo#1#2%
  {\setvalue{\??layoutinfo#1}{#2}}

\unexpanded\def\includeversioninfo#1%
  {\csname\??layoutinfo#1\endcsname}

\installversioninfo\v!concept
  {\vskip\!!sixpoint
   \hbox to \makeupwidth
     {\infofont
      \v!concept:\space\currentdate
      \hss
      \page_adapts_status_info}}

\installversioninfo\v!file
  {\vskip\!!sixpoint
   \hbox to \makeupwidth
     {\infofont
      \getmessage\m!system{27}:\space\currentdate\space
      \donefalse
      \ifx\currentproject  \empty \else \space\v!project  :\space\currentproject  \space \donetrue \fi
      \ifx\currentproduct  \empty \else \space\v!product  :\space\currentproduct  \space \donetrue \fi
      \ifx\currentcomponent\empty \else \space\v!component:\space\currentcomponent\space \donetrue \fi
      \ifdone                     \else \space\v!file     :\space\jobname         \space           \fi
      \hss
      \page_adapts_status_info}}

\installversioninfo\v!temporary
  {\includeversioninfo\v!file}

\appendtoks
    \overfullrule\zeropoint
\to \everyresetversion

\appendtoks
    \ifx\currentversioninfo\v!temporary
        \overfullrule5\points
    \fi
\to \everysetupversion

\newbox\b_page_versions

\def\page_info_add_to_box_indeed#1%
  {\scratchdimen\wd#1%
   \setbox\b_page_versions\vbox to \ht#1%
     {\vfill
      \settexthoffset
      \hsize\dimexpr\scratchdimen-2\texthoffset\relax
      \hskip\texthoffset % brrrr
      \vbox to \zeropoint{\vss\page_info_place_info}%
      \vskip\bodyfontsize}%
   \dp\b_page_versions\zeropoint
   \wd\b_page_versions\scratchdimen
   \setbox#1\hbox{\box#1\hskip-\scratchdimen\box\b_page_versions}}

\setupversion % resets
  [\v!final]

\protect \endinput