summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvWind.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2003-02-09 07:48:22 (GMT)
committerhobbs <hobbs>2003-02-09 07:48:22 (GMT)
commit9d1525754196bc3da08fd80f693f7cd24c50ab10 (patch)
treec6933d15bed38ac3ee37519fe2b9700aeee30333 /generic/tkCanvWind.c
parentd3f940de47f1e49a943a67d56fa64aaa543bd4bc (diff)
downloadtk-9d1525754196bc3da08fd80f693f7cd24c50ab10.zip
tk-9d1525754196bc3da08fd80f693f7cd24c50ab10.tar.gz
tk-9d1525754196bc3da08fd80f693f7cd24c50ab10.tar.bz2
* generic/tkCanvArc.c (CreateArc): Rework canvas create item
* generic/tkCanvBmap.c (CreateBitmap): type coords handling to be * generic/tkCanvImg.c (CreateImage): consistent across types * generic/tkCanvPoly.c (CreatePolygon): and not pass empty coords * generic/tkCanvLine.c (CreateLine): to item creation procs. * generic/tkCanvText.c (CreateText): * generic/tkCanvWind.c (CreateWinItem): * generic/tkCanvas.c (CanvasWidgetCmd CANV_CREATE): * generic/tkRectOval.c (CreateRectOval): * tests/canvRect.test: * tests/canvText.test: * tests/canvas.test:
Diffstat (limited to 'generic/tkCanvWind.c')
-rw-r--r--generic/tkCanvWind.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c
index b82efa1..a820163 100644
--- a/generic/tkCanvWind.c
+++ b/generic/tkCanvWind.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCanvWind.c,v 1.8 2002/10/10 07:25:24 hobbs Exp $
+ * RCS: @(#) $Id: tkCanvWind.c,v 1.9 2003/02/09 07:48:22 hobbs Exp $
*/
#include <stdio.h>
@@ -184,23 +184,10 @@ CreateWinItem(interp, canvas, itemPtr, objc, objv)
Tcl_Obj *CONST objv[]; /* Arguments describing window. */
{
WindowItem *winItemPtr = (WindowItem *) itemPtr;
- int i = 2;
+ int i;
- if (objc == 1) {
- i = 1;
- } else if (objc > 1) {
- char *arg = Tcl_GetString(objv[1]);
- if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) {
- i = 1;
- }
- }
-
- if (objc < i) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tk_PathName(Tk_CanvasTkwin(canvas)), " create ",
- itemPtr->typePtr->name, " x y ?options?\"",
- (char *) NULL);
- return TCL_ERROR;
+ if (objc == 0) {
+ panic("canvas did not pass any coords\n");
}
/*
@@ -215,12 +202,23 @@ CreateWinItem(interp, canvas, itemPtr, objc, objv)
/*
* Process the arguments to fill in the item record.
+ * Only 1 (list) or 2 (x y) coords are allowed.
*/
- if ((WinItemCoords(interp, canvas, itemPtr, i, objv) != TCL_OK)) {
+ if (objc == 1) {
+ i = 1;
+ } else {
+ char *arg = Tcl_GetString(objv[1]);
+ i = 2;
+ if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) {
+ i = 1;
+ }
+ }
+ if (WinItemCoords(interp, canvas, itemPtr, i, objv) != TCL_OK) {
goto error;
}
- if (ConfigureWinItem(interp, canvas, itemPtr, objc-i, objv+i, 0) == TCL_OK) {
+ if (ConfigureWinItem(interp, canvas, itemPtr, objc-i, objv+i, 0)
+ == TCL_OK) {
return TCL_OK;
}