From c15cc9537d6c0d2bf6d5417bd96930cae4381162 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Tue, 23 Mar 2004 08:27:03 +0000 Subject: This undo the addition of a -position attribute. --- generic/Group.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'generic/Group.c') diff --git a/generic/Group.c b/generic/Group.c index 09a1c65..b218ee2 100644 --- a/generic/Group.c +++ b/generic/Group.c @@ -52,7 +52,6 @@ typedef struct _GroupItemStruct { /* Public data */ ZnItem clip; unsigned char alpha; - ZnPoint pos; /* Private data */ ZnItem head; /* Doubly linked list of all items. */ @@ -96,8 +95,6 @@ static ZnAttrConfig group_attrs[] = { { ZN_CONFIG_BOOL, "-composescale", NULL, Tk_Offset(GroupItemStruct, header.flags), ZN_COMPOSE_SCALE_BIT, ZN_TRANSFO_FLAG, False }, - { ZN_CONFIG_POINT, "-position", NULL, - Tk_Offset(GroupItemStruct, pos), 0, ZN_TRANSFO_FLAG, False}, { ZN_CONFIG_PRI, "-priority", NULL, Tk_Offset(GroupItemStruct, header.priority), 0, ZN_DRAW_FLAG|ZN_REPICK_FLAG, False }, @@ -133,7 +130,6 @@ Init(ZnItem item, group->clip = ZN_NO_ITEM; group->alpha = 100; group->dependents = NULL; - group->pos.x = group->pos.y = 0.0; SET(item->flags, ZN_VISIBLE_BIT); SET(item->flags, ZN_SENSITIVE_BIT); SET(item->flags, ZN_COMPOSE_ALPHA_BIT); @@ -1326,8 +1322,6 @@ Coords(ZnItem item, char **controls __unused, unsigned int *num_pts) { - GroupItem group = (GroupItem) item; - if ((cmd == ZN_COORDS_ADD) || (cmd == ZN_COORDS_ADD_LAST) || (cmd == ZN_COORDS_REMOVE)) { Tcl_AppendResult(item->wi->interp, " can't add or remove vertices in groups", NULL); @@ -1339,12 +1333,23 @@ Coords(ZnItem item, " coords command need 1 point on groups", NULL); return TCL_ERROR; } - group->pos = (*pts)[0]; + if (!item->transfo && ((*pts)[0].x == 0.0) && ((*pts)[0].y == 0.0)) { + return TCL_OK; + } + if (!item->transfo) { + item->transfo = ZnTransfoNew(); + } + ZnSetTranslation(item->transfo, (*pts)[0].x, (*pts)[0].y); ZnITEM.Invalidate(item, ZN_TRANSFO_FLAG); } else if ((cmd == ZN_COORDS_READ) || (cmd == ZN_COORDS_READ_ALL)) { + ZnPoint *p; + + ZnListAssertSize(item->wi->work_pts, 1); + p = (ZnPoint *) ZnListArray(item->wi->work_pts); + ZnTransfoDecompose(item->transfo, NULL, p, NULL, NULL); *num_pts = 1; - *pts = &group->pos; + *pts = p; } return TCL_OK; } @@ -1692,7 +1697,7 @@ static ZnItemClassStruct GROUP_ITEM_CLASS = { False, /* has_anchors */ "group", group_attrs, - Tk_Offset(GroupItemStruct, pos), + -1, Init, Clone, Destroy, -- cgit v1.1