Re: [NTG-context] \setupframed[...][...=...]

2006-04-12 Thread Vit Zyka
Hans Hagen wrote:
> Vit Zyka wrote:
> 
>>Hans Hagen wrote:
>>  
>>
>>>Vit Zyka wrote:
>>>
>>>
>>>
>>>>Is there some simple solution? Or it has to be rewritten in a way like 
>>>>other \definesomething[...] (storing every parameter/definition-instance 
>>>> 
>>>>  
>>>
>>>btw, there is (beware: use some unique name):
>>>
>>>\presetlocalframed[myframed]
>>>\setuplocalframed[myframed][width=4cm,height=2cm]
>>>\localframed[myframed][framecolor=green]{oeps}
>>>
>>
>>localframed was a mysterious stuff for me.
>>
>>It seems do exactly what I wanted. In this perspective the 
>>\setupframed[...][...=...] is not needed (only for not being suprised 
>>since its absence is a bit against context filosofy).
>>
>>I just wanted to fill texshow web, but it is missing this stuff. So I 
>>added \*localframed note in missing texshow items on wiki.
>>  
> 
> it actually is a low level command, also, there is \defineframedtext which is 
> (1) configurable and (2) provided \myframed as well
> 
> Hans 

And the content of \framed and \framedtext is formated the same way?

Hmm I am a bit confused with \framed v. \localframed v. \framedtext. If 
the difference is only in an interface or even in functionality. I will 
have to study the code but not time for that now.

Thanks for this note.
Vit


___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] \setupframed[...][...=...]

2006-04-12 Thread Hans Hagen
Vit Zyka wrote:
> Hans Hagen wrote:
>   
>> Vit Zyka wrote:
>>
>> 
>>> Is there some simple solution? Or it has to be rewritten in a way like 
>>> other \definesomething[...] (storing every parameter/definition-instance 
>>>  
>>>   
>> btw, there is (beware: use some unique name):
>>
>> \presetlocalframed[myframed]
>> \setuplocalframed[myframed][width=4cm,height=2cm]
>> \localframed[myframed][framecolor=green]{oeps}
>> 
>
> localframed was a mysterious stuff for me.
>
> It seems do exactly what I wanted. In this perspective the 
> \setupframed[...][...=...] is not needed (only for not being suprised 
> since its absence is a bit against context filosofy).
>
> I just wanted to fill texshow web, but it is missing this stuff. So I 
> added \*localframed note in missing texshow items on wiki.
>   
it actually is a low level command, also, there is \defineframedtext which is 
(1) configurable and (2) provided \myframed as well

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
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] \setupframed[...][...=...]

2006-04-12 Thread Vit Zyka
Hans Hagen wrote:
> Vit Zyka wrote:
> 
>>Is there some simple solution? Or it has to be rewritten in a way like 
>>other \definesomething[...] (storing every parameter/definition-instance 
>>  
> 
> btw, there is (beware: use some unique name):
> 
> \presetlocalframed[myframed]
> \setuplocalframed[myframed][width=4cm,height=2cm]
> \localframed[myframed][framecolor=green]{oeps}

localframed was a mysterious stuff for me.

It seems do exactly what I wanted. In this perspective the 
\setupframed[...][...=...] is not needed (only for not being suprised 
since its absence is a bit against context filosofy).

I just wanted to fill texshow web, but it is missing this stuff. So I 
added \*localframed note in missing texshow items on wiki.

Vit
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] \setupframed[...][...=...]

2006-04-12 Thread Vit Zyka
Hans Hagen wrote:
> Vit Zyka wrote:
> 
>>Hi,
>>
>>I tied to extend \setupframed[...=...] to also \setupframed[...][...=...]:
>>
>>-----
>>\unprotect
>>\def\setupframed{\dodoubleempty\dosetupframed}
>>\def\dosetupframed{%
>>   \ifsecondargument
>> [EMAIL PROTECTED]
>>   \else
>> [EMAIL PROTECTED]
>>   \fi
>>}
>>\def\dosinglesetupframed[#1][#2]{\getparameters[\??oi][#1]}
>>\def\dodoublesetupframed[#1][#2]{%
>>   \bgroup
>> \def\dodoubleempty{}%
>> \def\doframed[##1]{##1}%
>> \xdef\tmp{\getvalue{#1}}%
>>   \egroup
>> 
>>[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
>>PROTECTED]@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 -) 

Sorry, next time I try to choose better time then 3 o'clock at night.

> anyway, here is a working solution: 
> 
> \unprotect
> 
> \def\setupframed
>   {\dodoubleempty\dosetupframed}
> 
> \def\dosetupframed
>   {\ifsecondargument
>  [EMAIL PROTECTED]
>\else
>  [EMAIL PROTECTED]
>\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

Clever.

> keep in mind that some 100 setups of the same instance may lead to rather big 
> definitions 

Yes, but no problem, I need only one (or two) resetuping after definition.

> \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) 

All right.

> you can add such patches to cont-loc.tex which is not distributed but read at 
> runtime 

I see, I did not know about this file. Fine.

Thanks Hans,
Vit
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] \setupframed[...][...=...]

2006-04-12 Thread Hans Hagen
Vit Zyka wrote:
> Is there some simple solution? Or it has to be rewritten in a way like 
> other \definesomething[...] (storing every parameter/definition-instance 
>   
btw, there is (beware: use some unique name):

\presetlocalframed[myframed]
\setuplocalframed[myframed][width=4cm,height=2cm]
\localframed[myframed][framecolor=green]{oeps}
 

-
  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
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] \setupframed[...][...=...]

2006-04-12 Thread Hans Hagen
Vit Zyka wrote:
> Hi,
>
> I tied to extend \setupframed[...=...] to also \setupframed[...][...=...]:
>
> -
> \unprotect
> \def\setupframed{\dodoubleempty\dosetupframed}
> \def\dosetupframed{%
>\ifsecondargument
>  [EMAIL PROTECTED]
>\else
>  [EMAIL PROTECTED]
>\fi
> }
> \def\dosinglesetupframed[#1][#2]{\getparameters[\??oi][#1]}
> \def\dodoublesetupframed[#1][#2]{%
>\bgroup
>  \def\dodoubleempty{}%
>  \def\doframed[##1]{##1}%
>  \xdef\tmp{\getvalue{#1}}%
>\egroup
>  
> [EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
> PROTECTED]@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
 [EMAIL PROTECTED]
   \else
 [EMAIL PROTECTED]
   \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
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] \setupframed[...][...=...]

2006-04-12 Thread Hans Hagen
Vit Zyka wrote:
> Hi,
>
> I tied to extend \setupframed[...=...] to also \setupframed[...][...=...]:
>
> -
> \unprotect
> \def\setupframed{\dodoubleempty\dosetupframed}
> \def\dosetupframed{%
>\ifsecondargument
>  [EMAIL PROTECTED]
>\else
>  [EMAIL PROTECTED]
>\fi
> }
> \def\dosinglesetupframed[#1][#2]{\getparameters[\??oi][#1]}
> \def\dodoublesetupframed[#1][#2]{%
>\bgroup
>  \def\dodoubleempty{}%
>  \def\doframed[##1]{##1}%
>  \xdef\tmp{\getvalue{#1}}%
>\egroup
>  
> [EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
> PROTECTED]@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 
>   
sure, later (fields do something similar)
> 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.
>   
the reason for not doing it that way is that it takes less memory; framed 
preallocates quite some hash entries 

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
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


[NTG-context] \setupframed[...][...=...]

2006-04-11 Thread Vit Zyka
Hi,

I tied to extend \setupframed[...=...] to also \setupframed[...][...=...]:

-
\unprotect
\def\setupframed{\dodoubleempty\dosetupframed}
\def\dosetupframed{%
   \ifsecondargument
 [EMAIL PROTECTED]
   \else
 [EMAIL PROTECTED]
   \fi
}
\def\dosinglesetupframed[#1][#2]{\getparameters[\??oi][#1]}
\def\dodoublesetupframed[#1][#2]{%
   \bgroup
 \def\dodoubleempty{}%
 \def\doframed[##1]{##1}%
 \xdef\tmp{\getvalue{#1}}%
   \egroup
 
[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]@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.

Vit
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context