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
107
108
109
110
111
112
113
114
115
116
|
%D \module
%D [ file=page-com, % moved from page-imp
%D version=1998.01.15,
%D title=\CONTEXT\ Page Macros,
%D subtitle=Page Comments,
%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.
%D This will become runtime loaded code.
\writestatus{loading}{ConTeXt Page Macros / Page Comments}
\unprotect
%D \macros
%D {setuppagecomment,startpagecomment}
%D
%D This command is not yet documented. Usage:
%D
%D \starttyping
%D \setuppagecomment[state=start,location=right]
%D
%D \startpagecomment
%D \input knuth
%D \stoppagecomment
%D \stoptyping
\unexpanded\def\setuppagecomment
{\dosingleempty\dosetuppagecomment}
\def\dosetuppagecomment[#1]%
{\getparameters[\??pc][#1]%
\doifelse\@@pcstate\v!start
{\doifinsetelse\@@pclocation{\v!bottom,\v!top}
{\setuppapersize[\c!left=\hskip\@@pcoffset]%
\edef\@@pcpaperheight{\the\dimexpr\paperheight+\@@pcoffset+\@@pcoffset+\@@pcdistance+\@@pcheight}%
\edef\@@pcpaperwidth {\the\dimexpr\paperwidth +\@@pcoffset+\@@pcoffset}%
\defineoverlay[\v!pagecomment][\placepagecommentTB]}
{\setuppapersize[\c!top=\vskip\@@pcoffset]%
\edef\@@pcpaperheight{\the\dimexpr\paperheight+\@@pcoffset+\@@pcoffset}%
\edef\@@pcpaperwidth {\the\dimexpr\paperwidth +\@@pcoffset+\@@pcoffset+\@@pcdistance+\@@pcwidth}%
\defineoverlay[\v!pagecomment][\placepagecommentLR]}%
\processaction
[\@@pclocation]
[ \v!bottom=>{\setuplayout[\c!location=]\setuppapersize[\c!bottom=\vss,\c!top =\vskip\@@pcoffset]},
\v!top=>{\setuplayout[\c!location=]\setuppapersize[\c!top =\vss,\c!bottom=\vskip\@@pcoffset]},
\v!left=>{\setuplayout[\c!location=]\setuppapersize[\c!left =\hss,\c!right =\hskip\@@pcoffset]},
\v!right=>{\setuplayout[\c!location=]\setuppapersize[\c!right =\hss,\c!left =\hskip\@@pcoffset]}]%
\definepapersize
[\v!pagecomment]
[\c!height=\@@pcpaperheight,
\c!width=\@@pcpaperwidth]%
\let\@@pcprintpapersize\printpapersize
\setuppapersize[\papersize][\v!pagecomment]%
\setupbackgrounds[\v!paper][\c!background=\v!pagecomment]}% todo append if already set
{\doif\@@pcstate\v!stop % else initialization invokes backgrounds
{% this should be tested first
% \normalexpanded{\noexpand\setuppapersize[\papersize][\@@pcprintpapersize]}%
\setupbackgrounds[\v!paper][\c!background=]}}}
\def\@@pcprintpapersize{\printpapersize}
\unexpanded\def\placepagecommentTB
{\vbox to \printpaperheight
{%\forgetall
\hsize\printpaperwidth
\vskip\@@pcoffset
\doifelse\@@pclocation\v!bottom{\vskip\dimexpr\paperheight+\@@pcdistance\relax}\vss
\hskip\@@pcoffset
\vbox to \@@pcheight
{%\forgetall
\hsize\paperwidth
\ifpagecomment
\getbuffer[\v!pagecomment]%
\global\pagecommentfalse
\fi}%
\hfill
\doifelse\@@pclocation\v!bottom\vss{\vskip\dimexpr\paperheight+\@@pcdistance\relax}%
\vskip\@@pcoffset}}
\unexpanded\def\placepagecommentLR
{\hbox to \printpaperwidth
{\hskip\@@pcoffset
\doifelse\@@pclocation\v!right{\hskip\paperwidth\hskip\@@pcdistance}\hss
\vbox to \printpaperheight
{%\forgetall
\vskip\@@pcoffset
\hsize\@@pcwidth
\ifpagecomment
\getbuffer[\v!pagecomment]%
\global\pagecommentfalse
\fi
\vss}%
\doifelse\@@pclocation\v!right\hss{\hskip\paperwidth\hskip\@@pcdistance}%
\hskip\@@pcoffset}}
\newif\ifpagecomment
\setvalue{\e!start\v!pagecomment}%
{\global\pagecommenttrue
\dostartbuffer[\v!pagecomment][\e!start\v!pagecomment][\e!stop\v!pagecomment]}
\setuppagecomment
[\c!state=, % \v!stop would invoke background calculation
\c!location=\v!bottom,
\c!offset=.5cm,
\c!distance=.5cm,
\c!height=5cm,
\c!width=10cm]
\protect \endinput
|