diff options
Diffstat (limited to 'tex/context/base/page-plg.mkiv')
-rw-r--r-- | tex/context/base/page-plg.mkiv | 101 |
1 files changed, 58 insertions, 43 deletions
diff --git a/tex/context/base/page-plg.mkiv b/tex/context/base/page-plg.mkiv index 004b9204d..ec61da1d2 100644 --- a/tex/context/base/page-plg.mkiv +++ b/tex/context/base/page-plg.mkiv @@ -11,10 +11,11 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% \ifx\pageareabox\undefined \else \endinput \fi - \writestatus{loading}{ConTeXt Page Macros / Extra Page Building} +%D This still needs some work, especially the dimensions need to be +%D checked cq.\ optimized. Beware: method has become alternative! + %D This feature has been present for a while but has never been %D exploited: pluggable pagebuilders. The next example code %D demonstrates the application of one such a plug-in. This variant @@ -31,6 +32,8 @@ %D \startpagelayout[leftpage] %D \setupTABLE[offset=overlay] %D \setupTABLE[c][1][width=\leftmarginwidth] +%D \setupTABLE[c][2][width=\textwidth] +%D \setupTABLE[c][3][width=\rightmarginwidth] %D \bTABLE %D \bTR %D \bTD[nx=3,background=color,backgroundcolor=green] @@ -43,7 +46,7 @@ %D \eTR %D \bTR %D \bTD[nx=3,offset=overlay] -%D {\bTABLE[width=.5\hsize] +%D {\bTABLE %D \bTR %D \bTD \pagearea[footer][text][left] \eTD %D \bTD \pagearea[bottom][text][left] \eTD @@ -56,7 +59,9 @@ %D %D \startpagelayout[rightpage] %D \setupTABLE[offset=overlay] -%D \setupTABLE[c][1][width=\rightmarginwidth] +%D \setupTABLE[c][1][width=\leftmarginwidth] +%D \setupTABLE[c][2][width=\textwidth] +%D \setupTABLE[c][3][width=\rightmarginwidth] %D \bTABLE %D \bTR %D \bTD[nx=3] \pagearea[header][text][middle] \eTD @@ -67,7 +72,7 @@ %D \eTR %D \bTR %D \bTD[nx=3,offset=overlay] -%D {\bTABLE[width=.5\hsize] +%D {\bTABLE %D \bTR %D \bTD \pagearea[bottom][text][right] \eTD %D \bTD \pagearea[footer][text][right] \eTD @@ -80,12 +85,9 @@ %D %D \setupcolors[state=start] %D -%D \setupbackgrounds[text][background=color,backgroundcolor=blue] -%D \setupbackgrounds[header][text][background=color,backgroundcolor=red] -%D %D \setuppagenumbering[alternative=doublesided,location=] %D -%D \setuplayout[method=makeup] +%D \setuplayout[alternative=makeup] %D %D \definetextbackground %D [test] @@ -110,6 +112,8 @@ \unprotect +\installcorenamespace{layoutmakeupalternative} + \def\page_boxes_construct_content_makeup#1#2#3% targetbox flusher box {\setbox#1\hbox {\vbox to \textheight @@ -125,65 +129,76 @@ \dp#1\zeropoint \hsize\paperwidth \vsize\paperheight - \setbox#1\vbox{\csname\??layoutmethod\doifbothsidesoverruled\v!page\v!rightpage\v!leftpage\endcsname}% + \setbox#1\vbox{\csname\??layoutmakeupalternative\doifbothsidesoverruled\v!page\v!rightpage\v!leftpage\endcsname}% \wd#1\paperwidth \ht#1\paperheight \dp#1\zeropoint} \installlayoutalternative\v!makeup{\page_boxes_construct_content_makeup} -\newbox\pageareabox +\newbox\b_page_area \unexpanded\def\pagearea {\dotripleempty\page_area} -\def\page_area[#1][#2][#3]% +\def\page_area {\ifthirdargument - \doifelse{#3}\v!left - {\page_area_indeed{#1}{#2}\c!lefttext} - {\doifelse{#3}\v!right - {\page_area_indeed{#1}{#2}\c!righttext} - {\page_area_indeed{#1}{#2}\c!middletext}}% + \expandafter\page_area_three \else\ifsecondargument - \doifbothsidesoverruled - {\page_area_indeed{#1}{#2}\c!righttext} - {\page_area_indeed{#1}{#2}\c!righttext} - {\page_area_indeed{#1}{#2}\c!lefttext }% + \doubleexpandafter\page_area_two \else - \doif{#1}\v!text % copy due to trial runs in TABLE - {\iftrialtypesetting -% \copy\pagebox - \fakebox\pagebox - \else -% \localpositioningfalse - \page_backgrounds_add_to_text\pagebox - \page_grids_add_to_box\pagebox - \box\pagebox - \fi}% + \doubleexpandafter\page_area_one \fi\fi} +\def\page_area_three[#1][#2][#3]% + {\edef\m_page_area_three{#3}% + \ifx\m_page_area_three\v!left + \let\m_page_area_three\c!lefttext + \else\ifx\m_page_area_three\v!right + \let\m_page_area_three\c!righttext + \else + \let\m_page_area_three\c!middletext + \fi\fi + \page_area_indeed{#1}{#2}\m_page_area_three} + +\def\page_area_two[#1][#2][#3]% + {\edef\m_page_area_three{\doifbothsidesoverruled\c!righttext\c!righttext\c!lefttext}% + \page_area_indeed{#1}{#2}\m_page_area_three} + +\def\page_area_one[#1][#2][#3]% + {\edef\m_page_area_one{#1} + \ifx\m_page_area_one\v!text % copy due to trial runs in TABLE + \iftrialtypesetting + \fakebox\pagebox + \else + \page_backgrounds_add_to_text\pagebox + \page_grids_add_to_box\pagebox + \box\pagebox + \fi + \fi} + \def\page_area_indeed#1#2#3% - {\setbox\pageareabox\vbox{\getspecificlayouttext{#1}{#2}{#3}}% + {\setbox\b_page_area\vbox{\getspecificlayouttext{#1}{#2}{#3}}% \ifsomebackgroundfound{#1#2}% \iftrialtypesetting -% \box\pageareabox - \fakebox\pageareabox + \fakebox\b_page_area \else - \localframed - [\??ma#1#2] - [\c!width=\wd\pageareabox, - \c!height=\ht\pageareabox, + % todo: \localbackgroundframed{\??layoutbackgrounds#1#2}{#1:#2} + \localframed % todo: + [\??layoutbackgrounds#1#2] + [\c!width=\wd\b_page_area, + \c!height=\ht\b_page_area, \c!offset=\v!overlay] - {\box\pageareabox}% + {\box\b_page_area}% \fi \else - \box\pageareabox + \box\b_page_area \fi} % to be done nicely (proper namespacing) -\setvalue{\??layoutmethod\v!leftpage }{\csname\??layoutmethod\v!page\endcsname} -\setvalue{\??layoutmethod\v!rightpage}{\csname\??layoutmethod\v!page\endcsname} +\setvalue{\??layoutmakeupalternative\v!leftpage }{\csname\??layoutmakeupalternative\v!page\endcsname} +\setvalue{\??layoutmakeupalternative\v!rightpage}{\csname\??layoutmakeupalternative\v!page\endcsname} \unexpanded\def\startpagelayout {\bgroup @@ -194,6 +209,6 @@ \def\page_layouts_start_layout[#1]#2\stoppagelayout {\egroup - \setvalue{\??layoutmethod#1}{#2}} + \setvalue{\??layoutmakeupalternative#1}{#2}} \protect \endinput |