Tk Source Code

Artifact [1f5ad88e]
Login

Artifact 1f5ad88eb08d4040a0d8a9a0c0b8df9b5744862e:

Attachment "tk_colors.diff" to ticket [1637930f] added by mpc_janssen 2007-01-18 01:00:14. Also attachment "tk_colors.diff" to ticket [1637923f] added by mpc_janssen 2007-01-18 00:49:02.
diff -r tk/doc/tk.n tknew/doc/tk.n
46a47,50
> \fBtk colors\fR 
> .
> Returns a list of all the symbolic color names recognized by Tk.
> .TP
114c118
< application name, send
---
> application name, color, send
diff -r tk/generic/tkCmds.c tknew/generic/tkCmds.c
617,618c617,618
< 	"appname",	"caret",	"scaling",	"useinputmethods",
< 	"windowingsystem",		"inactive",	NULL
---
> 	"appname",	"caret",	"colors",	"scaling",	
> 	"useinputmethods", 	"windowingsystem",	"inactive",	NULL
621,622c621,622
< 	TK_APPNAME,	TK_CARET,	TK_SCALING,	TK_USE_IM,
< 	TK_WINDOWINGSYSTEM,		TK_INACTIVE
---
> 	TK_APPNAME,	TK_CARET,	TK_COLORS,	TK_SCALING,
> 	TK_USE_IM, 	TK_WINDOWINGSYSTEM,		TK_INACTIVE
743a744,757
>     case TK_COLORS: {
>         Tcl_Obj * colors;
> 	int result ;
> 	if (objc != 2) {
> 	    Tcl_WrongNumArgs(interp, 2, objv, NULL);
> 	    return TCL_ERROR;
> 	}
> 	colors = Tcl_NewListObj(0,NULL);
> 	result = TkpGetColors(interp,colors);
> 	if (result == TCL_OK) {
> 		Tcl_SetObjResult(interp,colors);
> 	} 
> 	return result;
>     }
1218d1231
< 
diff -r tk/generic/tkInt.h tknew/generic/tkInt.h
1186a1187
> MODULE_SCOPE int	TkpGetColors(Tcl_Interp * interp, Tcl_Obj * colors);
diff -r tk/tests/tk.test tknew/tests/tk.test
19c19
<     -result {bad option "xyz": must be appname, caret, scaling, useinputmethods, windowingsystem, or inactive}
---
>     -result {bad option "xyz": must be appname, caret, colors, scaling, useinputmethods, windowingsystem, or inactive}
162a163,170
> 
> test tk-7.1 {tk known number of colors} -body {
>     llength [tk colors]
> } -result 752
> 
> test tk-7.2 {tk colors too many arguments} -body {
>     tk colors foo
> } -returnCodes 1 -result {wrong # args: should be "tk colors"}
diff -r tk/xlib/xcolors.c tknew/xlib/xcolors.c
862a863,893
>  * TkpGetColors --
>  *
>  *	This routine builds a list of the recognized symbolic color names
>  *	in the color Tcl_Obj. 
>  *
>  * Results:
>  *	Returns TCL_OK on success.
>  *
>  * Side effects:
>  *	None.
>  *
>  *----------------------------------------------------------------------
>  */
> 
> int  
> TkpGetColors(
> 	Tcl_Interp * interp ,
> 	Tcl_Obj * colors
> 	)
> {
> 	XColorEntry *ePtr;
> 
> 	for (ePtr = xColors; ePtr->name != NULL; ePtr++) {
> 	    Tcl_ListObjAppendElement(interp, colors, Tcl_NewStringObj(ePtr->name,-1));
> 	}
>     return TCL_OK;
> }
> 
> /*
>  *----------------------------------------------------------------------
>  *