From 43b699a331e50f5e89d1aa6580bf807c0997f474 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Thu, 9 Sep 2004 08:08:54 +0000 Subject: Fixed a bug in the parsing of find enclosed/overlapping arguments. The recursive flag was mixed with the inGroup argument. Added a test to the bbox method argument parsing to trap permutation of options (-label -field) and tagOrId specifications. --- generic/tkZinc.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'generic/tkZinc.c') diff --git a/generic/tkZinc.c b/generic/tkZinc.c index 0e4d878..c9bb082 100644 --- a/generic/tkZinc.c +++ b/generic/tkZinc.c @@ -3251,7 +3251,7 @@ FindItems(ZnWInfo *wi, } ps.recursive = True; ps.override_atomic = False; - if (argc > first+5) { + if (argc > first+6) { result = Tcl_GetBooleanFromObj(wi->interp, args[first+6], &ps.recursive); if (result != TCL_OK) { str = Tcl_GetString(args[first+6]); @@ -3288,7 +3288,7 @@ FindItems(ZnWInfo *wi, } ps.recursive = True; ps.override_atomic = False; - if (argc > first+5) { + if (argc > first+6) { result = Tcl_GetBooleanFromObj(wi->interp, args[first+6], &ps.recursive); if (result != TCL_OK) { str = Tcl_GetString(args[first+6]); @@ -4280,16 +4280,26 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ } else { ZnFIELD.GetLabelBBox(fs, &width, &height); - p.x = ZnNearestInt(fs->label_pos.x); - p.y = ZnNearestInt(fs->label_pos.y); - ZnAddPointToBBox(&bbox, p.x, p.y); - p.x += width; - p.y += height; - ZnAddPointToBBox(&bbox, p.x, p.y); + if (width && height) { + p.x = ZnNearestInt(fs->label_pos.x); + p.y = ZnNearestInt(fs->label_pos.y); + ZnAddPointToBBox(&bbox, p.x, p.y); + p.x += width; + p.y += height; + ZnAddPointToBBox(&bbox, p.x, p.y); + } } } else { for (i = 0; i < (unsigned int) argc; i++) { + /* + * Check for options in wrong place amidst tags. + */ + str = Tcl_GetString(args[i]); + if (*str == '-') { + Tcl_AppendResult(interp, "bbox options should be specified before any tag", NULL); + goto error; + } if (ZnTagSearchScan(wi, args[i], &search_var) == TCL_ERROR) { goto error; } -- cgit v1.1