Vit Zyka wrote:
Hi,
I tied to extend \setupframed[...=...] to also \setupframed[...][...=...]:
--------------------------------- \unprotect \def\setupframed{\dodoubleempty\dosetupframed} \def\dosetupframed{% \ifsecondargument \@EA\dodoublesetupframed \else \@EA\dosinglesetupframed \fi } \def\dosinglesetupframed[#1][#2]{\getparameters[\??oi][#1]} \def\dodoublesetupframed[#1][#2]{% \bgroup \def\dodoubleempty{}% \def\doframed[##1]{##1}% \xdef\tmp{\getvalue{#1}}% \egroup
\@EA\setvalue\@EA{\@EA#1\@EA}\@EA{\@EA\dodoubleempty\@EA\doframed\@EA[\tmp,#2]}% } \protect
\starttext \setupframed[framecolor=yellow] \framed{A} \defineframed[myframed][framecolor=blue] \myframed{B} \setupframe[myframe][framecolor=red] \myframed{C} \stoptext -------------------------------------
it works but with fully expansion of options. So it works a bit differently in a cases 1) \def\ONorOFF{off} \defineframed[myframed][frame=\ONorOFF] \def\ONorOFF{on}\myframed{A}
2) \def\ONorOFF{off} \defineframed[myframed][frame=\ONorOFF] \setupframed[myframe][framecolor=red] \def\ONorOFF{on}\myframed{A}
Is there some simple solution? Or it has to be rewritten in a way like other \definesomething[...] (storing every parameter/definition-instance in a macro)? If sometimes this code would be reviewed I vote for doing \setupframed in this 'standard' ConTeXt way.
next time post with less typos -) anyway, here is a working solution: \unprotect \def\setupframed {\dodoubleempty\dosetupframed} \def\dosetupframed {\ifsecondargument \@EA\dodoublesetupframed \else \@EA\dosinglesetupframed \fi} \def\dosinglesetupframed[#1][#2]% {\getparameters[\??oi][#1]} \def\dodoublesetupframed[#1][#2]% {\bgroup \let\dodoubleempty\empty \def\doframed[##1]{\gdef\globalredefinedframed{\dodoubleempty\doframed[##1,#2]}}% \getvalue{#1}% \egroup \letvalue{#1}\globalredefinedframed} \protect keep in mind that some 100 setups of the same instance may lead to rather big definitions \setupcolors[state=start] \starttext \setupframed[framecolor=yellow] \framed{A} \defineframed[myframed][framecolor=blue] \myframed{B} \setupframed[myframed][framecolor=red] \myframed{C} \stoptext i need to think about adding this, since it may break other things (i will run it for a while) you can add such patches to cont-loc.tex which is not distributed but read at runtime Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------