diff options
author | Taco Hoekwater <taco@elvenkind.com> | 2011-06-01 08:54:21 +0000 |
---|---|---|
committer | Taco Hoekwater <taco@elvenkind.com> | 2011-06-01 08:54:21 +0000 |
commit | d7ccb42582f85acf30568913610ccf4d602023fb (patch) | |
tree | 7292e3545a420676878e7451b68892d360c62cb6 /Master/texmf-dist/tex/context/base/anch-pgr.mkiv | |
parent | 2d62a6fe9b80def59c392268022f1f9a2d6e358f (diff) |
commit context 2011.05.18
git-svn-id: svn://tug.org/texlive/trunk@22719 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/anch-pgr.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/anch-pgr.mkiv | 475 |
1 files changed, 183 insertions, 292 deletions
diff --git a/Master/texmf-dist/tex/context/base/anch-pgr.mkiv b/Master/texmf-dist/tex/context/base/anch-pgr.mkiv index 248b9ca5e31..afa88193384 100644 --- a/Master/texmf-dist/tex/context/base/anch-pgr.mkiv +++ b/Master/texmf-dist/tex/context/base/anch-pgr.mkiv @@ -69,10 +69,14 @@ \def\registerpageposition#1% this one is flushed first ! {\ifpositioning\ifcase\realpageno\or - \ifdim\printpaperheight=\paperheight\else - \ifdim\printpaperwidth=\paperwidth\else + \ifdim\printpaperheight=\paperheight + \ifdim\printpaperwidth=\paperwidth + % not needed, + \else \setbox#1\hbox{\hpos\pageanchor{\box#1}}% \fi + \else + \setbox#1\ruledhbox{\hpos\pageanchor{\box#1}}% \fi \fi\fi} @@ -143,11 +147,6 @@ \def\MPanchoridentifier{mpa} % {mp-anchor} \def\MPoverlayposprefix{MO::} -% obsolete and wrong anyway -% -% \long\unexpanded\def\defineMPpositiongraphic#1% -% {\long\setvalue{\MPoverlayposprefix#1}} - %D The rest of the definitions concerning such overlays may %D look complicated, @@ -213,16 +212,6 @@ \fi \fi} -% \def\cleanuppositionaction#1% not in trialtypesetting -% {\ifcsname\POSactionprefix#1++\endcsname -% \the\everycleanpositionaction -% \iflocalpositioning -% \global\expandafter\let\csname\POSactionprefix#1++\endcsname\empty -% \else -% \global\expandafter\let\csname\POSactionprefix#1++\expandafter\endcsname\csname\POSactionprefix#1++\endcsname -% \fi -% \fi} - \def\handlepositionaction#1\with#2\on#3% {\bgroup \ifx\currentpositionoverlay\empty @@ -627,6 +616,7 @@ \appendtoks % a position can be mid paragraph in which case we're behind + % this will change when we move positions to lua \initializeparbackgrounds \to \everystarttext @@ -842,42 +832,6 @@ \def\calculatenexttextpardimensions {\docalculatetextpardimensions\nextbtbanchor\nextetbanchor\relax} -% \def\docalculatetextpardimensions#1#2#3% #1=\btbanchor #2=\etbanchor -% {\scratchcounter\numexpr\MPp#2-\MPp#1\relax -% \edef\textparpages{\the\scratchcounter}% -% \ifcase\scratchcounter -% % one page -% \scratchdimen\dimexpr\MPy#1-\MPy#2\relax -% \else -% % two or more pages -% \ifnum\scratchcounter>2 -% \ifnum\scratchcounter<5 -% % more pages -% \scratchdimen\textheight -% \advance\scratchcounter \minusone -% \multiply\scratchdimen \scratchcounter -% \else -% % keep'm small -% \scratchdimen5\textheight -% \fi -% \else -% \scratchdimen\dimexpr\MPy#1-\MPy#2-\MPy\textanchor+\MPy\textanchor+\MPh\textanchor\relax -% \fi -% \fi -% \edef\textparheight{\the\scratchdimen}% -% \ifcase\scratchcounter -% % one page -% \scratchdimen\dimexpr\MPx#2-\MPx#1\relax -% \else -% % two or more pages / maybe also hang -% \ifx#3\relax -% \scratchdimen\makeupwidth % \textwidth -% \else -% \scratchdimen\dimexpr\MPw\MPparanchor-\MPl\MPparanchor-\MPr\MPparanchor\relax -% \fi -% \fi -% \edef\textparwidth{\the\scratchdimen}} - \def\docalculatetextpardimensions#1#2#3% #1=\btbanchor #2=\etbanchor (adapted 8/6/2009) {\scratchcounter\numexpr\MPp#2-\MPp#1\relax \edef\textparpages @@ -1017,8 +971,6 @@ \ifx\basegrid\undefined \else \letvalue\v!grid=\basegrid \fi -% lelijk, aanpassen, opties - \setupMPvariables [mpos:connect] [linecolor=red, @@ -1109,226 +1061,187 @@ \def\stackposleft {\dostackposbox{\copy\nextbox\hskip\nextboxwd\hskip\stackposdistance}} \def\stackposright{\dostackposbox{\hskip\stackposdistance\hskip\nextboxwd\flushnextbox}} -%D \macros -%D {stackeddown} -%D -%D However, a better implementation is possible with the -%D following macro. We now have an extra key \type {stack} for -%D margin settings. When set to \type {yes}, this macro comes -%D into action. - -% Because there can be many stacked items in a line and successive lines, we -% play dirty and adapt the position and height of the current node so that -% this becomes visible to a next pass. +% obsolete % -% \startbuffer -% \inleft {test 1} test 1 \inleft {test 2} test 2 \endgraf -% \inleft {test 3} test 3 -% \stopbuffer -% \getbuffer \typebuffer \flushstatus \page +% %D \macros +% %D {stackeddown} +% %D +% %D However, a better implementation is possible with the +% %D following macro. We now have an extra key \type {stack} for +% %D margin settings. When set to \type {yes}, this macro comes +% %D into action. % -% \startbuffer -% \inleft {test 1} test 1 \inleft {test 2} test 2 \inleft {test 3} test 3 \endgraf -% \inleft {test 4} test 4 -% \stopbuffer -% \getbuffer \typebuffer \flushstatus \page +% % Because there can be many stacked items in a line and successive lines, we +% % play dirty and adapt the position and height of the current node so that +% % this becomes visible to a next pass. +% % +% % \startbuffer +% % \inleft {test 1} test 1 \inleft {test 2} test 2 \endgraf +% % \inleft {test 3} test 3 +% % \stopbuffer +% % \getbuffer \typebuffer \flushstatus \page +% % +% % \startbuffer +% % \inleft {test 1} test 1 \inleft {test 2} test 2 \inleft {test 3} test 3 \endgraf +% % \inleft {test 4} test 4 +% % \stopbuffer +% % \getbuffer \typebuffer \flushstatus \page +% % +% % \startbuffer +% % \inleft {test 1} test 1 \endgraf +% % \inleft {test 2} test 2 \endgraf +% % \inleft {test 3} test 3 +% % \stopbuffer +% % \getbuffer \typebuffer \flushstatus \page +% % +% % \startbuffer +% % \inleft {test 1\\test 1} test 1 \inleft {test 2} test 2 \endgraf +% % \inleft {test 3} test 3 +% % \stopbuffer +% % \getbuffer \typebuffer \flushstatus \page +% % +% % \startbuffer +% % \inleft {test 1\\test 1\\test 1\\test 1\\test 1} test 1 \endgraf +% % test 2 \endgraf +% % \inleft {test 3} test 3 +% % \stopbuffer +% % \getbuffer \typebuffer \flushstatus \page +% % +% % \startbuffer +% % \inleft{test 1} test \inleft{test 2} test \inleft{test 3\\test 3} test +% % \stopbuffer +% % \getbuffer \typebuffer \flushstatus \page +% % +% % \startbuffer +% % \inleft{test 1\\test 1\\test 1} test \inleft{test 2\\test 2} test \inleft{test 3\\test 3\\test 3} test \endgraf +% % \inleft{test 1\\test 1\\test 1} test \inleft{test 2\\test 2} test \inleft{test 3\\test 3\\test 3} test +% % \stopbuffer +% % \getbuffer \typebuffer \flushstatus \page % -% \startbuffer -% \inleft {test 1} test 1 \endgraf -% \inleft {test 2} test 2 \endgraf -% \inleft {test 3} test 3 -% \stopbuffer -% \getbuffer \typebuffer \flushstatus \page +% \newdimen\laststackvmove % use \scratchdimenone instead of skip % -% \startbuffer -% \inleft {test 1\\test 1} test 1 \inleft {test 2} test 2 \endgraf -% \inleft {test 3} test 3 -% \stopbuffer -% \getbuffer \typebuffer \flushstatus \page +% \def\stackeddown +% {\bgroup +% % this macro assumes a few things and is meant to work for margin notes +% \dowithnextbox +% {\global\advance\currentautopos\plusone +% \global\laststackvmove\zeropoint +% \hpos{\POSstackprefix\number\currentautopos} +% {\edef\next +% {\nextboxht\the\nextboxht +% \nextboxdp\the\nextboxdp +% \nextboxwd\the\nextboxwd}% +% \previousautopos\currentautopos +% \scratchdimen\zeropoint +% \scratchcounter\zerocount +% \doloop +% {\advance\previousautopos\minusone +% \edef\currentposition {\POSstackprefix\number\currentautopos}% +% \edef\previousposition{\POSstackprefix\number\previousautopos}% +% \ifnum\MPp\currentposition=\MPp\previousposition\relax +% %\registerstatus{doing \number\currentautopos/\number\previousautopos}% +% \doifoverlappingelse\currentposition\previousposition +% {\scratchskip\dimexpr +% \MPy\currentposition +% -\MPy\previousposition +% -\MPd\currentposition % untested +% +\MPd\previousposition % untested +% +\MPh\currentposition +% \relax\relax % second relax realy needed, forgotten while dimexpressing +% % todo: also take depth into account +% \ifdim\scratchskip<\scratchdimen +% %\registerstatus{no \the\scratchskip}% +% \else +% %\registerstatus{yes \the\scratchskip}% +% \scratchdimen\scratchskip +% \fi}% +% \donothing % {\registerstatus{next}}% +% \ifnum\previousautopos<\zerocount\exitloop\fi +% \else +% \exitloop +% \fi}% +% \ifdim\scratchdimen=\zeropoint \else +% \bgroup +% \edef\currentposition{\POSstackprefix\number\currentautopos}% +% \scratchskip\scratchdimen +% \advance\scratchskip\MPh\currentposition +% \scratchdimen-\scratchdimen +% \advance\scratchdimen\MPy\currentposition +% %\registerstatus{old \number\currentautopos: \MPy\currentposition/\MPh\currentposition}% +% \expanded{\replacepospxywhd +% {\currentposition}{\MPp\currentposition}{\MPx\currentposition}{\the\scratchdimen}% +% {\MPw\currentposition}{\the\scratchskip}{\MPd\currentposition}}% +% %\registerstatus{new \number\currentautopos: \MPy\currentposition/\MPh\currentposition}% +% \egroup +% \global\laststackvmove\scratchdimen % new +% \setbox\nextbox\iftracepositions\@EA\ruledhbox\else\@EA\hbox\fi +% {\lower\scratchdimen\flushnextbox}% +% \next +% %\registerstatus{\strut}% +% \fi +% \flushnextbox}% +% \egroup}} % -% \startbuffer -% \inleft {test 1\\test 1\\test 1\\test 1\\test 1} test 1 \endgraf -% test 2 \endgraf -% \inleft {test 3} test 3 -% \stopbuffer -% \getbuffer \typebuffer \flushstatus \page +% %D The next hack make sure that margin texts near faulty +% %D strutted lines are handled ok. % -% \startbuffer -% \inleft{test 1} test \inleft{test 2} test \inleft{test 3\\test 3} test -% \stopbuffer -% \getbuffer \typebuffer \flushstatus \page +% \newif\ifrepositionmarginbox \repositionmarginboxtrue % -% \startbuffer -% \inleft{test 1\\test 1\\test 1} test \inleft{test 2\\test 2} test \inleft{test 3\\test 3\\test 3} test \endgraf -% \inleft{test 1\\test 1\\test 1} test \inleft{test 2\\test 2} test \inleft{test 3\\test 3\\test 3} test -% \stopbuffer -% \getbuffer \typebuffer \flushstatus \page - -\newdimen\laststackvmove % use \scratchdimenone instead of skip - -\def\stackeddown - {\bgroup - % this macro assumes a few things and is meant to work for margin notes - \dowithnextbox - {\global\advance\currentautopos\plusone - \global\laststackvmove\zeropoint - \hpos{\POSstackprefix\number\currentautopos} - {\edef\next - {\nextboxht\the\nextboxht - \nextboxdp\the\nextboxdp - \nextboxwd\the\nextboxwd}% - \previousautopos\currentautopos - \scratchdimen\zeropoint - \scratchcounter\zerocount - \doloop - {\advance\previousautopos\minusone - \edef\currentposition {\POSstackprefix\number\currentautopos}% - \edef\previousposition{\POSstackprefix\number\previousautopos}% - \ifnum\MPp\currentposition=\MPp\previousposition\relax - %\registerstatus{doing \number\currentautopos/\number\previousautopos}% - \doifoverlappingelse\currentposition\previousposition - {\scratchskip\dimexpr - \MPy\currentposition - -\MPy\previousposition - -\MPd\currentposition % untested - +\MPd\previousposition % untested - +\MPh\currentposition - \relax\relax % second relax realy needed, forgotten while dimexpressing - % todo: also take depth into account - \ifdim\scratchskip<\scratchdimen - %\registerstatus{no \the\scratchskip}% - \else - %\registerstatus{yes \the\scratchskip}% - \scratchdimen\scratchskip - \fi}% - \donothing % {\registerstatus{next}}% - \ifnum\previousautopos<\zerocount\exitloop\fi - \else - \exitloop - \fi}% - \ifdim\scratchdimen=\zeropoint \else - \bgroup - \edef\currentposition{\POSstackprefix\number\currentautopos}% - \scratchskip\scratchdimen - \advance\scratchskip\MPh\currentposition - \scratchdimen-\scratchdimen - \advance\scratchdimen\MPy\currentposition - %\registerstatus{old \number\currentautopos: \MPy\currentposition/\MPh\currentposition}% - \expanded{\replacepospxywhd - {\currentposition}{\MPp\currentposition}{\MPx\currentposition}{\the\scratchdimen}% - {\MPw\currentposition}{\the\scratchskip}{\MPd\currentposition}}% - %\registerstatus{new \number\currentautopos: \MPy\currentposition/\MPh\currentposition}% - \egroup - \global\laststackvmove\scratchdimen % new - \setbox\nextbox\iftracepositions\@EA\ruledhbox\else\@EA\hbox\fi - {\lower\scratchdimen\flushnextbox}% - \next - %\registerstatus{\strut}% - \fi - \flushnextbox}% - \egroup}} - -%D The next hack make sure that margin texts near faulty -%D strutted lines are handled ok. - -\newif\ifrepositionmarginbox \repositionmarginboxtrue - -\newcount\currentmarginpos - -\def\dopositionmarginbox#1% - {\bgroup - \ifrepositionmarginbox - \global\advance\currentmarginpos\plusone - %\setposition{\s!margin:\number\currentmarginpos}% not always - \ifcase\marginrepositionmethod - % nothing - \or - % nothing - \or - % stack / page check yet untested - \setposition{\s!margin:\number\currentmarginpos}% - \scratchdimen\MPy{\s!margin:\number\currentmarginpos}% - \global\advance\currentmarginpos\plusone - \advance\scratchdimen -\MPy{\s!margin:\number\currentmarginpos}% - \advance\scratchdimen -\strutdp - % new but bugged - % \setbox#1\hbox - % {\hskip-\MPx{\s!margin:\number\currentmarginpos}% - % \hskip\MPx{head:\the\realpageno}% - % \box#1}% - % so far - \setbox#1\hbox - {\setposition{\s!margin:\number\currentmarginpos}% - \raise\scratchdimen\box#1}% - \or - % move up - \setposition{\s!margin:\number\currentmarginpos}% - \ifnum\MPp{p:\number\parposcounter}=\MPp{\s!margin:\number\currentmarginpos}\relax - \scratchdimen\dimexpr\MPy{p:\number\parposcounter}-\MPy{\s!margin:\number\currentmarginpos}\relax - \expanded{\setbox#1\hbox{\raise\scratchdimen\box#1}\ht#1\the\ht#1\dp#1\the\dp#1}% - \fi - \or - % move up, assume end of par - \setposition{\s!margin:\number\currentmarginpos}% - \ifnum\MPp{p:\number\parposcounter}=\MPp{\s!margin:\number\currentmarginpos}\relax - \getnoflines\margincontentheight - \advance\noflines\minusone - \scratchdimen\noflines\lineheight - \else - \scratchdimen\dimexpr\MPy{p:\number\parposcounter}-\MPy{\s!margin:\number\currentmarginpos}\relax - \fi - \expanded{\setbox#1\hbox{\raise\scratchdimen\box#1}\ht#1\the\ht#1\dp#1\the\dp#1}% - \fi - \dp#1\zeropoint - \ht#1\zeropoint - \fi - \graphicvadjust{\dontleavehmode\box#1}% dontleavehmode is needed to get direction right - \egroup} - -\chardef\marginrepositionmethod\plusone % sidemethod -\chardef\margincontentmethod \plusthree % textmethod % beware: 1 = old method -\chardef\marginpagecheckmethod \plusone % splitmethod - -%D For a right menu, a sequence of calls to \type -%D {right_menu_button} is generated. -%D -%D \starttyping -%D right_menu_button (n, p, s=0/1/2, x, y, w, h, d) ; -%D \stoptyping -%D -%D Here, n is the number of the button, s a status variable, -%D while the rest is positional info. The status variable is -%D 0, 1 or~2: not found, found and found but current page. - -% 0=not found 1=found 2=current page - -% geen leeg - -\newtoks\MPmenutoks - -\def\MPmenubuttons#1{\the\MPmenutoks} - -\appendtoks \global\MPmenutoks\emptytoks \to \everyshipout - -% 0=notfound 1=found 2=currentpage - -\def\domenuitemposition#1#2#3% - {\doifelsevalue{\??am#1\c!position}\v!yes - {\doglobal\increment\currentamposition - \doifreferencefoundelse{#2}% 0=not found, 1=same page, >1=elsewhere - {\chardef\currentamrealpage\ifnum\currentreferencerealpage=\realpageno\plusone\else\plustwo\fi}% - {\chardef\currentamrealpage\plustwo}% - \expanded - {\doglobal\noexpand\appendtoks - #1_menu_button(\number\currentamposition,\the\currentamrealpage,\MPpos{#1:\currentamposition}) ; - \to \MPmenutoks}% - \hpos{#1:\currentamposition}{#3}} - {#3}} - -\def\dowholemenuposition#1% - {\ifnum\currentamposition>0 - \dowithnextbox{\hpos{menu:#1:\the\realpageno}{\flushnextbox}}\hbox - \fi} +% \newcount\currentmarginpos +% +% \def\dopositionmarginbox#1% +% {\bgroup +% \ifrepositionmarginbox +% \global\advance\currentmarginpos\plusone +% %\setposition{\s!margin:\number\currentmarginpos}% not always +% \ifcase\marginrepositionmethod +% % nothing +% \or +% % nothing +% \or +% % stack / page check yet untested +% \setposition{\s!margin:\number\currentmarginpos}% +% \scratchdimen\MPy{\s!margin:\number\currentmarginpos}% +% \global\advance\currentmarginpos\plusone +% \advance\scratchdimen -\MPy{\s!margin:\number\currentmarginpos}% +% \advance\scratchdimen -\strutdp +% % new but bugged +% % \setbox#1\hbox +% % {\hskip-\MPx{\s!margin:\number\currentmarginpos}% +% % \hskip\MPx{head:\the\realpageno}% +% % \box#1}% +% % so far +% \setbox#1\hbox +% {\setposition{\s!margin:\number\currentmarginpos}% +% \raise\scratchdimen\box#1}% +% \or +% % move up +% \setposition{\s!margin:\number\currentmarginpos}% +% \ifnum\MPp{p:\number\parposcounter}=\MPp{\s!margin:\number\currentmarginpos}\relax +% \scratchdimen\dimexpr\MPy{p:\number\parposcounter}-\MPy{\s!margin:\number\currentmarginpos}\relax +% \expanded{\setbox#1\hbox{\raise\scratchdimen\box#1}\ht#1\the\ht#1\dp#1\the\dp#1}% +% \fi +% \or +% % move up, assume end of par +% \setposition{\s!margin:\number\currentmarginpos}% +% \ifnum\MPp{p:\number\parposcounter}=\MPp{\s!margin:\number\currentmarginpos}\relax +% \getnoflines\margincontentheight +% \advance\noflines\minusone +% \scratchdimen\noflines\lineheight +% \else +% \scratchdimen\dimexpr\MPy{p:\number\parposcounter}-\MPy{\s!margin:\number\currentmarginpos}\relax +% \fi +% \expanded{\setbox#1\hbox{\raise\scratchdimen\box#1}\ht#1\the\ht#1\dp#1\the\dp#1}% +% \fi +% \dp#1\zeropoint +% \ht#1\zeropoint +% \fi +% \graphicvadjust{\dontleavehmode\box#1}% dontleavehmode is needed to get direction right +% \egroup} +% +% % \setnewconstant\marginrepositionmethod\plusone % sidemethod +% % \setnewconstant\margincontentmethod \plusthree % textmethod % beware: 1 = old method +% % \setnewconstant\marginpagecheckmethod \plusone % splitmethod %D \macros %D {GFC, GTC, GSC} @@ -1348,11 +1261,6 @@ \def\tbPOSprefix {tbp:\number\noftabpositions:} -% \def\tableposindeed -% {\scratchtoks\posXCtoks -% \global\posXCtoks\emptytoks -% \the\scratchtoks} - \def\tablepos {\normalexpanded{\global\posXCtoks\emptytoks\the\posXCtoks}} @@ -1453,14 +1361,6 @@ \hskip-\wd\scratchbox \box\scratchbox} -\def\tabulatenormalcolumn#1% overloaded later in node-bck - {&\iftabulateequal\tabulateequalpos\else\tabulatenormalpos\fi - &\global\chardef\tabulatetype#1&} - -\def\tabulateequalcolumn#1% overloaded - {&\tabulateequalpos - &\global\chardef\tabulatetype#1&} - \appendtoks \global\advance\noftabpositions\plusone \global\setfalse\tablehaspositions @@ -1481,17 +1381,8 @@ \gdef\doflushtabulateepos{\epos{#1}}% \fi} -\def\splitofftabulatebox % overloaded in node-bck - {\dontcomplain - \global\setbox\tabulatebox % % % global ? % % % - \vsplit\tablebox\tabulatecolumn to \lineheight - \setbox\tabulatebox\normalvbox - {\unvbox\tabulatebox}% - \setbox\tabulatebox\hbox to \wd\tabulatebox - {\hss\dotabulatehook{\box\tabulatebox}\hss}% - \ht\tabulatebox\strutht - \dp\tabulatebox\strutdp - \box\tabulatebox +\def\flushtabulatesplitbox + {\box\tabulatebox \iftrialtypesetting\else\ifconditional\tablehaspositions\doflushtabulateepos\fi\fi} \appendtoks |