diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkxl/attr-lay.mkxl')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkxl/attr-lay.mkxl | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkxl/attr-lay.mkxl b/Master/texmf-dist/tex/context/base/mkxl/attr-lay.mkxl new file mode 100644 index 00000000000..00c6335337a --- /dev/null +++ b/Master/texmf-dist/tex/context/base/mkxl/attr-lay.mkxl @@ -0,0 +1,107 @@ +%D \module +%D [ file=attr-lay, +%D version=2007.06.06, +%D title=\CONTEXT\ Attribute Macros, +%D subtitle=Viewerlayers, +%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 Attribute Macros / Viewerlayers} + +%D Currently there is a limitation in mixed inline usage. This has to do with the fact +%D that we have a stacked model but cannot determine where to revert to (as we can +%D have AABBCCAA ranges). Maybe I'll solve that one day. It only affects nested inline +%D layers and these make not much sense anyway. We'd have to store the complete nesting +%D stack in the attribute in order to be able to cross pages and that demands a new +%D mechanism. + +\unprotect + +\registerctxluafile{attr-lay}{autosuffix} + +% needs to work over stopitemize grouping etc + +\installcorenamespace{viewerlayer} + +\installcommandhandler \??viewerlayer {viewerlayer} \??viewerlayer + +\setupviewerlayer + [\c!state=\v!start, + \c!title=, + \c!export=\v!yes, % exportable is ugly + \c!printable=\v!yes, + \c!scope=\v!local, % maybe global but needs checking with layout + \c!method=\v!none] + +\appendtoks + \clf_defineviewerlayer + tag {\currentviewerlayer}% + title {\viewerlayerparameter\c!title}% + visible {\viewerlayerparameter\c!state}% + editable {\v!yes}% + export {\viewerlayerparameter\c!export}% + printable {\viewerlayerparameter\c!printable}% + scope {\viewerlayerparameter\c!scope}% + \relax + \doif{\viewerlayerparameter\c!method}\v!command + {\frozen\instance\setuxvalue{\e!start#1}{\startviewerlayer[\currentviewerlayer]}% + \frozen\instance\setuxvalue{\e!stop #1}{\stopviewerlayer}}% +\to \everydefineviewerlayer + +% \startviewerlayer[#1] % defined at lua end +% \stopviewerlayer % defined at lua end + +\permanent\protected\def\viewerlayer[#1]% + {\groupedcommand{\startviewerlayer[#1]}{\stopviewerlayer}} + +% some day we will keep this at the lua end as the info is only needed there + +\newtoks\currentviewerlayertoks % soon we can set macros at the lua end + +\def\currentviewerlayer{\the\currentviewerlayertoks} + +\appendtoks + \let\currentviewerlayer\empty +\to \everybeforepagebody + +% layout components are implemented rather directly (speed) + +\installcorenamespace{layoutcomponentattribute} + +\mutable\let\layoutcomponentboxattribute\empty + +\permanent\def\attr_layoutcomponent_initialize#1% + {\edef\layoutcomponentboxattribute{\clf_definedlayoutcomponent{#1}}% + \edef\layoutcomponentboxattribute{attr \viewerlayerattribute \layoutcomponentboxattribute\relax}% + \gletcsname\??layoutcomponentattribute#1\endcsname\layoutcomponentboxattribute} + +\permanent\def\attr_layoutcomponent_set#1% make this faster + {\expandafter\let\expandafter\layoutcomponentboxattribute\csname\??layoutcomponentattribute#1\endcsname + \ifrelax\layoutcomponentboxattribute + \attr_layoutcomponent_initialize{#1}% get rid of { } + \fi} + +\permanent\def\attr_layoutcomponent_reset + {\let\layoutcomponentboxattribute\empty} + +\permanent\let\setlayoutcomponentattribute \gobbleoneargument +\permanent\let\resetlayoutcomponentattribute\relax + \let\layoutcomponentboxattribute \empty + +\permanent\protected\def\showlayoutcomponents + {\enforced\let\setlayoutcomponentattribute \attr_layoutcomponent_set + \enforced\let\resetlayoutcomponentattribute\attr_layoutcomponent_reset} + +\protected\def\attr_layoutcomponent_cleanup + {\clf_cleanuplayers} + +\appendtoks + \attr_layoutcomponent_cleanup +\to \everyshipout + +\protect \endinput |