summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvArc.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2003-02-09 07:48:22 (GMT)
committerhobbs <hobbs>2003-02-09 07:48:22 (GMT)
commit7cbbdcb1ea458bfaaa68bb1fc0cdb9351d11ab7c (patch)
treec6933d15bed38ac3ee37519fe2b9700aeee30333 /generic/tkCanvArc.c
parent5181ceda950c495e8e4bfc881184539c9c5313d9 (diff)
downloadtk-7cbbdcb1ea458bfaaa68bb1fc0cdb9351d11ab7c.zip
tk-7cbbdcb1ea458bfaaa68bb1fc0cdb9351d11ab7c.tar.gz
tk-7cbbdcb1ea458bfaaa68bb1fc0cdb9351d11ab7c.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/tkCanvArc.c')
-rw-r--r--generic/tkCanvArc.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c
index 317c272..096e23b 100644
--- a/generic/tkCanvArc.c
+++ b/generic/tkCanvArc.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: tkCanvArc.c,v 1.10 2002/08/05 04:30:38 dgp Exp $
+ * RCS: @(#) $Id: tkCanvArc.c,v 1.11 2003/02/09 07:48:22 hobbs Exp $
*/
#include <stdio.h>
@@ -295,23 +295,10 @@ CreateArc(interp, canvas, itemPtr, objc, objv)
Tcl_Obj *CONST objv[]; /* Arguments describing arc. */
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
- int i = 4;
-
- 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;
- }
- }
+ int i;
- if (objc < i) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tk_PathName(Tk_CanvasTkwin(canvas)), " create ",
- itemPtr->typePtr->name, " x1 y1 x2 y2 ?options?\"",
- (char *) NULL);
- return TCL_ERROR;
+ if (objc == 0) {
+ panic("canvas did not pass any coords\n");
}
/*
@@ -340,10 +327,16 @@ CreateArc(interp, canvas, itemPtr, objc, objv)
* Process the arguments to fill in the item record.
*/
- if ((ArcCoords(interp, canvas, itemPtr, i, objv) != TCL_OK)) {
+ for (i = 1; i < objc; i++) {
+ char *arg = Tcl_GetString(objv[i]);
+ if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) {
+ break;
+ }
+ }
+ if (ArcCoords(interp, canvas, itemPtr, i, objv) != TCL_OK) {
goto error;
}
- if (ConfigureArc(interp, canvas, itemPtr, objc-4, objv+4, 0) == TCL_OK) {
+ if (ConfigureArc(interp, canvas, itemPtr, objc-i, objv+i, 0) == TCL_OK) {
return TCL_OK;
}
error: