From bccc75526f55d54758d252e0dbae7cab3e07bd8e Mon Sep 17 00:00:00 2001 From: lecoanet Date: Fri, 30 Apr 2004 12:08:17 +0000 Subject: Modification of ZnQueryAttribute signature Adaptation for the new global variables Reworking of the class structure --- generic/Arc.c | 22 +++++++++++----------- generic/Rectangle.c | 16 ++++++++-------- generic/Tabular.c | 14 +++++++------- generic/Triangles.c | 17 ++++++++--------- 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/generic/Arc.c b/generic/Arc.c index be6508d..4bca94d 100644 --- a/generic/Arc.c +++ b/generic/Arc.c @@ -339,7 +339,7 @@ Query(ZnItem item, int argc __unused, Tcl_Obj *CONST argv[]) { - if (ZnQueryAttribute(item->wi, item, arc_attrs, argv[0]) == TCL_ERROR) { + if (ZnQueryAttribute(item->wi->interp, item, arc_attrs, argv[0]) == TCL_ERROR) { return TCL_ERROR; } @@ -985,8 +985,8 @@ Draw(ZnItem item) (ISSET(arc->flags, FILLED_BIT) || (arc->line_width))) { p = ZnListArray(arc->render_shape); num_points = ZnListSize(arc->render_shape); - ZnListAssertSize(wi->work_xpts, num_points); - xp = ZnListArray(wi->work_xpts); + ZnListAssertSize(ZnWorkXPoints, num_points); + xp = ZnListArray(ZnWorkXPoints); for (i = 0; i < num_points; i++, p++) { xp[i].x = (short) p->x; xp[i].y = (short) p->y; @@ -1609,11 +1609,11 @@ GetClipVertices(ZnItem item, center.x = (item->item_bounding_box.corner.x + item->item_bounding_box.orig.x) / 2.0; center.y = (item->item_bounding_box.corner.y + item->item_bounding_box.orig.y) / 2.0; - ZnListEmpty(item->wi->work_pts); - ZnListAdd(item->wi->work_pts, ¢er, ZnListTail); - ZnListAppend(item->wi->work_pts, arc->render_shape); - ZnTriStrip1(tristrip, ZnListArray(item->wi->work_pts), - ZnListSize(item->wi->work_pts), True); + ZnListEmpty(ZnWorkPoints); + ZnListAdd(ZnWorkPoints, ¢er, ZnListTail); + ZnListAppend(ZnWorkPoints, arc->render_shape); + ZnTriStrip1(tristrip, ZnListArray(ZnWorkPoints), + ZnListSize(ZnWorkPoints), True); return False; } @@ -1758,11 +1758,11 @@ PostScript(ZnItem item __unused, ********************************************************************************** */ static ZnItemClassStruct ARC_ITEM_CLASS = { - sizeof(ArcItemStruct), - 0, /* num_parts */ - False, /* has_anchors */ "arc", + sizeof(ArcItemStruct), arc_attrs, + 0, /* num_parts */ + 0, /* flags */ -1, Init, Clone, diff --git a/generic/Rectangle.c b/generic/Rectangle.c index 500473c..a7ffb81 100644 --- a/generic/Rectangle.c +++ b/generic/Rectangle.c @@ -290,7 +290,7 @@ Query(ZnItem item, int argc __unused, Tcl_Obj *CONST argv[]) { - if (ZnQueryAttribute(item->wi, item, rect_attrs, argv[0]) == TCL_ERROR) { + if (ZnQueryAttribute(item->wi->interp, item, rect_attrs, argv[0]) == TCL_ERROR) { return TCL_ERROR; } @@ -788,8 +788,8 @@ GetClipVertices(ZnItem item, ZnPoint *points; if (ISSET(rect->flags, ALIGNED_BIT)) { - ZnListAssertSize(item->wi->work_pts, 2); - points = ZnListArray(item->wi->work_pts); + ZnListAssertSize(ZnWorkPoints, 2); + points = ZnListArray(ZnWorkPoints); ZnTriStrip1(tristrip, points, 2, False); tristrip->strips[0].fan = False; @@ -811,8 +811,8 @@ GetClipVertices(ZnItem item, } } else { - ZnListAssertSize(item->wi->work_pts, 4); - points = ZnListArray(item->wi->work_pts); + ZnListAssertSize(ZnWorkPoints, 4); + points = ZnListArray(ZnWorkPoints); points[0] = rect->dev[1]; points[1] = rect->dev[2]; points[2] = rect->dev[0]; @@ -924,11 +924,11 @@ GetAnchor(ZnItem item, ********************************************************************************** */ static ZnItemClassStruct RECTANGLE_ITEM_CLASS = { - sizeof(RectangleItemStruct), - 0, /* num_parts */ - False, /* has_anchors */ "rectangle", + sizeof(RectangleItemStruct), rect_attrs, + 0, /* num_parts */ + 0, /* flags */ -1, Init, Clone, diff --git a/generic/Tabular.c b/generic/Tabular.c index 42fa9e3..382342c 100644 --- a/generic/Tabular.c +++ b/generic/Tabular.c @@ -211,7 +211,7 @@ Configure(ZnItem item, * to the old one. */ if ((item->connected_item == ZN_NO_ITEM) || - (item->connected_item->class->has_anchors && + (ISSET(item->connected_item->class->flags, ZN_CLASS_HAS_ANCHORS) && (item->parent == item->connected_item->parent))) { ZnITEM.UpdateItemDependency(item, old_connected); } @@ -236,7 +236,7 @@ Query(ZnItem item, int argc __unused, Tcl_Obj *CONST argv[]) { - if (ZnQueryAttribute(item->wi, item, tabular_attrs, argv[0]) == TCL_ERROR) { + if (ZnQueryAttribute(item->wi->interp, item, tabular_attrs, argv[0]) == TCL_ERROR) { return TCL_ERROR; } @@ -466,8 +466,8 @@ GetClipVertices(ZnItem item, if (field_set->label_format) { ZnFIELD.GetLabelBBox(field_set, &width, &height); - ZnListAssertSize(item->wi->work_pts, 2); - points = (ZnPoint *) ZnListArray(item->wi->work_pts); + ZnListAssertSize(ZnWorkPoints, 2); + points = (ZnPoint *) ZnListArray(ZnWorkPoints); ZnTriStrip1(tristrip, points, 2, False); points[0] = field_set->label_pos; points[1].x = points[0].x + width; @@ -670,11 +670,11 @@ Selection(ZnItem item, ********************************************************************************** */ static ZnItemClassStruct TABULAR_ITEM_CLASS = { - sizeof(TabularItemStruct), - 0, /* num_parts */ - True, /* has_anchors */ "tabular", + sizeof(TabularItemStruct), tabular_attrs, + ZN_CLASS_HAS_ANCHORS|ZN_CLASS_ONE_COORD, /* flags */ + True, /* has_anchors */ Tk_Offset(TabularItemStruct, pos), Init, Clone, diff --git a/generic/Triangles.c b/generic/Triangles.c index 358341e..d17dc9c 100644 --- a/generic/Triangles.c +++ b/generic/Triangles.c @@ -251,7 +251,7 @@ Query(ZnItem item, int argc __unused, Tcl_Obj *CONST argv[]) { - if (ZnQueryAttribute(item->wi, item, tr_attrs, argv[0]) == TCL_ERROR) { + if (ZnQueryAttribute(item->wi->interp, item, tr_attrs, argv[0]) == TCL_ERROR) { return TCL_ERROR; } @@ -411,8 +411,8 @@ Draw(ZnItem item) if (ISCLEAR(tr->flags, FAN_BIT)) { XPoint *xpoints; - ZnListAssertSize(wi->work_xpts, num_points); - xpoints = ZnListArray(wi->work_xpts); + ZnListAssertSize(ZnWorkXPoints, num_points); + xpoints = ZnListArray(ZnWorkXPoints); for (i = 0; i < num_points; i++) { xpoints[i].x = ZnNearestInt(points[i].x); xpoints[i].y = ZnNearestInt(points[i].y); @@ -632,7 +632,6 @@ GetContours(ZnItem item, ZnPoly *poly) { TrianglesItem tr = (TrianglesItem) item; - ZnWInfo *wi = item->wi; ZnPoint *points; unsigned int k, j, num_points; int i; @@ -645,8 +644,8 @@ GetContours(ZnItem item, num_points = tr->dev_points.strips->num_points; if (ISCLEAR(tr->flags, FAN_BIT)) { - ZnListAssertSize(wi->work_pts, num_points); - points = ZnListArray(wi->work_pts); + ZnListAssertSize(ZnWorkPoints, num_points); + points = ZnListArray(ZnWorkPoints); for (k = 1, j = 0; k < num_points; k += 2, j++) { points[j] = tr->dev_points.strips->points[k]; @@ -842,11 +841,11 @@ PickVertex(ZnItem item, ********************************************************************************** */ static ZnItemClassStruct TRIANGLES_ITEM_CLASS = { - sizeof(TrianglesItemStruct), - 0, /* num_parts */ - False, /* has_anchors */ "triangles", + sizeof(TrianglesItemStruct), tr_attrs, + 0, /* num_parts */ + 0, /* flags */ -1, Init, Clone, -- cgit v1.1