summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/scrn-fld.mkvi
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/scrn-fld.mkvi')
-rw-r--r--Master/texmf-dist/tex/context/base/scrn-fld.mkvi394
1 files changed, 226 insertions, 168 deletions
diff --git a/Master/texmf-dist/tex/context/base/scrn-fld.mkvi b/Master/texmf-dist/tex/context/base/scrn-fld.mkvi
index bf84f15b79f..87209909961 100644
--- a/Master/texmf-dist/tex/context/base/scrn-fld.mkvi
+++ b/Master/texmf-dist/tex/context/base/scrn-fld.mkvi
@@ -5,7 +5,7 @@
%D subtitle=Fields,
%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
@@ -100,22 +100,23 @@
%D When submitting a form, we need to tell the driver module
%D that we want \FDF\ or \HTML.
-\newtoks\everysetupforms
+\installcorenamespace {forms}
-\unexpanded\def\setupforms
- {\dosingleempty\scrn_forms_setup}
-
-\def\scrn_forms_setup[#settings]
- {\getparameters[\??fr][#settings]%
- \the\everysetupforms}
+\installdirectcommandhandler \??forms {forms}
\appendtoks
- \ctxcommand{setformsmethod("@@frmethod")}%
+ \ctxcommand{setformsmethod("\formsparameter\c!method")}%
\to \everysetupforms
\setupforms
[\c!method=XML] % no need for everyjob initialization as this is the default
+\appendtoks
+ \iflocation
+ \ctxcommand{exportformdata("\formsparameter\c!export")}%
+ \fi
+\to \everystoptext
+
%D We need to initialize symbols in a special way so that they
%D can be used as rendering for a widget.
@@ -128,10 +129,8 @@
\def\scrn_symbols_preset_indeed#tag%
{\doifobjectfoundelse{SYM}{#tag}
{}
- {\settightobject{SYM}{#tag}\hbox{\symbol[#tag]}%
- \flushatshipout
- {\setbox0\hbox{\hskip-\maxdimen\getobject{SYM}{#tag}}%
- \smashbox0\box0}}}
+ {\settightobject{SYM}{#tag}\hbox{\symbol[#tag]}% % todo: set this as immediate xform
+ \page_otr_add_special_content{\hskip-\maxdimen\getobject{SYM}{#tag}}}} % and then force it into the file
\let\dosetfieldsymbol\scrn_symbols_preset_indeed
@@ -140,17 +139,20 @@
\unexpanded\def\definedefaultsymbols % used ?
{\definesymbol[defaultyes][\mathematics{\times}]%
- \definesymbol[defaultno ][\mathematics{\cdot }]}
+ \definesymbol[defaultno] [\mathematics{\cdot }]}
% \def\resetfieldsymbol[#tag]% for experimental usage only
% {\resetobject{SYM}{#tag}}
%D Now comes the real code:
-\installcommandhandler \??fd {fieldcategory} \??fd
-\installcommandhandler \??fb {fieldbody} \??fb
+\installcorenamespace{fieldcategory}
+\installcorenamespace{fieldbody}
+
+\installcommandhandler \??fieldcategory {fieldcategory} \??fieldcategory
+\installcommandhandler \??fieldbody {fieldbody} \??fieldbody
-\newbox\scrn_field_box_body
+\newbox\b_scrn_field_body
\setupfieldcategory
[\c!alternative=\v!normal, % normal clone copy
@@ -165,9 +167,11 @@
\def\scrn_field_check_category
{\edef\currentfieldbodycategory{\fieldbodyparameter\c!category}%
\ifx\currentfieldbodycategory\empty
- \setevalue{\??fb\currentfieldbody\s!parent}{\??fd}%
+ \letfieldbodyparameter\s!parent\??fieldcategory
+ %\setevalue{\currentfieldbodyhash\s!parent}{\namedfieldcategoryhash\empty}% to WS: not hash !
\else
- \setevalue{\??fb\currentfieldbody\s!parent}{\??fd\currentfieldbodycategory}%
+ \normalexpanded{\setfieldbodyparameter{\s!parent}{\??fieldcategory\currentfieldbodycategory}}%
+ %\setevalue{\currentfieldbodyhash\s!parent}{\namedfieldcategoryhash\currentfieldbodycategory}% to WS: not hash !
\fi}
\appendtoks % we cannot use parent .. maybe s!parent has to change
@@ -201,10 +205,10 @@
\hbox\bgroup
\edef\currentfieldbody{#tag}%
\ifsecondargument
- \setupfieldbody[#tag][#settings]%
+ \setupcurrentfieldbody[#settings]%
\fi
\scrn_field_body_typeset
- \box\scrn_field_box_body
+ \box\b_scrn_field_body
\egroup
\fi}
@@ -212,12 +216,14 @@
{\edef\currentfieldframecolor{\fieldbodyparameter\c!fieldframecolor}%
\ifx\currentfieldframecolor\empty\else
\getcolorattributevalue\currentfieldframecolor\currentfieldframecolorvalue
+ % == \edef\currentfieldframecolorvalue{\thecolorattribute\currentfieldframecolor}%
\fi
\edef\currentfieldbackgroundcolor{\fieldbodyparameter\c!fieldbackgroundcolor}%
\ifx\currentfieldbackgroundcolor\empty\else
\getcolorattributevalue\currentfieldbackgroundcolor\currentfieldbackgroundcolorvalue
+ % == \edef\currentfieldbackgroundcolorvalue{\thecolorattribute\currentfieldbackgroundcolor}%
\fi
- \dosetfieldbodyattributes\c!style\c!color
+ \usefieldbodystyleandcolor\c!style\c!color
\ctxcommand{insertfield("\currentfieldbody", {
title = "\currentfieldbody",
width = \number\dimexpr\fieldbodyparameter\c!width \relax,
@@ -235,6 +241,7 @@
\ifx\currentfieldbackgroundcolor\empty \else
backgroundcolor = "\currentfieldbackgroundcolor",
backgroundcolorvalue = "\currentfieldbackgroundcolorvalue",
+
\fi
\ifx\currentfieldframecolor\empty \else
framecolor = "\currentfieldframecolor",
@@ -326,9 +333,10 @@
%D (implemented as properties).
\appendtoks
+ \let\currentfieldcategory\empty
\doifelse{\interactionparameter\c!fieldlayer}\v!auto
- {\setupfieldcategory[\c!fieldlayer=\currentviewerlayer]}%
- {\setupfieldcategory[\c!fieldlayer=]}%
+ {\setupcurrentfieldcategory[\c!fieldlayer=\currentviewerlayer]}%
+ {\setupcurrentfieldcategory[\c!fieldlayer=]}%
\to \everysetupinteraction
\setupinteraction
@@ -344,7 +352,7 @@
%D \ruledhbox{\fitfield[buttona]}
%D \stoptyping
-\newbox\scrn_field_box_fit_symbol
+\newbox\b_scrn_field_fit_symbol
\defineframed
[fitfieldframed]
@@ -360,12 +368,12 @@
{\iflocation
\begingroup
\edef\currentdefaultfieldvalue{\ctxcommand{getdefaultfieldvalue("#tag")}}%
- \setbox\scrn_field_box_fit_symbol\hbox{\symbol[\currentdefaultfieldvalue]}%
+ \setbox\b_scrn_field_fit_symbol\hbox{\symbol[\currentdefaultfieldvalue]}%
\fitfieldframed[#tag]
{\fieldbody[#tag]
- [\c!width=\wd\scrn_field_box_fit_symbol,
- \c!height=\ht\scrn_field_box_fit_symbol,
- \c!depth=\dp\scrn_field_box_fit_symbol,
+ [\c!width=\wd\b_scrn_field_fit_symbol,
+ \c!height=\ht\b_scrn_field_fit_symbol,
+ \c!depth=\dp\b_scrn_field_fit_symbol,
#settings]}%
\endgroup
\fi}
@@ -373,31 +381,35 @@
%D The traditional field command does some labeling and
%D boxing:
-\installparameterhandler \??wl {fieldlabelframed}
-\installparameterhandler \??wc {fieldcontentframed}
-\installparameterhandler \??wt {fieldtotalframed}
+\installcorenamespace{fieldlabel}
+\installcorenamespace{fieldcontent}
+\installcorenamespace{fieldtotal}
+
+\installparameterhandler \??fieldlabel {fieldlabelframed}
+\installparameterhandler \??fieldcontent {fieldcontentframed}
+\installparameterhandler \??fieldtotal {fieldtotalframed}
+
+\installsetuphandler \??fieldlabel {fieldlabelframed}
+\installsetuphandler \??fieldcontent {fieldcontentframed}
+\installsetuphandler \??fieldtotal {fieldtotalframed}
-\installsetuphandler \??wl {fieldlabelframed}
-\installsetuphandler \??wc {fieldcontentframed}
-\installsetuphandler \??wt {fieldtotalframed}
+\installinheritedframed {fieldlabelframed}
+\installinheritedframed {fieldcontentframed}
+\installinheritedframed {fieldtotalframed}
\unexpanded\def\setupfield {\doquintupleempty\scrn_field_setup_field}
\unexpanded\def\setupfields{\doquadrupleempty\scrn_field_setup_fields}
-% \presetlocalframed[\??wl]
-% \presetlocalframed[\??wc]
-% \presetlocalframed[\??wt]
-
\setupfieldcontentframed
[\c!align=\v!flushleft,
\c!strut=\v!no,
- \s!parent=\??ol]
+ \s!parent=\??ol] % needs checking
\setupfieldcontentframed % independent
[\c!alternative=\v!normal,
\c!type=\v!line,
\c!width=5em,
- \c!height=1em,
+ \c!height=\lineheight,
\c!depth=\zeropoint,
\c!align=\v!flushleft,
\c!option=\v!printable,
@@ -407,38 +419,40 @@
[\c!style=,
\c!color=,
\c!align=\v!flushleft,
- \s!parent=\??ol]
+ \s!parent=\??ol] % needs checking
\setupfieldtotalframed
[%\c!alternative={\v!label,\v!frame,\v!horizontal},
\c!strut=\v!no,
\c!align=,
- \s!parent=\??ol]
+ \s!parent=\??ol] % needs checking
+
+% \setupcurrent
\def\scrn_field_setup_field[#tag][#variant][#totalsettings][#labelsettings][#fieldsettings]%
{\iffifthargument
- \definefieldcategory[#tag][\s!parent=\??wc#tag,#fieldsettings]
- \setupfieldtotalframed [#tag][\s!parent=\??wt,\c!alternative={#variant},#totalsettings]%
- \setupfieldlabelframed [#tag][\s!parent=\??wl,#labelsettings]%
- \setupfieldcontentframed[#tag][\s!parent=\??wc,#fieldsettings]%
+ \definefieldcategory[#tag][\s!parent=\??fieldcontent#tag,#fieldsettings]%
+ \setupfieldtotalframed [#tag][\s!parent=\??fieldtotal,\c!alternative={#variant},#totalsettings]%
+ \setupfieldlabelframed [#tag][\s!parent=\??fieldlabel,#labelsettings]%
+ \setupfieldcontentframed[#tag][\s!parent=\??fieldcontent,#fieldsettings]%
\else\iffourthargument
- \definefieldcategory[#tag][\s!parent=\??wc#tag,#labelsettings]
- \setupfieldtotalframed [#tag][\s!parent=\??wt,\c!alternative={#variant},#totalsettings]%
- \setupfieldlabelframed [#tag][\s!parent=\??wl]%
- \setupfieldcontentframed[#tag][\s!parent=\??wc,#labelsettings]%
+ \definefieldcategory[#tag][\s!parent=\??fieldcontent#tag,#labelsettings]%
+ \setupfieldtotalframed [#tag][\s!parent=\??fieldtotal,\c!alternative={#variant},#totalsettings]%
+ \setupfieldlabelframed [#tag][\s!parent=\??fieldlabel]%
+ \setupfieldcontentframed[#tag][\s!parent=\??fieldcontent,#labelsettings]%
\else\ifthirdargument
- \definefieldcategory[#tag][\s!parent=\??wc#tag,#totalsettings]
- \setupfieldtotalframed [#tag][\s!parent=\??wt,\c!alternative={#variant}]%
- \setupfieldlabelframed [#tag][\s!parent=\??wl]%
- \setupfieldcontentframed[#tag][\s!parent=\??wc,#totalsettings]%
+ \definefieldcategory[#tag][\s!parent=\??fieldcontent#tag,#totalsettings]%
+ \setupfieldtotalframed [#tag][\s!parent=\??fieldtotal,\c!alternative={#variant}]%
+ \setupfieldlabelframed [#tag][\s!parent=\??fieldlabel]%
+ \setupfieldcontentframed[#tag][\s!parent=\??fieldcontent,#totalsettings]%
\else\ifsecondargument
- \definefieldcategory[#tag][\s!parent=\??wc#tag,#variant]
- \setupfieldtotalframed [#tag][\s!parent=\??wt]%
- \setupfieldlabelframed [#tag][\s!parent=\??wl]%
- \setupfieldcontentframed[#tag][\s!parent=\??wc,#variant]%
+ \definefieldcategory[#tag][\s!parent=\??fieldcontent#tag,#variant]%
+ \setupfieldtotalframed [#tag][\s!parent=\??fieldtotal]%
+ \setupfieldlabelframed [#tag][\s!parent=\??fieldlabel]%
+ \setupfieldcontentframed[#tag][\s!parent=\??fieldcontent,#variant]%
\fi\fi\fi\fi}
-\def\scrn_field_setup_fields[#variant][#totalsettings][#labelsettings][#fieldsettings]
+\def\scrn_field_setup_fields[#variant][#totalsettings][#labelsettings][#fieldsettings]%
{\iffourthargument
\setupfieldtotalframed [\c!alternative={#variant},#totalsettings]%
\setupfieldlabelframed [#labelsettings]%
@@ -456,10 +470,10 @@
% just to get the chain right for no category:
-\definefieldcategory [][\s!parent=\??wc]
-\setupfieldtotalframed [][\s!parent=\??wt]
-\setupfieldlabelframed [][\s!parent=\??wl]
-\setupfieldcontentframed[][\s!parent=\??wc]
+\definefieldcategory [][\s!parent=\??fieldcontent]
+%setupfieldtotalframed [][\s!parent=\??fieldtotal]
+%setupfieldlabelframed [][\s!parent=\??fieldlabel]
+%setupfieldcontentframed[][\s!parent=\??fieldcontent]
% no longer supported:
@@ -475,7 +489,7 @@
\unexpanded\def\field
{\dodoubleempty\scrn_field_direct}
-\def\scrn_field_direct[#tag][#label]%
+\def\scrn_field_direct[#tag][#label]% can be sped up with \setupcurrentfieldtotalframed etc
{\iflocation
\dontleavehmode
\begingroup
@@ -487,9 +501,9 @@
\let\currentfieldlabel\currentfieldbody
\fi
\ifx\currentfieldcategory\empty
- \setupfieldtotalframed [\currentfieldbody][\s!parent=\??wt]%
- \setupfieldlabelframed [\currentfieldbody][\s!parent=\??wl]%
- \setupfieldcontentframed[\currentfieldbody][\s!parent=\??wc]%
+ \setupfieldtotalframed [\currentfieldbody][\s!parent=\??fieldtotal]%
+ \setupfieldlabelframed [\currentfieldbody][\s!parent=\??fieldlabel]%
+ \setupfieldcontentframed[\currentfieldbody][\s!parent=\??fieldcontent]%
\definefieldcategory [\currentfieldbody]%
\setupfieldbody [\currentfieldbody][\c!category=\currentfieldbody]%
\let\currentfieldcategory\currentfieldbody
@@ -499,9 +513,11 @@
\let\currentfieldcontentframed\currentfieldcategory
\scrn_field_analyze_setups
\ifconditional\fieldframeshown
- \localframed[\??wt\currentfieldcategory]\bgroup
+ \inheritedfieldtotalframedframed % lower framedoffset
+ \bgroup
\else
- \vbox\bgroup
+ \vbox
+ \bgroup
\fi
\dontcomplain
\ifconditional\fieldlabelshown
@@ -523,57 +539,67 @@
% opties: veld, label, kader, vertikaal/horizontaal
-\newbox\scrn_field_box_label
-\newbox\scrn_field_box_content
+\newbox\b_scrn_field_label
+\newbox\b_scrn_field_content
% lower framedoffset
\def\scrn_field_set_label_box
- {\setbox\scrn_field_box_label\hbox
+ {\setbox\b_scrn_field_label\hbox
{\reshapeframeboxtrue % else wrong dimensions % still needed?
- \localframed
- [\??wl\currentfieldcategory]
+ \inheritedfieldlabelframedframed
{\currentfieldlabel}}}
% \c!fieldoffset=-\framedoffset,\c!fieldbackgroundcolor=,
% \hbox{\lower\@@fdfieldoffset\hbox{\typesetfield}}
\def\scrn_field_set_content_box
- {\setbox\scrn_field_box_content\hbox
+ {\setbox\b_scrn_field_content\hbox
{\reshapeframeboxtrue % else wrong dimensions (to be checked)
- \ifconditional\fieldisvertical
- \setupfieldcontentframed[\c!height=6ex,\c!width=\hsize]%
- \else\ifconditional\fieldishorizontal
- \setupfieldcontentframed[\c!height=\vsize,\c!width=20em]%
- \else
- \setupfieldcontentframed[\c!height=2cm,\c!width=2cm]%
- \fi\fi
- \localframed % lower framedoffset
- [\??wc\currentfieldcategory]
+ \doifnothing{\fieldcontentframedparameter\c!height}
+ {\ifconditional\fieldisvertical
+ \setfieldcontentframedparameter\c!height{6ex}%
+ \else\ifconditional\fieldishorizontal
+ \setfieldcontentframedparameter\c!height{\vsize}%
+ \else
+ \setfieldcontentframedparameter\c!height{2cm}%
+ \fi\fi}%
+ \doifnothing{\fieldcontentframedparameter\c!width}
+ {\ifconditional\fieldisvertical
+ \setfieldcontentframedparameter\c!width{\hsize}%
+ \else\ifconditional\fieldishorizontal
+ \setfieldcontentframedparameter\c!width{20em}%
+ \else
+ \setfieldcontentframedparameter\c!width{2cm}%
+ \fi\fi}%
+ \inheritedfieldcontentframedframed % lower framedoffset
{\fieldbody
[\currentfieldbody]
[\c!width=\framedwidth,\c!height=\framedheight]}}}
+
\def\scrn_field_flush_vertical
{\vbox
- {\copy\scrn_field_box_label
+ {\copy\b_scrn_field_label
\fieldtotalframedparameter\c!inbetween
- \copy\scrn_field_box_content}}
+ \copy\b_scrn_field_content}}
\def\scrn_field_flush_horizontal
{\hbox
- {\vbox \ifdim\ht\scrn_field_box_content>\ht\scrn_field_box_label to \ht\scrn_field_box_content \fi
+ {\vbox \ifdim\ht\b_scrn_field_content>\ht\b_scrn_field_label to \ht\b_scrn_field_content \fi
{\fieldtotalframedparameter\c!before
- \copy\scrn_field_box_label
+ \copy\b_scrn_field_label
\fieldtotalframedparameter\c!after}%
\hskip\fieldtotalframedparameter\c!distance
- \vbox \ifdim\ht\scrn_field_box_label>\ht\scrn_field_box_content to \ht\scrn_field_box_label \fi
+ \vbox \ifdim\ht\b_scrn_field_label>\ht\b_scrn_field_content to \ht\b_scrn_field_label \fi
{\fieldtotalframedparameter\c!before
- \box\scrn_field_box_content
+ \box\b_scrn_field_content
\fieldtotalframedparameter\c!after}}}
\def\scrn_field_flush_content
- {\box\scrn_field_box_content}
+ {\box\b_scrn_field_content}
+
+%D todo: replace \processallactionsinset
\def\scrn_field_analyze_setups
{\setfalse\fieldlabelshown
@@ -600,11 +626,11 @@
%D Common stuff (obsolete)
-\newcount\scrn_field_system_n
+\newcount\c_scrn_field_system_n
\def\nextsystemfield
- {\global\advance\scrn_field_system_n\plusone
- \def\currentsystemfield{sys::\number\scrn_field_system_n}}
+ {\global\advance\c_scrn_field_system_n\plusone
+ \def\currentsystemfield{sys::\number\c_scrn_field_system_n}}
%D \CONTEXT\ had tooltips right from the moment that it
%D supported fields. Due to the at that moment somewhat
@@ -620,11 +646,13 @@
%D before \tooltip[left]{inbetween}{a very nice tip} after\par
%D \stoptyping
-\newbox \scrn_tooltip_box_anchor
-\newbox \scrn_tooltip_box_text
-\newcount\scrn_tooltip_n
+\newbox \b_scrn_tooltip_anchor
+\newbox \b_scrn_tooltip_text
+\newcount\c_scrn_tooltip_n
-\installcommandhandler \??wh {tooltip} \??wh
+\installcorenamespace{tooltip}
+
+\installframedcommandhandler \??tooltip {tooltip} \??tooltip
\setuptooltip
[\c!location=\v!right,
@@ -633,8 +661,6 @@
\c!background=\v!color,
\c!backgroundcolor=gray]
-\presetlocalframed[\??wh]
-
\appendtoks
\setuevalue\currenttooltip{\scrn_tooltip_direct{\currenttooltip}}%
\to \everydefinetooltip
@@ -651,49 +677,50 @@
\def\scrn_tooltip_indeed[#settings]#anchortext#tiptext% a more modern aproach (push buttons)
{\dontleavehmode \hbox \bgroup
\dontcomplain
- \global\advance\scrn_tooltip_n\plusone
- \edef\currenttooltipname{tooltip:\number\scrn_tooltip_n}%
- \setbox\scrn_tooltip_box_anchor\hbox
+ \global\advance\c_scrn_tooltip_n\plusone
+ \edef\currenttooltipname{tooltip:\number\c_scrn_tooltip_n}%
+ \setbox\b_scrn_tooltip_anchor\hbox
{\strut#anchortext}%
\doifassignmentelse{#settings}
- {\setuptooltip[\currenttooltip][#settings]}%
- {\setuptooltip[\currenttooltip][\c!location=#settings]}%
- \setbox\scrn_tooltip_box_text\hbox
- {\localframed[\??wh\currenttooltip][\c!location=]{#tiptext}}%
+ {\setupcurrenttooltip[#settings]}%
+ {\setupcurrenttooltip[\c!location=#settings]}%
+ \setbox\b_scrn_tooltip_text\hbox
+ {\lettooltipparameter\c!location\empty
+ \inheritedtooltipframed{#tiptext}}%
\definesymbol
[\currenttooltipname:txt]
- [\copy\scrn_tooltip_box_text]%
+ [\copy\b_scrn_tooltip_text]%
\definefieldbody
[\currenttooltipname:txt]
[\c!type=push,
- \c!width=\wd\scrn_tooltip_box_text,
- \c!height=\ht\scrn_tooltip_box_text,
- \c!depth=\dp\scrn_tooltip_box_text,
+ \c!width=\wd\b_scrn_tooltip_text,
+ \c!height=\ht\b_scrn_tooltip_text,
+ \c!depth=\dp\b_scrn_tooltip_text,
\c!option=\v!hidden,
\c!values=\currenttooltipname:txt]%
- \setbox\scrn_tooltip_box_text\hbox
+ \setbox\b_scrn_tooltip_text\hbox
{\fieldbody[\currenttooltipname:txt]}%
- \setbox\scrn_tooltip_box_text\hbox
- {\strut\lower\dimexpr.25ex+\ht\scrn_tooltip_box_text\relax\box\scrn_tooltip_box_text}%
+ \setbox\b_scrn_tooltip_text\hbox
+ {\strut\lower\dimexpr.25ex+\ht\b_scrn_tooltip_text\relax\box\b_scrn_tooltip_text}%
\edef\currenttooltiplocation{\tooltipparameter\c!location}%
\ifx\currenttooltiplocation\v!left
- \hsmashed{\hskip\wd\scrn_tooltip_box_anchor\llap{\box\scrn_tooltip_box_text}}%
+ \hsmashed{\hskip\wd\b_scrn_tooltip_anchor\llap{\box\b_scrn_tooltip_text}}%
\else\ifx\currenttooltiplocation\v!middle
- \hsmashed to \wd\scrn_tooltip_box_anchor{\hss\box\scrn_tooltip_box_text\hss}%
+ \hsmashed to \wd\b_scrn_tooltip_anchor{\hss\box\b_scrn_tooltip_text\hss}%
\else
- \hsmashed{\box\scrn_tooltip_box_text}%
+ \hsmashed{\box\b_scrn_tooltip_text}%
\fi\fi
\definesymbol
[\currenttooltipname:but]
- [\hphantom{\copy\scrn_tooltip_box_anchor}]%
+ [\hphantom{\copy\b_scrn_tooltip_anchor}]%
\definefieldbody
[\currenttooltipname:but]
[\c!type=push,
\c!regionin=action(show{\currenttooltipname:txt}),
\c!regionout=action(hide{\currenttooltipname:txt}),
- \c!width=\wd\scrn_tooltip_box_anchor,
- \c!height=\ht\scrn_tooltip_box_anchor,
- \c!depth=\dp\scrn_tooltip_box_anchor]%
+ \c!width=\wd\b_scrn_tooltip_anchor,
+ \c!height=\ht\b_scrn_tooltip_anchor,
+ \c!depth=\dp\b_scrn_tooltip_anchor]%
\hsmashed{\fieldbody[\currenttooltipname:but]}%
\egroup
#anchortext}% when hyphenated the text wil stick out ... such are fields and we cannot use a link here
@@ -732,32 +759,32 @@
\fi
\getvalue{scrn_fieldstack:#tag}}
-\newbox\scrn_fieldstack_box
+\newbox\b_scrn_fieldstack_box
\def\scrn_fieldstack_add#tag#settings#symbol%
{\advance\scratchcounter\plusone
\edef\currentfieldstackname{#tag:\number\scratchcounter}%
- \ifnum\scratchcounter=\@@fdstart\relax
+ \ifnum\scratchcounter=\fieldcategoryparameter\c!start\relax
\definefieldbody[\currentfieldstackname][\c!type=check,\c!values={#symbol,\empty},\c!default={#symbol}]%
\else
\definefieldbody[\currentfieldstackname][\c!type=check,\c!values={#symbol,\empty},\c!default=]%
\fi
- \setbox\scrn_fieldstack_box\hbox{\symbol[#symbol]}%
+ \setbox\b_scrn_fieldstack_box\hbox{\symbol[#symbol]}%
\setcollector
[fieldstack]
{\fieldbody
[\currentfieldstackname]
[\c!option=\v!readonly,
- \c!width=\wd\scrn_fieldstack_box,
- \c!height=\ht\scrn_fieldstack_box,
- \c!depth=\dp\scrn_fieldstack_box,
+ \c!width=\wd\b_scrn_fieldstack_box,
+ \c!height=\ht\b_scrn_fieldstack_box,
+ \c!depth=\dp\b_scrn_fieldstack_box,
#settings]}}
\def\scrn_fieldstack_construct[#tag][#symbols][#settings]% start=n, 0 == leeg
{\iflocation
\dontleavehmode
\begingroup
- \getparameters[\??fd][\c!start=1,#settings]%
+ \setupfieldcategory[\c!start=1,#settings]% was just \??fieldcategory
\scrn_field_load_scripts
\definecollector
[fieldstack]%
@@ -783,7 +810,7 @@
%D \framed[background=WithTest]{toggle}
%D \stoptyping
-\newcount\scrn_rollbutton_n
+\newcount\c_scrn_rollbutton_n
\unexpanded\def\overlayrollbutton
{\dodoubleargument\scrn_rollbutton_overlay}
@@ -791,12 +818,12 @@
\def\scrn_rollbutton_overlay[#regionin][#regionout]%
{\iflocation
\bgroup
- \global\advance\scrn_rollbutton_n\plusone
+ \global\advance\c_scrn_rollbutton_n\plusone
\definesymbol
- [rollbutton:\number\scrn_rollbutton_n]
+ [rollbutton:\number\c_scrn_rollbutton_n]
[{\framed[\c!frame=\v!off,\c!width=\overlaywidth,\c!height=\overlayheight]{}}]%
\definefieldbody
- [rollbutton:\number\scrn_rollbutton_n]
+ [rollbutton:\number\c_scrn_rollbutton_n]
[\c!type=push,
\c!regionin={#regionin},
\c!regionout={#regionout},
@@ -806,20 +833,32 @@
\egroup
\fi}
-\protect \endinput
+% \protect \endinput % THE FOLLOWING CODE IS NOT CHECKED
%D I will redo these when I need them.
+% \setupinteraction[state=start]
+%
% \definepushbutton [reset]
%
-% \definepushsymbol [reset] [n] [\uniqueMPgraphic{whatever}{color=green}]
-% \definepushsymbol [reset] [r] [\uniqueMPgraphic{whatever}{color=white}]
+% \startuniqueMPgraphic{whatever}{color}
+% fill fullcircle xysized (OverlayWidth,OverlayHeight) withcolor \MPvar{color} ;
+% \stopuniqueMPgraphic
+%
+% \definepushsymbol [reset] [n] [\uniqueMPgraphic{whatever}{color=red}]
+% \definepushsymbol [reset] [r] [\uniqueMPgraphic{whatever}{color=green}]
+% \definepushsymbol [reset] [d] [\uniqueMPgraphic{whatever}{color=blue}]
%
-% \startinteractionmenu[bottom]
-% \psh [reset] [JS(reset_something)] \\
-% \stopinteractionmenu
+% \starttext
+% \startTEXpage
+% \pushbutton [reset] [page(2)]
+% \stopTEXpage
+% \startTEXpage
+% \pushbutton [reset] [page(1)]
+% \stopTEXpage
+% \stoptext
-\newcount\scrn_pushbutton_n
+\newcount\c_scrn_pushbutton_n
\unexpanded\def\definepushbutton % name optional setup
{\dodoubleempty\scrn_pushbutton_define}
@@ -837,7 +876,7 @@
\def\scrn_pushbutton_handle#tag#settings#reference%
{\bgroup
- \global\advance\scrn_pushbutton_n\plusone
+ \global\advance\c_scrn_pushbutton_n\plusone
\setupfield
[pushbutton]
[\c!frame=\v!overlay,
@@ -845,12 +884,12 @@
\c!clickout={#reference},
#settings]%
\definefield
- [pushbutton:\number\scrn_pushbutton_n]%
+ [pushbutton:\number\c_scrn_pushbutton_n]%
[push]
[pushbutton]
[pushsymbol:#tag:n,pushsymbol:#tag:r,pushsymbol:#tag:d]%
\fitfield
- [pushbutton:\number\scrn_pushbutton_n]%
+ [pushbutton:\number\c_scrn_pushbutton_n]%
\egroup}
\unexpanded\def\definepushsymbol
@@ -877,7 +916,7 @@
\let\startpsh\scrn_menu_psh_start
\let\stoppsh \relax
\let\psh \scrn_menu_psh_direct
-\everysetmenucommands
+\to \everysetmenucommands
%D Another goodie: (unchecked in \MKIV)
@@ -907,53 +946,72 @@
r=green,
d=blue]
-\newcount\scrn_rollbutton_n_button
-\newcount\scrn_rollbutton_n_symbol
+\newcount\c_scrn_rollbutton_n_button
+\newcount\c_scrn_rollbutton_n_symbol
\unexpanded\def\rollbutton
{\dodoubleempty\scrn_rollbutton}
+\def\scrn_rollbutton_symbol_m
+ {\scrn_rollbutton_symbol_indeed
+ \getinteractionmenuparameter
+ \inheritedinteractionmenuframed
+ \setinteractionmenuparameter
+ \useinteractionmenustyleandcolor}
+
+\def\scrn_rollbutton_symbol_b
+ {\scrn_rollbutton_symbol_indeed
+ \getbuttonparameter
+ \inheritedbuttonframed
+ \setbuttonparameter
+ \usebuttonstyleandcolor}
+
\def\scrn_rollbutton[#tag][#settings]#text[#reference]%
{\dontleavehmode
\bgroup
- \doglobal\advance\scrn_rollbutton_n_button
- \doglobal\advance\scrn_rollbutton_n_symbol
+ \doglobal\advance\c_scrn_rollbutton_n_button
+ \doglobal\advance\c_scrn_rollbutton_n_symbol
\iffirstargument
\ifsecondargument
- \getparameters[\??am#tag][#settings]%
- \def\scrn_rollbutton_symbol{\scrn_rollbutton_symbol_indeed{\??am#tag}{#text}}%
+ \edef\currentinteractionmenu{#tag}%
+ \setupcurrentinteractionmenu[#settings]%
+ \let\scrn_rollbutton_symbol\scrn_rollbutton_symbol_m
\else
\doifassignmentelse{#tag}
- {\getparameters[\??bt][#tag]%
- \def\scrn_rollbutton_symbol{\scrn_rollbutton_symbol_indeed{\??bt}{#text}}}
- {\def\scrn_rollbutton_symbol{\scrn_rollbutton_symbol_indeed{\??am#tag}{#text}}}%
+ {\let\currentbutton\empty
+ \setupcurrentbutton[#tag]%
+ \let\scrn_rollbutton_symbol\scrn_rollbutton_symbol_b}%
+ {\edef\currentinteractionmenu{#tag}%
+ \let\scrn_rollbutton_symbol\scrn_rollbutton_symbol_m}%
\fi
\else
- \def\scrn_rollbutton_symbol{\set_location_box_indeed_indeed{\??bt}{#text}}%
+ \let\scrn_rollbutton_symbol\scrn_rollbutton_symbol_b
\fi
% todo: share symbols, tricky since different dimensions
- \definesymbol[rollsymbol:\number\scrn_rollbutton_n_symbol:n][\scrn_rollbutton_symbol{n}]%
- \definesymbol[rollsymbol:\number\scrn_rollbutton_n_symbol:r][\scrn_rollbutton_symbol{r}]%
- \definesymbol[rollsymbol:\number\scrn_rollbutton_n_symbol:d][\scrn_rollbutton_symbol{d}]%
+ \definesymbol[rollsymbol:\number\c_scrn_rollbutton_n_symbol:n][\scrn_rollbutton_symbol{n}{#text}]%
+ \definesymbol[rollsymbol:\number\c_scrn_rollbutton_n_symbol:r][\scrn_rollbutton_symbol{r}{#text}]%
+ \definesymbol[rollsymbol:\number\c_scrn_rollbutton_n_symbol:d][\scrn_rollbutton_symbol{d}{#text}]%
\setupfield
[rollbutton]
[\c!frame=\v!off,
\c!offset=\v!overlay,
\c!clickout={#reference}]%
\definefield
- [rollbutton:\number\scrn_rollbutton_n_button][push][rollbutton]
- [rollsymbol:\number\scrn_rollbutton_n_symbol:n,%
- rollsymbol:\number\scrn_rollbutton_n_symbol:r,%
- rollsymbol:\number\scrn_rollbutton_n_symbol:d]%
- \fitfield[rollbutton:\number\scrn_rollbutton_n_button]%
+ [rollbutton:\number\c_scrn_rollbutton_n_button][push][rollbutton]
+ [rollsymbol:\number\c_scrn_rollbutton_n_symbol:n,%
+ rollsymbol:\number\c_scrn_rollbutton_n_symbol:r,%
+ rollsymbol:\number\c_scrn_rollbutton_n_symbol:d]%
+ \fitfield[rollbutton:\number\c_scrn_rollbutton_n_button]%
\egroup}
-\unexpanded\def\scrn_rollbutton_symbol_indeed#namespace#text#what%
+\unexpanded\def\scrn_rollbutton_symbol_indeed#getparameter#inheritedframed#setparameter#usestyleandcolor#what#text%
{\definecolor[rollover][rollover:#what]%
- \doifelse{#what}{n}{\doifelsevalue{#namespace\c!alternative}\v!hidden\phantom\hbox}\hbox
- {\localframed[#namespace]
- [\c!framecolor=rollover,\c!backgroundcolor=rollover,\c!color=rollover]%
- {\dolocationattributes{#namespace}\c!style\c!color{#text}}}}%
+ \doifelse{#what}{n}% ?
+ {\doifelse{#getparameter\c!alternative}\v!hidden\phantom\hbox}\hbox
+ {#setparameter\c!framecolor {rollover}%
+ #setparameter\c!backgroundcolor{rollover}%
+ #setparameter\c!color {rollover}%
+ #inheritedframed{#usestyleandcolor\c!style\c!color{#text}}}}
%D We plug into the menu system
@@ -967,6 +1025,6 @@
\let\startrob\scrn_menu_rob_start
\let\stoprob \relax
\let\rob \scrn_menu_rob_direct
-\everysetmenucommands
+\to \everysetmenucommands
\protect \endinput