diff options
Diffstat (limited to 'generic/Group.c')
-rw-r--r-- | generic/Group.c | 451 |
1 files changed, 244 insertions, 207 deletions
diff --git a/generic/Group.c b/generic/Group.c index d020186..a8cea20 100644 --- a/generic/Group.c +++ b/generic/Group.c @@ -34,8 +34,10 @@ #include "Geo.h" #include "tkZinc.h" -#include <malloc.h> +#ifndef _WIN32 #include <X11/extensions/shape.h> +#endif + static const char rcsid[] = "$Id$"; static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " $"; @@ -45,15 +47,15 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " * Group item special record. */ typedef struct _GroupItemStruct { - ItemStruct header; + ZnItemStruct header; /* Public data */ - Item clip; + ZnItem clip; unsigned char alpha; /* Private data */ - Item head; /* Doubly linked list of all items. */ - Item tail; + ZnItem head; /* Doubly linked list of all items. */ + ZnItem tail; ZnList dependents; /* List of dependent items. */ #ifdef OM /* Overlap manager variables. @@ -65,6 +67,9 @@ typedef struct _GroupItemStruct { } GroupItemStruct, *GroupItem; +#define ATOMIC_BIT (1<<ZN_PRIVATE_FLAGS_OFFSET) + + /* ********************************************************************************** * @@ -82,27 +87,27 @@ static ZnAttrConfig group_attrs[] = { Tk_Offset(GroupItemStruct, clip), 0, ZN_COORDS_FLAG|ZN_ITEM_FLAG, False }, { ZN_CONFIG_BOOL, "-composealpha", NULL, - Tk_Offset(GroupItemStruct, header.flags), COMPOSE_ALPHA_BIT, + Tk_Offset(GroupItemStruct, header.flags), ZN_COMPOSE_ALPHA_BIT, ZN_DRAW_FLAG, False }, { ZN_CONFIG_BOOL, "-composerotation", NULL, - Tk_Offset(GroupItemStruct, header.flags), COMPOSE_ROTATION_BIT, + Tk_Offset(GroupItemStruct, header.flags), ZN_COMPOSE_ROTATION_BIT, ZN_TRANSFO_FLAG, False }, { ZN_CONFIG_BOOL, "-composescale", NULL, - Tk_Offset(GroupItemStruct, header.flags), COMPOSE_SCALE_BIT, + Tk_Offset(GroupItemStruct, header.flags), ZN_COMPOSE_SCALE_BIT, ZN_TRANSFO_FLAG, False }, { ZN_CONFIG_PRI, "-priority", NULL, Tk_Offset(GroupItemStruct, header.priority), 0, ZN_DRAW_FLAG|ZN_REPICK_FLAG, False }, { ZN_CONFIG_BOOL, "-sensitive", NULL, - Tk_Offset(GroupItemStruct, header.flags), SENSITIVE_BIT, + Tk_Offset(GroupItemStruct, header.flags), ZN_SENSITIVE_BIT, ZN_REPICK_FLAG, False }, { ZN_CONFIG_TAG_LIST, "-tags", NULL, Tk_Offset(GroupItemStruct, header.tags), 0, 0, False }, { ZN_CONFIG_BOOL, "-visible", NULL, - Tk_Offset(GroupItemStruct, header.flags), VISIBLE_BIT, + Tk_Offset(GroupItemStruct, header.flags), ZN_VISIBLE_BIT, ZN_DRAW_FLAG|ZN_REPICK_FLAG|ZN_VIS_FLAG, False }, - { ZN_CONFIG_END, NULL, NULL, 0, 0, 0 } + { ZN_CONFIG_END, NULL, NULL, 0, 0, 0, False } }; @@ -114,9 +119,9 @@ static ZnAttrConfig group_attrs[] = { ********************************************************************************** */ static int -Init(Item item, - int *argc, - Tcl_Obj *CONST *args[]) +Init(ZnItem item, + int *argc __unused, + Tcl_Obj *CONST *args[] __unused) { GroupItem group = (GroupItem) item; @@ -125,18 +130,18 @@ Init(Item item, group->clip = ZN_NO_ITEM; group->alpha = 100; group->dependents = NULL; - SET(item->flags, VISIBLE_BIT); - SET(item->flags, SENSITIVE_BIT); - SET(item->flags, COMPOSE_ALPHA_BIT); - SET(item->flags, COMPOSE_ROTATION_BIT); - SET(item->flags, COMPOSE_SCALE_BIT); + SET(item->flags, ZN_VISIBLE_BIT); + SET(item->flags, ZN_SENSITIVE_BIT); + SET(item->flags, ZN_COMPOSE_ALPHA_BIT); + SET(item->flags, ZN_COMPOSE_ROTATION_BIT); + SET(item->flags, ZN_COMPOSE_SCALE_BIT); CLEAR(item->flags, ATOMIC_BIT); - item->priority = DEFAULT_GROUP_PRIORITY; + item->priority = 1; #ifdef OM group->call_om = False; #endif - return ZN_OK; + return TCL_OK; } @@ -148,12 +153,12 @@ Init(Item item, ********************************************************************************** */ static void -Clone(Item item) +Clone(ZnItem item) { GroupItem group = (GroupItem) item; ZnList dependents; - Item connected, current_item, new_item; - Item *items; + ZnItem connected, current_item, new_item; + ZnItem *items; Tcl_HashTable mapping; Tcl_HashEntry *entry; int new, num_items, i; @@ -179,9 +184,9 @@ Clone(Item item) */ while (current_item != ZN_NO_ITEM) { connected = current_item->connected_item; - new_item = ITEM.CloneItem(current_item); + new_item = ZnITEM.CloneItem(current_item); new_item->connected_item = connected; - ITEM.InsertItem(new_item, item, ZN_NO_ITEM, True); + ZnITEM.InsertItem(new_item, item, ZN_NO_ITEM, True); if (dependents) { entry = Tcl_CreateHashEntry(&mapping, (char *) current_item, &new); @@ -200,7 +205,7 @@ Clone(Item item) if (dependents) { /*printf("rebuilding dependents\n");*/ group->dependents = NULL; - items = (Item *) ZnListArray(dependents); + items = (ZnItem *) ZnListArray(dependents); num_items = ZnListSize(dependents); for (i = 0; i < num_items; i++, items++) { entry = Tcl_FindHashEntry(&mapping, (char *) *items); @@ -209,7 +214,7 @@ Clone(Item item) abort(); } else { - current_item = (Item) Tcl_GetHashValue(entry); + current_item = (ZnItem) Tcl_GetHashValue(entry); } entry = Tcl_FindHashEntry(&mapping, (char *) current_item->connected_item); if (entry == NULL) { @@ -218,7 +223,7 @@ Clone(Item item) } else { /*printf("item %d correspond to ", current_item->connected_item->id);*/ - current_item->connected_item = (Item) Tcl_GetHashValue(entry); + current_item->connected_item = (ZnItem) Tcl_GetHashValue(entry); /*printf("%d\n", current_item->connected_item->id);*/ ZnInsertDependentItem(current_item); } @@ -236,15 +241,15 @@ Clone(Item item) ********************************************************************************** */ static void -Destroy(Item item) +Destroy(ZnItem item) { GroupItem group = (GroupItem) item; - Item current_item, next_item; + ZnItem current_item, next_item; current_item = group->head; while (current_item != ZN_NO_ITEM) { next_item = current_item->next; - ITEM.DestroyItem(current_item); + ZnITEM.DestroyItem(current_item); current_item = next_item; } if (group->dependents) { @@ -260,22 +265,22 @@ Destroy(Item item) * ********************************************************************************** */ +#if defined(SHAPE) && !defined(_WIN32) static void -SetXShape(Item grp) +SetXShape(ZnItem grp) { -#ifdef SHAPE - WidgetInfo *wi = grp->wi; - Item clip = ((GroupItem) grp)->clip; - int i, j, num_pts, max_num_pts; + ZnWInfo *wi = grp->wi; + ZnItem clip = ((GroupItem) grp)->clip; + unsigned int i, j, num_pts, max_num_pts; ZnPos min_x, min_y, max_x, max_y; ZnTriStrip tristrip; ZnPoint *p; ZnBool simple; ZnDim width, height; XPoint xpts[3], *xp2, *xpts2; - Region reg, reg_op, reg_to; + TkRegion reg, reg_op, reg_to; - if (!wi->has_x_shape) { + if (ISCLEAR(wi->flags, ZN_HAS_X_SHAPE)) { return; } @@ -284,7 +289,7 @@ SetXShape(Item grp) * Reset both clip just to be sure (the application can have * changed wi->full_reshape while resetting wi->reshape). */ - XShapeCombineMask(wi->dpy, ZnWindowId(wi->win), ShapeBounding, + XShapeCombineMask(wi->dpy, Tk_WindowId(wi->win), ShapeBounding, 0, 0, None, ShapeSet); XShapeCombineMask(wi->dpy, wi->real_top, ShapeBounding, 0, 0, None, ShapeSet); @@ -301,7 +306,7 @@ SetXShape(Item grp) * fit exactly the window. We may test here if a shape is currently * active and reset the mask only in this case (need a flag in wi). */ - XShapeCombineMask(wi->dpy, ZnWindowId(wi->win), ShapeBounding, + XShapeCombineMask(wi->dpy, Tk_WindowId(wi->win), ShapeBounding, 0, 0, None, ShapeSet); XShapeCombineMask(wi->dpy, wi->real_top, ShapeBounding, 0, 0, None, ShapeSet); @@ -340,9 +345,9 @@ SetXShape(Item grp) } max_x -= min_x; max_y -= min_y; - XShapeCombineMask(wi->dpy, wi->full_reshape?ZnWindowId(wi->win):wi->real_top, + XShapeCombineMask(wi->dpy, wi->full_reshape?Tk_WindowId(wi->win):wi->real_top, ShapeBounding, 0, 0, None, ShapeSet); - reg = XCreateRegion(); + reg = TkCreateRegion(); /* * Now normalize the shape and map it to the window size, @@ -370,11 +375,11 @@ SetXShape(Item grp) xp2->x = (short) ((p->x - min_x) * width / max_x); xp2->y = (short) ((p->y - min_y) * height / max_y); } - reg_op = XPolygonRegion(xpts2, num_pts, EvenOddRule); - reg_to = XCreateRegion(); - XUnionRegion(reg, reg_op, reg_to); - XDestroyRegion(reg); - XDestroyRegion(reg_op); + reg_op = ZnPolygonRegion(xpts2, num_pts, EvenOddRule); + reg_to = TkCreateRegion(); + ZnUnionRegion(reg, reg_op, reg_to); + TkDestroyRegion(reg); + TkDestroyRegion(reg_op); reg = reg_to; ZnFree(xpts2); } @@ -388,24 +393,29 @@ SetXShape(Item grp) for (i = 2 ; i < num_pts; i++, p++) { xpts[2].x = (short) ((p->x - min_x) * width / max_x); xpts[2].y = (short) ((p->y - min_y) * height / max_y); - reg_op = XPolygonRegion(xpts, 3, EvenOddRule); - reg_to = XCreateRegion(); - XUnionRegion(reg, reg_op, reg_to); - XDestroyRegion(reg); - XDestroyRegion(reg_op); + reg_op = ZnPolygonRegion(xpts, 3, EvenOddRule); + reg_to = TkCreateRegion(); + ZnUnionRegion(reg, reg_op, reg_to); + TkDestroyRegion(reg); + TkDestroyRegion(reg_op); reg = reg_to; xpts[0] = xpts[1]; xpts[1] = xpts[2]; } } } - XShapeCombineRegion(wi->dpy, wi->full_reshape?wi->real_top:ZnWindowId(wi->win), - ShapeBounding, 0, 0, reg, ShapeSet); - XDestroyRegion(reg); + XShapeCombineRegion(wi->dpy, wi->full_reshape?wi->real_top:Tk_WindowId(wi->win), + ShapeBounding, 0, 0, (Region) reg, ShapeSet); + TkDestroyRegion(reg); } } -#endif } +#else +static void +SetXShape(ZnItem grp __unused) +{ +} +#endif /* @@ -416,16 +426,16 @@ SetXShape(Item grp) ********************************************************************************** */ static int -Configure(Item item, +Configure(ZnItem item, int argc, Tcl_Obj *CONST argv[], int *flags) { GroupItem group = (GroupItem) item; - WidgetInfo *wi = item->wi; + ZnWInfo *wi = item->wi; - if (ZnConfigureAttributes(wi, item, group_attrs, argc, argv, flags) == ZN_ERROR) { - return ZN_ERROR; + if (ZnConfigureAttributes(wi, item, group_attrs, argc, argv, flags) == TCL_ERROR) { + return TCL_ERROR; } /* @@ -438,14 +448,14 @@ Configure(Item item, group->clip = ZN_NO_ITEM; Tcl_AppendResult(wi->interp, " clip item must be a child of the group", NULL); - return ZN_ERROR; + return TCL_ERROR; } if (!group->clip && (item == wi->top_group)) { SetXShape(item); } } - return ZN_OK; + return TCL_OK; } @@ -457,15 +467,15 @@ Configure(Item item, ********************************************************************************** */ static int -Query(Item item, - int argc, +Query(ZnItem item, + int argc __unused, Tcl_Obj *CONST argv[]) { - if (ZnQueryAttribute(item->wi, item, group_attrs, argv[0]) == ZN_ERROR) { - return ZN_ERROR; + if (ZnQueryAttribute(item->wi, item, group_attrs, argv[0]) == TCL_ERROR) { + return TCL_ERROR; } - return ZN_OK; + return TCL_OK; } @@ -484,14 +494,18 @@ static void PushClip(GroupItem group, ZnBool set_gc) { - WidgetInfo *wi = ((Item) group)->wi; + ZnWInfo *wi = ((ZnItem) group)->wi; ZnTriStrip tristrip; ZnBool simple; if ((group->clip != ZN_NO_ITEM) && - ((((Item) group) != wi->top_group) || !wi->reshape)) { + ((((ZnItem) group) != wi->top_group) +#if defined(SHAPE) && ! defined (_WIN32) + || !wi->reshape +#endif + )) { simple = group->clip->class->GetClipVertices(group->clip, &tristrip); - /*printf("Group: PushClip group %d\n", ((Item) group)->id);*/ + /*printf("Group: PushClip group %d\n", ((ZnItem) group)->id);*/ if (tristrip.num_strips) { ZnPushClip(wi, &tristrip, simple, set_gc); } @@ -511,11 +525,15 @@ static void PopClip(GroupItem group, ZnBool set_gc) { - WidgetInfo *wi = ((Item) group)->wi; + ZnWInfo *wi = ((ZnItem) group)->wi; if ((group->clip != ZN_NO_ITEM) && - ((((Item) group) != wi->top_group) || !wi->reshape)) { - /*printf("Group: PopClip group %d\n", ((Item) group)->id);*/ + ((((ZnItem) group) != wi->top_group) +#if defined(SHAPE) && !defined(_WIN32) + || !wi->reshape +#endif + )) { + /*printf("Group: PopClip group %d\n", ((ZnItem) group)->id);*/ ZnPopClip(wi, set_gc); } } @@ -531,17 +549,17 @@ PopClip(GroupItem group, ********************************************************************************** */ static void -PushTransform(Item item) +PushTransform(ZnItem item) { if (!item->transfo && - ISSET(item->flags, COMPOSE_SCALE_BIT) && - ISSET(item->flags, COMPOSE_ROTATION_BIT)) { + ISSET(item->flags, ZN_COMPOSE_SCALE_BIT) && + ISSET(item->flags, ZN_COMPOSE_ROTATION_BIT)) { return; } ZnPushTransform(item->wi, item->transfo, - ISSET(item->flags, COMPOSE_SCALE_BIT), - ISSET(item->flags, COMPOSE_ROTATION_BIT)); + ISSET(item->flags, ZN_COMPOSE_SCALE_BIT), + ISSET(item->flags, ZN_COMPOSE_ROTATION_BIT)); /*printf("Pushing transfo for item: %d\n;", item->id); ZnPrintTransfo(wi->current_transfo);*/ } @@ -556,11 +574,11 @@ PushTransform(Item item) ********************************************************************************** */ static void -PopTransform(Item item) +PopTransform(ZnItem item) { if (!item->transfo && - ISSET(item->flags, COMPOSE_SCALE_BIT) && - ISSET(item->flags, COMPOSE_ROTATION_BIT)) { + ISSET(item->flags, ZN_COMPOSE_SCALE_BIT) && + ISSET(item->flags, ZN_COMPOSE_ROTATION_BIT)) { return; } @@ -583,15 +601,15 @@ PopTransform(Item item) ********************************************************************************** */ static void -CallRegularCC(Item item) +CallRegularCC(ZnItem item) { - WidgetInfo *wi = item->wi; + ZnWInfo *wi = item->wi; /*ZnBBox *clip_box;*/ /* * Do some generic pre-work in behalf of the (regular) children. */ - if (ISSET(item->flags, VISIBLE_BIT)) { + if (ISSET(item->flags, ZN_VISIBLE_BIT)) { ZnDamage(wi, &item->item_bounding_box); } PushTransform(item); @@ -616,13 +634,13 @@ CallRegularCC(Item item) if (ZnCurrentClip(wi, NULL, &clip_box, NULL)) { ZnBBox inter; - IntersectBBox(&item->item_bounding_box, clip_box, &inter); + ZnIntersectBBox(&item->item_bounding_box, clip_box, &inter); item->item_bounding_box = inter; }*/ /* * Do some generic post-work in behalf of the (regular) children. */ -#ifdef GLX +#ifdef GL #ifdef GL_LIST /* * Remove the item display list so that it will be recreated @@ -635,18 +653,18 @@ CallRegularCC(Item item) #endif #endif if (ISSET(item->inv_flags, ZN_REPICK_FLAG)) { - SET(wi->events_flags, INTERNAL_NEED_REPICK); + SET(wi->flags, ZN_INTERNAL_NEED_REPICK); } if (ISSET(item->inv_flags, ZN_COORDS_FLAG) && - (ISSET(item->flags, SENSITIVE_BIT) || - ISSET(item->flags, VISIBLE_BIT))) { - SET(wi->events_flags, INTERNAL_NEED_REPICK); + (ISSET(item->flags, ZN_SENSITIVE_BIT) || + ISSET(item->flags, ZN_VISIBLE_BIT))) { + SET(wi->flags, ZN_INTERNAL_NEED_REPICK); } /* * Damage if the item is visible or if it is * a group clipper. */ - if (ISSET(item->flags, VISIBLE_BIT) || + if (ISSET(item->flags, ZN_VISIBLE_BIT) || (item == ((GroupItem) item->parent)->clip)) { ZnDamage(wi, &item->item_bounding_box); } @@ -656,12 +674,12 @@ CallRegularCC(Item item) } static void -ComputeCoordinates(Item item, +ComputeCoordinates(ZnItem item, ZnBool force) { GroupItem group = (GroupItem) item; - Item current_item; - Item *deps; + ZnItem current_item; + ZnItem *deps; int num_deps, i; PushTransform(item); @@ -737,13 +755,13 @@ ComputeCoordinates(Item item, */ if (group->dependents) { num_deps = ZnListSize(group->dependents); - deps = (Item *) ZnListArray(group->dependents); + deps = (ZnItem *) ZnListArray(group->dependents); for (i = 0; i < num_deps; i++) { current_item = deps[i]; if (force || ISSET(current_item->inv_flags, ZN_COORDS_FLAG) || ISSET(current_item->inv_flags, ZN_TRANSFO_FLAG) || - ISSET(current_item->connected_item->flags, UPDATE_DEPENDENT_BIT)) { + ISSET(current_item->connected_item->flags, ZN_UPDATE_DEPENDENT_BIT)) { /*printf("Updating dependent: %d\n", current_item->id);*/ CallRegularCC(current_item); } @@ -752,17 +770,17 @@ ComputeCoordinates(Item item, * Now, we must reset the update_dependent flag */ for (i = 0; i < num_deps; i++) { - CLEAR(deps[i]->connected_item->flags, UPDATE_DEPENDENT_BIT); + CLEAR(deps[i]->connected_item->flags, ZN_UPDATE_DEPENDENT_BIT); } /*printf("... done\n");*/ } /* * Compute the bounding box. */ - ResetBBox(&item->item_bounding_box); + ZnResetBBox(&item->item_bounding_box); current_item = group->head; while (current_item != ZN_NO_ITEM) { - AddBBoxToBBox(&item->item_bounding_box, ¤t_item->item_bounding_box); + ZnAddBBoxToBBox(&item->item_bounding_box, ¤t_item->item_bounding_box); current_item = current_item->next; } item->inv_flags = 0; @@ -782,11 +800,11 @@ ComputeCoordinates(Item item, ********************************************************************************** */ static int -ToArea(Item item, +ToArea(ZnItem item, ZnToArea ta) { GroupItem group = (GroupItem) item; - Item current_item; + ZnItem current_item; ZnBBox enclosing, inter; int result = -1; ZnBool outside, inside; @@ -854,13 +872,13 @@ ToArea(Item item, for (current_item = group->head; current_item != ZN_NO_ITEM; current_item = current_item->next) { - if (ISCLEAR(current_item->flags, VISIBLE_BIT) && - ISCLEAR(current_item->flags, SENSITIVE_BIT)) { + if (ISCLEAR(current_item->flags, ZN_VISIBLE_BIT) && + ISCLEAR(current_item->flags, ZN_SENSITIVE_BIT)) { continue; } /*printf("visible&sensitive %d\n", current_item?current_item->id:0);*/ - IntersectBBox(&enclosing, ¤t_item->item_bounding_box, &inter); - if (IsEmptyBBox(&inter)) { + ZnIntersectBBox(&enclosing, ¤t_item->item_bounding_box, &inter); + if (ZnIsEmptyBBox(&inter)) { continue; } /*printf("bbox test passed %d\n", current_item?current_item->id:0);*/ @@ -940,11 +958,11 @@ ToArea(Item item, ********************************************************************************** */ static void -Draw(Item item) +Draw(ZnItem item) { GroupItem group = (GroupItem) item; - WidgetInfo *wi = item->wi; - Item current_item; + ZnWInfo *wi = item->wi; + ZnItem current_item; ZnBBox bbox, old_damaged_area, *clip_box; PushTransform(item); @@ -952,36 +970,35 @@ Draw(Item item) if (group->clip != ZN_NO_ITEM) { old_damaged_area = wi->damaged_area; if (ZnCurrentClip(wi, NULL, &clip_box, NULL)) { - IntersectBBox(&wi->damaged_area, clip_box, &bbox); + ZnIntersectBBox(&wi->damaged_area, clip_box, &bbox); wi->damaged_area = bbox; } } current_item = group->tail; while (current_item != ZN_NO_ITEM) { - if (ISSET(current_item->flags, VISIBLE_BIT)) { - IntersectBBox(&wi->damaged_area, ¤t_item->item_bounding_box, &bbox); - if (!IsEmptyBBox(&bbox)) { + if (ISSET(current_item->flags, ZN_VISIBLE_BIT)) { + ZnIntersectBBox(&wi->damaged_area, ¤t_item->item_bounding_box, &bbox); + if (!ZnIsEmptyBBox(&bbox)) { if (current_item->class != ZnGroup) { PushTransform(current_item); } current_item->class->Draw(current_item); if (wi->draw_bboxes) { XGCValues values; - values.foreground = ZnPixel(ZnGetGradientColor(wi->bbox_color, - 0, NULL)); + values.foreground = ZnPixel(ZnGetGradientColor(wi->bbox_color, 0.0, NULL)); values.fill_style = FillSolid; values.line_width = 1; values.line_style = (current_item->class==ZnGroup)?LineOnOffDash:LineSolid; XChangeGC(wi->dpy, wi->gc, GCForeground|GCLineStyle|GCLineWidth|GCFillStyle, &values); XDrawRectangle(wi->dpy, wi->draw_buffer, wi->gc, - current_item->item_bounding_box.orig.x, - current_item->item_bounding_box.orig.y, - current_item->item_bounding_box.corner.x - - current_item->item_bounding_box.orig.x, - current_item->item_bounding_box.corner.y - - current_item->item_bounding_box.orig.y); + (int) current_item->item_bounding_box.orig.x, + (int) current_item->item_bounding_box.orig.y, + (unsigned int) (current_item->item_bounding_box.corner.x - + current_item->item_bounding_box.orig.x), + (unsigned int) (current_item->item_bounding_box.corner.y - + current_item->item_bounding_box.orig.y)); } if (current_item->class != ZnGroup) { PopTransform(current_item); @@ -1006,21 +1023,21 @@ Draw(Item item) * ********************************************************************************** */ +#ifdef GL static void -Render(Item item) +Render(ZnItem item) { -#ifdef GLX GroupItem group = (GroupItem) item; - Item current_item; - WidgetInfo *wi = item->wi; -#ifdef GLX_DAMAGE + ZnItem current_item; + ZnWInfo *wi = item->wi; +#ifdef GL_DAMAGE ZnBBox *clip_box; ZnBBox bbox, old_damaged_area; #endif unsigned char save_alpha = wi->alpha; unsigned char save_alpha2; - if (ISSET(item->flags, COMPOSE_ALPHA_BIT)) { + if (ISSET(item->flags, ZN_COMPOSE_ALPHA_BIT)) { wi->alpha = wi->alpha * group->alpha / 100; } else { @@ -1030,11 +1047,11 @@ Render(Item item) PushTransform(item); PushClip(group, True); -#ifdef GLX_DAMAGE +#ifdef GL_DAMAGE if (group->clip != ZN_NO_ITEM) { old_damaged_area = wi->damaged_area; if (ZnCurrentClip(wi, NULL, &clip_box, NULL)) { - IntersectBBox(&wi->damaged_area, clip_box, &bbox); + ZnIntersectBBox(&wi->damaged_area, clip_box, &bbox); wi->damaged_area = bbox; } } @@ -1042,14 +1059,14 @@ Render(Item item) current_item = group->tail; while (current_item != ZN_NO_ITEM) { - if (ISSET(current_item->flags, VISIBLE_BIT)) { -#ifdef GLX_DAMAGE - IntersectBBox(&wi->damaged_area, ¤t_item->item_bounding_box, &bbox); - if (!IsEmptyBBox(&bbox)) { + if (ISSET(current_item->flags, ZN_VISIBLE_BIT)) { +#ifdef GL_DAMAGE + ZnIntersectBBox(&wi->damaged_area, ¤t_item->item_bounding_box, &bbox); + if (!ZnIsEmptyBBox(&bbox)) { #endif if (current_item->class != ZnGroup) { PushTransform(current_item); - if (ISCLEAR(current_item->flags, COMPOSE_ALPHA_BIT)) { + if (ISCLEAR(current_item->flags, ZN_COMPOSE_ALPHA_BIT)) { wi->alpha = 100; } } @@ -1058,14 +1075,14 @@ Render(Item item) PopTransform(current_item); wi->alpha = save_alpha2; } -#ifdef GLX_DAMAGE +#ifdef GL_DAMAGE } #endif } current_item = current_item->previous; } -#ifdef GLX_DAMAGE +#ifdef GL_DAMAGE if (group->clip != ZN_NO_ITEM) { wi->damaged_area = old_damaged_area; } @@ -1075,8 +1092,13 @@ Render(Item item) PopTransform(item); wi->alpha = save_alpha; -#endif } +#else +static void +Render(ZnItem item __unused) +{ +} +#endif /* @@ -1087,14 +1109,14 @@ Render(Item item) ********************************************************************************** */ static ZnBool -IsSensitive(Item item, - int item_part) +IsSensitive(ZnItem item, + int item_part __unused) { - ZnBool sensitive = ISSET(item->flags, SENSITIVE_BIT); - Item parent = item->parent; + ZnBool sensitive = ISSET(item->flags, ZN_SENSITIVE_BIT); + ZnItem parent = item->parent; while (sensitive && (parent != ZN_NO_ITEM)) { - sensitive &= ISSET(parent->flags, SENSITIVE_BIT); + sensitive &= ISSET(parent->flags, ZN_SENSITIVE_BIT); parent = parent->parent; } return sensitive; @@ -1123,12 +1145,12 @@ IsSensitive(Item item, ********************************************************************************** */ static double -Pick(Item item, +Pick(ZnItem item, ZnPick ps) { GroupItem group = (GroupItem) item; - Item p_item=ZN_NO_ITEM, current_item; - WidgetInfo *wi = item->wi; + ZnItem p_item=ZN_NO_ITEM, current_item; + ZnWInfo *wi = item->wi; int p_part=0, aperture = ps->aperture; double dist, best = 1e10; ZnBBox bbox, inter, *clip_box; @@ -1182,8 +1204,8 @@ Pick(Item item, bbox.corner.y = p->y + (aperture?aperture:1); if (ZnCurrentClip(wi, NULL, &clip_box, NULL)) { - IntersectBBox(&bbox, clip_box, &inter); - if (IsEmptyBBox(&inter)) { + ZnIntersectBBox(&bbox, clip_box, &inter); + if (ZnIsEmptyBBox(&inter)) { goto out; } } @@ -1197,8 +1219,8 @@ Pick(Item item, * It is legal to fire bindings on invisible sensitive items. * This is _not_ a bug do _not_ modify the test below. */ - if (ISCLEAR(current_item->flags, SENSITIVE_BIT) && - ISCLEAR(current_item->flags, VISIBLE_BIT)) { + if (ISCLEAR(current_item->flags, ZN_SENSITIVE_BIT) && + ISCLEAR(current_item->flags, ZN_VISIBLE_BIT)) { continue; } if (current_item->class != ZnGroup) { @@ -1259,32 +1281,32 @@ Pick(Item item, ********************************************************************************** */ static int -Coords(Item item, - int contour, - int index, - int cmd, - ZnPoint **pts, - char **controls, - int *num_pts) +Coords(ZnItem item, + int contour __unused, + int index __unused, + int cmd, + ZnPoint **pts, + char **controls __unused, + unsigned int *num_pts) { - if ((cmd == COORDS_ADD) || (cmd == COORDS_ADD_LAST) || (cmd == COORDS_REMOVE)) { + if ((cmd == ZN_COORDS_ADD) || (cmd == ZN_COORDS_ADD_LAST) || (cmd == ZN_COORDS_REMOVE)) { Tcl_AppendResult(item->wi->interp, " groups can't add or remove vertices", NULL); - return ZN_ERROR; + return TCL_ERROR; } - else if ((cmd == COORDS_REPLACE) || (cmd == COORDS_REPLACE_ALL)) { + else if ((cmd == ZN_COORDS_REPLACE) || (cmd == ZN_COORDS_REPLACE_ALL)) { if (*num_pts == 0) { Tcl_AppendResult(item->wi->interp, " coords command need 1 point on groups", NULL); - return ZN_ERROR; + return TCL_ERROR; } if (!item->transfo) { item->transfo = ZnTransfoNew(); } ZnSetTranslation(item->transfo, (*pts)[0].x, (*pts)[0].y); - ITEM.Invalidate(item, ZN_TRANSFO_FLAG); + ZnITEM.Invalidate(item, ZN_TRANSFO_FLAG); } - else if ((cmd == COORDS_READ) || (cmd == COORDS_READ_ALL)) { + else if ((cmd == ZN_COORDS_READ) || (cmd == ZN_COORDS_READ_ALL)) { ZnPoint *p; ZnListAssertSize(item->wi->work_pts, 1); @@ -1293,7 +1315,7 @@ Coords(Item item, *num_pts = 1; *pts = p; } - return ZN_OK; + return TCL_OK; } @@ -1305,15 +1327,15 @@ Coords(Item item, ********************************************************************************** */ static void -PostScript(Item item, - PostScriptInfo ps_info) +PostScript(ZnItem item __unused, + ZnPostScriptInfo ps_info __unused) { } -Item -ZnGroupHead(Item group) +ZnItem +ZnGroupHead(ZnItem group) { if (group->class != ZnGroup) { return ZN_NO_ITEM; @@ -1321,8 +1343,8 @@ ZnGroupHead(Item group) return ((GroupItem) group)->head; } -Item -ZnGroupTail(Item group) +ZnItem +ZnGroupTail(ZnItem group) { if (group->class != ZnGroup) { return ZN_NO_ITEM; @@ -1330,8 +1352,9 @@ ZnGroupTail(Item group) return ((GroupItem) group)->tail; } +#ifdef OM ZnBool -ZnGroupCallOm(Item group) +ZnGroupCallOm(ZnItem group) { if (group->class != ZnGroup) { return False; @@ -1339,35 +1362,48 @@ ZnGroupCallOm(Item group) return ((GroupItem) group)->call_om; } -ZnBool -ZnGroupAtomic(Item group) +void +ZnGroupSetCallOm(ZnItem group, + ZnBool set) { if (group->class != ZnGroup) { - return True; + return; } - return ISSET(group->flags, ATOMIC_BIT); + ((GroupItem) group)->call_om = set; +} +#else +ZnBool +ZnGroupCallOm(ZnItem group __unused) +{ + return False; } void -ZnGroupSetCallOm(Item group, - ZnBool set) +ZnGroupSetCallOm(ZnItem group __unused, + ZnBool set __unused) +{ + return; +} +#endif + +ZnBool +ZnGroupAtomic(ZnItem group) { if (group->class != ZnGroup) { - return; + return True; } - ((GroupItem) group)->call_om = set; + return ISSET(group->flags, ATOMIC_BIT); } - void -ZnGroupRemoveClip(Item group, - Item clip) +ZnGroupRemoveClip(ZnItem group, + ZnItem clip) { GroupItem grp = (GroupItem) group; if (grp->clip == clip) { grp->clip = ZN_NO_ITEM; - ITEM.Invalidate(group, ZN_COORDS_FLAG); + ZnITEM.Invalidate(group, ZN_COORDS_FLAG); } } @@ -1380,7 +1416,7 @@ ZnGroupRemoveClip(Item group, ********************************************************************************** */ void -ZnInsertDependentItem(Item item) +ZnInsertDependentItem(ZnItem item) { GroupItem group = (GroupItem) item->parent; @@ -1388,7 +1424,7 @@ ZnInsertDependentItem(Item item) return; } if (!group->dependents) { - group->dependents = ZnListNew(2, sizeof(Item)); + group->dependents = ZnListNew(2, sizeof(ZnItem)); } ZnListAdd(group->dependents, &item, ZnListTail); } @@ -1402,17 +1438,17 @@ ZnInsertDependentItem(Item item) ********************************************************************************** */ void -ZnExtractDependentItem(Item item) +ZnExtractDependentItem(ZnItem item) { GroupItem group = (GroupItem) item->parent; - int index, num_items; - Item *deps; + unsigned int index, num_items; + ZnItem *deps; if (!group || !group->dependents) { return; } num_items = ZnListSize(group->dependents); - deps = (Item *) ZnListArray(group->dependents); + deps = (ZnItem *) ZnListArray(group->dependents); for (index = 0; index < num_items; index++) { if (deps[index]->id == item->id) { ZnListDelete(group->dependents, index); @@ -1435,17 +1471,18 @@ ZnExtractDependentItem(Item item) ********************************************************************************** */ void -ZnDisconnectDependentItems(Item item) +ZnDisconnectDependentItems(ZnItem item) { - Item current_item; + ZnItem current_item; GroupItem group = (GroupItem) item->parent; - Item *deps; - int num_deps, i; + ZnItem *deps; + unsigned int num_deps; + int i; if (!group || !group->dependents) { return; } - deps = (Item *) ZnListArray(group->dependents); + deps = (ZnItem *) ZnListArray(group->dependents); num_deps = ZnListSize(group->dependents); for (i = num_deps-1; i >= 0; i--) { @@ -1453,7 +1490,7 @@ ZnDisconnectDependentItems(Item item) if (current_item->connected_item == item) { current_item->connected_item = ZN_NO_ITEM; ZnListDelete(group->dependents, i); - ITEM.Invalidate(current_item, ZN_COORDS_FLAG); + ZnITEM.Invalidate(current_item, ZN_COORDS_FLAG); } } if (ZnListSize(group->dependents) == 0) { @@ -1471,7 +1508,7 @@ ZnDisconnectDependentItems(Item item) ********************************************************************************** */ void -ZnGroupExtractItem(Item item) +ZnGroupExtractItem(ZnItem item) { GroupItem group; @@ -1494,7 +1531,7 @@ ZnGroupExtractItem(Item item) group->tail = item->previous; } - ITEM.Invalidate((Item) group, ZN_COORDS_FLAG); + ZnITEM.Invalidate((ZnItem) group, ZN_COORDS_FLAG); item->previous = ZN_NO_ITEM; item->next = ZN_NO_ITEM; @@ -1510,9 +1547,9 @@ ZnGroupExtractItem(Item item) ********************************************************************************** */ void -ZnGroupInsertItem(Item group, - Item item, - Item mark_item, +ZnGroupInsertItem(ZnItem group, + ZnItem item, + ZnItem mark_item, ZnBool before) { GroupItem grp = (GroupItem) group; @@ -1587,7 +1624,7 @@ ZnGroupInsertItem(Item group, } } - ITEM.Invalidate(group, ZN_COORDS_FLAG); + ZnITEM.Invalidate(group, ZN_COORDS_FLAG); } /* @@ -1598,16 +1635,16 @@ ZnGroupInsertItem(Item group, ********************************************************************************** */ static void -GetAnchor(Item item, - ZnAnchor anchor, +GetAnchor(ZnItem item, + Tk_Anchor anchor, ZnPoint *p) { ZnBBox *bbox = &item->item_bounding_box; - Origin2Anchor(&bbox->orig, - bbox->corner.x - bbox->orig.x, - bbox->corner.y - bbox->orig.y, - anchor, p); + ZnOrigin2Anchor(&bbox->orig, + bbox->corner.x - bbox->orig.x, + bbox->corner.y - bbox->orig.y, + anchor, p); } @@ -1618,7 +1655,7 @@ GetAnchor(Item item, * ********************************************************************************** */ -static ItemClassStruct GROUP_ITEM_CLASS = { +static ZnItemClassStruct GROUP_ITEM_CLASS = { sizeof(GroupItemStruct), 0, /* num_parts */ False, /* has_anchors */ |