summaryrefslogtreecommitdiff
path: root/tex/context/base/page-mrk.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/page-mrk.mkiv')
-rw-r--r--tex/context/base/page-mrk.mkiv259
1 files changed, 259 insertions, 0 deletions
diff --git a/tex/context/base/page-mrk.mkiv b/tex/context/base/page-mrk.mkiv
new file mode 100644
index 000000000..9923632ac
--- /dev/null
+++ b/tex/context/base/page-mrk.mkiv
@@ -0,0 +1,259 @@
+%D \module
+%D [ file=page-mrk,
+%D version=2011.05.23, % moved from page-lay
+%D title=\CONTEXT\ Page Macros,
+%D subtitle=Cutmarks and Colorbars,
+%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 / Cutmarks and Colorbars}
+
+%D This module depends on \METAPOST.
+
+\unprotect
+
+% \def\pagecutmarksymbol {\the\realpageno}
+% \let\pagecutmarktoptext \empty
+% \let\pagecutmarkbottomtext \empty
+
+\def\pagecutmarklength {5mm}
+\def\pagecutmarkoffset {3mm} % slightly larger than before, and now a fixed size
+\def\pagecutmarkmargin{10cm}
+
+\newconditional\c_page_marks_add_more_color
+\newconditional\c_page_marks_add_more_marking
+\newconditional\c_page_marks_add_more_lines
+\newconditional\c_page_marks_add_page_lines
+\newconditional\c_page_marks_add_more_number
+
+\startuniqueMPgraphic{print:color}{w,h,l,o}
+ page_marks_add_color(\MPvar w,\MPvar h,\MPvar l,\MPvar o) ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{print:marking}{w,h,l,o}
+ page_marks_add_marking(\MPvar w,\MPvar h,\MPvar l,\MPvar o) ;
+\stopuniqueMPgraphic
+
+\startuniqueMPgraphic{print:lines}{w,h,l,o}
+ page_marks_add_lines(\MPvar w,\MPvar h,\MPvar l,\MPvar o) ;
+\stopuniqueMPgraphic
+
+\startuseMPgraphic{print:number}{w,h,l,o,n}
+ page_marks_add_number(\MPvar w,\MPvar h,\MPvar l,\MPvar o,\MPvar n) ;
+\stopuseMPgraphic
+
+\def\page_marks_add_color
+ {\setlayoutcomponentattribute\v!print\v!color
+ \setbox\scratchbox\hbox \layoutcomponentboxattribute\bgroup
+ \uniqueMPgraphic
+ {print:color}%
+ {w=\the\scratchwidth ,h=\the\scratchheight,%
+ l=\pagecutmarklength,o=\pagecutmarkoffset}%
+ \egroup
+ \wd\scratchbox\scratchwidth\ht\scratchbox\scratchheight\dp\scratchbox\scratchdepth
+ \hskip-\scratchwidth\box\scratchbox}
+
+\def\page_marks_add_marking
+ {\setlayoutcomponentattribute\v!print\v!marking
+ \setbox\scratchbox\hbox \layoutcomponentboxattribute\bgroup
+ \uniqueMPgraphic
+ {print:marking}%
+ {w=\the\scratchwidth ,h=\the\scratchheight,%
+ l=\pagecutmarklength,o=\pagecutmarkoffset}%
+ \egroup
+ \wd\scratchbox\scratchwidth\ht\scratchbox\scratchheight\dp\scratchbox\scratchdepth
+ \hskip-\scratchwidth\box\scratchbox}
+
+\def\page_marks_add_lines
+ {\setlayoutcomponentattribute\v!print\v!lines
+ \setbox\scratchbox\hbox \layoutcomponentboxattribute\bgroup
+ \uniqueMPgraphic
+ {print:lines}%
+ {w=\the\scratchwidth ,h=\the\scratchheight,%
+ l=\pagecutmarklength,o=\pagecutmarkoffset}%
+ \egroup
+ \wd\scratchbox\scratchwidth\ht\scratchbox\scratchheight\dp\scratchbox\scratchdepth
+ \hskip-\scratchwidth\box\scratchbox}
+
+\def\page_marks_add_number
+ {\setlayoutcomponentattribute\v!print\v!number
+ \setbox\scratchbox\hbox \layoutcomponentboxattribute\bgroup
+ \useMPgraphic
+ {print:number}%
+ {w=\the\scratchwidth ,h=\the\scratchheight,%
+ l=\pagecutmarklength,o=\pagecutmarkoffset,%
+ n=\realfolio}%
+ \egroup
+ \wd\scratchbox\scratchwidth\ht\scratchbox\scratchheight\dp\scratchbox\scratchdepth
+ \hskip-\scratchwidth\box\scratchbox}
+
+\def\page_marks_add_page_indeed#1%
+ {\setbox#1\hbox\bgroup
+ \let\objectoffset\pagecutmarkmargin
+ %\infofont
+ \scratchwidth \wd#1%
+ \scratchheight\ht#1%
+ \scratchdepth \dp#1%
+ \box#1\relax
+ \ifconditional\c_page_marks_add_page_lines
+ \page_marks_add_lines
+ \fi
+ \egroup}
+
+\def\page_marks_add_more_indeed#1%
+ {\setbox#1\hbox\bgroup
+ \let\objectoffset\pagecutmarkmargin
+ \infofont
+ \scratchwidth \wd#1% these can move out
+ \scratchheight\ht#1%
+ \scratchdepth \dp#1%
+ \box#1\relax
+ \ifconditional\c_page_marks_add_more_color
+ \page_marks_add_color
+ \fi
+ \ifconditional\c_page_marks_add_more_marking
+ \page_marks_add_marking
+ \fi
+ \ifconditional\c_page_marks_add_more_lines
+ \page_marks_add_lines
+ \fi
+ \ifconditional\c_page_marks_add_more_number
+ \page_marks_add_number
+ \fi
+ \egroup}
+
+\let\page_marks_add_page\gobbleoneargument
+\let\page_marks_add_more\gobbleoneargument
+
+\def\installpagecutmark#1#2%
+ {\setvalue{\??ly:n:\c!marking:#1}{#2}}
+
+% \installpagecutmark\v!off
+% {}
+
+% \installpagecutmark\v!text
+% {\settrue\c_page_marks_add_more_lines
+% \settrue\c_page_marks_add_more_number
+% \let\pagecutmarksymbol\empty
+% \let\pagecutmarkbottomtext\extrapagecutmarkbottomtext}
+
+\installpagecutmark\v!on
+ {\settrue\c_page_marks_add_page_lines
+ \settrue\c_page_marks_add_more_lines
+ \settrue\c_page_marks_add_more_number}
+
+\installpagecutmark\v!page % todo
+ {\settrue\c_page_marks_add_more_lines
+ \settrue\c_page_marks_add_more_number}
+
+\installpagecutmark\v!empty
+ {\settrue\c_page_marks_add_page_lines
+ \settrue\c_page_marks_add_more_lines}
+
+\installpagecutmark\v!color
+ {\settrue\c_page_marks_add_page_lines
+ \settrue\c_page_marks_add_more_lines
+ \settrue\c_page_marks_add_more_color
+ \settrue\c_page_marks_add_more_marking
+ \settrue\c_page_marks_add_more_number}
+
+\appendtoks
+ \setfalse\c_page_marks_add_more_color
+ \setfalse\c_page_marks_add_more_marking
+ \setfalse\c_page_marks_add_more_lines
+ \setfalse\c_page_marks_add_more_number
+ \csname\??ly:n:\c!marking:\layoutparameter\c!marking\endcsname
+ \ifconditional\c_page_marks_add_page_lines
+ \let\page_marks_add_page\page_marks_add_page_indeed
+ \else
+ \let\page_marks_add_page\gobbleoneargument
+ \fi
+ \ifconditional\c_page_marks_add_more_lines
+ \let\page_marks_add_more\page_marks_add_more_indeed
+ \else\ifconditional\c_page_marks_add_more_color
+ \let\page_marks_add_more\page_marks_add_more_indeed
+ \else\ifconditional\c_page_marks_add_more_marking
+ \let\page_marks_add_more\page_marks_add_more_indeed
+ \else\ifconditional\c_page_marks_add_more_number
+ \let\page_marks_add_more\page_marks_add_more_indeed
+ \else
+ \let\page_marks_add_more\gobbleoneargument
+ \fi\fi\fi\fi
+\to \everysetuplayout
+
+\setuplayout
+ [\c!marking=\v!off]
+
+\protect \endinput
+
+% We keep the old code for while.
+
+% \def\pagecutmarksymbol {\the\realpageno}
+% \def\pagecutmarklength {.5cm}
+% \let\pagecutmarktoptext \empty
+% \let\pagecutmarkbottomtext \empty
+% \def\pagecutmarkoffset {.5\dimexpr\pagecutmarklength\relax}
+%
+% \def\extrapagecutmarkbottomtext
+% {\rlap{\jobname}\hfill\currentdate\space-\space\currenttime\hfill\llap{\realfolio}}
+%
+% \def\makepagecutbox % #1
+% {\let\cutmarksymbol \pagecutmarksymbol
+% \let\cutmarklength \pagecutmarklength
+% \let\cutmarktoptext \pagecutmarktoptext
+% \let\cutmarkbottomtext\pagecutmarkbottomtext
+% \let\cutmarkhoffset \pagecutmarkoffset
+% \let\cutmarkvoffset \pagecutmarkoffset
+% \makecutbox}
+%
+% \newcount\currentpagebox % will be used in more places
+%
+% \def\installpagecutmark #1#2{\setvalue{\??ly:n:\c!marking:#1}{#2}}
+% \def\installpagecolormark#1#2{\setvalue{\??ly:c:\c!marking:#1}{#2}}
+%
+% % \def\addpagecolormarks{\expandcheckedcsname{\??ly:c:\c!marking:}{\layoutparameter\c!marking}\s!unknown}
+% % \def\addpagecutmarks {\expandcheckedcsname{\??ly:n:\c!marking:}{\layoutparameter\c!marking}\s!unknown}
+%
+% \def\addpagecutmarks#1% only at outer when nx/ny > 0
+% {\ifcsname\??ly:n:\c!marking:\layoutparameter\c!marking\endcsname
+% \currentpagebox#1\relax
+% \csname\??ly:n:\c!marking:\layoutparameter\c!marking\endcsname
+% \fi}
+%
+% \def\addpagecolormarks#1%
+% {\ifcsname\??ly:c:\c!marking:\layoutparameter\c!marking\endcsname
+% \currentpagebox#1\relax
+% \ifnum\horizontalcutmarks>\plustwo \def\colormarkoffset{\plusfour}\fi
+% \ifnum\verticalcutmarks >\plustwo \def\colormarkoffset{\plusfour}\fi
+% \csname\??ly:c:\c!marking:\layoutparameter\c!marking\endcsname
+% \fi}
+%
+% \installpagecutmark\v!on
+% {\makepagecutbox\currentpagebox}
+%
+% \installpagecutmark\v!page
+% {\makepagecutbox\currentpagebox}
+%
+% \installpagecutmark\v!empty
+% {\let\pagecutmarksymbol\empty
+% \let\pagecutmarktoptext\empty
+% \let\pagecutmarkbottomtext\empty
+% \makepagecutbox\currentpagebox}
+%
+% \installpagecutmark\v!text
+% {\let\pagecutmarksymbol\empty
+% \let\pagecutmarkbottomtext\extrapagecutmarkbottomtext
+% \makepagecutbox\currentpagebox}
+%
+% \installpagecolormark\v!color
+% {\makepagecutbox\currentpagebox % maybe move this elsewhere
+% \colormarkbox\currentpagebox}
+%
+% \installpagecolormark\v!screen % obsolete (all \v!screen will be removed)
+% {\makepagecutbox\currentpagebox % maybe move this elsewhere
+% \rastermarkbox\currentpagebox}