|
From: <mj...@ga...> - 2004-11-13 21:48:32
|
Alan W. Irwin writes:
> On 2004-11-13 08:15-0800 Alan W. Irwin wrote:
>
> > On 2004-11-13 00:50-0600 mj...@ga... wrote:
> >
> >>
> >> As for the widget command syntax, it's:
> >>
> >> <widget> scol0 <i> <color>
> >>
> >> where <color> is any form suitable to XParseColor().
> >>
> >> E.g. from plframe.c --
> >>
> >> if ( ! XParseColor(plFramePtr->display,
> >> Tk_Colormap(plFramePtr->tkwin), col, &xcol)) {
> >> Tcl_AppendResult(interp, "Couldn't parse color ", col,
> >> (char *) NULL);
> >> return TCL_ERROR;
> >> }
> >
> > Is this interpretation also correct for the pure tcl case, i.e., when
> > you aren't using X and you are using, for example, the postscript device?
>
> I just looked a bit further into this, and plscol0 appears to be defined
> properly in bindings/tcl/tclgen.c to take 4 character arguments which are
> converted to integers using atoi. And if it doesn't have 4 arguments it
> complains. So this gets curiouser and curiouser since 4 arguments
> apparently do not work and the construct (with two arguments)
>
> .f cmd plscol0 0 white
>
> does work. I presume this is one of those cases (which I thought we had
> sorted out some time ago) where there is a nameclash so the tcl API in
> tclgen.c is hijacked with something else.
>
> Maurice, once you figure this out, I hope you change things so for all
> commands in the tcl interface (and also for the separate plframe interface
> that is nameclashing with it) a single-colour argument like "white" is
> accepted (since that is useful) as well as the 3-argument (r g b) form
> (since that is the expected form if you generalize from the C API).
Known issue, feature-not-bug, etc.
This was a rare case in which I ditched the C API in order to use the common
convention from Tk/X land, where the color is expressed by a name or a hex
string. If one wanted to, it'd be straightforward enough to support both
syntaxes in the Tcl<->C layer using the # args to choose the right
interpretation. As for supporting color names from the Tcl bindings, well,
the translation is done by Xlib and you'd have to find some non-X substitute
that is reasonably compatible.
--
Maurice LeBrun mj...@ga...
|