From e5c3ecc0b363ce5afd63eac6f9a0dd88b70ccdae Mon Sep 17 00:00:00 2001 From: lecoanet Date: Thu, 23 Mar 2000 14:24:49 +0000 Subject: * (PickCurrentItem): Corrig� un bug tendant � oublier des tags 'current' sur des items visit�s par le pointeur lorsqu'un bouton est enfonc� (simulation du grab implicite). * (FindItems): find et addtag utilis�s avec l'option withtag ne reportent plus d'erreur si l'item ou le tag sont inconnus. addtag ne fait rien et find retourne une chaine vide. * Adaptation suite au remanniement du traitement des piles de clip et de transfo. --- generic/tkZinc.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'generic/tkZinc.c') diff --git a/generic/tkZinc.c b/generic/tkZinc.c index b47abe1..0dc1f21 100644 --- a/generic/tkZinc.c +++ b/generic/tkZinc.c @@ -384,11 +384,10 @@ ZincCmd(ClientData client_data, /* Main window associated with wi->work_item_list = NULL; wi->work_pts = ZnListNew(8, sizeof(ZnPoint)); + wi->work_xpts = ZnListNew(8, sizeof(XPoint)); - wi->clip_stack = ZnListNew(8, sizeof(ClipState)); - ITEM_P.ResetClipStack(wi); - wi->transfo_stack = ZnListNew(8, sizeof(ZnTransfo)); - ITEM_P.ResetTransformStack(wi); + ITEM_P.InitClipStack(wi); + ITEM_P.InitTransformStack(wi); for (num = 0; num < NUM_ALPHA_STEPS; num++) { char name[INTEGER_SPACE+12]; @@ -1202,7 +1201,7 @@ FindItems(Tcl_Interp *interp, } num_items = ZnItemsWithTagOrId(wi, LangString(args[1]), &item, &items); if (num_items == 0) { - return ZN_ERROR; + Tcl_SetResult(interp, "", TCL_STATIC); } for (i = 0; i < num_items; i++) { if (IsHeirOf(items[i], group)) { @@ -1771,9 +1770,9 @@ WidgetCmd(ClientData client_data, /* Information about the widget. */ goto done; } if (adjust) { - ITEM.GetTransform(grp, &t); + ITEM.GetItemTransform(grp, &t); ZnTransfoInvert(&t, &inv); - ITEM.GetTransform(item->parent, &t); + ITEM.GetItemTransform(item->parent, &t); ZnTransfoCompose(&t2, &t, &inv); this_one = &t2; if (item->transfo) { @@ -2439,12 +2438,12 @@ WidgetCmd(ClientData client_data, /* Information about the widget. */ inv = *((ZnTransfo *) Tcl_GetHashValue(e)); } else { - ITEM.GetTransform(to, &t); + ITEM.GetItemTransform(to, &t); ZnTransfoInvert(&t, &inv); } this_one = &inv; if (argc == 5) { - ITEM.GetTransform(from, &t); + ITEM.GetItemTransform(from, &t); ZnTransfoCompose(&t2, &t, &inv); this_one = &t2; } @@ -3287,6 +3286,7 @@ PickCurrentItem(WidgetInfo *wi, * event handler for that deletes the current item. */ if ((item == wi->current_item) && !button_down) { + /*printf("Removing 'current' to %d\n", wi->current_item->id);*/ ITEM.RemoveTag(item, current_uid); } /* @@ -3313,6 +3313,10 @@ PickCurrentItem(WidgetInfo *wi, * LEFT_GRABBED_ITEM. */ if (wi->current_item != wi->new_item) { + if (wi->current_item != ZN_NO_ITEM) { + /*printf("***Removing 'current' to %d\n", wi->current_item->id);*/ + ITEM.RemoveTag(wi->current_item, current_uid); + } wi->current_item = wi->new_item; wi->new_item = ZN_NO_ITEM; } @@ -3325,6 +3329,7 @@ PickCurrentItem(WidgetInfo *wi, /* * Add the tag 'current' to the current item under the pointer. */ + /*printf("Adding 'current' to %d\n", wi->current_item->id);*/ DoItem((Tcl_Interp *) NULL, wi->current_item, ZN_NO_PART, current_uid); /* * Then emit a fake Enter event on it. @@ -3585,10 +3590,11 @@ Destroy(char *mem_ptr) /* Info about the widget. */ /* * Should be empty by now. */ - ZnListFree(wi->transfo_stack); - ZnListFree(wi->clip_stack); + ITEM_P.FreeTransformStack(wi); + ITEM_P.FreeClipStack(wi); ZnListFree(wi->work_pts); + ZnListFree(wi->work_xpts); ZnFree(wi); /*printf("Destroy ending\n");*/ -- cgit v1.1