diff options
author | lecoanet | 2003-04-16 09:49:22 +0000 |
---|---|---|
committer | lecoanet | 2003-04-16 09:49:22 +0000 |
commit | 3261805fee19e346b4d1f84b23816daa1628764a (patch) | |
tree | 63ca1d7e4b0a3d9ae49cc0888e58033c3ef3fe22 /generic/Item.c | |
parent | eed2656db0adae2c234c3d74af0913746ed5c444 (diff) | |
download | tkzinc-3261805fee19e346b4d1f84b23816daa1628764a.zip tkzinc-3261805fee19e346b4d1f84b23816daa1628764a.tar.gz tkzinc-3261805fee19e346b4d1f84b23816daa1628764a.tar.bz2 tkzinc-3261805fee19e346b4d1f84b23816daa1628764a.tar.xz |
Update from the Windows port and general cleanup/restructure
Diffstat (limited to 'generic/Item.c')
-rw-r--r-- | generic/Item.c | 1086 |
1 files changed, 363 insertions, 723 deletions
diff --git a/generic/Item.c b/generic/Item.c index 4dbc315..45581e3 100644 --- a/generic/Item.c +++ b/generic/Item.c @@ -27,16 +27,6 @@ */ -#include <limits.h> /* For INT_MAX */ -#include <sys/param.h> -#include <malloc.h> -#include <stdarg.h> -#include <stdio.h> -#include <string.h> -#ifdef GLX -#include <GL/glx.h> -#endif - #include "libtess/glu.h" #include "Field.h" #include "Item.h" @@ -51,6 +41,11 @@ #include "tkZinc.h" #include "OverlapMan.h" +#include <limits.h> /* For INT_MAX */ +#include <stdarg.h> +#include <stdio.h> +#include <string.h> + static const char rcsid[] = "$Id$"; static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ " $"; @@ -108,8 +103,8 @@ static char *attribute_type_strings[] = { * ********************************************************************************** */ -static void Invalidate(Item item, int reason); -static void AttributeToObj(WidgetInfo *wi, void *record, ZnAttrConfig *desc, +static void Invalidate(ZnItem item, int reason); +static void AttributeToObj(ZnWInfo *wi, void *record, ZnAttrConfig *desc, char *buffer, Tcl_Obj *result); @@ -142,7 +137,7 @@ InitAttrDesc(ZnAttrConfig *attr_desc) ********************************************************************************** */ int -ZnAttributesInfo(WidgetInfo *wi, +ZnAttributesInfo(ZnWInfo *wi, void *record, ZnAttrConfig *desc, int argc, @@ -159,7 +154,7 @@ ZnAttributesInfo(WidgetInfo *wi, if (desc->type == ZN_CONFIG_END) { Tcl_AppendResult(wi->interp, "unknown attribute \"", Tcl_GetString(args[0]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } else if (attr_uid == desc->uid) { break; @@ -168,22 +163,22 @@ ZnAttributesInfo(WidgetInfo *wi, desc++; } } - entries[0] = NewStringObj(desc->name); - entries[1] = NewStringObj(attribute_type_strings[desc->type]); - entries[2] = NewBooleanObj(desc->read_only ? 1 : 0); - entries[3] = NewStringObj(""); - entries[4] = NewStringObj(""); + entries[0] = Tcl_NewStringObj(desc->name, -1); + entries[1] = Tcl_NewStringObj(attribute_type_strings[desc->type], -1); + entries[2] = Tcl_NewBooleanObj(desc->read_only ? 1 : 0); + entries[3] = Tcl_NewStringObj("", -1); + entries[4] = Tcl_NewStringObj("", -1); AttributeToObj(wi, record, desc, buffer, entries[4]); Tcl_SetObjResult(wi->interp, Tcl_NewListObj(5, entries)); } else { l = Tcl_GetObjResult(wi->interp); while (desc->type != ZN_CONFIG_END) { - entries[0] = NewStringObj(desc->name); - entries[1] = NewStringObj(attribute_type_strings[desc->type]); - entries[2] = NewBooleanObj(desc->read_only ? 1 : 0); - entries[3] = NewStringObj(""); - entries[4] = NewStringObj(""); + entries[0] = Tcl_NewStringObj(desc->name, -1); + entries[1] = Tcl_NewStringObj(attribute_type_strings[desc->type], -1); + entries[2] = Tcl_NewBooleanObj(desc->read_only ? 1 : 0); + entries[3] = Tcl_NewStringObj("", -1); + entries[4] = Tcl_NewStringObj("", -1); AttributeToObj(wi, record, desc, buffer, entries[4]); Tcl_ListObjAppendElement(wi->interp, l, Tcl_NewListObj(5, entries)); desc++; @@ -202,7 +197,7 @@ ZnAttributesInfo(WidgetInfo *wi, ********************************************************************************** */ int -ZnConfigureAttributes(WidgetInfo *wi, +ZnConfigureAttributes(ZnWInfo *wi, void *record, ZnAttrConfig *attr_desc, int argc, @@ -223,13 +218,13 @@ ZnConfigureAttributes(WidgetInfo *wi, if (desc->type == ZN_CONFIG_END) { Tcl_AppendResult(wi->interp, "unknown attribute \"", Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } else if (attr_uid == desc->uid) { if (desc->read_only) { Tcl_AppendResult(wi->interp, "attribute \"", Tcl_GetString(args[i]), "\" can only be read", NULL); - return ZN_ERROR; + return TCL_ERROR; } valp = ((char *) record) + desc->offset; /*printf("record <0x%X>, valp <0x%X>, offset %d\n", record, valp, desc->offset);*/ @@ -248,7 +243,7 @@ ZnConfigureAttributes(WidgetInfo *wi, Tcl_AppendResult(wi->interp, " gradient expected for attribute \"", Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } if (*((ZnGradient **) valp)) { ZnFreeGradient(*((ZnGradient **) valp)); @@ -260,17 +255,17 @@ ZnConfigureAttributes(WidgetInfo *wi, } case ZN_CONFIG_GRADIENT_LIST: { - ZnList new_grad_list = NULL; - ZnGradient **grads; - int num_grads, j, k; - Tcl_Obj **elems; + ZnList new_grad_list = NULL; + ZnGradient **grads; + unsigned int num_grads, j, k; + Tcl_Obj **elems; if (Tcl_ListObjGetElements(wi->interp, args[i+1], - &num_grads, &elems) == ZN_ERROR) { + &num_grads, &elems) == TCL_ERROR) { Tcl_AppendResult(wi->interp, " gradient list expected for attribute \"", Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } if (num_grads) { new_grad_list = ZnListNew(num_grads, sizeof(ZnGradient *)); @@ -295,7 +290,7 @@ ZnConfigureAttributes(WidgetInfo *wi, ZnFreeGradient(grads[k]); } ZnListFree(new_grad_list); - return ZN_ERROR; + return TCL_ERROR; } } } @@ -322,10 +317,10 @@ ZnConfigureAttributes(WidgetInfo *wi, case ZN_CONFIG_BOOL: { int b; - if (Tcl_GetBooleanFromObj(wi->interp, args[i+1], &b) != ZN_OK) { + if (Tcl_GetBooleanFromObj(wi->interp, args[i+1], &b) != TCL_OK) { Tcl_AppendResult(wi->interp, " boolean expected for attribute \"", Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } if (b ^ (ISSET(*((unsigned short *) valp), desc->bool_bit) != 0)) { ASSIGN(*((unsigned short *) valp), desc->bool_bit, b); @@ -360,7 +355,7 @@ ZnConfigureAttributes(WidgetInfo *wi, } if (image == ZnUnspecifiedImage) { Tcl_AppendResult(wi->interp, msg, Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } } if (*((ZnImage *) valp) != ZnUnspecifiedImage) { @@ -375,17 +370,17 @@ ZnConfigureAttributes(WidgetInfo *wi, } case ZN_CONFIG_BITMAP_LIST: { - ZnList new_pat_list = NULL; - ZnImage *pats; - int num_pats, j, k; - Tcl_Obj **elems; + ZnList new_pat_list = NULL; + ZnImage *pats; + unsigned int num_pats, j, k; + Tcl_Obj **elems; if (Tcl_ListObjGetElements(wi->interp, args[i+1], - &num_pats, &elems) == ZN_ERROR) { + &num_pats, &elems) == TCL_ERROR) { Tcl_AppendResult(wi->interp, " pattern list expected for attribute \"", Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } if (num_pats) { new_pat_list = ZnListNew(num_pats, sizeof(Pixmap)); @@ -402,7 +397,7 @@ ZnConfigureAttributes(WidgetInfo *wi, ZnFreeImage(pats[k]); } ZnListFree(new_pat_list); - return ZN_ERROR; + return TCL_ERROR; } } else { @@ -436,19 +431,19 @@ ZnConfigureAttributes(WidgetInfo *wi, Tcl_Obj **elems; if (Tcl_ListObjGetElements(wi->interp, args[i+1], - &num_tags, &elems) == ZN_ERROR) { + &num_tags, &elems) == TCL_ERROR) { Tcl_AppendResult(wi->interp, " tag list expected for attribute \"", Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } if (*((ZnList *) valp)) { - ITEM.FreeTags((Item) record); + ZnITEM.FreeTags((ZnItem) record); *flags |= desc->flags; } if (num_tags) { for (j = 0; j < num_tags; j++) { - ITEM.AddTag((Item) record, Tk_GetUid(Tcl_GetString(elems[j]))); + ZnITEM.AddTag((ZnItem) record, Tk_GetUid(Tcl_GetString(elems[j]))); } *flags |= desc->flags; } @@ -485,7 +480,7 @@ ZnConfigureAttributes(WidgetInfo *wi, if (!font) { Tcl_AppendResult(wi->interp, " font expected for attribute \"", Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } if (*((Tk_Font *) valp)) { Tk_FreeFont(*((Tk_Font *) valp)); @@ -497,113 +492,45 @@ ZnConfigureAttributes(WidgetInfo *wi, } case ZN_CONFIG_EDGE_LIST: { - Border border = NO_BORDER; - int j, len, largc; - Tcl_Obj **largv; - - if (Tcl_ListObjGetElements(wi->interp, args[i+1], - &largc, &largv) == ZN_ERROR) { - border_error: - Tcl_AppendResult(wi->interp, " border expected for attribute \"", + ZnBorder border; + + if (ZnGetBorder(wi, args[i+1], &border) == TCL_ERROR) { + Tcl_AppendResult(wi->interp, " edge list expected for attribute \"", Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } - for (j = 0; j < largc; j++) { - str = Tcl_GetString(largv[j]); - len = strlen(str); - if (strncasecmp(str, LEFT_SPEC, len) == 0) { - border |= LEFT_BORDER; - } - else if (strncasecmp(str, RIGHT_SPEC, len) == 0) { - border |= RIGHT_BORDER; - } - else if (strncasecmp(str, TOP_SPEC, len) == 0) { - border |= TOP_BORDER; - } - else if (strncasecmp(str, BOTTOM_SPEC, len) == 0) { - border |= BOTTOM_BORDER; - } - else if (strncasecmp(str, CONTOUR_SPEC, len) == 0) { - border |= CONTOUR_BORDER; - } - else if (strncasecmp(str, OBLIQUE_SPEC, len) == 0) { - border |= OBLIQUE; - } - else if (strncasecmp(str, COUNTER_OBLIQUE_SPEC, len) == 0) { - border |= COUNTER_OBLIQUE; - } - else if (strncasecmp(str, NO_BORDER_SPEC, len) == 0) { - border |= NO_BORDER; - } - else { - goto border_error; - } - } - if (border != *((Border *) valp)) { - *((Border *) valp) = border; + if (border != *((ZnBorder *) valp)) { + *((ZnBorder *) valp) = border; *flags |= desc->flags; } break; } case ZN_CONFIG_LINE_SHAPE: { - LineShape line_shape; - int len; - str = Tcl_GetString(args[i+1]); - len = strlen(str); - if (strncasecmp(str, STRAIGHT_SPEC, len) == 0) { - line_shape = LINE_STRAIGHT; - } - else if (strncasecmp(str, RIGHT_LIGHTNING_SPEC, len) == 0) { - line_shape = LINE_RIGHT_LIGHTNING; - } - else if (strncasecmp(str, LEFT_LIGHTNING_SPEC, len) == 0) { - line_shape = LINE_LEFT_LIGHTNING; - } - else if (strncasecmp(str, RIGHT_CORNER_SPEC, len) == 0) { - line_shape = LINE_RIGHT_CORNER; - } - else if (strncasecmp(str, LEFT_CORNER_SPEC, len) == 0) { - line_shape = LINE_LEFT_CORNER; - } - else if (strncasecmp(str, DOUBLE_RIGHT_CORNER_SPEC, len) == 0) { - line_shape = LINE_DOUBLE_RIGHT_CORNER; - } - else if (strncasecmp(str, DOUBLE_LEFT_CORNER_SPEC, len) == 0) { - line_shape = LINE_DOUBLE_LEFT_CORNER; - } - else { + ZnLineShape line_shape; + + if (ZnGetLineShape(wi, Tcl_GetString(args[i+1]), &line_shape) == TCL_ERROR) { Tcl_AppendResult(wi->interp, " line shape expected for attribute \"", Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } - if (line_shape != *((LineShape *) valp)) { - *((LineShape *) valp) = line_shape; + if (line_shape != *((ZnLineShape *) valp)) { + *((ZnLineShape *) valp) = line_shape; *flags |= desc->flags; } break; } case ZN_CONFIG_LINE_STYLE: { - LineStyle line_style; - int len; - str = Tcl_GetString(args[i+1]); - len = strlen(str); - if (strncasecmp(str, SIMPLE_SPEC, len) == 0) - line_style = LINE_SIMPLE; - else if (strncasecmp(str, DASHED_SPEC, len) == 0) - line_style = LINE_DASHED; - else if (strncasecmp(str, MIXED_SPEC, len) == 0) - line_style = LINE_MIXED; - else if (strncasecmp(str, DOTTED_SPEC, len) == 0) - line_style = LINE_DOTTED; - else { + ZnLineStyle line_style; + + if (ZnGetLineStyle(wi, Tcl_GetString(args[i+1]), &line_style) == TCL_ERROR) { Tcl_AppendResult(wi->interp, " line style expected for attribute \"", Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } - if (line_style != *((LineStyle *) valp)) { - *((LineStyle *) valp) = line_style; + if (line_style != *((ZnLineStyle *) valp)) { + *((ZnLineStyle *) valp) = line_style; *flags |= desc->flags; } break; @@ -613,13 +540,13 @@ ZnConfigureAttributes(WidgetInfo *wi, ZnLineEnd line_end = NULL; str = Tcl_GetString(args[i+1]); if (strlen(str) != 0) { - line_end = LineEndCreate(wi->interp, str); + line_end = ZnLineEndCreate(wi->interp, str); if (line_end == NULL) { - return ZN_ERROR; + return TCL_ERROR; } } if (*((ZnLineEnd *) valp) != NULL) { - LineEndDelete(*((ZnLineEnd *) valp)); + ZnLineEndDelete(*((ZnLineEnd *) valp)); *((ZnLineEnd *) valp) = line_end; *flags |= desc->flags; } @@ -633,15 +560,15 @@ ZnConfigureAttributes(WidgetInfo *wi, } case ZN_CONFIG_RELIEF: { - ReliefStyle relief; - if (ZnGetRelief(wi, Tcl_GetString(args[i+1]), &relief) == ZN_ERROR) { + ZnReliefStyle relief; + if (ZnGetRelief(wi, Tcl_GetString(args[i+1]), &relief) == TCL_ERROR) { Tcl_AppendResult(wi->interp, " relief expected for attribute \"", Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } - if (relief != *((ReliefStyle *) valp)) { + if (relief != *((ZnReliefStyle *) valp)) { /*printf("valp <0x%X>, flags <0x%X>, relief %d\n", valp, flags, relief);*/ - *((ReliefStyle *) valp) = relief; + *((ZnReliefStyle *) valp) = relief; *flags |= desc->flags; } break; @@ -649,10 +576,10 @@ ZnConfigureAttributes(WidgetInfo *wi, case ZN_CONFIG_JOIN_STYLE: { int join; - if (Tk_GetJoinStyle(wi->interp, Tcl_GetString(args[i+1]), &join) == ZN_ERROR) { + if (Tk_GetJoinStyle(wi->interp, Tcl_GetString(args[i+1]), &join) == TCL_ERROR) { Tcl_AppendResult(wi->interp, " join expected for attribute \"", Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } if (join != *((int *) valp)) { *((int *) valp) = join; @@ -663,10 +590,10 @@ ZnConfigureAttributes(WidgetInfo *wi, case ZN_CONFIG_CAP_STYLE: { int cap; - if (Tk_GetCapStyle(wi->interp, Tcl_GetString(args[i+1]), &cap) == ZN_ERROR) { + if (Tk_GetCapStyle(wi->interp, Tcl_GetString(args[i+1]), &cap) == TCL_ERROR) { Tcl_AppendResult(wi->interp, " cap expected for attribute \"", Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } if (cap != *((int *) valp)) { *((int *) valp) = cap; @@ -681,15 +608,15 @@ ZnConfigureAttributes(WidgetInfo *wi, Tcl_Obj **largv; if ((Tcl_ListObjGetElements(wi->interp, args[i+1], - &largc, &largv) == ZN_ERROR) || + &largc, &largv) == TCL_ERROR) || (largc != 2)) { point_error: Tcl_AppendResult(wi->interp, " position expected for attribute \"", Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } - if ((Tcl_GetDoubleFromObj(wi->interp, largv[0], &point.x) == ZN_ERROR) || - (Tcl_GetDoubleFromObj(wi->interp, largv[1], &point.y) == ZN_ERROR)) { + if ((Tcl_GetDoubleFromObj(wi->interp, largv[0], &point.x) == TCL_ERROR) || + (Tcl_GetDoubleFromObj(wi->interp, largv[1], &point.y) == TCL_ERROR)) { goto point_error; } if ((point.x != ((ZnPoint *) valp)->x) || @@ -702,10 +629,10 @@ ZnConfigureAttributes(WidgetInfo *wi, case ZN_CONFIG_DIM: { ZnDim dim; - if (Tcl_GetDoubleFromObj(wi->interp, args[i+1], &dim) == ZN_ERROR) { + if (Tcl_GetDoubleFromObj(wi->interp, args[i+1], &dim) == TCL_ERROR) { Tcl_AppendResult(wi->interp, " dimension expected for attribute \"", Tcl_GetString(args[i+1]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } if (dim != *((ZnDim *) valp)) { *((ZnDim *) valp) = dim; @@ -716,17 +643,17 @@ ZnConfigureAttributes(WidgetInfo *wi, case ZN_CONFIG_PRI: { int pri; - if (Tcl_GetIntFromObj(wi->interp, args[i+1], &pri) == ZN_ERROR) { - return ZN_ERROR; + if (Tcl_GetIntFromObj(wi->interp, args[i+1], &pri) == TCL_ERROR) { + return TCL_ERROR; } if (pri < 0) { Tcl_AppendResult(wi->interp, " priority must be a positive integer \"", Tcl_GetString(args[i+1]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } if (pri != *((int *) valp)) { *((int *) valp) = pri; - ITEM.UpdateItemPriority((Item) record, ZN_NO_ITEM, True); + ZnITEM.UpdateItemPriority((ZnItem) record, ZN_NO_ITEM, True); *flags |= desc->flags; } break; @@ -738,9 +665,9 @@ ZnConfigureAttributes(WidgetInfo *wi, * associated with the tag. */ { - Item item2; + ZnItem item2; int result; - TagSearch *search_var = NULL; + ZnTagSearch *search_var = NULL; if (strlen(Tcl_GetString(args[i+1])) == 0) { item2 = ZN_NO_ITEM; @@ -748,21 +675,21 @@ ZnConfigureAttributes(WidgetInfo *wi, else { result = ZnItemWithTagOrId(wi, args[i+1], &item2, &search_var); ZnTagSearchDestroy(search_var); - if ((result == ZN_ERROR) || (item2 == ZN_NO_ITEM)) { + if ((result == TCL_ERROR) || (item2 == ZN_NO_ITEM)) { Tcl_AppendResult(wi->interp, " unknown item \"", Tcl_GetString(args[i+1]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } } - if (item2 != *((Item *) valp)) { - *((Item *) valp) = item2; + if (item2 != *((ZnItem *) valp)) { + *((ZnItem *) valp) = item2; *flags |= desc->flags; } } break; case ZN_CONFIG_WINDOW: { - ZnWindow win, ancestor, parent; + Tk_Window win, ancestor, parent; str = Tcl_GetString(args[i+1]); if (strlen(str) == 0) { win = NULL; @@ -770,7 +697,7 @@ ZnConfigureAttributes(WidgetInfo *wi, else { win = Tk_NameToWindow(wi->interp, str, wi->win); if (win == NULL) { - return ZN_ERROR; + return TCL_ERROR; } else { /* @@ -800,8 +727,8 @@ ZnConfigureAttributes(WidgetInfo *wi, if (win == wi->win) { goto badWindow; } - if (win != *((ZnWindow *) valp)) { - *((ZnWindow *) valp) = win; + if (win != *((Tk_Window *) valp)) { + *((Tk_Window *) valp) = win; *flags |= desc->flags; } } @@ -814,8 +741,8 @@ ZnConfigureAttributes(WidgetInfo *wi, case ZN_CONFIG_ALPHA: { int integer; - if (Tcl_GetIntFromObj(wi->interp, args[i+1], &integer) == ZN_ERROR) { - return ZN_ERROR; + if (Tcl_GetIntFromObj(wi->interp, args[i+1], &integer) == TCL_ERROR) { + return TCL_ERROR; } switch (desc->type) { case ZN_CONFIG_ANGLE: @@ -845,32 +772,15 @@ ZnConfigureAttributes(WidgetInfo *wi, } case ZN_CONFIG_FILL_RULE: { - int fill_rule; - int len; - str = Tcl_GetString(args[i+1]); - len = strlen(str); - if (strncasecmp(str, "odd", len) == 0) { - fill_rule = GLU_TESS_WINDING_ODD; - } - else if (strncasecmp(str, "nonzero", len) == 0) { - fill_rule = GLU_TESS_WINDING_NONZERO; - } - else if (strncasecmp(str, "positive", len) == 0) { - fill_rule = GLU_TESS_WINDING_POSITIVE; - } - else if (strncasecmp(str, "negative", len) == 0) { - fill_rule = GLU_TESS_WINDING_NEGATIVE; - } - else if (strncasecmp(str, "abs_geq_2", len) == 0) { - fill_rule = GLU_TESS_WINDING_ABS_GEQ_TWO; - } - else { + ZnFillRule fill_rule; + + if (ZnGetFillRule(wi, Tcl_GetString(args[i+1]), &fill_rule) == TCL_ERROR) { Tcl_AppendResult(wi->interp, " fill rule expected for attribute \"", Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } - if (fill_rule != *((int *) valp)) { - *((int *) valp) = fill_rule; + if (fill_rule != *((ZnFillRule *) valp)) { + *((ZnFillRule *) valp) = fill_rule; *flags |= desc->flags; } break; @@ -878,13 +788,13 @@ ZnConfigureAttributes(WidgetInfo *wi, case ZN_CONFIG_ALIGNMENT: { Tk_Justify justify; - if (Tk_GetJustify(wi->interp, Tcl_GetString(args[i+1]), &justify) == ZN_ERROR) { + if (Tk_GetJustify(wi->interp, Tcl_GetString(args[i+1]), &justify) == TCL_ERROR) { Tcl_AppendResult(wi->interp, " justify expected for attribute \"", Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } - if (justify != *((ZnJustify *) valp)) { - *((ZnJustify *) valp) = justify; + if (justify != *((Tk_Justify *) valp)) { + *((Tk_Justify *) valp) = justify; *flags |= desc->flags; } break; @@ -892,13 +802,13 @@ ZnConfigureAttributes(WidgetInfo *wi, case ZN_CONFIG_ANCHOR: { Tk_Anchor anchor; - if (Tk_GetAnchor(wi->interp, Tcl_GetString(args[i+1]), &anchor) == ZN_ERROR) { + if (Tk_GetAnchor(wi->interp, Tcl_GetString(args[i+1]), &anchor) == TCL_ERROR) { Tcl_AppendResult(wi->interp, " anchor expected for attribute \"", Tcl_GetString(args[i]), "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } - if (anchor != *((ZnAnchor *) valp)) { - *((ZnAnchor *) valp) = anchor; + if (anchor != *((Tk_Anchor *) valp)) { + *((Tk_Anchor *) valp) = anchor; *flags |= desc->flags; } break; @@ -912,16 +822,16 @@ ZnConfigureAttributes(WidgetInfo *wi, str++; } if (strlen(str) != 0) { - Item item = (Item) record; - frmt = LabelFormatCreate(wi->interp, str, - FIELD.NumFields(item->class->GetFieldSet(item))); + ZnItem item = (ZnItem) record; + frmt = ZnLFCreate(wi->interp, str, + ZnFIELD.NumFields(item->class->GetFieldSet(item))); if (frmt == NULL) { - return ZN_ERROR; + return TCL_ERROR; } } if (*((ZnLabelFormat *) valp) != NULL) { - LabelFormatDelete(*((ZnLabelFormat *) valp)); + ZnLFDelete(*((ZnLabelFormat *) valp)); *((ZnLabelFormat *) valp) = frmt; *flags |= desc->flags; } @@ -936,136 +846,39 @@ ZnConfigureAttributes(WidgetInfo *wi, case ZN_CONFIG_AUTO_ALIGNMENT: { - AutoAlign aa; - int j; + ZnAutoAlign aa; - str = Tcl_GetString(args[i+1]); - if (strcmp(str, "-") == 0) { - aa.automatic = False; - } - else if (strlen(str) == 3) { - aa.automatic = True; - for (j = 0; j < 3; j++) { - switch(str[j]) { - case 'l': - case 'L': - aa.align[j] = ZnJustifyLeft; - break; - case 'c': - case 'C': - aa.align[j] = ZnJustifyCenter; - break; - case 'r': - case 'R': - aa.align[j] = ZnJustifyRight; - break; - default: - Tcl_AppendResult(wi->interp, "invalid auto justify specifcation \"", - Tcl_GetString(args[i+1]), - "\" should be - or a triple of lcr", NULL); - return ZN_ERROR; - } - } + if (ZnGetAutoAlign(wi, Tcl_GetString(args[i+1]), &aa) == TCL_ERROR) { + Tcl_AppendResult(wi->interp, " auto alignment expected for attribute \"", + Tcl_GetString(args[i]), "\"", NULL); + return TCL_ERROR; } - else { - Tcl_AppendResult(wi->interp, "invalid auto alignment specification \"", - Tcl_GetString(args[i+1]), - "\" should be - or a triple of lcr", NULL); - return ZN_ERROR; - } - if ((aa.automatic != ((AutoAlign *) valp)->automatic) || - (aa.align[0] != ((AutoAlign *) valp)->align[0]) || - (aa.align[1] != ((AutoAlign *) valp)->align[1]) || - (aa.align[2] != ((AutoAlign *) valp)->align[2])) { - *((AutoAlign *) valp) = aa; + if ((aa.automatic != ((ZnAutoAlign *) valp)->automatic) || + (aa.align[0] != ((ZnAutoAlign *) valp)->align[0]) || + (aa.align[1] != ((ZnAutoAlign *) valp)->align[1]) || + (aa.align[2] != ((ZnAutoAlign *) valp)->align[2])) { + *((ZnAutoAlign *) valp) = aa; *flags |= desc->flags; } break; } case ZN_CONFIG_LEADER_ANCHORS: - /* - * Format is: lChar leftLeaderAnchor [ lChar rightLeaderAnchor] - * - * If lChar is a '|', leftLeaderAnchor and rightLeaderAnchor are the indices - * of the fields that serve to anchor the label's leader. More specifically - * the bottom left corner of the left field and the bottom right corner of - * the right field are used as the anchors. - * If lChar is '%', leftLeaderAnchor and rightLeaderAnchor should be - * specified as 'valxval', 'val' being a percentage (max 100) of the - * width/height of the label bounding box. - * If rightLeaderAnchor is not specified it defaults to leftLeaderAnchor. - * If neither of them are specified, the center of the label is used as an - * anchor. - */ { - LeaderAnchors lanch = NULL; - int anchors[4]; - int index, num_tok, anchor_index=0; - - str = Tcl_GetString(args[i+1]); - while (*str && (*str == ' ')) { - str++; - } - while (*str && (anchor_index < 4)) { - switch (*str) { - case '|': - num_tok = sscanf(str, "|%d%n", &anchors[anchor_index], &index); - if (num_tok != 1) { - la_error: - Tcl_AppendResult(wi->interp, " incorrect leader anchors \"", - Tcl_GetString(args[i+1]), "\"", NULL); - return ZN_ERROR; - } - anchors[anchor_index+1] = -1; - break; - case '%': - num_tok = sscanf(str, "%%%dx%d%n", &anchors[anchor_index], - &anchors[anchor_index+1], &index); - if (num_tok != 2) { - goto la_error; - } - if (anchors[anchor_index] < 0) { - anchors[anchor_index] = 0; - } - if (anchors[anchor_index] > 100) { - anchors[anchor_index] = 100; - } - if (anchors[anchor_index+1] < 0) { - anchors[anchor_index+1] = 0; - } - if (anchors[anchor_index+1] > 100) { - anchors[anchor_index+1] = 100; - } - break; - } - anchor_index += 2; - str += index; - } - /* - * If empty, pick the default (center of the bounding box). - */ - if (anchor_index != 0) { - lanch = (LeaderAnchors ) ZnMalloc(sizeof(LeaderAnchorsStruct)); - lanch->left_x = anchors[0]; - lanch->left_y = anchors[1]; - if (anchor_index == 2) { - lanch->right_x = lanch->left_x; - lanch->right_y = lanch->left_y; - } - else { - lanch->right_x = anchors[2]; - lanch->right_y = anchors[3]; - } + ZnLeaderAnchors lanch = NULL; + if (ZnGetLeaderAnchors(wi, Tcl_GetString(args[i+1]), &lanch) == TCL_ERROR) { + Tcl_AppendResult(wi->interp, " leader anchors expected for attribute \"", + Tcl_GetString(args[i]), "\"", NULL); + return TCL_ERROR; } - if (*((LeaderAnchors *) valp) != NULL) { - ZnFree(*((LeaderAnchors *) valp)); - *((LeaderAnchors *) valp) = lanch; + if (*((ZnLeaderAnchors *) valp) != NULL) { + ZnFree(*((ZnLeaderAnchors *) valp)); + *((ZnLeaderAnchors *) valp) = lanch; *flags |= desc->flags; } else { if (lanch != NULL) { - *((LeaderAnchors *) valp) = lanch; + *((ZnLeaderAnchors *) valp) = lanch; *flags |= desc->flags; } } @@ -1079,7 +892,7 @@ ZnConfigureAttributes(WidgetInfo *wi, } } } - return ZN_OK; + return TCL_OK; } @@ -1096,55 +909,53 @@ ZnConfigureAttributes(WidgetInfo *wi, ********************************************************************************** */ static void -AttributeToObj(WidgetInfo *wi, +AttributeToObj(ZnWInfo *wi, void *record, ZnAttrConfig *desc, char *buffer, Tcl_Obj *result) { char *valp = ((char *) record) + desc->offset; - Tk_Uid str = ""; + char *str = ""; Tcl_Obj *o; - int i; - + unsigned int i; + switch (desc->type) { case ZN_CONFIG_GRADIENT: if (*((ZnGradient **) valp)) { str = ZnNameOfGradient(*((ZnGradient **) valp)); - Tcl_SetStringObj(result, str, strlen(str)); } break; case ZN_CONFIG_GRADIENT_LIST: { - int num_grads; - ZnGradient **grads; + unsigned int num_grads; + ZnGradient **grads; if (*((ZnList *) valp)) { grads = ZnListArray(*((ZnList *) valp)); num_grads = ZnListSize(*((ZnList *) valp)); for (i = 0; i < num_grads; i++) { - o = NewStringObj(ZnNameOfGradient(grads[i])); + o = Tcl_NewStringObj(ZnNameOfGradient(grads[i]), -1); Tcl_ListObjAppendElement(wi->interp, result, o); } + return; } } break; case ZN_CONFIG_BOOL: Tcl_SetBooleanObj(result, ISSET(*((unsigned short *) valp), desc->bool_bit)?1:0); - break; + return; case ZN_CONFIG_IMAGE: case ZN_CONFIG_BITMAP: - str = ""; if (*((ZnImage *) valp)) { str = ZnNameOfImage(*((ZnImage *) valp)); } - Tcl_SetStringObj(result, str, strlen(str)); break; case ZN_CONFIG_BITMAP_LIST: { - int num_pats=0; - ZnImage *pats; + unsigned int num_pats=0; + ZnImage *pats; if (*((ZnList *) valp)) { pats = (ZnImage *) ZnListArray(*((ZnList *) valp)); @@ -1152,206 +963,84 @@ AttributeToObj(WidgetInfo *wi, for (i = 0; i < num_pats; i++) { if (pats[i] != ZnUnspecifiedImage) { - o = NewStringObj(ZnNameOfImage(pats[i])); + o = Tcl_NewStringObj(ZnNameOfImage(pats[i]), -1); } else { - o = NewStringObj(""); + o = Tcl_NewStringObj("", -1); } Tcl_ListObjAppendElement(wi->interp, result, o); } + return; } break; } case ZN_CONFIG_TAG_LIST: { - int num_tags=0; - Tk_Uid *tags; + unsigned int num_tags=0; + Tk_Uid *tags; if (*((ZnList *) valp)) { tags = (Tk_Uid *) ZnListArray(*((ZnList *) valp)); num_tags = ZnListSize(*((ZnList *) valp)); for (i = 0; i < num_tags; i++) { Tcl_ListObjAppendElement(wi->interp, result, - NewStringObj(tags[i])); + Tcl_NewStringObj(tags[i], -1)); } + return; } break; } case ZN_CONFIG_STRING: case ZN_CONFIG_MAP_INFO: - str = *((char **) valp); - if (str) { - Tcl_SetStringObj(result, str, strlen(str)); - } - else { - Tcl_SetStringObj(result, "", 0); + if (*((char **) valp)) { + str = *((char **) valp); } break; case ZN_CONFIG_FONT: - str = ""; if (*((Tk_Font *) valp)) { - str = Tk_NameOfFont(*((Tk_Font *) valp)); + str = (char *) Tk_NameOfFont(*((Tk_Font *) valp)); } - Tcl_SetStringObj(result, str, strlen(str)); break; case ZN_CONFIG_EDGE_LIST: - { - Border border = *((Border *) valp); - if (border == NO_BORDER) { - Tcl_SetStringObj(result, NO_BORDER_SPEC, strlen(NO_BORDER_SPEC)); - break; - } - buffer[0] = 0; - if ((border & CONTOUR_BORDER) == CONTOUR_BORDER) { - strcat(buffer, CONTOUR_SPEC); - } - else { - if (border & LEFT_BORDER) { - strcat(buffer, LEFT_SPEC); - } - if (border & RIGHT_BORDER) { - if (buffer[0] != 0) { - strcat(buffer, " "); - } - strcat(buffer, RIGHT_SPEC); - } - if (border & TOP_BORDER) { - if (buffer[0] != 0) { - strcat(buffer, " "); - } - strcat(buffer, TOP_SPEC); - } - if (border & BOTTOM_BORDER) { - if (buffer[0] != 0) { - strcat(buffer, " "); - } - strcat(buffer, BOTTOM_SPEC); - } - } - if (border & OBLIQUE) { - if (buffer[0] != 0) { - strcat(buffer, " "); - } - strcat(buffer, OBLIQUE_SPEC); - } - if (border & COUNTER_OBLIQUE) { - if (buffer[0] != 0) { - strcat(buffer, " "); - } - strcat(buffer, COUNTER_OBLIQUE_SPEC); - } - Tcl_SetStringObj(result, buffer, strlen(buffer)); - } - break; + str = buffer; + ZnNameOfBorder(*((ZnBorder *) valp), buffer); + break; case ZN_CONFIG_LINE_SHAPE: - { - LineShape line_shape = *((LineShape *) valp); - switch (line_shape) { - case LINE_STRAIGHT: - str = STRAIGHT_SPEC; - break; - case LINE_RIGHT_LIGHTNING: - str = RIGHT_LIGHTNING_SPEC; - break; - case LINE_LEFT_LIGHTNING: - str = LEFT_LIGHTNING_SPEC; - break; - case LINE_RIGHT_CORNER: - str = RIGHT_CORNER_SPEC; - break; - case LINE_LEFT_CORNER: - str = LEFT_CORNER_SPEC; - break; - case LINE_DOUBLE_RIGHT_CORNER: - str = DOUBLE_RIGHT_CORNER_SPEC; - break; - case LINE_DOUBLE_LEFT_CORNER: - str = DOUBLE_LEFT_CORNER_SPEC; - break; - } - Tcl_SetStringObj(result, str, strlen(str)); - break; - } + str = ZnNameOfLineShape(*((ZnLineShape *) valp)); + break; case ZN_CONFIG_FILL_RULE: - { - int fill_rule = *((int *) valp); - switch (fill_rule) { - case GLU_TESS_WINDING_ODD: - str = "odd"; - break; - case GLU_TESS_WINDING_NONZERO: - str = "nonzero"; - break; - case GLU_TESS_WINDING_POSITIVE: - str = "positive"; - break; - case GLU_TESS_WINDING_NEGATIVE: - str = "negative"; - break; - case GLU_TESS_WINDING_ABS_GEQ_TWO: - str = "abs_geq_2"; - break; - } - Tcl_SetStringObj(result, str, strlen(str)); - break; - } + str = ZnNameOfFillRule(*((ZnFillRule *) valp)); + break; case ZN_CONFIG_LINE_STYLE: - { - LineStyle line_style = *((LineStyle *) valp); - switch (line_style) { - case LINE_SIMPLE: - str = SIMPLE_SPEC; - break; - case LINE_DASHED: - str = DASHED_SPEC; - break; - case LINE_MIXED: - str = MIXED_SPEC; - break; - case LINE_DOTTED: - str = DOTTED_SPEC; - break; - } - Tcl_SetStringObj(result, str, strlen(str)); - break; - } + str = ZnNameOfLineStyle(*((ZnLineStyle *) valp)); + break; case ZN_CONFIG_LINE_END: - { - ZnLineEnd line_end = *((ZnLineEnd *) valp); - - if (line_end) { - str = LineEndGetString(line_end); - Tcl_SetStringObj(result, str, strlen(str)); - } - break; + if (*((ZnLineEnd *) valp)) { + str = ZnLineEndGetString(*((ZnLineEnd *) valp)); } + break; case ZN_CONFIG_RELIEF: - str = ZnNameOfRelief(*((ReliefStyle *) valp)); - Tcl_SetStringObj(result, str, strlen(str)); + str = ZnNameOfRelief(*((ZnReliefStyle *) valp)); break; case ZN_CONFIG_JOIN_STYLE: - str = Tk_NameOfJoinStyle(*((int *) valp)); - Tcl_SetStringObj(result, str, strlen(str)); + str = (char *) Tk_NameOfJoinStyle(*((int *) valp)); break; case ZN_CONFIG_CAP_STYLE: - str = Tk_NameOfCapStyle(*((int *) valp)); - Tcl_SetStringObj(result, str, strlen(str)); + str = (char *) Tk_NameOfCapStyle(*((int *) valp)); break; case ZN_CONFIG_POINT: - { - Tcl_ListObjAppendElement(wi->interp, result, NewDoubleObj(((ZnPoint *) valp)->x)); - Tcl_ListObjAppendElement(wi->interp, result, NewDoubleObj(((ZnPoint *) valp)->y)); - break; - } + Tcl_ListObjAppendElement(wi->interp, result, Tcl_NewDoubleObj(((ZnPoint *) valp)->x)); + Tcl_ListObjAppendElement(wi->interp, result, Tcl_NewDoubleObj(((ZnPoint *) valp)->y)); + return; case ZN_CONFIG_ITEM: - if (*((Item *) valp) != ZN_NO_ITEM) { - Tcl_SetLongObj(result, (*((Item *) valp))->id); + if (*((ZnItem *) valp) != ZN_NO_ITEM) { + Tcl_SetLongObj(result, (int) (*((ZnItem *) valp))->id); + return; } break; case ZN_CONFIG_WINDOW: - if (*((ZnWindow *) valp) != NULL) { - str = Tk_PathName(*((ZnWindow *) valp)); - Tcl_SetStringObj(result, str, strlen(str)); + if (*((Tk_Window *) valp) != NULL) { + str = Tk_PathName(*((Tk_Window *) valp)); } break; case ZN_CONFIG_INT: @@ -1360,85 +1049,31 @@ AttributeToObj(WidgetInfo *wi, case ZN_CONFIG_ANGLE: case ZN_CONFIG_ALPHA: Tcl_SetIntObj(result, *((int *) valp)); - break; + return; case ZN_CONFIG_DIM: Tcl_SetDoubleObj(result, *((ZnDim *) valp)); - break; + return; case ZN_CONFIG_ALIGNMENT: - str = Tk_NameOfJustify(*((ZnJustify *) valp)); - Tcl_SetStringObj(result, str, strlen(str)); + str = (char *) Tk_NameOfJustify(*((Tk_Justify *) valp)); break; case ZN_CONFIG_ANCHOR: - str = Tk_NameOfAnchor(*((Tk_Anchor *) valp)); - Tcl_SetStringObj(result, str, strlen(str)); + str = (char *) Tk_NameOfAnchor(*((Tk_Anchor *) valp)); break; case ZN_CONFIG_LABEL_FORMAT: - { - ZnLabelFormat frmt = *((ZnLabelFormat *) valp); - - if (frmt) { - str = LabelFormatGetString(frmt); - Tcl_SetStringObj(result, str, strlen(str)); - } - break; + if (*((ZnLabelFormat *) valp)) { + str = ZnLFGetString(*((ZnLabelFormat *) valp)); } + break; case ZN_CONFIG_AUTO_ALIGNMENT: - { - AutoAlign *aa = (AutoAlign *) valp; - int i; - if (aa->automatic == False) { - str = "-"; - Tcl_SetStringObj(result, str, strlen(str)); - } - else { - buffer[0] = 0; - str = buffer; - for (i = 0; i < 3; i++) { - switch (aa->align[i]) { - case ZnJustifyLeft: - strcat(buffer, "l"); - break; - case ZnJustifyCenter: - strcat(buffer, "c"); - break; - case ZnJustifyRight: - strcat(buffer, "r"); - break; - } - } - Tcl_SetStringObj(result, buffer, strlen(buffer)); - } - } + str = buffer; + ZnNameOfAutoAlign((ZnAutoAlign *) valp, buffer); break; - case ZN_CONFIG_LEADER_ANCHORS: - { - LeaderAnchors lanch = *((LeaderAnchors *) valp); - char *ptr = buffer; - int count; - - if (!lanch) { - ptr = "%50x50"; - } - else { - if (lanch->left_y < 0) { - count = sprintf(ptr, "|%d", lanch->left_x); - } - else { - count = sprintf(ptr, "%%%dx%d", lanch->left_x, lanch->left_y); - } - ptr += count; - if (lanch->right_y < 0) { - count = sprintf(ptr, "|%d", lanch->right_x); - } - else { - count = sprintf(ptr, "%%%dx%d", lanch->right_x, lanch->right_y); - } - ptr = buffer; - } - Tcl_SetStringObj(result, ptr, strlen(ptr)); - } + str = buffer; + ZnNameOfLeaderAnchors(*((ZnLeaderAnchors *) valp), buffer); + break; } + Tcl_SetStringObj(result, str, -1); } @@ -1450,7 +1085,7 @@ AttributeToObj(WidgetInfo *wi, ********************************************************************************** */ int -ZnQueryAttribute(WidgetInfo *wi, +ZnQueryAttribute(ZnWInfo *wi, void *record, ZnAttrConfig *desc, Tcl_Obj *attr_name) @@ -1462,7 +1097,7 @@ ZnQueryAttribute(WidgetInfo *wi, while (True) { if (desc->type == ZN_CONFIG_END) { Tcl_AppendResult(wi->interp, "unknown attribute \"", attr_uid, "\"", NULL); - return ZN_ERROR; + return TCL_ERROR; } else if (attr_uid == desc->uid) { result = Tcl_GetObjResult(wi->interp); @@ -1473,7 +1108,7 @@ ZnQueryAttribute(WidgetInfo *wi, desc++; } } - return ZN_OK; + return TCL_OK; } @@ -1497,16 +1132,16 @@ ZnItemClassList() * ********************************************************************************** */ -ItemClass +ZnItemClass ZnLookupItemClass(char *class_name) { - ItemClass *class; + ZnItemClass *class; int i, num_classes; - class = (ItemClass *) ZnListArray(item_classes); + class = (ZnItemClass *) ZnListArray(item_classes); num_classes = ZnListSize(item_classes); for (i = 0; i < num_classes; i++) { - if (strcasecmp((class[i])->name, class_name) == 0) { + if (strcmp((class[i])->name, class_name) == 0) { return class[i]; } } @@ -1522,7 +1157,7 @@ ZnLookupItemClass(char *class_name) ********************************************************************************** */ void -ZnAddItemClass(ItemClass class) +ZnAddItemClass(ZnItemClass class) { if (!ZnLookupItemClass(class->name)) { ZnListAdd(item_classes, &class, ZnListTail); @@ -1543,7 +1178,7 @@ ZnItemInit() { /* First check if static part already inited */ if (item_classes == NULL) { - item_classes = ZnListNew(16, sizeof(ItemClass)); + item_classes = ZnListNew(16, sizeof(ZnItemClass)); ZnAddItemClass(ZnTrack); ZnAddItemClass(ZnWayPoint); ZnAddItemClass(ZnMap); @@ -1556,8 +1191,8 @@ ZnItemInit() ZnAddItemClass(ZnGroup); ZnAddItemClass(ZnIcon); ZnAddItemClass(ZnText); - ZnAddItemClass(ZnWind); - InitAttrDesc(FIELD.attr_desc); + ZnAddItemClass(ZnWindow); + InitAttrDesc(ZnFIELD.attr_desc); } } @@ -1572,8 +1207,8 @@ ZnItemInit() ********************************************************************************** */ static void -UpdateItemDependency(Item item, - Item old_connection) +UpdateItemDependency(ZnItem item, + ZnItem old_connection) { if (old_connection == ZN_NO_ITEM) { /* Add a connection */ @@ -1603,13 +1238,13 @@ UpdateItemDependency(Item item, ********************************************************************************** */ static void -ExtractItem(Item item) +ExtractItem(ZnItem item) { - WidgetInfo *wi = item->wi; - Item group = item->parent; + ZnWInfo *wi = item->wi; + ZnItem group = item->parent; /* damage bounding boxes */ - if (ISSET(item->flags, VISIBLE_BIT)) { + if (ISSET(item->flags, ZN_VISIBLE_BIT)) { ZnDamage(wi, &item->item_bounding_box); } @@ -1617,7 +1252,7 @@ ExtractItem(Item item) * Tell that we need to repick */ if (item->class != ZnGroup) { - SET(wi->events_flags, INTERNAL_NEED_REPICK); + SET(wi->flags, ZN_INTERNAL_NEED_REPICK); } if (group != ZN_NO_ITEM) { @@ -1652,9 +1287,9 @@ ExtractItem(Item item) ********************************************************************************** */ static void -InsertItem(Item item, - Item grp, - Item mark_item, +InsertItem(ZnItem item, + ZnItem grp, + ZnItem mark_item, ZnBool before) { if (!grp) { @@ -1680,16 +1315,16 @@ InsertItem(Item item, ********************************************************************************** */ static void -UpdateItemPriority(Item item, - Item mark_item, +UpdateItemPriority(ZnItem item, + ZnItem mark_item, ZnBool before) { - Item parent = item->parent; + ZnItem parent = item->parent; ZnGroupExtractItem(item); InsertItem(item, parent, mark_item, before); Invalidate(item, ZN_DRAW_FLAG); - SET(item->wi->events_flags, INTERNAL_NEED_REPICK); + SET(item->wi->flags, ZN_INTERNAL_NEED_REPICK); } @@ -1706,9 +1341,9 @@ UpdateItemPriority(Item item, ********************************************************************************** */ static void -SetId(Item item) +SetId(ZnItem item) { - WidgetInfo *wi = item->wi; + ZnWInfo *wi = item->wi; Tcl_HashEntry *entry; int dummy; @@ -1719,7 +1354,7 @@ SetId(Item item) } static void -FreeId(Item item) +FreeId(ZnItem item) { Tcl_HashEntry *entry; @@ -1744,11 +1379,11 @@ FreeId(Item item) ********************************************************************************** */ static void -AddTag(Item item, +AddTag(ZnItem item, Tk_Uid tag) { - int num, i; - char **ptr; + int num, i; + char **ptr; /* * No tags yet. @@ -1771,7 +1406,7 @@ AddTag(Item item, /* * Add it. */ - ZnListAdd(item->tags, &tag, ZnListTail); + ZnListAdd(item->tags, (void *) &tag, ZnListTail); } /* @@ -1782,10 +1417,10 @@ AddTag(Item item, ********************************************************************************** */ static void -RemoveTag(Item item, +RemoveTag(ZnItem item, Tk_Uid tag) { - int indx, num; + unsigned int indx, num; char **ptr; if (!item->tags) { @@ -1814,7 +1449,7 @@ RemoveTag(Item item, ********************************************************************************** */ static void -FreeTags(Item item) +FreeTags(ZnItem item) { if (!item->tags) { return; @@ -1832,7 +1467,7 @@ FreeTags(Item item) ********************************************************************************** */ static ZnBool -HasTag(Item item, +HasTag(ZnItem item, Tk_Uid tag) { int num; @@ -1867,15 +1502,15 @@ HasTag(Item item, * ********************************************************************************** */ -Item -ZnCreateItem(WidgetInfo *wi, - ItemClass item_class, +ZnItem +ZnCreateItem(ZnWInfo *wi, + ZnItemClass item_class, int *argc, Tcl_Obj *CONST *args[]) { - Item item; + ZnItem item; - item = (Item) ZnMalloc(item_class->size); + item = ZnMalloc(item_class->size); /* Initialize common state */ item->class = item_class; @@ -1883,20 +1518,20 @@ ZnCreateItem(WidgetInfo *wi, item->parent = NULL; item->previous = ZN_NO_ITEM; item->next = ZN_NO_ITEM; - CLEAR(item->flags, UPDATE_DEPENDENT_BIT); + CLEAR(item->flags, ZN_UPDATE_DEPENDENT_BIT); item->inv_flags = 0; item->transfo = NULL; item->parent = NULL; item->connected_item = ZN_NO_ITEM; -#ifdef GLX +#ifdef GL #ifdef GL_LIST item->gl_list = 0; #endif #endif - ResetBBox(&item->item_bounding_box); + ZnResetBBox(&item->item_bounding_box); /* Init item specific attributes */ - if (item_class->Init(item, argc, args) == ZN_ERROR) { + if (item_class->Init(item, argc, args) == TCL_ERROR) { ZnFree(item); return ZN_NO_ITEM; } @@ -1904,7 +1539,7 @@ ZnCreateItem(WidgetInfo *wi, SetId(item); item->tags = NULL; - SET(wi->events_flags, INTERNAL_NEED_REPICK); + SET(wi->flags, ZN_INTERNAL_NEED_REPICK); wi->num_items++; return (item); @@ -1919,25 +1554,26 @@ ZnCreateItem(WidgetInfo *wi, * ********************************************************************************** */ -static Item -CloneItem(Item model) +static ZnItem +CloneItem(ZnItem model) { - WidgetInfo *wi = model->wi; - Item item; + ZnWInfo *wi = model->wi; + ZnItem item; Tk_Uid *tags; - int i, num_tags; + unsigned int num_tags; + int i; if (!model->parent) { return ZN_NO_ITEM; } - item = (Item) ZnMalloc(model->class->size); + item = ZnMalloc(model->class->size); memcpy(item, model, model->class->size); item->previous = ZN_NO_ITEM; item->next = ZN_NO_ITEM; item->connected_item = ZN_NO_ITEM; - CLEAR(item->flags, UPDATE_DEPENDENT_BIT); + CLEAR(item->flags, ZN_UPDATE_DEPENDENT_BIT); item->inv_flags = 0; SetId(item); @@ -1957,9 +1593,11 @@ CloneItem(Item model) /* Call item's clone to duplicate non shared resources */ item->class->Clone(item); - SET(wi->events_flags, INTERNAL_NEED_REPICK); + SET(wi->flags, ZN_INTERNAL_NEED_REPICK); wi->num_items++; + Invalidate(item, ZN_COORDS_FLAG); + return item; } @@ -1972,39 +1610,39 @@ CloneItem(Item model) ********************************************************************************** */ static int -ConfigureItem(Item item, +ConfigureItem(ZnItem item, int field, int argc, Tcl_Obj *CONST argv[], ZnBool init) { - WidgetInfo *wi = item->wi; + ZnWInfo *wi = item->wi; int flags; - ZnBool previous_visible = init ? False : ISSET(item->flags, VISIBLE_BIT); + ZnBool previous_visible = init ? False : ISSET(item->flags, ZN_VISIBLE_BIT); flags = 0; ASSIGN(flags, ZN_COORDS_FLAG, init); if (argv) { if (field < 0){ - if (item->class->Configure(item, argc, argv, &flags) == ZN_ERROR) { - return ZN_ERROR; + if (item->class->Configure(item, argc, argv, &flags) == TCL_ERROR) { + return TCL_ERROR; } if (item->class->GetFieldSet && ISSET(flags, ZN_CLFC_FLAG)) { - FIELD.ClearFieldCache(item->class->GetFieldSet(item), -1); + ZnFIELD.ClearFieldCache(item->class->GetFieldSet(item), -1); } } else if (item->class->GetFieldSet) { - if (FIELD.ConfigureField(item->class->GetFieldSet(item), - field, argc, argv, &flags) == ZN_ERROR) { - return ZN_ERROR; + if (ZnFIELD.ConfigureField(item->class->GetFieldSet(item), + field, argc, argv, &flags) == TCL_ERROR) { + return TCL_ERROR; } } else { - return ZN_ERROR; + return TCL_ERROR; } } - if (previous_visible && ISCLEAR(item->flags, VISIBLE_BIT)) { + if (previous_visible && ISCLEAR(item->flags, ZN_VISIBLE_BIT)) { /* * Special case when the item has its visibility * just turned out. @@ -2014,7 +1652,7 @@ ConfigureItem(Item item, Invalidate(item, flags); - return ZN_OK; + return TCL_OK; } @@ -2026,7 +1664,7 @@ ConfigureItem(Item item, ********************************************************************************** */ static int -QueryItem(Item item, +QueryItem(ZnItem item, int field, int argc, Tcl_Obj *CONST argv[]) @@ -2035,11 +1673,11 @@ QueryItem(Item item, return item->class->Query(item, argc, argv); } else if (item->class->GetFieldSet) { - return FIELD.QueryField(item->class->GetFieldSet(item), - field, argc, argv); + return ZnFIELD.QueryField(item->class->GetFieldSet(item), + field, argc, argv); } - return ZN_ERROR; + return TCL_ERROR; } @@ -2110,15 +1748,15 @@ ComposeTransform(ZnTransfo *transfo, ********************************************************************************** */ static void -GetItemTransform(Item item, +GetItemTransform(ZnItem item, ZnTransfo *t) { - Item *items; + ZnItem *items; int i; ZnTransfo t_tmp, *t1, *t2, *swap; if (item_stack == NULL) { - item_stack = ZnListNew(16, sizeof(Item)); + item_stack = ZnListNew(16, sizeof(ZnItem)); } else { ZnListEmpty(item_stack); @@ -2132,11 +1770,11 @@ GetItemTransform(Item item, ZnTransfoSetIdentity(t); t1 = t; t2 = &t_tmp; - items = (Item *) ZnListArray(item_stack); + items = (ZnItem *) ZnListArray(item_stack); for (i = ZnListSize(item_stack)-1; i >= 0; i--) { ComposeTransform(items[i]->transfo, t1, t2, - ISSET(items[i]->flags, COMPOSE_SCALE_BIT), - ISSET(items[i]->flags, COMPOSE_ROTATION_BIT)); + ISSET(items[i]->flags, ZN_COMPOSE_SCALE_BIT), + ISSET(items[i]->flags, ZN_COMPOSE_ROTATION_BIT)); swap = t2; t2 = t1; t1 = swap; @@ -2161,7 +1799,7 @@ GetItemTransform(Item item, ********************************************************************************** */ void -ZnResetTransformStack(WidgetInfo *wi) +ZnResetTransformStack(ZnWInfo *wi) { ZnListAssertSize(wi->transfo_stack, 1); wi->current_transfo = (ZnTransfo *) ZnListAt(wi->transfo_stack, 0); @@ -2169,26 +1807,26 @@ ZnResetTransformStack(WidgetInfo *wi) } void -ZnInitTransformStack(WidgetInfo *wi) +ZnInitTransformStack(ZnWInfo *wi) { wi->transfo_stack = ZnListNew(8, sizeof(ZnTransfo)); ZnResetTransformStack(wi); } void -ZnFreeTransformStack(WidgetInfo *wi) +ZnFreeTransformStack(ZnWInfo *wi) { ZnListFree(wi->transfo_stack); } void -ZnPushTransform(WidgetInfo *wi, +ZnPushTransform(ZnWInfo *wi, ZnTransfo *transfo, ZnBool compose_scale, ZnBool compose_rot) { ZnTransfo *next_t; - int num_t; + unsigned int num_t; /* * Push the current transform and concatenate @@ -2204,7 +1842,7 @@ ZnPushTransform(WidgetInfo *wi, } void -ZnPopTransform(WidgetInfo *wi) +ZnPopTransform(ZnWInfo *wi) { /* * Restore the previous transform. @@ -2232,13 +1870,13 @@ ZnPopTransform(WidgetInfo *wi) */ typedef struct _ClipState { ZnBool simple; /* The clip is an aligned rectangle. */ - Region region; /* The X region used to draw and to */ + TkRegion region; /* The region used to draw and to */ /* probe for picking. */ ZnBBox clip_box; /* The bounding box of the clip area. */ } ClipState; void -ZnResetClipStack(WidgetInfo *wi) +ZnResetClipStack(ZnWInfo *wi) { int i; ClipState *clips = (ClipState *) ZnListArray(wi->clip_stack); @@ -2248,30 +1886,30 @@ ZnResetClipStack(WidgetInfo *wi) * empty when this function is called. */ for (i = ZnListSize(wi->clip_stack)-1; i >= 0; i--) { - XDestroyRegion(clips[i].region); + TkDestroyRegion(clips[i].region); } ZnListEmpty(wi->clip_stack); wi->current_clip = NULL; } void -ZnInitClipStack(WidgetInfo *wi) +ZnInitClipStack(ZnWInfo *wi) { wi->clip_stack = ZnListNew(8, sizeof(ClipState)); ZnResetClipStack(wi); } void -ZnFreeClipStack(WidgetInfo *wi) +ZnFreeClipStack(ZnWInfo *wi) { ZnListFree(wi->clip_stack); } ZnBool -ZnCurrentClip(WidgetInfo *wi, - Region *reg, - ZnBBox **clip_box, - ZnBool *simple) +ZnCurrentClip(ZnWInfo *wi, + TkRegion *reg, + ZnBBox **clip_box, + ZnBool *simple) { if (wi->current_clip) { if (reg) { @@ -2295,16 +1933,16 @@ ZnCurrentClip(WidgetInfo *wi, * is a regular pointer to a multi contour poly. */ void -ZnPushClip(WidgetInfo *wi, +ZnPushClip(ZnWInfo *wi, ZnTriStrip *tristrip, ZnBool simple, ZnBool set_gc) { - int i, j, num_clips; - int num_pts, max_num_pts; + unsigned int i, j, num_clips; + unsigned int num_pts, max_num_pts; ZnPoint *p; ClipState *previous_clip=NULL; - Region reg, reg_op, reg_to; + TkRegion reg, reg_op, reg_to; XRectangle rect; XPoint xpts[3]; @@ -2336,54 +1974,56 @@ ZnPushClip(WidgetInfo *wi, * Compute the local region. */ if (simple) { - rect.x = tristrip->strips[0].points[0].x; - rect.y = tristrip->strips[0].points[0].y; - rect.width = tristrip->strips[0].points[1].x - tristrip->strips[0].points[0].x; - rect.height = tristrip->strips[0].points[1].y - tristrip->strips[0].points[0].y; - reg = XCreateRegion(); - XUnionRectWithRegion(&rect, reg, reg); + rect.x = (short) tristrip->strips[0].points[0].x; + rect.y = (short) tristrip->strips[0].points[0].y; + rect.width = ((unsigned short) (tristrip->strips[0].points[1].x - + tristrip->strips[0].points[0].x)); + rect.height = ((unsigned short) (tristrip->strips[0].points[1].y - + tristrip->strips[0].points[0].y)); + reg = TkCreateRegion(); + TkUnionRectWithRegion(&rect, reg, reg); /*printf("Adding a simple clip: %d, %d, %d, %d\n", rect.x, rect.y, rect.width, rect.height);*/ } else { - reg = XCreateRegion(); + reg = TkCreateRegion(); for (j = 0; j < tristrip->num_strips; j++) { num_pts = tristrip->strips[j].num_points; p = tristrip->strips[j].points; if (tristrip->strips[j].fan) { - xpts[0].x = REAL_TO_INT(p->x); - xpts[0].y = REAL_TO_INT(p->y); + xpts[0].x = ZnNearestInt(p->x); + xpts[0].y = ZnNearestInt(p->y); p++; - xpts[1].x = REAL_TO_INT(p->x); - xpts[1].y = REAL_TO_INT(p->y); + xpts[1].x = ZnNearestInt(p->x); + xpts[1].y = ZnNearestInt(p->y); p++; for (i = 2; i < num_pts; i++, p++) { - xpts[2].x = REAL_TO_INT(p->x); - xpts[2].y = REAL_TO_INT(p->y); - reg_op = XPolygonRegion(xpts, 3, EvenOddRule); - reg_to = XCreateRegion(); - XUnionRegion(reg, reg_op, reg_to); - XDestroyRegion(reg); - XDestroyRegion(reg_op); + xpts[2].x = ZnNearestInt(p->x); + xpts[2].y = ZnNearestInt(p->y); + reg_op = (TkRegion) ZnPolygonRegion(xpts, 3, EvenOddRule); + reg_to = TkCreateRegion(); + ZnUnionRegion(reg, reg_op, reg_to); + TkDestroyRegion(reg); + TkDestroyRegion(reg_op); reg = reg_to; xpts[1] = xpts[2]; } } else { - xpts[0].x = p->x; - xpts[0].y = p->y; + xpts[0].x = (short) p->x; + xpts[0].y = (short) p->y; p++; - xpts[1].x = p->x; - xpts[1].y = p->y; + xpts[1].x = (short) p->x; + xpts[1].y = (short) p->y; p++; for (i = 2 ; i < num_pts; i++, p++) { - xpts[2].x = p->x; - xpts[2].y = p->y; - reg_op = XPolygonRegion(xpts, 3, EvenOddRule); - reg_to = XCreateRegion(); - XUnionRegion(reg, reg_op, reg_to); - XDestroyRegion(reg); - XDestroyRegion(reg_op); + xpts[2].x = (short) p->x; + xpts[2].y = (short) p->y; + reg_op = (TkRegion) 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]; @@ -2396,15 +2036,15 @@ ZnPushClip(WidgetInfo *wi, * Combine with previous region if any. */ if (previous_clip) { - wi->current_clip->region = XCreateRegion(); - XIntersectRegion(reg, previous_clip->region, wi->current_clip->region); - XDestroyRegion(reg); + wi->current_clip->region = TkCreateRegion(); + TkIntersectRegion(reg, previous_clip->region, wi->current_clip->region); + TkDestroyRegion(reg); /*printf("Merging with previous clip\n");*/ } else { wi->current_clip->region = reg; } - XClipBox(wi->current_clip->region, &rect); + TkClipBox(wi->current_clip->region, &rect); wi->current_clip->clip_box.orig.x = rect.x; wi->current_clip->clip_box.orig.y = rect.y; wi->current_clip->clip_box.corner.x = rect.x + rect.width; @@ -2415,20 +2055,20 @@ ZnPushClip(WidgetInfo *wi, */ if (set_gc) { if (wi->render) { -#ifdef GLX +#ifdef GL glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glEnable(GL_STENCIL_TEST); - glStencilFunc(GL_EQUAL, num_clips, 0xFF); + glStencilFunc(GL_EQUAL, (GLint) num_clips, 0xFF); glStencilOp(GL_KEEP, GL_INCR, GL_INCR); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); if (simple) { /* printf("Clip box is : %d, %d, %d, %d, num_clips : %d\n", rect.x, rect.y, rect.width, rect.height, num_clips);*/ glBegin(GL_QUADS); - glVertex2f(wi->current_clip->clip_box.orig.x, wi->current_clip->clip_box.orig.y); - glVertex2f(wi->current_clip->clip_box.orig.x, wi->current_clip->clip_box.corner.y); - glVertex2f(wi->current_clip->clip_box.corner.x, wi->current_clip->clip_box.corner.y); - glVertex2f(wi->current_clip->clip_box.corner.x, wi->current_clip->clip_box.orig.y); + glVertex2d(wi->current_clip->clip_box.orig.x, wi->current_clip->clip_box.orig.y); + glVertex2d(wi->current_clip->clip_box.orig.x, wi->current_clip->clip_box.corner.y); + glVertex2d(wi->current_clip->clip_box.corner.x, wi->current_clip->clip_box.corner.y); + glVertex2d(wi->current_clip->clip_box.corner.x, wi->current_clip->clip_box.orig.y); glEnd(); } else { @@ -2442,24 +2082,24 @@ ZnPushClip(WidgetInfo *wi, glBegin(GL_TRIANGLE_STRIP); } for (i = 0; i < num_pts; i++, p++) { - glVertex2f(p->x, p->y); + glVertex2d(p->x, p->y); } glEnd(); } } glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glStencilFunc(GL_EQUAL, num_clips+1, 0xFF); + glStencilFunc(GL_EQUAL, (GLint) (num_clips+1), 0xFF); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); #endif } else { - XSetRegion(wi->dpy, wi->gc, wi->current_clip->region); + TkSetRegion(wi->dpy, wi->gc, wi->current_clip->region); } } } void -ZnPopClip(WidgetInfo *wi, +ZnPopClip(ZnWInfo *wi, ZnBool set_gc) { int num_clips; @@ -2468,7 +2108,7 @@ ZnPopClip(WidgetInfo *wi, return; } - XDestroyRegion(wi->current_clip->region); + TkDestroyRegion(wi->current_clip->region); ZnListDelete(wi->clip_stack, ZnListTail); num_clips = ZnListSize(wi->clip_stack); @@ -2485,18 +2125,18 @@ ZnPopClip(WidgetInfo *wi, if (set_gc) { if (num_clips != 0) { if (wi->render) { -#ifdef GLX - glStencilFunc(GL_EQUAL, num_clips+1, 0xFF); +#ifdef GL + glStencilFunc(GL_EQUAL, (GLint) (num_clips+1), 0xFF); glStencilOp(GL_KEEP, GL_DECR, GL_DECR); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); #if 0 if (wi->current_clip->simple) { #endif glBegin(GL_QUADS); - glVertex2f(wi->current_clip->clip_box.orig.x, wi->current_clip->clip_box.orig.y); - glVertex2f(wi->current_clip->clip_box.orig.x, wi->current_clip->clip_box.corner.y); - glVertex2f(wi->current_clip->clip_box.corner.x, wi->current_clip->clip_box.corner.y); - glVertex2f(wi->current_clip->clip_box.corner.x, wi->current_clip->clip_box.orig.y); + glVertex2d(wi->current_clip->clip_box.orig.x, wi->current_clip->clip_box.orig.y); + glVertex2d(wi->current_clip->clip_box.orig.x, wi->current_clip->clip_box.corner.y); + glVertex2d(wi->current_clip->clip_box.corner.x, wi->current_clip->clip_box.corner.y); + glVertex2d(wi->current_clip->clip_box.corner.x, wi->current_clip->clip_box.orig.y); glEnd(); #if 0 } @@ -2504,18 +2144,18 @@ ZnPopClip(WidgetInfo *wi, } #endif glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glStencilFunc(GL_EQUAL, num_clips, 0xFF); + glStencilFunc(GL_EQUAL, (GLint) num_clips, 0xFF); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); #endif } else { - XSetRegion(wi->dpy, wi->gc, wi->current_clip->region); + TkSetRegion(wi->dpy, wi->gc, wi->current_clip->region); } } else { /*printf("resetting clip mask\n");*/ if (wi->render) { -#ifdef GLX +#ifdef GL glClear(GL_STENCIL_BUFFER_BIT); glDisable(GL_STENCIL_TEST); #endif @@ -2537,7 +2177,7 @@ ZnPopClip(WidgetInfo *wi, ********************************************************************************** */ static void -Invalidate(Item item, +Invalidate(ZnItem item, int reason) { if (ISSET(item->inv_flags, ZN_TRANSFO_FLAG)) { @@ -2546,7 +2186,7 @@ Invalidate(Item item, if (ISSET(reason, ZN_COORDS_FLAG) || ISSET(reason, ZN_TRANSFO_FLAG)) { - Item parent = item->parent; + ZnItem parent = item->parent; while ((parent != NULL) && ISCLEAR(parent->inv_flags, ZN_COORDS_FLAG) && ISCLEAR(parent->inv_flags, ZN_TRANSFO_FLAG)) { @@ -2566,10 +2206,10 @@ Invalidate(Item item, ZnNeedRedisplay(item->wi); } else if (ISSET(reason, ZN_DRAW_FLAG)) { - if (ISSET(item->flags, VISIBLE_BIT)) { + if (ISSET(item->flags, ZN_VISIBLE_BIT)) { /*printf("invalidate graphics for item %d\n", item->id);*/ ZnDamage(item->wi, &item->item_bounding_box); -#ifdef GLX +#ifdef GL #ifdef GL_LIST /* * Remove the item display list so that it will be recreated @@ -2597,10 +2237,10 @@ Invalidate(Item item, ********************************************************************************** */ static void -InvalidateItems(Item group, - ItemClass item_class) +InvalidateItems(ZnItem group, + ZnItemClass item_class) { - Item item; + ZnItem item; if (group->class != ZnGroup) { return; @@ -2633,7 +2273,7 @@ InvalidateItems(Item group, ********************************************************************************** */ static void -ResetTransfo(Item item) +ResetTransfo(ZnItem item) { if (item->transfo) { ZnFree(item->transfo); @@ -2644,7 +2284,7 @@ ResetTransfo(Item item) static void -SetTransfo(Item item, +SetTransfo(ZnItem item, ZnTransfo *t) { if (item->transfo) { @@ -2661,7 +2301,7 @@ SetTransfo(Item item, static void -TranslateItem(Item item, +TranslateItem(ZnItem item, ZnReal dx, ZnReal dy) { @@ -2674,7 +2314,7 @@ TranslateItem(Item item, static void -ScaleItem(Item item, +ScaleItem(ZnItem item, ZnReal sx, ZnReal sy) { @@ -2687,7 +2327,7 @@ ScaleItem(Item item, static void -RotateItem(Item item, +RotateItem(ZnItem item, ZnReal angle, ZnPoint *p) { @@ -2714,10 +2354,10 @@ RotateItem(Item item, ********************************************************************************** */ static void -DestroyItem(Item item) +DestroyItem(ZnItem item) { - WidgetInfo *wi = item->wi; - TextInfo *ti = &wi->text_info; + ZnWInfo *wi = item->wi; + ZnTextInfo *ti = &wi->text_info; /* * Extract it from its group. @@ -2783,7 +2423,7 @@ DestroyItem(Item item) ********************************************************************************** */ -struct _ITEM ITEM = { +struct _ZnITEM ZnITEM = { CloneItem, DestroyItem, ConfigureItem, |