From f8dc88fa290c550f77fb3855e56a818a1679ff08 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Mon, 26 Jan 2004 10:55:18 +0000 Subject: * (WidgetObjCmd): Added a flag for providing angles in degrees to the rotate method. * (WidgetObjCmd): Added an optional center for the scale method. * (FindItems): Modified the recursive flag of sub-methods closest, enclosed, overlapping so that the find can be asked to investigate into atomic groups. Simply say 'override' instead of true/false. * (WidgetObjCmd): Method bbox no longer works on multiple tagOrIds but handles label and field bboxes on items with fields. * bind now handles virtual events. * bind accept an alternative syntax for specifying fields. * Added conditional inclusion of overlap manager include --- generic/tkZinc.c | 335 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 240 insertions(+), 95 deletions(-) (limited to 'generic/tkZinc.c') diff --git a/generic/tkZinc.c b/generic/tkZinc.c index e173485..6dcff2d 100644 --- a/generic/tkZinc.c +++ b/generic/tkZinc.c @@ -48,7 +48,9 @@ static const char * const zinc_version = "zinc-version-" VERSION; #include "WidgetInfo.h" #include "tkZinc.h" #include "MapInfo.h" +#ifdef OM #include "OverlapMan.h" +#endif #include "Track.h" #include "Transfo.h" #include "Image.h" @@ -842,8 +844,8 @@ ZincObjCmd(ClientData client_data, /* Main window associated with Event, (ClientData) wi); Tk_CreateEventHandler(tkwin, KeyPressMask|KeyReleaseMask| ButtonPressMask|ButtonReleaseMask|EnterWindowMask| - LeaveWindowMask|PointerMotionMask, Bind, - (ClientData) wi); + LeaveWindowMask|PointerMotionMask|VirtualEventMask, + Bind, (ClientData) wi); Tk_CreateSelHandler(tkwin, XA_PRIMARY, XA_STRING, FetchSelection, (ClientData) wi, XA_STRING); @@ -1546,8 +1548,8 @@ ZnTagSearchScan(ZnWInfo *wi, */ if (strpbrk(tag, ".*")) { Tk_Uid path; - char c, *next; - long id; + char c, *next; + unsigned int id; Tcl_HashEntry *entry; ZnListEmpty(wi->work_strs); @@ -2472,24 +2474,30 @@ FindArea(ZnWInfo *wi, Tk_Uid tag_uid, ZnBool enclosed, ZnBool recursive, + ZnBool override_atomic, ZnItem group) { ZnPos pos; ZnBBox area; ZnToAreaStruct ta; + double d; - if (Tcl_GetDoubleFromObj(wi->interp, args[0], &area.orig.x) == TCL_ERROR) { + if (Tcl_GetDoubleFromObj(wi->interp, args[0], &d) == TCL_ERROR) { return TCL_ERROR; } - if (Tcl_GetDoubleFromObj(wi->interp, args[1], &area.orig.y) == TCL_ERROR) { + area.orig.x = d; + if (Tcl_GetDoubleFromObj(wi->interp, args[1], &d) == TCL_ERROR) { return TCL_ERROR; } - if (Tcl_GetDoubleFromObj(wi->interp, args[2], &area.corner.x) == TCL_ERROR) { + area.orig.y = d; + if (Tcl_GetDoubleFromObj(wi->interp, args[2], &d) == TCL_ERROR) { return TCL_ERROR; } - if (Tcl_GetDoubleFromObj(wi->interp, args[3], &area.corner.y) == TCL_ERROR) { + area.corner.x = d; + if (Tcl_GetDoubleFromObj(wi->interp, args[3], &d) == TCL_ERROR) { return TCL_ERROR; } + area.corner.y = d; if (area.corner.x < area.orig.x) { pos = area.orig.x; area.orig.x = area.corner.x; @@ -2507,6 +2515,7 @@ FindArea(ZnWInfo *wi, ta.enclosed = enclosed; ta.in_group = group; ta.recursive = recursive; + ta.override_atomic = override_atomic; ta.report = False; ta.area = &area; wi->top_group->class->ToArea(wi->top_group, &ta); @@ -2541,8 +2550,8 @@ FindItems(ZnWInfo *wi, Tk_Uid tag_uid = NULL; int index, result; ZnItem item; - ZnBool recursive = True; ZnPickStruct ps; + char *str; #ifdef PTK static char *search_cmd_strings[] = #else @@ -2620,13 +2629,14 @@ FindItems(ZnWInfo *wi, */ case ZN_S_ATPRIORITY: { - int pri; + int pri; if ((argc != first+2) && (argc != first+3)) { Tcl_WrongNumArgs(wi->interp, first+1, args, "pri ?tagOrId?"); return TCL_ERROR; } - if (Tcl_GetIntFromObj(wi->interp, args[first+1], &pri) == TCL_ERROR) { + if ((Tcl_GetIntFromObj(wi->interp, args[first+1], &pri) == TCL_ERROR) || + (pri < 0)){ return TCL_ERROR; } @@ -2640,7 +2650,7 @@ FindItems(ZnWInfo *wi, } for (item = ZnTagSearchFirst(*search_var); item != ZN_NO_ITEM; item = ZnTagSearchNext(*search_var)) { - if (item->priority == pri) { + if (item->priority == (unsigned int) pri) { ZnDoItem(wi->interp, item, ZN_NO_PART, tag_uid); } } @@ -2677,17 +2687,20 @@ FindItems(ZnWInfo *wi, { int halo = 1; ZnPoint p; + double d; if ((argc < first+3) || (argc > first+6)) { Tcl_WrongNumArgs(wi->interp, first+1, args, "x y ?halo? ?start?, ?recursive?"); return TCL_ERROR; } - if (Tcl_GetDoubleFromObj(wi->interp, args[first+1], &p.x) == TCL_ERROR) { + if (Tcl_GetDoubleFromObj(wi->interp, args[first+1], &d) == TCL_ERROR) { return TCL_ERROR; } - if (Tcl_GetDoubleFromObj(wi->interp, args[first+2], &p.y) == TCL_ERROR) { + p.x = d; + if (Tcl_GetDoubleFromObj(wi->interp, args[first+2], &d) == TCL_ERROR) { return TCL_ERROR; } + p.y = d; if (argc > first+3) { if (Tcl_GetIntFromObj(wi->interp, args[first+3], &halo) == TCL_ERROR) { return TCL_ERROR; @@ -2712,9 +2725,20 @@ FindItems(ZnWInfo *wi, } } } + ps.recursive = True; + ps.override_atomic = False; if (argc > first+5) { - if (Tcl_GetBooleanFromObj(wi->interp, args[first+5], &recursive) != TCL_OK) { - return TCL_ERROR; + result = Tcl_GetBooleanFromObj(wi->interp, args[first+5], &ps.recursive); + if (result != TCL_OK) { + str = Tcl_GetString(args[first+5]); + if (strcmp(str, "override") != 0) { + Tcl_AppendResult(wi->interp, + "recursive should be a boolean value or ", + "override \"", str, "\"", NULL); + return TCL_ERROR; + } + ps.recursive = True; + ps.override_atomic = True; } } /* @@ -2726,7 +2750,6 @@ FindItems(ZnWInfo *wi, */ ps.aperture = halo; ps.point = &p; - ps.recursive = recursive; wi->top_group->class->Pick(wi->top_group, &ps); if (ps.a_item != ZN_NO_ITEM) { @@ -2751,12 +2774,25 @@ FindItems(ZnWInfo *wi, return TCL_ERROR; } } - if (argc > first+6) { - if (Tcl_GetBooleanFromObj(wi->interp, args[first+6], &recursive) != TCL_OK) { - return TCL_ERROR; + ps.recursive = True; + ps.override_atomic = False; + if (argc > first+5) { + result = Tcl_GetBooleanFromObj(wi->interp, args[first+6], &ps.recursive); + if (result != TCL_OK) { + str = Tcl_GetString(args[first+6]); + if (strcmp(str, "override") != 0) { + Tcl_AppendResult(wi->interp, + "recursive should be a boolean value or ", + "override \"", str, "\"", NULL); + return TCL_ERROR; + } + ps.recursive = True; + ps.override_atomic = True; } } - return FindArea(wi, args+first+1, tag_uid, True, recursive, item); + return FindArea(wi, args+first+1, tag_uid, + True, ps.recursive, ps.override_atomic, + item); } break; /* @@ -2775,12 +2811,25 @@ FindItems(ZnWInfo *wi, return TCL_ERROR; } } - if (argc > first+6) { - if (Tcl_GetBooleanFromObj(wi->interp, args[first+6], &recursive) != TCL_OK) { - return TCL_ERROR; + ps.recursive = True; + ps.override_atomic = False; + if (argc > first+5) { + result = Tcl_GetBooleanFromObj(wi->interp, args[first+6], &ps.recursive); + if (result != TCL_OK) { + str = Tcl_GetString(args[first+6]); + if (strcmp(str, "override") != 0) { + Tcl_AppendResult(wi->interp, + "recursive should be a boolean value or ", + "override \"", str, "\"", NULL); + return TCL_ERROR; + } + ps.recursive = True; + ps.override_atomic = True; } } - return FindArea(wi, args+first+1, tag_uid, False, recursive, item); + return FindArea(wi, args+first+1, tag_uid, + False, ps.recursive, ps.override_atomic, + item); } break; /* @@ -2861,7 +2910,7 @@ ZnParseCoordList(ZnWInfo *wi, ZnPoint *p; int old_style, len; char *str; - ZnReal r; + double d; if (controls) { *controls = NULL; @@ -2888,7 +2937,7 @@ ZnParseCoordList(ZnWInfo *wi, * If not, the list consists in sublists describing each point * with its control flag. */ - result = Tcl_GetDoubleFromObj(wi->interp, elems[0], &r); + result = Tcl_GetDoubleFromObj(wi->interp, elems[0], &d); old_style = (result == TCL_OK); if (old_style) { @@ -2897,12 +2946,14 @@ ZnParseCoordList(ZnWInfo *wi, ZnListAssertSize(wi->work_pts, *num_pts); *pts = p = (ZnPoint *) ZnListArray(wi->work_pts); for (i = 0; i < num_elems; i += 2, p++) { - if (Tcl_GetDoubleFromObj(wi->interp, elems[i], &p->x) == TCL_ERROR) { + if (Tcl_GetDoubleFromObj(wi->interp, elems[i], &d) == TCL_ERROR) { goto coord_error; } - if (Tcl_GetDoubleFromObj(wi->interp, elems[i+1], &p->y) == TCL_ERROR) { + p->x = d; + if (Tcl_GetDoubleFromObj(wi->interp, elems[i+1], &d) == TCL_ERROR) { goto coord_error; } + p->y = d; /*printf("Parsed a point: %g@%g, ", p->x, p->y);*/ } /*printf("\n");*/ @@ -2911,12 +2962,14 @@ ZnParseCoordList(ZnWInfo *wi, *num_pts = 1; ZnListAssertSize(wi->work_pts, *num_pts); *pts = p = (ZnPoint *) ZnListArray(wi->work_pts); - if (Tcl_GetDoubleFromObj(wi->interp, elems[0], &p->x) == TCL_ERROR) { + if (Tcl_GetDoubleFromObj(wi->interp, elems[0], &d) == TCL_ERROR) { goto coord_error; } - if (Tcl_GetDoubleFromObj(wi->interp, elems[1], &p->y) == TCL_ERROR) { + p->x = d; + if (Tcl_GetDoubleFromObj(wi->interp, elems[1], &d) == TCL_ERROR) { goto coord_error; } + p->y = d; if (controls) { if (! *controls) { *controls = ZnMalloc(*num_pts * sizeof(char)); @@ -2942,12 +2995,14 @@ ZnParseCoordList(ZnWInfo *wi, if ((result == TCL_ERROR) || (num_selems < 2) || (num_selems > 3)) { goto coord_error; } - if (Tcl_GetDoubleFromObj(wi->interp, selems[0], &p->x) == TCL_ERROR) { + if (Tcl_GetDoubleFromObj(wi->interp, selems[0], &d) == TCL_ERROR) { goto coord_error; } - if (Tcl_GetDoubleFromObj(wi->interp, selems[1], &p->y) == TCL_ERROR) { + p->x = d; + if (Tcl_GetDoubleFromObj(wi->interp, selems[1], &d) == TCL_ERROR) { goto coord_error; } + p->y = d; if (controls) { if (num_selems == 3) { if (! *controls) { @@ -3511,10 +3566,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ ZnTagSearch *search_var = NULL; Tcl_HashEntry *entry; ZnPoint *points; + ZnPoint p; unsigned int num_points; ZnList to_points; Tcl_Obj *entries[3]; char c[] = "c"; + double d; #ifdef PTK static char *sub_cmd_strings[] = @@ -3651,7 +3708,6 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ case ZN_W_ANCHORXY: { Tk_Anchor anchor; - ZnPoint p; if (argc != 4) { Tcl_WrongNumArgs(interp, 1, args, "anchorxy tagOrId anchor"); @@ -3693,19 +3749,49 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ case ZN_W_BBOX: { ZnBBox bbox; - int i; - - if (argc < 3) { - Tcl_WrongNumArgs(interp, 1, args, "bbox tagOrId ?tagOrId ...?"); + ZnDim width, height; + ZnFieldSet fs; + + if ((argc != 3) && (argc != 4)) { + Tcl_WrongNumArgs(interp, 1, args, "bbox tagOrId ?field?"); goto error; } - argc -= 2; - args += 2; Update(wi); ZnResetBBox(&bbox); - for (i = 0; i < argc; i++) { - if (ZnTagSearchScan(wi, args[i], &search_var) == TCL_ERROR) { + + if (argc == 4) { + result = ZnItemWithTagOrId(wi, args[2], &item, &search_var); + if ((result == TCL_ERROR) || (item == ZN_NO_ITEM) || + ! item->class->GetFieldSet) { + Tcl_AppendResult(interp, ", unknown item or doesn't support fields\" ", + Tcl_GetString(args[2]), "\"", NULL); + goto error; + } + fs = item->class->GetFieldSet(item); + if (Tcl_GetIntFromObj(wi->interp, args[3], &field) != TCL_ERROR) { + ZnFIELD.GetFieldBBox(fs, field, &bbox); + } + else { + str = Tcl_GetString(args[3]); + if (strcmp(str, "label") == 0) { + 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); + } + else { + Tcl_AppendResult(interp, ", bbox second parameter should be", + "either a field index or the tag \"label\"", + NULL); + goto error; + } + } + } else { + if (ZnTagSearchScan(wi, args[2], &search_var) == TCL_ERROR) { goto error; } for (item = ZnTagSearchFirst(search_var); @@ -3713,6 +3799,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ ZnAddBBoxToBBox(&bbox, &item->item_bounding_box); } } + if (!ZnIsEmptyBBox(&bbox)) { l = Tcl_GetObjResult(interp); Tcl_ListObjAppendElement(interp, l, Tcl_NewDoubleObj(bbox.orig.x)); @@ -3730,14 +3817,20 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ ClientData elem = 0; int part = ZN_NO_PART; - if ((argc < 3) || (argc > 5)) { - Tcl_WrongNumArgs(interp, 1, args, "bind tagOrId ?sequence? ?command?"); + if ((argc < 3) || (argc > 6)) { + Tcl_WrongNumArgs(interp, 1, args, + "bind tagOrId ?part? ?sequence? ?command?"); goto error; } /* - * Test if (a) an itemid or (b) an itemid:part or (c) a tag is provided. + * Test if (a) an itemid or (b) an itemid:part or + * (c) an item part or (d) a tag is provided. */ str = Tcl_GetString(args[2]); + + argc -= 3; + args += 3; + if (isdigit(str[0])) { int id; @@ -3754,9 +3847,15 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ if (!elem) { goto error; } + if (*end == ':') { + /* + * The part is provided with the id (old method). + */ + end++; + part_encode: if (item->class->Part) { - l = Tcl_NewStringObj(end+1, -1); + l = Tcl_NewStringObj(end, -1); if (item->class->Part(item, &l, &part) == TCL_ERROR) { goto error; } @@ -3767,6 +3866,21 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ goto error; } } + else { + /* + * Check if a part is given in the next parameter + * (alternative method for providing a part). + */ + if (argc > 3) { + str = Tcl_GetString(args[0]); + if (str[0] != '<') { + end = str; + argc--; + args++; + goto part_encode; + } + } + } /*printf("adding element 0x%X to the binding table of item 0x%X\n", elem, item);*/ } else { @@ -3781,26 +3895,26 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ wi->binding_table = Tk_CreateBindingTable(interp); } - if (argc == 5) { + if (argc == 2) { int append = 0; unsigned long mask; - str = Tcl_GetString(args[4]); + str = Tcl_GetString(args[1]); if (str[0] == 0) { result = Tk_DeleteBinding(interp, wi->binding_table, elem, - Tcl_GetString(args[3])); + Tcl_GetString(args[0])); goto done; } #ifdef PTK mask = Tk_CreateBinding(interp, wi->binding_table, - elem, Tcl_GetString(args[3]), args[4], append); + elem, Tcl_GetString(args[0]), args[1], append); #else if (str[0] == '+') { str++; append = 1; } mask = Tk_CreateBinding(interp, wi->binding_table, - elem, Tcl_GetString(args[3]), str, append); + elem, Tcl_GetString(args[0]), str, append); #endif if (mask == 0) { goto error; @@ -3811,20 +3925,20 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | KeyPressMask | KeyReleaseMask | - PointerMotionMask)) { + PointerMotionMask | VirtualEventMask)) { Tk_DeleteBinding(interp, wi->binding_table, elem, Tcl_GetString(args[3])); Tcl_ResetResult(interp); Tcl_AppendResult(interp, "requested illegal events; ", - "only key, button, motion, and enter/leave ", - "events may be used", NULL); + "only key, button, motion, enter, leave ", + "and virtual events may be used", NULL); goto error; } } - else if (argc == 4) { + else if (argc == 1) { #ifdef PTK Tcl_Obj *command; command = Tk_GetBinding(interp, wi->binding_table, elem, - Tcl_GetString(args[3])); + Tcl_GetString(args[0])); if (command == NULL) { char *string = Tcl_GetString(Tcl_GetObjResult(interp)); /* @@ -3845,7 +3959,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ #else CONST char *command; command = Tk_GetBinding(interp, wi->binding_table, elem, - Tcl_GetString(args[3])); + Tcl_GetString(args[0])); if (command == NULL) { goto error; } @@ -4210,8 +4324,6 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ */ case ZN_W_FIT: { - ZnReal error; - if (argc != 4) { Tcl_WrongNumArgs(interp, 1, args, "fit coordList error"); goto error; @@ -4220,11 +4332,11 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ NULL, &num_points, NULL) == TCL_ERROR) { return TCL_ERROR; } - if (Tcl_GetDoubleFromObj(interp, args[3], &error) == TCL_ERROR) { + if (Tcl_GetDoubleFromObj(interp, args[3], &d) == TCL_ERROR) { goto error; } to_points = ZnListNew(32, sizeof(ZnPoint)); - ZnFitBezier(points, num_points, error, to_points); + ZnFitBezier(points, num_points, d, to_points); points = (ZnPoint *) ZnListArray(to_points); num_points = ZnListSize(to_points); l = Tcl_GetObjResult(interp); @@ -4852,21 +4964,28 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ */ case ZN_W_ROTATE: { - ZnReal angle; - ZnPoint p; - - if ((argc != 4) && (argc != 6)) { - Tcl_WrongNumArgs(interp, 1, args, "rotate tagOrIdOrTransform angle ?centerX centerY?"); + ZnBool deg=False; + + if ((argc < 4) && (argc > 7)) { + Tcl_WrongNumArgs(interp, 1, args, "rotate tagOrIdOrTransform angle ?degree? ?centerX centerY?"); goto error; } - if (argc == 6) { - if (Tcl_GetDoubleFromObj(interp, args[4], &p.x) == TCL_ERROR) { + if (argc > 5) { + if (Tcl_GetDoubleFromObj(interp, args[argc-2], &d) == TCL_ERROR) { goto error; } - if (Tcl_GetDoubleFromObj(interp, args[5], &p.y) == TCL_ERROR) { + p.x = d; + if (Tcl_GetDoubleFromObj(interp, args[argc-1], &d) == TCL_ERROR) { goto error; } + p.y = d; + } + if ((argc == 5) || (argc == 7)) { + if (Tcl_GetBooleanFromObj(interp, args[4], °) != TCL_OK) { + goto error; + } + } entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2])); if (entry != NULL) { @@ -4877,23 +4996,28 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ goto error; } } - if (Tcl_GetDoubleFromObj(interp, args[3], &angle) == TCL_ERROR) { + if (Tcl_GetDoubleFromObj(interp, args[3], &d) == TCL_ERROR) { goto error; } - + if (t) { - if (argc == 6) { + if (argc > 5) { ZnTranslate(t, -p.x, -p.y); } - ZnRotateRad(t, angle); - if (argc == 6) { + if (deg) { + ZnRotateDeg(t, d); + } + else { + ZnRotateRad(t, d); + } + if (argc > 5) { ZnTranslate(t, p.x, p.y); } } else { for (item = ZnTagSearchFirst(search_var); item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) { - ZnITEM.RotateItem(item, angle, (argc == 6) ? &p : NULL); + ZnITEM.RotateItem(item, d, deg, (argc > 5) ? &p : NULL); } } } @@ -4905,8 +5029,9 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ { ZnPoint scale; - if (argc != 5) { - Tcl_WrongNumArgs(interp, 1, args, "scale tagOrIdOrTransform xFactor yFactor"); + if ((argc != 5) && (argc != 7)) { + Tcl_WrongNumArgs(interp, 1, args, + "scale tagOrIdOrTransform xFactor yFactor ?centerX centerY?"); goto error; } entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2])); @@ -4918,20 +5043,38 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ goto error; } } - if (Tcl_GetDoubleFromObj(interp, args[3], &scale.x) == TCL_ERROR) { + if (Tcl_GetDoubleFromObj(interp, args[3], &d) == TCL_ERROR) { goto error; } - if (Tcl_GetDoubleFromObj(interp, args[4], &scale.y) == TCL_ERROR) { + scale.x = d; + if (Tcl_GetDoubleFromObj(interp, args[4], &d) == TCL_ERROR) { goto error; } - + scale.y = d; + if (argc == 7) { + if (Tcl_GetDoubleFromObj(interp, args[5], &d) == TCL_ERROR) { + goto error; + } + p.x = d; + if (Tcl_GetDoubleFromObj(interp, args[6], &d) == TCL_ERROR) { + goto error; + } + p.y = d; + } + if (t) { + if (argc == 7) { + ZnTranslate(t, -p.x, -p.y); + } ZnScale(t, scale.x, scale.y); + if (argc == 7) { + ZnTranslate(t, p.x, p.y); + } } else { for (item = ZnTagSearchFirst(search_var); item != ZN_NO_ITEM; item = ZnTagSearchNext(search_var)) { - ZnITEM.ScaleItem(item, scale.x, scale.y); + ZnITEM.ScaleItem(item, scale.x, scale.y, (argc == 7) ? &p : NULL); } } } @@ -5054,7 +5197,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ */ case ZN_W_SKEW: { - ZnReal x_skew, y_skew; + double x_skew, y_skew; if (argc != 5) { Tcl_WrongNumArgs(interp, 1, args, "skew tagOrIdOrTransform xSkewAngle ySkewAngle"); @@ -5222,7 +5365,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ { char *controls, *tag; ZnPoint *p, xp; - ZnTransfo *from_t, *to_t, *result_t; + ZnTransfo *from_t=NULL, *to_t=NULL, *result_t; ZnTransfo t1, t2, t3; ZnBool old_format; Tcl_HashEntry *e; @@ -5344,8 +5487,6 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ */ case ZN_W_TRANSLATE: { - ZnPoint trans; - if (argc != 5) { Tcl_WrongNumArgs(interp, 1, args, "translate tagOrIdorTransform xAmount yAmount"); goto error; @@ -5359,20 +5500,22 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ goto error; } } - if (Tcl_GetDoubleFromObj(interp, args[3], &trans.x) == TCL_ERROR) { + if (Tcl_GetDoubleFromObj(interp, args[3], &d) == TCL_ERROR) { goto error; } - if (Tcl_GetDoubleFromObj(interp, args[4], &trans.y) == TCL_ERROR) { + p.x = d; + if (Tcl_GetDoubleFromObj(interp, args[4], &d) == TCL_ERROR) { goto error; } - + p.y = d; + if (t) { - ZnTranslate(t, trans.x, trans.y); + ZnTranslate(t, p.x, p.y); } else { for (item = ZnTagSearchFirst(search_var); item != ZN_NO_ITEM; item =ZnTagSearchNext(search_var)) { - ZnITEM.TranslateItem(item, trans.x, trans.y); + ZnITEM.TranslateItem(item, p.x, p.y); } } } @@ -5505,9 +5648,10 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ } for (i = 0; i < 6; i++) { - if (Tcl_GetDoubleFromObj(interp, args[3+i], &new._[i/2][i%2]) == TCL_ERROR) { + if (Tcl_GetDoubleFromObj(interp, args[3+i], &d) == TCL_ERROR) { goto error; } + new._[i/2][i%2] = d; } e = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2])); if (e != NULL) { @@ -5551,8 +5695,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ */ case ZN_W_VERTEX_AT: { - ZnPoint p; - int contour, vertex, o_vertex; + int contour, vertex, o_vertex; if (argc != 5) { Tcl_WrongNumArgs(interp, 1, args, " vertexat tagOrId x y"); @@ -5572,12 +5715,14 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */ Tcl_GetString(args[2]), "\"", NULL); goto error; } - if (Tcl_GetDoubleFromObj(interp, args[3], &p.x) == TCL_ERROR) { + if (Tcl_GetDoubleFromObj(interp, args[3], &d) == TCL_ERROR) { goto error; } - if (Tcl_GetDoubleFromObj(interp, args[4], &p.y) == TCL_ERROR) { + p.x = d; + if (Tcl_GetDoubleFromObj(interp, args[4], &d) == TCL_ERROR) { goto error; } + p.y = d; item->class->PickVertex(item, &p, &contour, &vertex, &o_vertex); l = Tcl_GetObjResult(interp); Tcl_ListObjAppendElement(interp, l, Tcl_NewIntObj(contour)); -- cgit v1.1