diff options
author | hobbs <hobbs@noemail.net> | 2003-02-09 07:48:22 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 2003-02-09 07:48:22 (GMT) |
commit | c157274ebe7c2fe80735f2ff206d1726f579254d (patch) | |
tree | c6933d15bed38ac3ee37519fe2b9700aeee30333 /generic/tkCanvText.c | |
parent | 8c105df5911ecc6664635f778715b5d7cb06269a (diff) | |
download | tk-c157274ebe7c2fe80735f2ff206d1726f579254d.zip tk-c157274ebe7c2fe80735f2ff206d1726f579254d.tar.gz tk-c157274ebe7c2fe80735f2ff206d1726f579254d.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:
FossilOrigin-Name: 940279e11eb4e8a562733a47cb3345a14014e4c3
Diffstat (limited to 'generic/tkCanvText.c')
-rw-r--r-- | generic/tkCanvText.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index a7b9aa3..7adb737 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.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: tkCanvText.c,v 1.14 2002/08/05 04:30:38 dgp Exp $ + * RCS: @(#) $Id: tkCanvText.c,v 1.15 2003/02/09 07:48:22 hobbs Exp $ */ #include <stdio.h> @@ -235,22 +235,10 @@ CreateText(interp, canvas, itemPtr, objc, objv) Tcl_Obj *CONST objv[]; /* Arguments describing rectangle. */ { TextItem *textPtr = (TextItem *) 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"); } /* @@ -288,8 +276,18 @@ CreateText(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 (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 ((TextCoords(interp, canvas, itemPtr, i, objv) != TCL_OK)) { goto error; } |