Hello,

I was testing the "color add #rrggbb" function in the tcl console. It seems 
that there is no easy way to figure out the index of your new color, since 
"color index #rrggbb" is not available any more.

The "color add" procedure only returns the index of the _last_ color in the 
list. So, if you add a color that is -accidentally- already in the list, the 
index of the last color is returned (cfr. tclxcircuit.c), but not the index 
of the color you added.

Maybe it would be more intuitive if "color add #rrggbb" would return the index 
of this color. Doing this way your tcl script looks like:

#add the color (doesn't matter if already exists)
set my_index [color add #f3f3f3]
#continue drawing using the new color
color set $my_index

As an example, I've attached a patch against the current stable version 
(3.4.26) in CVS. Patch was created at the top-level xcircuit-3.4/ directory. 
Changes are located in xcircuit.c, prototypes.h and tclxcircuit.c

Kind regards,
Wim




Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

_______________________________________________
Xcircuit-dev mailing list
[email protected]
http://www.opencircuitdesign.com/mailman/listinfo/xcircuit-dev

Reply via email to