summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/scrn-but.mkvi
diff options
context:
space:
mode:
authorMojca Miklavec <mojca.miklavec@gmail.com>2012-05-14 17:38:55 +0000
committerMojca Miklavec <mojca.miklavec@gmail.com>2012-05-14 17:38:55 +0000
commit15995e10bfc68edf79970c4ea4fbb6678566c46e (patch)
tree2de7ca2a83f2d37ef043ad7429a5cb945bb79ddb /Master/texmf-dist/tex/context/base/scrn-but.mkvi
parentc9a39f716f1e5ec820ed3aab2c9aef25c5a9d730 (diff)
ConTeXt 2012.05.14 16:00
git-svn-id: svn://tug.org/texlive/trunk@26371 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/scrn-but.mkvi')
-rw-r--r--Master/texmf-dist/tex/context/base/scrn-but.mkvi555
1 files changed, 303 insertions, 252 deletions
diff --git a/Master/texmf-dist/tex/context/base/scrn-but.mkvi b/Master/texmf-dist/tex/context/base/scrn-but.mkvi
index e1dedd6051b..b20d34c09ac 100644
--- a/Master/texmf-dist/tex/context/base/scrn-but.mkvi
+++ b/Master/texmf-dist/tex/context/base/scrn-but.mkvi
@@ -5,7 +5,7 @@
%D subtitle=Interaction,
%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
@@ -44,15 +44,15 @@
%D
%D \showsetup{setupbuttons}
-\installcommandhandler \??bt {button} \??bt
+\installcorenamespace{button}
+\installcorenamespace{buttonlocation}
-\let\setupbuttons\setupbutton
+\installframedcommandhandler \??button {button} \??button
-\presetlocalframed[\??bt]
+\let\setupbuttons\setupbutton
\appendtoks
\setuevalue\currentbutton{\scrn_button_direct{\currentbutton}}%
- \setevalue{\??bt:\currentbutton\s!parent}{\??bt\currentbutton}% framed
\to \everydefinebutton
\unexpanded\def\scrn_button_direct#tag%
@@ -67,17 +67,21 @@
\scrn_button_direct_indeed
\scrn_button_direct_ignore}
-%\def\buttonframed{\dodoubleempty\localframed[\??bt]} % goodie
-
% empty=yes
%
% \button[settings]{}[action] % normally used at the tex end
\def\scrn_button_direct_indeed[#settings]#text[#action]%
{\iffirstargument
- \setupbuttons[\currentbutton][#settings]%
+ \setupcurrentbutton[#settings]%
\fi
- \scrn_button_make\??bt\currentbutton\buttonparameter{#text}{#action}%
+ \scrn_button_make
+ \buttonparameter
+ \inheritedbuttonframed
+ \letbuttonparameter
+ \setbuttonparameter
+ {#text}%
+ {#action}%
\endgroup}
\def\scrn_button_direct_ignore[#settings]#text[#destination]%
@@ -140,94 +144,98 @@
%D The renderers:
-\expandafter\let\csname\??bt:\c!location:\v!yes \endcsname\zerocount
-\expandafter\let\csname\??bt:\c!location:\v!empty \endcsname\plusone
-\expandafter\let\csname\??bt:\c!location:\v!no \endcsname\plustwo
-\expandafter\let\csname\??bt:\c!location:\v!none \endcsname\plusthree
-\expandafter\let\csname\??bt:\c!location:\v!normal \endcsname\plusone % default
-\expandafter\let\csname\??bt:\c!location:\s!default\endcsname\plusone % default
-\expandafter\let\csname\??bt:\c!location:\s!empty \endcsname\plusone % default
+\expandafter\let\csname\??buttonlocation\v!yes \endcsname\zerocount
+\expandafter\let\csname\??buttonlocation\v!empty \endcsname\plusone
+\expandafter\let\csname\??buttonlocation\v!no \endcsname\plustwo
+\expandafter\let\csname\??buttonlocation\v!none \endcsname\plusthree
+\expandafter\let\csname\??buttonlocation\v!normal \endcsname\plusone % default
+\expandafter\let\csname\??buttonlocation\s!default\endcsname\plusone % default
+\expandafter\let\csname\??buttonlocation\s!empty \endcsname\plusone % default
-\newconditional\scrn_button_skipped
+\newconditional\c_scrn_button_skipped
-\def\scrn_button_make#namespace#current#currentparameter#text#action%
+\def\scrn_button_make#currentparameter#inheritedframed#letparameter#setparameter#text#action%
{\begingroup
\attribute\referenceattribute\attributeunsetvalue
- \global\setfalse\scrn_button_skipped
- \chardef\locationboxpagestate\csname\??bt:\c!location:#currentparameter\c!samepage\endcsname
+ \global\setfalse\c_scrn_button_skipped
+ \chardef\locationboxpagestate\csname\??buttonlocation#currentparameter\c!samepage\endcsname % ?? bt: todo
\doifreferencefoundelse{#action}\scrn_button_make_yes\scrn_button_make_nop
- {#namespace}{#current}{#currentparameter}{#text}%
+ #currentparameter%
+ #inheritedframed%
+ #letparameter%
+ #setparameter
+ {#text}%
\endgroup}
\def\scrn_button_make_yes
- {\analyzecurrentreference % needed as we act on the state
- \ifcase\referencepagestate
- \expandafter\scrn_button_make_normal % no state : something else than a page reference
+ {\scratchcounter\referencerealpage\relax % called in otr
+ \ifcase\scratchcounter
+ \expandafter\scrn_button_make_normal % no state : something else than a page reference
+ \else\ifnum\scratchcounter=\realpageno
+ \expandafter\expandafter\expandafter\scrn_button_make_yes_same
+ \else
+ \expandafter\expandafter\expandafter\scrn_button_make_yes_other
+ \fi\fi}
+
+\def\scrn_button_make_yes_same
+ {\ifcase\locationboxpagestate\relax
+ \expandafter\scrn_button_make_contrast % same page: yes: same page or not ... todo
+ \or
+ \expandafter\scrn_button_make_empty % same page: empty but frame: no click
+ \or
+ \expandafter\scrn_button_make_nothing % same page: empty no frame: no
+ \else
+ \expandafter\scrn_button_make_skipped % same page: nothing at all
+ \fi}
+
+\def\scrn_button_make_yes_other
+ {\ifcase\locationboxpagestate\relax
+ \expandafter\scrn_button_make_normal % other page: yes: same page or not ... todo
+ \or
+ \expandafter\scrn_button_make_normal % other page: empty but frame: no click
\or
- \ifcase\locationboxpagestate\relax
- \expandafter\expandafter\expandafter\scrn_button_make_contrast % same page: yes: same page or not ... todo
- \or
- \expandafter\expandafter\expandafter\scrn_button_make_empty % same page: empty but frame: no click
- \or
- \expandafter\expandafter\expandafter\scrn_button_make_nothing % same page: empty no frame: no
- \else
- \expandafter\expandafter\expandafter\scrn_button_make_skipped % same page: nothing at all
- \fi
+ \expandafter\scrn_button_make_normal % other page: empty no frame: no
\else
- \ifcase\locationboxpagestate\relax
- \expandafter\expandafter\expandafter\scrn_button_make_normal % other page: yes: same page or not ... todo
- \or
- \expandafter\expandafter\expandafter\scrn_button_make_normal % other page: empty but frame: no click
- \or
- \expandafter\expandafter\expandafter\scrn_button_make_normal % other page: empty no frame: no
- \else
- \expandafter\expandafter\expandafter\scrn_button_make_skipped % other page: nothing at all
- \fi%
+ \expandafter\scrn_button_make_skipped % other page: nothing at all
\fi}
\def\scrn_button_make_nop
{\ifcase\locationboxpagestate\relax
- \expandafter\scrn_button_make_framed
+ \expandafter\scrn_button_make_framed
\or
- \expandafter\scrn_button_make_empty
+ \expandafter\scrn_button_make_empty
\or
- \expandafter\scrn_button_make_nothing
+ \expandafter\scrn_button_make_nothing
\or
- \expandafter\scrn_button_make_skipped
+ \expandafter\scrn_button_make_skipped
\fi}
-\def\scrn_button_make_framed#namespace#current#currentparameter#text%
- {\directlocalframed[#namespace:#current]{\ignorespaces#text\removeunwantedspaces}}
+\def\scrn_button_make_framed#currentparameter#inheritedframed#letparameter#setparameter#text%
+ {#inheritedframed{\ignorespaces#text\removeunwantedspaces}}
-\def\scrn_button_make_skipped#namespace#current#currentparameter#text%
- {\global\settrue\scrn_button_skipped}
+\def\scrn_button_make_skipped#currentparameter#inheritedframed#letparameter#setparameter#text%
+ {\global\settrue\c_scrn_button_skipped}
-\def\scrn_button_make_normal#namespace#current#currentparameter#text%
+\def\scrn_button_make_normal#currentparameter#inheritedframed#letparameter#setparameter#text%
{\ctxlua{structures.references.injectcurrentset(nil,nil)}%
\hbox attr \referenceattribute \lastreferenceattribute
- {\directlocalframed
- [#namespace:#current]%
- {\ignorespaces#text\removeunwantedspaces}}}
+ {#inheritedframed{\ignorespaces#text\removeunwantedspaces}}}
-\def\scrn_button_make_contrast#namespace#current#currentparameter#text%
+\def\scrn_button_make_contrast#currentparameter#inheritedframed#letparameter#setparameter#text%
{\ctxlua{structures.references.injectcurrentset(nil,nil)}%
\hbox attr \referenceattribute \lastreferenceattribute
- {\localframedwithsettings
- [#namespace:#current]%
- [\c!foregroundcolor=#currentparameter\c!contrastcolor]%
- {\ignorespaces#text\removeunwantedspaces}}}
-
-\def\scrn_button_make_empty#namespace#current#currentparameter#text%
- {\localframedwithsettings
- [#namespace:#current]%
- [\c!empty=\v!yes]%
- {\ignorespaces#text\removeunwantedspaces}}
-
-\def\scrn_button_make_nothing#namespace#current#currentparameter#text%
- {\localframedwithsettings
- [#namespace:#current]%
- [\c!empty=\v!yes,\c!frame=,\c!background=]%
- {\ignorespaces#text\removeunwantedspaces}}
+ {#setparameter\c!foregroundcolor{#currentparameter\c!contrastcolor}%
+ #inheritedframed{\ignorespaces#text\removeunwantedspaces}}}
+
+\def\scrn_button_make_empty#currentparameter#inheritedframed#letparameter#setparameter#text%
+ {#letparameter\c!empty\v!yes
+ #inheritedframed{\ignorespaces#text\removeunwantedspaces}}
+
+\def\scrn_button_make_nothing#currentparameter#inheritedframed#letparameter#setparameter#text%
+ {#letparameter\c!empty\v!yes
+ #letparameter\c!frame\empty
+ #letparameter\c!background\empty
+ #inheritedframed{\ignorespaces#text\removeunwantedspaces}}
%D Menus:
%D
@@ -316,11 +324,15 @@
%D \setupinteractionmenu[right][samepage=none, unknownreference=none]
%D \stoptyping
-\installcommandhandler \??am {interactionmenu} \??am
+\installcorenamespace{menu}
+\installcorenamespace{menutoks}
+\installcorenamespace{menustate}
+\installcorenamespace{menupacker}
+\installcorenamespace{menualign}
-\let\setupinteractionmenus\setupinteractionmenu
+\installframedcommandhandler \??menu {interactionmenu} \??menu
-\presetlocalframed[\??am]
+\let\setupinteractionmenus\setupinteractionmenu
\let\scrn_menu_action\relax
@@ -335,34 +347,30 @@
{\scrn_menu_define_original[#tag][#category][\c!category=#category,#settings]}% child definition
{\scrn_menu_define_original[#tag][#settings][\c!category=#category]}% % child definition
\scrn_menu_register{#tag}{#category}%
- \setevalue{\??am:#tag\s!parent}{\??am#tag}% framed
\else\ifsecondargument
\doifassignmentelse{#category}%
- {\scrn_menu_define_original[#tag][#category]% % root definition
- \setevalue{\??am:#tag\s!parent}{\??am}}% framed
+ {\scrn_menu_define_original[#tag][#category]}% % root definition
{\scrn_menu_define_original[#tag][#category][\c!category=#category]% % child definition
- \scrn_menu_register{#tag}{#category}%
- \setevalue{\??am:#tag\s!parent}{\??am#tag}}% framed
- \else
+ \scrn_menu_register{#tag}{#category}}%
+ \else
\scrn_menu_define_original[#tag]% % root definition
- \setevalue{\??am:#tag\s!parent}{\??am}% framed
\fi\fi}
\def\scrn_menu_register#tag#category%
- {\ifcsname\??am:t:#category\endcsname \else
- \expandafter\newtoks \csname\??am:t:#category\endcsname
- \expandafter\setfalse\csname\??am:c:#category\endcsname
+ {\ifcsname\??menutoks#category\endcsname \else
+ \expandafter\newtoks \csname\??menutoks#category\endcsname
+ \expandafter\setfalse\csname\??menustate#category\endcsname
\fi
- \normalexpanded{\csname\??am:t:#category\endcsname{\the\csname\??am:t:#category\endcsname\scrn_menu_action{#tag}}}}
+ \normalexpanded{\csname\??menutoks#category\endcsname{\the\csname\??menutoks#category\endcsname\scrn_menu_action{#tag}}}}
\def\scrn_menu_actions#category%
- {\the\csname\??am:t:#category\endcsname}
+ {\the\csname\??menutoks#category\endcsname}
%D Fill menus:
\normalexpanded{\long\def\expandafter\noexpand\csname\e!start\v!interactionmenu\endcsname[#tag]#content\expandafter\noexpand\csname\e!stop\v!interactionmenu\endcsname}%
{\def\currentinteractionmenu{#tag}%
- \expandafter\settrue\csname\??am:c:\interactionmenuparameter\c!category\endcsname
+ \expandafter\settrue\csname\??menustate\interactionmenuparameter\c!category\endcsname
\setinteractionmenuparameter\c!menu{#content}}
\def\resetinteractionmenu[#tag]%
@@ -402,69 +410,69 @@
%D The no longer hard coded text areas offset compensation makes tuning
%D easier. After all, menus need some setup anyway.
-\newbox \scrn_menu_box
+\newbox \b_scrn_menu
-\newdimen\scrn_menu_next_distance
-\newdimen\scrn_menu_final_width
-\newdimen\scrn_menu_final_height
-\newdimen\scrn_menu_used_width
-\newdimen\scrn_menu_used_height
-\newdimen\scrn_menu_asked_width
-\newdimen\scrn_menu_asked_height
-\newdimen\scrn_menu_offset_top
-\newdimen\scrn_menu_offset_bottom
-\newdimen\scrn_menu_offset_left
-\newdimen\scrn_menu_offset_right
+\newdimen\d_scrn_menu_next_distance
+\newdimen\d_scrn_menu_final_width
+\newdimen\d_scrn_menu_final_height
+\newdimen\d_scrn_menu_used_width
+\newdimen\d_scrn_menu_used_height
+\newdimen\d_scrn_menu_asked_width
+\newdimen\d_scrn_menu_asked_height
+\newdimen\d_scrn_menu_offset_top
+\newdimen\d_scrn_menu_offset_bottom
+\newdimen\d_scrn_menu_offset_left
+\newdimen\d_scrn_menu_offset_right
-\newconditional\scrn_menu_zerodimensions
+\newconditional\c_scrn_menu_zerodimensions
\def\scrn_menu_set_used
- {\doassigncheckedframeoffset\scrn_menu_offset_left {\interactionmenuparameter\c!leftoffset }%
- \doassigncheckedframeoffset\scrn_menu_offset_right {\interactionmenuparameter\c!rightoffset }%
- \doassigncheckedframeoffset\scrn_menu_offset_top {\interactionmenuparameter\c!topoffset }%
- \doassigncheckedframeoffset\scrn_menu_offset_bottom{\interactionmenuparameter\c!bottomoffset}%
- \scrn_menu_asked_width \interactionmenuparameter\c!maxwidth
- \scrn_menu_asked_height \interactionmenuparameter\c!maxheight
- \scrn_menu_used_width\dimexpr
- \scrn_menu_asked_width + \scrn_menu_offset_left + \scrn_menu_offset_right
+ {\doassigncheckedframeoffset\d_scrn_menu_offset_left {\interactionmenuparameter\c!leftoffset }%
+ \doassigncheckedframeoffset\d_scrn_menu_offset_right {\interactionmenuparameter\c!rightoffset }%
+ \doassigncheckedframeoffset\d_scrn_menu_offset_top {\interactionmenuparameter\c!topoffset }%
+ \doassigncheckedframeoffset\d_scrn_menu_offset_bottom{\interactionmenuparameter\c!bottomoffset}%
+ \d_scrn_menu_asked_width \interactionmenuparameter\c!maxwidth
+ \d_scrn_menu_asked_height \interactionmenuparameter\c!maxheight
+ \d_scrn_menu_used_width\dimexpr
+ \d_scrn_menu_asked_width + \d_scrn_menu_offset_left + \d_scrn_menu_offset_right
\relax
- \scrn_menu_used_height\dimexpr
- \scrn_menu_asked_height + \scrn_menu_offset_top + \scrn_menu_offset_bottom
+ \d_scrn_menu_used_height\dimexpr
+ \d_scrn_menu_asked_height + \d_scrn_menu_offset_top + \d_scrn_menu_offset_bottom
\relax}
\def\scrn_menu_set_final
- {\scrn_menu_final_width \namedinteractionmenuparameter\askedinteractionmenulocation\c!maxwidth
- \scrn_menu_final_height\namedinteractionmenuparameter\askedinteractionmenulocation\c!maxheight}
+ {\d_scrn_menu_final_width \namedinteractionmenuparameter\askedinteractionmenulocation\c!maxwidth
+ \d_scrn_menu_final_height\namedinteractionmenuparameter\askedinteractionmenulocation\c!maxheight}
\def\scrn_menu_apply_final
- {\ifconditional\scrn_menu_zerodimensions
- \wd\scrn_menu_box\zeropoint
- \ht\scrn_menu_box\zeropoint
+ {\ifconditional\c_scrn_menu_zerodimensions
+ \wd\b_scrn_menu\zeropoint
+ \ht\b_scrn_menu\zeropoint
\else
- \wd\scrn_menu_box\scrn_menu_final_width
- \ht\scrn_menu_box\scrn_menu_final_height
+ \wd\b_scrn_menu\d_scrn_menu_final_width
+ \ht\b_scrn_menu\d_scrn_menu_final_height
\fi
- \dp\scrn_menu_box\zeropoint}
+ \dp\b_scrn_menu\zeropoint}
\def\scrn_menu_apply_used
- {\ifdim\scrn_menu_offset_left=\zeropoint \else
- \setbox\scrn_menu_box\hbox{\hskip-\scrn_menu_offset_left \box\scrn_menu_box}%
+ {\ifdim\d_scrn_menu_offset_left=\zeropoint \else
+ \setbox\b_scrn_menu\hbox{\hskip-\d_scrn_menu_offset_left \box\b_scrn_menu}%
\fi
- \ifdim\scrn_menu_offset_bottom=\zeropoint \else
- \setbox\scrn_menu_box\hbox{\lower \scrn_menu_offset_bottom \box\scrn_menu_box}%
+ \ifdim\d_scrn_menu_offset_bottom=\zeropoint \else
+ \setbox\b_scrn_menu\hbox{\lower \d_scrn_menu_offset_bottom \box\b_scrn_menu}%
\fi
- \wd\scrn_menu_box\scrn_menu_asked_width
- \ht\scrn_menu_box\scrn_menu_asked_height
- \dp\scrn_menu_box\zeropoint}
-
-\setvalue{scrn_menu_align_\v!right }{\let\scrn_menu_left_align\raggedright}
-\setvalue{scrn_menu_align_\v!left }{\let\scrn_menu_left_align\raggedleft}
-\setvalue{scrn_menu_align_\v!flushright}{\let\scrn_menu_left_align\raggedleft}
-\setvalue{scrn_menu_align_\v!flushleft }{\let\scrn_menu_left_align\raggedright}
-\setvalue{scrn_menu_align_\v!middle }{\let\scrn_menu_left_align\raggedcenter}
-\setvalue{scrn_menu_align_\v!low }{\let\scrn_menu_top_align\vss\let\scrn_menu_bottom_align\relax}
-\setvalue{scrn_menu_align_\v!high }{\let\scrn_menu_top_align\relax\let\scrn_menu_bottom_align\vss}
-\setvalue{scrn_menu_align_\v!lohi }{\let\scrn_menu_top_align\vss\let\scrn_menu_bottom_align\vss}
+ \wd\b_scrn_menu\d_scrn_menu_asked_width
+ \ht\b_scrn_menu\d_scrn_menu_asked_height
+ \dp\b_scrn_menu\zeropoint}
+
+\setvalue{\??menualign\v!right }{\let\scrn_menu_left_align\raggedright}
+\setvalue{\??menualign\v!left }{\let\scrn_menu_left_align\raggedleft}
+\setvalue{\??menualign\v!flushright}{\let\scrn_menu_left_align\raggedleft}
+\setvalue{\??menualign\v!flushleft }{\let\scrn_menu_left_align\raggedright}
+\setvalue{\??menualign\v!middle }{\let\scrn_menu_left_align\raggedcenter}
+\setvalue{\??menualign\v!low }{\let\scrn_menu_top_align\vss\let\scrn_menu_bottom_align\relax}
+\setvalue{\??menualign\v!high }{\let\scrn_menu_top_align\relax\let\scrn_menu_bottom_align\vss}
+\setvalue{\??menualign\v!lohi }{\let\scrn_menu_top_align\vss\let\scrn_menu_bottom_align\vss}
\let\scrn_menu_left_align \relax
\let\scrn_menu_right_align \relax
@@ -472,7 +480,7 @@
\let\scrn_menu_bottom_align\relax
\def\scrn_menu_set_align
- {\csname scrn_menu_align_\interactionmenuparameter\c!itemalign\endcsname}
+ {\csname\??menualign\interactionmenuparameter\c!itemalign\endcsname}
%D Hook into the pagebuilder (as less testing as possible):
@@ -484,7 +492,7 @@
\fi}
\def\scrn_menu_insert_checked#location%
- {\ifconditional\csname\??am:c:#location\endcsname
+ {\ifconditional\csname\??menustate#location\endcsname
\scrn_menu_insert_indeed{#location}%
\fi}
@@ -492,28 +500,28 @@
{\begingroup
\xdef\askedinteractionmenulocation{#location}%
\scrn_menu_set_final
- \ifcase\scrn_menu_final_width \else \ifcase\scrn_menu_final_height \else
+ \ifcase\d_scrn_menu_final_width \else \ifcase\d_scrn_menu_final_height \else
\forgetall
- \global\scrn_menu_next_distance\zeropoint
+ \global\d_scrn_menu_next_distance\zeropoint
\let\scrn_menu_action\scrn_menu_package_indeed
\the\everysetmenucommands
- \csname\??am:\c!menu:\namedinteractionmenuparameter\askedinteractionmenulocation\c!alternative\endcsname
+ \csname\??menupacker\namedinteractionmenuparameter\askedinteractionmenulocation\c!alternative\endcsname
\fi \fi
\endgroup}
%D This calls: % can be \c!command for vertical/horizontal
-\setvalue{\??am:\c!menu:\v!vertical}% all menus
+\setvalue{\??menupacker\v!vertical}% all menus
{\let\scrn_menu_packager\scrn_menu_packager_vertical
- \setbox\scrn_menu_box\hbox{\scrn_menu_actions\askedinteractionmenulocation}%
+ \setbox\b_scrn_menu\hbox{\scrn_menu_actions\askedinteractionmenulocation}%
\scrn_menu_apply_final
- \box\scrn_menu_box}
+ \box\b_scrn_menu}
-\setvalue{\??am:\c!menu:\v!horizontal}% all menus
+\setvalue{\??menupacker\v!horizontal}% all menus
{\let\scrn_menu_packager\scrn_menu_packager_horizontal
- \setbox\scrn_menu_box\vbox{\scrn_menu_actions\askedinteractionmenulocation}%
+ \setbox\b_scrn_menu\vbox{\scrn_menu_actions\askedinteractionmenulocation}%
\scrn_menu_apply_final
- \box\scrn_menu_box}
+ \box\b_scrn_menu}
% stop : skipped
% start: processed
@@ -533,48 +541,50 @@
%D With the packager being one of:
+\let\currentinteractionmenudistance\!!zeropoint
+
\def\scrn_menu_packager_vertical
{\scrn_menu_set_used
- \hskip\scrn_menu_next_distance
- \setbox\scrn_menu_box\hbox to \scrn_menu_used_width
+ \hskip\d_scrn_menu_next_distance
+ \setbox\b_scrn_menu\hbox to \d_scrn_menu_used_width
{\ifx\currentinteractionmenustate\v!empty \else
\interactionmenuparameter\c!left
- \scrn_menu_package_vertical{\interactionmenuparameter\c!menu}%
+ \scrn_menu_package_vertical{\strictinteractionmenuparameter\c!menu}%
\interactionmenuparameter\c!right
\fi}%
\edef\currentinteractionmenudistance{\interactionmenuparameter\c!distance}%
\ifx\currentinteractionmenudistance\v!overlay
- \global\scrn_menu_next_distance\zeropoint
- \wd\scrn_menu_box\zeropoint
+ \global\d_scrn_menu_next_distance\zeropoint
+ \wd\b_scrn_menu\zeropoint
\else
- \global\scrn_menu_next_distance\currentinteractionmenudistance
+ \global\d_scrn_menu_next_distance\currentinteractionmenudistance
\scrn_menu_apply_used
\fi
- \box\scrn_menu_box}
+ \box\b_scrn_menu}
\def\scrn_menu_packager_horizontal
{\scrn_menu_set_used
- \vskip\scrn_menu_next_distance
+ \vskip\d_scrn_menu_next_distance
\scrn_menu_set_align
- \setbox\scrn_menu_box\vbox to \scrn_menu_used_height
+ \setbox\b_scrn_menu\vbox to \d_scrn_menu_used_height
{\ifx\currentinteractionmenustate\v!none \else
\scrn_menu_top_align
\interactionmenuparameter\c!before
- \scrn_menu_package_horizontal{\interactionmenuparameter\c!menu}%
+ \scrn_menu_package_horizontal{\strictinteractionmenuparameter\c!menu}%
\interactionmenuparameter\c!after
\scrn_menu_bottom_align
\fi}%
\edef\currentinteractionmenudistance{\interactionmenuparameter\c!distance}%
\ifx\currentinteractionmenudistance\v!overlay
- \global\scrn_menu_next_distance\zeropoint
+ \global\d_scrn_menu_next_distance\zeropoint
\offinterlineskip
- \dp\scrn_menu_box\zeropoint
- \ht\scrn_menu_box\zeropoint
+ \dp\b_scrn_menu\zeropoint
+ \ht\b_scrn_menu\zeropoint
\else
- \global\scrn_menu_next_distance\currentinteractionmenudistance
+ \global\d_scrn_menu_next_distance\currentinteractionmenudistance
\scrn_menu_apply_used
\fi
- \box\scrn_menu_box}
+ \box\b_scrn_menu}
%D For a right menu, a sequence of calls to \type
%D {right_menu_button} is generated.
@@ -587,65 +597,65 @@
%D while the rest is positional info. The status variable is
%D 0, 1 or~2: not found, found and found but current page.
-\newcount \scrn_menu_position
-\newconstant \scrn_menu_page_mode % 0=notfound 1=found 2=currentpage
-\newconditional\scrn_menu_positioning
-\newtoks \scrn_menu_mp_data
+\newcount \c_scrn_menu_position
+\newconstant \c_scrn_menu_page_mode % 0=notfound 1=found 2=currentpage
+\newconditional\c_scrn_menu_positioning
+\newtoks \t_scrn_menu_meta_data
-\def\scrn_menu_button_mp_template
+\def\scrn_menu_button_meta_template
{\askedinteractionmenulocation _menu_button(%
- \number\scrn_menu_position,%
- \number\scrn_menu_page_mode,%
- \MPpos{\askedinteractionmenulocation:\number\scrn_menu_position}%
+ \number\c_scrn_menu_position,%
+ \number\c_scrn_menu_page_mode,%
+ \MPpos{\askedinteractionmenulocation:\number\c_scrn_menu_position}%
);}
-\def\MPmenubuttons#1{\the\scrn_menu_mp_data}
+\def\MPmenubuttons#1{\the\t_scrn_menu_meta_data}
\appendtoks
- \global\scrn_menu_mp_data\emptytoks
+ \global\t_scrn_menu_meta_data\emptytoks
\to \everyshipout
\def\scrn_menu_whole_position % cannot happen in previous due to align
- {\setbox\scrn_menu_box\hbox \bgroup
- \hpos{menu:\askedinteractionmenulocation:\the\realpageno}{\box\scrn_menu_box}%
+ {\setbox\b_scrn_menu\hbox \bgroup
+ \hpos{menu:\askedinteractionmenulocation:\the\realpageno}{\box\b_scrn_menu}%
\egroup}
% removed: \restorestandardblank (vspacing) ... should happen elsewhere
\def\scrn_menu_package_vertical#content%
{\begingroup
- \global\scrn_menu_position\zerocount
+ \global\c_scrn_menu_position\zerocount
\def\scrn_menu_between_action_indeed{\interactionmenuparameter\c!inbetween}%
- \doifelse{\interactionmenuparameter\c!position}\v!yes\settrue\setfalse\scrn_menu_positioning
+ \doifelse{\interactionmenuparameter\c!position}\v!yes\settrue\setfalse\c_scrn_menu_positioning
\scrn_menu_set_align
- \setbox\scrn_menu_box\vbox to \scrn_menu_used_height \bgroup
- \hsize\scrn_menu_used_width
+ \setbox\b_scrn_menu\vbox to \d_scrn_menu_used_height \bgroup
+ \hsize\d_scrn_menu_used_width
\scrn_menu_left_align
\interactionmenuparameter\c!before\relax
\ignorespaces#content\unskip
\interactionmenuparameter\c!after
\scrn_menu_right_align
\egroup
- \ifconditional\scrn_menu_positioning
+ \ifconditional\c_scrn_menu_positioning
\scrn_menu_whole_position
\fi
- \box\scrn_menu_box
+ \box\b_scrn_menu
\endgroup}
\def\scrn_menu_package_horizontal#content%
{\begingroup
- \global\scrn_menu_position\zerocount
+ \global\c_scrn_menu_position\zerocount
\def\scrn_menu_between_action_indeed{\interactionmenuparameter\c!middle}%
- \doifelse{\interactionmenuparameter\c!position}\v!yes\settrue\setfalse\scrn_menu_positioning
- \setbox\scrn_menu_box\hbox to \scrn_menu_used_width \bgroup
+ \doifelse{\interactionmenuparameter\c!position}\v!yes\settrue\setfalse\c_scrn_menu_positioning
+ \setbox\b_scrn_menu\hbox to \d_scrn_menu_used_width \bgroup
\interactionmenuparameter\c!left\relax
\ignorespaces#content\unskip
\interactionmenuparameter\c!right
\egroup
- \ifconditional\scrn_menu_positioning
+ \ifconditional\c_scrn_menu_positioning
\scrn_menu_whole_position
\fi
- \box\scrn_menu_box
+ \box\b_scrn_menu
\endgroup}
\def\scrn_menu_action_start
@@ -653,7 +663,7 @@
\begingroup}
\def\scrn_menu_action_stop
- {\ifconditional\scrn_button_skipped \else
+ {\ifconditional\c_scrn_button_skipped \else
\scrn_menu_between_action_indeed
\fi
\endgroup
@@ -666,52 +676,67 @@
\unexpanded\def\scrn_menu_but_start[#action]#text\stopbut
{\scrn_menu_action_start
- \ifconditional\scrn_menu_positioning
+ \ifconditional\c_scrn_menu_positioning
\expandafter\scrn_button_make_position
\else
\expandafter\scrn_button_make
- \fi\??am\currentinteractionmenu\interactionmenuparameter{#text}{#action}%
+ \fi
+ \interactionmenuparameter
+ \inheritedinteractionmenuframed
+ \letinteractionmenuparameter
+ \setinteractionmenuparameter
+ {#text}%
+ {#action}%
\scrn_menu_action_stop}
-\def\scrn_button_make_position#namespace#current#currentparameter#text#action%
- {\global\advance\scrn_menu_position\plusone
+\def\scrn_button_make_position#currentparameter#inheritedframed#letparameter#setparameter#text#action%
+ {\global\advance\c_scrn_menu_position\plusone
\doifreferencefoundelse{#action}% 0=not found, 1=same page, >1=elsewhere
- {\scrn_menu_page_mode\ifnum\currentreferencerealpage=\realpageno\plusone\else\plustwo\fi}%
- {\scrn_menu_page_mode\plustwo}%
+ {\c_scrn_menu_page_mode\ifnum\currentreferencerealpage=\realpageno\plusone\else\plustwo\fi}%
+ {\c_scrn_menu_page_mode\plustwo}%
\doglobal\appendetoks
- \scrn_menu_button_mp_template
- \to \scrn_menu_mp_data
+ \scrn_menu_button_meta_template
+ \to \t_scrn_menu_meta_data
\hpos
- {\askedinteractionmenulocation:\number\scrn_menu_position}%
- {\scrn_button_make{#namespace}{#current}{#currentparameter}{#text}{#action}}}
+ {\askedinteractionmenulocation:\number\c_scrn_menu_position}%
+ {\scrn_button_make
+ #currentparameter%
+ #inheritedframed%
+ #letparameter%
+ #setparameter%
+ {#text}%
+ {#action}}}
\unexpanded\def\scrn_menu_got_start[#action]#text\stopgot
{\scrn_menu_action_start
- \setupbuttons[\currentinteractionmenu][\c!frame=\v!off,\c!background=]%
- \scrn_button_make\??am\currentinteractionmenu\interactionmenuparameter{#text}{#action}%
+ \setupcurrentinteractionmenu[\c!frame=\v!off,\c!background=]% needs checking, was buttons
+ \scrn_button_make
+ \interactionmenuparameter
+ \inheritedinteractionmenuframed
+ \letinteractionmenuparameter
+ \setinteractionmenuparameter
+ {#text}%
+ {#action}%
\scrn_menu_action_stop}
\unexpanded\def\scrn_menu_nop_start#text\stopnop
{\scrn_menu_action_start
- \localframedwithsettings
- [\??am:\currentinteractionmenu]%
- [\c!frame=\v!off,\c!background=,\c!empty=\v!yes]%
- {\ignorespaces#text\removeunwantedspaces}%
+ \letinteractionmenuparameter\c!frame\v!off
+ \letinteractionmenuparameter\c!background\empty
+ \letinteractionmenuparameter\v!yes
+ \inheritedinteractionmenuframed{\ignorespaces#text\removeunwantedspaces}%
\scrn_menu_action_stop}
\unexpanded\def\scrn_menu_txt_start#text\stoptxt
{\scrn_menu_action_start
- \localframedwithsettings
- [\??am:\currentinteractionmenu]%
- [\c!frame=\v!off,\c!background=]%
- {\ignorespaces#text\removeunwantedspaces}%
+ \letinteractionmenuparameter\c!frame\v!off
+ \letinteractionmenuparameter\c!background\empty
+ \inheritedinteractionmenuframed{\ignorespaces#text\removeunwantedspaces}%
\scrn_menu_action_stop}
\unexpanded\def\scrn_menu_rul_start#text\stoprul
{\scrn_menu_action_start
- \directlocalframed
- [\??am:\currentinteractionmenu]%
- {\ignorespaces#text\removeunwantedspaces}%
+ \inheritedinteractionmenuframed{\ignorespaces#text\removeunwantedspaces}%
\scrn_menu_action_stop}
\unexpanded\def\scrn_menu_com_start#text\stopcom
@@ -722,20 +747,20 @@
\unexpanded\def\scrn_menu_but#content\\{\scrn_menu_but_start#content\stopbut} \let\stopbut\relax
\unexpanded\def\scrn_menu_got#content\\{\scrn_menu_got_start#content\stopgot} \let\stopgot\relax
\unexpanded\def\scrn_menu_nop#content\\{\scrn_menu_nop_start#content\stopnop} \let\stopnop\relax
-\unexpanded\def\scrn_menu_txt#content\\{\scrn_menu_nop_start#content\stoptxt} \let\stoptxt\relax
+\unexpanded\def\scrn_menu_txt#content\\{\scrn_menu_txt_start#content\stoptxt} \let\stoptxt\relax
\unexpanded\def\scrn_menu_rul#content\\{\scrn_menu_rul_start#content\stoprul} \let\stoprul\relax
\unexpanded\def\scrn_menu_com#content\\{\scrn_menu_com_start#content\stopcom} \let\stopcom\relax
\newtoks\everysetmenucommands % public
\appendtoks
- \let\raw\scrn_menu_raw \let\startraw\scrn_menu_raw_start
- \let\but\scrn_menu_but \let\startbut\scrn_menu_but_start
- \let\got\scrn_menu_got \let\startgot\scrn_menu_got_start
- \let\nop\scrn_menu_nop \let\startnop\scrn_menu_nop_start
- \let\txt\scrn_menu_txt \let\starttxt\scrn_menu_txt_start
- \let\rul\scrn_menu_rul \let\startrul\scrn_menu_rul_start
- \let\com\scrn_menu_com \let\startcom\scrn_menu_com_start
+ \let\raw\scrn_menu_raw \let\startraw\scrn_menu_raw_start \let\stopraw\relax
+ \let\but\scrn_menu_but \let\startbut\scrn_menu_but_start \let\stopbut\relax
+ \let\got\scrn_menu_got \let\startgot\scrn_menu_got_start \let\stopgot\relax
+ \let\nop\scrn_menu_nop \let\startnop\scrn_menu_nop_start \let\stopnop\relax
+ \let\txt\scrn_menu_txt \let\starttxt\scrn_menu_txt_start \let\stoptxt\relax
+ \let\rul\scrn_menu_rul \let\startrul\scrn_menu_rul_start \let\stoprul\relax
+ \let\com\scrn_menu_com \let\startcom\scrn_menu_com_start \let\stopcom\relax
\to \everysetmenucommands
%D Sometimes handy:
@@ -757,8 +782,7 @@
\edef\currentinteractionmenu{#tag}%
\doif{\interactionmenuparameter\c!state}\v!local
{\letinteractionmenuparameter\c!state\v!start
- \setinteractionmenuparameter\s!parent{\??am\askedinteractionmenulocation}% nice hack
- \interactionmenuparameter\c!menu}%
+ \strictinteractionmenuparameter\c!menu}%
\endgroup}
%D Direct call (todo):
@@ -768,13 +792,9 @@
\def\scrn_menu_interaction_menu[#tag][#settings]%
{\begingroup
- \setupinteractionmenu[#tag][#settings]%
-% \edef\currentinteractionmenu {#tag}%
-% \edef\askedinteractionmenulocation {\interactionmenuparameter\c!category}%
-% \edef\askedinteractionmenualternative{\interactionmenuparameter\c!alternative}%
-% \def\scrn_menu_actions#dummy{\scrn_menu_package_indeed\currentinteractionmenu}%
-% \csname\??am:\c!menu:\askedinteractionmenualternative\endcsname
- \scrn_menu_insert{#tag}%
+ \edef\currentinteractionmenu{#tag}%
+ \setupcurrentinteractionmenu[#settings]%
+ \scrn_menu_insert{#tag}%
\endgroup}
%D Plugin handler:
@@ -799,41 +819,33 @@
\unexpanded\def\scrn_menu_leftedge
{\hbox to \leftedgewidth \bgroup
\hsize\leftedgewidth
- %\csname\??tk\v!leftedge\c!left\endcsname
- \settrue\scrn_menu_zerodimensions
+ \settrue\c_scrn_menu_zerodimensions
\scrn_menu_insert\v!left
- %\csname\??tk\v!leftedge\c!right\endcsname
\egroup
\hskip-\leftedgewidth}
\unexpanded\def\scrn_menu_rightedge
{\hbox to \rightedgewidth \bgroup
\hsize\rightedgewidth
- %\csname\??tk\v!rightedge\c!left\endcsname
- \settrue\scrn_menu_zerodimensions
+ \settrue\c_scrn_menu_zerodimensions
\scrn_menu_insert\v!right
- %\csname\??tk\v!rightedge\c!right\endcsname
\egroup
\hskip-\rightedgewidth}
-\unexpanded\def\scrn_menu_top % uses \??tk
+\unexpanded\def\scrn_menu_top
{\vbox to \topheight \bgroup
\vsize\topheight
- %\csname\??tk\v!top\c!before\endcsname
- \settrue\scrn_menu_zerodimensions
+ \settrue\c_scrn_menu_zerodimensions
\scrn_menu_insert\v!top
- %\csname\??tk\v!top\c!after\endcsname
\kern\zeropoint
\egroup
\vskip-\topheight}
-\unexpanded\def\scrn_menu_bottom % uses \??tk
+\unexpanded\def\scrn_menu_bottom
{\vbox to \bottomheight \bgroup
\vsize\bottomheight
- %\csname\??tk\v!bottom\c!before\endcsname
- \settrue\scrn_menu_zerodimensions
+ \settrue\c_scrn_menu_zerodimensions
\scrn_menu_insert\v!bottom
- %\csname\??tk\v!bottom\c!after\endcsname
\kern\zeropoint
\egroup
\vskip-\bottomheight}
@@ -922,15 +934,32 @@
%D Lists:
-\setvalue{\@@dodolistelement\v!left }{\def\dosomelistelement{\scrn_menu_list_element\v!left }}
-\setvalue{\@@dodolistelement\v!right }{\def\dosomelistelement{\scrn_menu_list_element\v!right }}
-\setvalue{\@@dodolistelement\v!top }{\def\dosomelistelement{\scrn_menu_list_element\v!top }}
-\setvalue{\@@dodolistelement\v!bottom}{\def\dosomelistelement{\scrn_menu_list_element\v!bottom}}
+\ifdefined\definelistalternative
+
+ \definelistalternative [\v!left ] [\c!renderingsetup=strc:lists:rendering:menu]
+ \definelistalternative [\v!right ] [\c!renderingsetup=strc:lists:rendering:menu]
+ \definelistalternative [\v!top ] [\c!renderingsetup=strc:lists:rendering:menu]
+ \definelistalternative [\v!bottom] [\c!renderingsetup=strc:lists:rendering:menu]
+
+ \startsetups[strc:lists:rendering:menu]
+ \startbut[internal(\currentlistentryinternal)]
+ \limitatetext\currentlistentrytext{\currentlistparameter\c!maxwidth}\unknown
+ \stopbut
+ \stopsetups
+
+\else % will go
+
+ \setvalue{\??listelement\v!left }{\def\dosomelistelement{\scrn_menu_list_element\v!left }}
+ \setvalue{\??listelement\v!right }{\def\dosomelistelement{\scrn_menu_list_element\v!right }}
+ \setvalue{\??listelement\v!top }{\def\dosomelistelement{\scrn_menu_list_element\v!top }}
+ \setvalue{\??listelement\v!bottom}{\def\dosomelistelement{\scrn_menu_list_element\v!bottom}}
+
+ \def\scrn_menu_list_element#1#2#3#4#5#6#7%
+ {\startbut[internal(#3)]
+ \limitatetext{#5}{\namedlistparameter{#2}\c!maxwidth}\unknown%
+ \stopbut}
-\def\scrn_menu_list_element#1#2#3#4#5#6#7%
- {\startbut[internal(#3)]
- \limitatetext{#5}{\namedlistparameter{#2}\c!maxwidth}\unknown%
- \stopbut}
+\fi
%D Sometimes handy:
@@ -954,7 +983,8 @@
\scrn_menu_menu_button_a
{#menutag}{#settings}{#text}{#action}%
\else
- \doifassignmentelse{#menutag}\scrn_menu_menu_button_b\scrn_menu_menu_button_c{#menutag}{#text}{#action}%
+ \doifassignmentelse{#menutag}\scrn_menu_menu_button_b\scrn_menu_menu_button_c
+ {#menutag}{#text}{#action}%
\fi}
\def\scrn_menu_menu_button_ignore[#menutag][#settings]#text[#action]%
@@ -963,21 +993,42 @@
\def\scrn_menu_menu_button_a#tag#settings#text#action%
{\doif{\interactionmenuparameter\c!state}\v!start
{\dontleavehmode \begingroup
- \setupinteractionmenu[#tag][#settings]%
- \scrn_button_make\??am{#tag}\menuparameter{#text}{#action}%
+ \edef\currentinteractionmenu{#tag}%
+ \setupcurrentinteractionmenu[#settings]%
+ \scrn_button_make
+ \interactionmenuparameter
+ \inheritedinteractionmenuframed
+ \letinteractionmenuparameter
+ \setinteractionmenuparameter
+ {#text}%
+ {#action}%
\endgroup}}
\def\scrn_menu_menu_button_b#settings#text#action%
{\doif{\buttonparameter\c!state}\v!start
{\dontleavehmode \begingroup
- \setupbuttons[#settings]%
- \scrn_button_make\??bt\empty\buttonparameter{#text}{#action}%
+ \let\currentbutton\empty
+ \setupcurrentbutton[#settings]%
+ \scrn_button_make
+ \buttonparameter
+ \inheritedbuttonframed
+ \letbuttonparameter
+ \setbuttonparameter
+ {#text}%
+ {#action}%
\endgroup}}
\def\scrn_menu_menu_button_c#tag#text#action%
{\doif{\interactionmenuparameter\c!state}\v!start
{\dontleavehmode \begingroup
- \scrn_button_make\??am{#tag}\menuparameter{#text}{#action}%
+ \edef\currentinteractionmenu{#tag}%
+ \scrn_button_make
+ \interactionmenuparameter
+ \inheritedinteractionmenuframed
+ \letinteractionmenuparameter
+ \setinteractionmenuparameter
+ {#text}%
+ {#action}%
\endgroup}}
%D Untested: