diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/page-flt.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/page-flt.mkiv | 115 |
1 files changed, 60 insertions, 55 deletions
diff --git a/Master/texmf-dist/tex/context/base/page-flt.mkiv b/Master/texmf-dist/tex/context/base/page-flt.mkiv index 6d23891767c..18c0ad263c6 100644 --- a/Master/texmf-dist/tex/context/base/page-flt.mkiv +++ b/Master/texmf-dist/tex/context/base/page-flt.mkiv @@ -1,11 +1,11 @@ %D \module %D [ file=page-flt, -%D version=2010.04,08, +%D version=2010.04.08, %D title=\CONTEXT\ Page Macros, %D subtitle=Float Management, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%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 @@ -72,52 +72,49 @@ \to \everyfloatscheck \def\dofloatsflush#1#2% - {\ctxlua{floats.flush("#1",\number#2)}% + {\ctxcommand{flushfloat("#1",\number#2)}% \the\everyfloatscheck} \def\dofloatsflushbylabel#1#2% - {\ctxlua{floats.flush("#1","#2",true)}% + {\ctxcommand{flushfloat("#1","#2",true)}% \the\everyfloatscheck} \def\dofloatssave#1% - {\ctxlua{floats.save("#1")}% + {\ctxcommand{savefloat("#1")}% \the\everyfloatscheck} \def\dofloatsresave#1% - {\ctxlua{floats.resave("#1")}% + {\ctxcommand{resavefloat("#1")}% \the\everyfloatscheck} \def\dopushsavedfloats - {\ctxlua{floats.push()}% + {\ctxcommand{pushfloat()}% \the\everyfloatscheck} \def\dopopsavedfloats - {\ctxlua{floats.pop()}% + {\ctxcommand{popfloat()}% \the\everyfloatscheck} \def\dofloatsgetinfo#1% - {\ctxlua{floats.consult("#1")}} + {\ctxcommand{consultfloat("#1")}} -\def\doifsavedfloatelse#1% - {\ctxcommand{doifsavedfloatelse("#1")}} +\def\doifelsesavedfloat#1% + {\ctxcommand{doifelsesavedfloat("#1")}} \def\dofloatscollect#1#2#3% - {\ctxlua{floats.collect("#1",\number\dimexpr#2,\number\dimexpr#3)}} + {\ctxcommand{collectfloat("#1",\number\dimexpr#2,\number\dimexpr#3)}} -\def\dofloatsnofstacked#1% - {\ctxlua{floats.thestacked("#1")}} - -\def\dofloatsgetvariable#1% - {\ctxlua{floats.thevar("specification")}} +\def\nofstackedfloatincategory#1% + {\ctxcommand{nofstackedfloats("#1")}} \let\dopushcolumnfloats\dopushsavedfloats \let\dopopcolumnfloats \dopopsavedfloats \def\dofloatssavepagefloat#1#2% - {\ctxlua{floats.save("#1", { specification = "#2" })}} + {\ctxcommand{savefloat("#1", { specification = "#2" })}} \def\dofloatssavesomewherefloat#1#2% #1=method - {\ctxlua{floats.save("#1", { specification = "#2", label = "\floatlabel" })}} + {\ctxcommand{savefloat("#1", { specification = "#2", label = "\floatlabel" })}} %D This is an experimental new feature (for Alan Braslau), a prelude to more: %D @@ -146,11 +143,36 @@ \exitloop \else \def\currentfloat{#1}% - \blank[\@@bkspacebefore]% + \blank[\rootfloatparameter\c!spacebefore]% \box\floatbox - \blank[\@@bkspaceafter] + \blank[\rootfloatparameter\c!spaceafter] \fi}} +% \setupcaption [figure] [align=flushleft] +% \setupcaption [figure-1] [align=flushleft,leftmargin=10mm] +% \setupcaption [figure-2] [align=flushleft,leftmargin=10mm,rightmargin=-10mm,width=\textwidth] +% +% \startsetups somefigure +% \ifdim\floatsetupwidth>\textwidth +% \placesetupfloat[figure-2] +% \else +% \placesetupfloat[figure-1] +% \fi +% \stopsetups +% +% \placefloatwithsetups[somefigure]{}{\externalfigure[dummy][width=5cm,height=2cm]} + +\def\placefloatwithsetups + {\dotripleempty\doplacefloatwithsetups} + +\long\def\doplacefloatwithsetups[#1][#2][#3]#4% + {\def\floatsetupcaption {#4}% + \def\floatsetupcontent {\copy\nextbox}% + \def\floatsetupwidth {\wd\nextbox}% + \def\floatsetupheight {\ht\nextbox}% + \def\placesetupfloat[##1]{\placefloat[##1][#2][#3]{#4}{\floatsetupcontent}}% #4 and not \floatsetupcaption (unexpanded) + \dowithnextbox{\setups[#1]}\vbox} + %D The following code is in transition as we don't want to break the %D current single column, multi column, and columnset mechanism. %D @@ -166,7 +188,7 @@ % retain special alignments \ifinsidecolumns \ifdim\wd\floatbox>\makeupwidth - \global\wd\floatbox\makeupwidth + \wd\floatbox\makeupwidth \fi \fi \fi @@ -186,10 +208,10 @@ \def\doreversesavefloat {\dofloatsresave\s!text} -\def\doflushsavedfloats % simplified \OTRONEdodoflushfloats +\def\doflushsavedfloats {\doloop {\ifsomefloatwaiting - \docheckiffloatfits + \page_otr_command_check_if_float_fits \ifroomforfloat \dogetfloat \doplacefloatbox @@ -197,7 +219,11 @@ \exitloop \fi \else - \exitloop +% \ifconditional\c_page_margin_blocks_present % not here, here just as many floats as fit +% \page_otr_command_flush_margin_blocks +% \else + \exitloop +% \fi \fi}} %D Page floats use different stacks. @@ -206,44 +232,25 @@ \def\doflushsomepagefloat#1% future releases can do more clever things {\dofloatsflush{#1}{1}% - \edef\floatspecification{\dofloatsgetvariable{specification}}% + \edef\floatspecification{\ctxcommand{getfloatvariable("specification")}}% Is this okay? \the\everybeforeflushedpagefloat \vbox to \textheight {\doifnotinset\v!high\floatspecification\vfill \box\floatbox \doifnotinset\v!low\floatspecification\vfill}% - \vfill\eject} - -% \def\doflushpagefloats -% {\doifoddpageelse -% {\ifnum\dofloatsnofstacked\s!rightpage>\zerocount -% \doflushsomepagefloat\s!rightpage -% \else\ifnum\dofloatsnofstacked\s!page>\zerocount -% \doflushsomepagefloat\s!page -% \else\ifnum\dofloatsnofstacked\s!leftpage>\zerocount -% \emptyhbox\vfill\eject -% %\doflushsomepagefloat\s!leftpage -% \fi\fi\fi} -% {\ifnum\dofloatsnofstacked\s!leftpage>\zerocount -% \doflushsomepagefloat\s!leftpage -% \else\ifnum\dofloatsnofstacked\s!page>\zerocount -% \doflushsomepagefloat\s!page -% \else\ifnum\dofloatsnofstacked\s!rightpage>\zerocount -% \emptyhbox\vfill\eject -% %\doflushsomepagefloat\s!rightpage -% \fi\fi\fi}} + \page_otr_fill_and_eject_page} \def\doflushpagefloats - {\edef\checkedpagefloat{\ctxlua{floats.thecheckedpagefloat()}}% (true) for packed - \ifx\checkedpagefloat\empty + {\edef\m_page_otf_checked_page_float{\ctxcommand{checkedpagefloat()}}% (true) for packed + \ifx\m_page_otf_checked_page_float\empty % nothing - \else\ifx\checkedpagefloat\v!empty - \emptyhbox\vfill\eject + \else\ifx\m_page_otf_checked_page_float\v!empty + \emptyhbox \page_otr_fill_and_eject_page % why not dummy_page \else - \doflushsomepagefloat\checkedpagefloat + \doflushsomepagefloat\m_page_otf_checked_page_float \fi\fi} -\def\uncenteredfloatbox +\def\uncenteredfloatbox % hm, where is this one used (was in save/restore, see old implementation) {\ifcenterfloatbox \ifhbox\floatbox\relax % remove centering \ifdim\wd\floatbox=\hsize @@ -266,9 +273,6 @@ \box\floatbox \fi} -\ifdefined\doflushfloats\else \let\doflushfloats\relax \fi -\ifdefined\flushfloatbox\else \let\flushfloatbox\relax \fi - % temp hack, needed to prevent floatbox being forgotten during % output, this will change to using another box for flushing % @@ -281,6 +285,7 @@ \appendtoks \global\setbox\savedfloatbox\box\floatbox \to \everybeforeoutput + \appendtoks \global\setbox\floatbox\box\savedfloatbox \to \everyafteroutput |