diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/scrn-bar.mkvi')
-rw-r--r-- | Master/texmf-dist/tex/context/base/scrn-bar.mkvi | 150 |
1 files changed, 77 insertions, 73 deletions
diff --git a/Master/texmf-dist/tex/context/base/scrn-bar.mkvi b/Master/texmf-dist/tex/context/base/scrn-bar.mkvi index 4605f1d2e16..dabc8f77dc6 100644 --- a/Master/texmf-dist/tex/context/base/scrn-bar.mkvi +++ b/Master/texmf-dist/tex/context/base/scrn-bar.mkvi @@ -5,7 +5,7 @@ %D subtitle=Progress Bars, %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 @@ -57,9 +57,9 @@ %D \stoptext %D \stoptyping -\installcommandhandler \??ib {interactionbar} \??ib +\installcorenamespace{interactionbar} -\presetlocalframed[\??ib] +\installframedcommandhandler \??interactionbar {interactionbar} \??interactionbar \unexpanded\def\interactionbar {\dodoubleempty\scrn_bar_direct} @@ -68,19 +68,20 @@ {\iflocation \begingroup \doifassignmentelse{#tag} - {\getparameters[\??ib][#tag]% + {\let\currentinteractionbar\empty + \setupcurrentinteractionbar[#tag]% \edef\currentinteractionbar{\interactionbarparameter\c!alternative}}% {\edef\currentinteractionbar{#tag}% - \ifsecondargument\getparameters[\??ib#tag][#settings]\fi}% + \ifsecondargument\setupcurrentinteractionbar[#settings]\fi}% \doif{\interactionbarparameter\c!state}\v!start {\interactionbarparameter\c!command}% \endgroup \fi} -\newdimen\scrn_bar_width -\newdimen\scrn_bar_height -\newdimen\scrn_bar_depth -\newdimen\scrn_bar_distance +\newdimen\d_scrn_bar_width +\newdimen\d_scrn_bar_height +\newdimen\d_scrn_bar_depth +\newdimen\d_scrn_bar_distance %D Interaction buttons, in fact a row of tiny buttons, are %D typically only used for navigational purposed. The next @@ -125,32 +126,33 @@ \def\scrn_bar_buttons_indeed[#settings][#list]% {\begingroup %\let\menuparameter\interactionbarparameter - \setupinteractionbar[#settings]% - \scrn_bar_width\interactionbarparameter\c!width - \ifdim\scrn_bar_width=\zeropoint - \scrn_bar_width1.5\emwidth + \setupcurrentinteractionbar[#settings]% + \d_scrn_bar_width\interactionbarparameter\c!width + \ifdim\d_scrn_bar_width=\zeropoint + \d_scrn_bar_width1.5\emwidth \fi \doifnothing{\interactionbarparameter\c!height}{\letinteractionbarparameter\c!height\v!broad}% \doifnothing{\interactionbarparameter\c!depth }{\letinteractionbarparameter\c!depth\!!zeropoint}%%% - \setbox2\hbox{\localframed[\??ib\currentinteractionbar][\c!background=]{\symbol[\interactionparameter\c!symbolset][\v!previouspage]}}% + \letinteractionbarparameter\c!background\empty + \setbox2\hbox{\inheritedinteractionbarframed{\symbol[\interactionparameter\c!symbolset][\v!previouspage]}}% \!!heighta\ht2 % needed because we default to nothing - \setupinteractionbar[\c!strut=\v!no]% + \letinteractionbarparameter\c!strut\v!no \letinteractionparameter\c!width\zeropoint \!!counta\zerocount % new, was 1 \processallactionsinset [#list] - [ \v!page=>\advance\!!counta 4, - \v!subpage=>\advance\!!counta 4, - \s!unknown=>\advance\!!counta 1]% - \ifdim\scrn_bar_width=\zeropoint - \!!widtha\dimexpr2\emwidth+\scrn_bar_distance\relax - \!!widthb\dimexpr\!!counta\!!widtha-\scrn_bar_distance\relax + [ \v!page=>\advance\!!counta\plusfour, + \v!subpage=>\advance\!!counta\plusfour, + \s!unknown=>\advance\!!counta\plusone]% + \ifdim\d_scrn_bar_width=\zeropoint + \!!widtha\dimexpr2\emwidth+\d_scrn_bar_distance\relax + \!!widthb\dimexpr\!!counta\!!widtha-\d_scrn_bar_distance\relax \else - \!!widtha\scrn_bar_width - \!!widthb\dimexpr\!!counta\scrn_bar_distance-\scrn_bar_distance\relax + \!!widtha\d_scrn_bar_width + \!!widthb\dimexpr\!!counta\d_scrn_bar_distance-\d_scrn_bar_distance\relax \advance\!!widtha -\!!widthb \divide\!!widtha \!!counta - \!!widthb\scrn_bar_width + \!!widthb\d_scrn_bar_width \fi \hbox to \!!widthb {\setnostrut @@ -177,15 +179,17 @@ [#action]% \hss} +% todo: this will be \letblackruleparameter\c!width\!!widtha (faster) + \def\scrn_bar_alternative_a - {\scrn_bar_width \interactionbarparameter\c!width - \scrn_bar_distance\interactionbarparameter\c!distance - \scrn_bar_height \interactionbarparameter\c!height - \scrn_bar_depth \interactionbarparameter\c!depth - \noindent\hbox to \scrn_bar_width \bgroup + {\d_scrn_bar_width \interactionbarparameter\c!width + \d_scrn_bar_distance\interactionbarparameter\c!distance + \d_scrn_bar_height \interactionbarparameter\c!height + \d_scrn_bar_depth \interactionbarparameter\c!depth + \noindent\hbox to \d_scrn_bar_width \bgroup \dontcomplain \setupblackrules[\c!height=\v!max,\c!depth=\v!max]% - \!!widthb\dimexpr\scrn_bar_width-4\emwidth\relax + \!!widthb\dimexpr\d_scrn_bar_width-4\emwidth\relax \processaction [\interactionbarparameter\c!step] [ \v!small=>\scratchcounter 20, @@ -194,7 +198,7 @@ \s!unknown=>\scratchcounter 10]% \!!widtha\dimexpr\!!widthb/\scratchcounter\relax \setupblackrules[\c!width=\!!widtha]% - \setbox\scratchbox\hbox to \scrn_bar_width + \setbox\scratchbox\hbox to \d_scrn_bar_width {\hskip2\emwidth \setbox\scratchbox\hbox{\blackrule[\c!color=\interactionbarparameter\c!backgroundcolor]}% \dorecurse\scratchcounter @@ -226,10 +230,10 @@ \def\scrn_bar_alternative_c {\ifnum\lastpage>\plusone - \scrn_bar_width\interactionbarparameter\c!width - \hbox to \scrn_bar_width + \d_scrn_bar_width\interactionbarparameter\c!width + \hbox to \d_scrn_bar_width {\setupblackrules[\c!height=\interactionbarparameter\c!height,\c!depth=\interactionbarparameter\c!depth,\c!width=\emwidth]% - \scratchdimen\dimexpr(\scrn_bar_width-4\emwidth)/\numexpr\lastpage+\minusone\relax\relax + \scratchdimen\dimexpr(\d_scrn_bar_width-4\emwidth)/\numexpr\lastpage+\minusone\relax\relax \!!widtha\numexpr\realpageno+\minusone\relax\scratchdimen \!!widthb\numexpr\lastpage-\realpageno\relax\scratchdimen \directgotospecbox\interactionbarparameter{\blackrule}[\v!firstpage]% @@ -245,20 +249,20 @@ {\symbol[\ifcase#whereto\v!previous\or\v!somewhere\or\v!next\fi]} \unexpanded\def\scrn_bar_goto_b#whereto% - {\vrule\!!height\scrn_bar_height\!!depth\scrn_bar_depth\!!width\!!widtha\relax} + {\vrule\!!height\d_scrn_bar_height\!!depth\d_scrn_bar_depth\!!width\!!widtha\relax} \unexpanded\def\scrn_bar_goto_c#whereto% {\symbol[\ifcase#whereto\v!previous\or\v!somewhere\or\v!somewhere\or\v!somewhere\or\v!next\fi} \unexpanded\def\scrn_bar_goto_d#whereto% {\vrule \!!width\!!widtha \ifcase#whereto% - \!!height \scrn_bar_height \!!depth \scrn_bar_depth \or - \!!height.5\scrn_bar_height \!!depth.5\scrn_bar_depth \or - \!!height \scrn_bar_height \!!depth \scrn_bar_depth \or - \!!height.5\scrn_bar_height \!!depth.5\scrn_bar_depth \else - \!!height \scrn_bar_height \!!depth \scrn_bar_depth \fi} + \!!height \d_scrn_bar_height \!!depth \d_scrn_bar_depth \or + \!!height.5\d_scrn_bar_height \!!depth.5\d_scrn_bar_depth \or + \!!height \d_scrn_bar_height \!!depth \d_scrn_bar_depth \or + \!!height.5\d_scrn_bar_height \!!depth.5\d_scrn_bar_depth \else + \!!height \d_scrn_bar_height \!!depth \d_scrn_bar_depth \fi} -\newconstant\scrn_bar_mode +\newconstant\c_scrn_bar_mode \unexpanded\def\scrn_bar_goto_x#command% {\doifelse{\interactionbarparameter\c!symbol}\v!yes @@ -267,64 +271,64 @@ {\let\scrn_bar_goto_indeed\scrn_bar_goto_b}% \dorecurse\nofsubpages {\scratchcounter\numexpr\recurselevel+\firstsubpage+\minusone\relax - \scrn_bar_mode + \c_scrn_bar_mode \ifnum\scratchcounter<\realpageno \zerocount \else \ifnum\scratchcounter=\realpageno \plusone \else \plustwo \fi\fi - \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\scrn_bar_goto_indeed\scrn_bar_mode}[page(\the\scratchcounter)]}% + \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\scrn_bar_goto_indeed\c_scrn_bar_mode}[page(\the\scratchcounter)]}% #command}% \unskip} \def\scrn_bar_alternative_d - {\ifnum\nofsubpages>\plusone \doif{\structurecounterparameter\s!subpage\c!state}\v!start{% - \scrn_bar_width \interactionbarparameter\c!width - \scrn_bar_distance\interactionbarparameter\c!distance - \scrn_bar_height \interactionbarparameter\c!height - \scrn_bar_depth \interactionbarparameter\c!depth - \!!widtha\scrn_bar_width - \noindent\hbox{\scrn_bar_goto_x{\hskip\scrn_bar_distance}}% + {\ifnum\nofsubpages>\plusone \doif{\counterparameter\s!subpage\c!state}\v!start{% + \d_scrn_bar_width \interactionbarparameter\c!width + \d_scrn_bar_distance\interactionbarparameter\c!distance + \d_scrn_bar_height \interactionbarparameter\c!height + \d_scrn_bar_depth \interactionbarparameter\c!depth + \!!widtha\d_scrn_bar_width + \noindent\hbox{\scrn_bar_goto_x{\hskip\d_scrn_bar_distance}}% }\fi} \def\scrn_bar_alternative_e - {\ifnum\nofsubpages>\plusone \doif{\structurecounterparameter\s!subpage\c!state}\v!start{% - \scrn_bar_width \interactionbarparameter\c!width - \scrn_bar_distance\interactionbarparameter\c!distance - \scrn_bar_height \interactionbarparameter\c!height - \scrn_bar_depth \interactionbarparameter\c!depth - \!!widthb\dimexpr\nofsubpages\scrn_bar_distance-\scrn_bar_distance\relax % (n-1) - \!!widtha\dimexpr(\scrn_bar_width-\!!widthb)/\nofsubpages\relax - \ifdim\!!widtha<\scrn_bar_distance + {\ifnum\nofsubpages>\plusone \doif{\counterparameter\s!subpage\c!state}\v!start{% + \d_scrn_bar_width \interactionbarparameter\c!width + \d_scrn_bar_distance\interactionbarparameter\c!distance + \d_scrn_bar_height \interactionbarparameter\c!height + \d_scrn_bar_depth \interactionbarparameter\c!depth + \!!widthb\dimexpr\nofsubpages\d_scrn_bar_distance-\d_scrn_bar_distance\relax % (n-1) + \!!widtha\dimexpr(\d_scrn_bar_width-\!!widthb)/\nofsubpages\relax + \ifdim\!!widtha<\d_scrn_bar_distance \scrn_bar_alternative_f \else - \noindent\hbox to \scrn_bar_width{\scrn_bar_goto_x{\hss}\unskip}% + \noindent\hbox to \d_scrn_bar_width{\scrn_bar_goto_x{\hss}\unskip}% \fi }\fi} \def\scrn_bar_alternative_f - {\ifnum\nofsubpages>\plusone \doif{\structurecounterparameter\s!subpage\c!state}\v!start{% - \scrn_bar_width \interactionbarparameter\c!width - \scrn_bar_distance\interactionbarparameter\c!distance - \scrn_bar_height \interactionbarparameter\c!height - \scrn_bar_depth \interactionbarparameter\c!depth - \noindent \hbox to \scrn_bar_width \bgroup + {\ifnum\nofsubpages>\plusone \doif{\counterparameter\s!subpage\c!state}\v!start{% + \d_scrn_bar_width \interactionbarparameter\c!width + \d_scrn_bar_distance\interactionbarparameter\c!distance + \d_scrn_bar_height \interactionbarparameter\c!height + \d_scrn_bar_depth \interactionbarparameter\c!depth + \noindent \hbox to \d_scrn_bar_width \bgroup \doloop {\!!countc\numexpr(\nofsubpages/\recurselevel)+\plusone\relax % rounding - \!!widthb\scrn_bar_distance + \!!widthb\d_scrn_bar_distance \multiply\!!widthb \!!countc - \advance\!!widthb -\scrn_bar_distance - \!!widtha\scrn_bar_width + \advance\!!widthb -\d_scrn_bar_distance + \!!widtha\d_scrn_bar_width \advance\!!widtha -\!!widthb \divide\!!widtha \!!countc - \ifdim\!!widtha<\scrn_bar_distance\else + \ifdim\!!widtha<\d_scrn_bar_distance\else \!!countb\recurselevel \exitloop \fi}% \ifnum\!!countc>\plusone % this is not that well tested \advance\!!countc \minustwo - \!!widtha-\scrn_bar_distance + \!!widtha-\d_scrn_bar_distance \!!widtha\!!countc\!!widtha - \advance\!!widtha \scrn_bar_width + \advance\!!widtha \d_scrn_bar_width \advance\!!countc \plusone \divide\!!widtha \!!countc \fi @@ -341,7 +345,7 @@ \advance\!!countf \plusone \ifnum\recurselevel=\firstsubpage\relax \!!doneatrue \fi \ifnum\recurselevel=\lastsubpage \relax \!!doneatrue \fi - \scrn_bar_mode + \c_scrn_bar_mode \if!!donea \ifnum\recurselevel<\realpageno \zerocount @@ -363,7 +367,7 @@ \plusthree \fi \fi - \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\scrn_bar_goto_indeed\scrn_bar_mode}[page(\recurselevel)]}% + \normalexpanded{\directgotospecbox\noexpand\interactionbarparameter{\scrn_bar_goto_indeed\c_scrn_bar_mode}[page(\recurselevel)]}% \hss \!!countf\zerocount}% \unskip |