aboutsummaryrefslogtreecommitdiff
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tkZinc.c72
1 files changed, 47 insertions, 25 deletions
diff --git a/generic/tkZinc.c b/generic/tkZinc.c
index 3733051..d360539 100644
--- a/generic/tkZinc.c
+++ b/generic/tkZinc.c
@@ -303,7 +303,7 @@ static void Repair _ANSI_ARGS_((WidgetInfo *wi));
Tcl_Obj *
-NewStringObj(char *str) {
+NewStringObj(CONST char *str) {
return Tcl_NewStringObj(str, strlen(str));
}
@@ -595,9 +595,9 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
Tk_Window tkwin;
unsigned int num;
int major_op, first_err, first_evt;
- int major_glx, minor_glx;
ZnBool has_glx = False;
#ifdef GLX
+ int major_glx, minor_glx;
Display *dpy = Tk_Display(top_w);
Screen *screen = Tk_Screen(top_w);
int attribs[] = {
@@ -788,13 +788,17 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
wi->damaged_area.corner.y = wi->height = wi->opt_height;
/*
+ * Allocate a GLU tesselator.
+ */
+ wi->tess = gluNewTess();
+ wi->tess_combine_list = NULL;
+
+ /*
* Allocate double buffer pixmap/image.
*/
if (wi->render) {
#ifdef GLX
wi->gl_context = 0;
- wi->tess = 0;
- wi->tess_combine_list = NULL;
if (wi->has_glx) {
#ifdef GLX_PRINT_CONFIG
@@ -843,7 +847,6 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
24,
XCreateColormap(wi->dpy, RootWindowOfScreen(wi->screen),
wi->gl_visual->visual, AllocNone));
- wi->tess = gluNewTess();
}
}
}
@@ -1376,7 +1379,7 @@ ZnTagSearchScan(WidgetInfo *wi,
TagSearch **search_var) /* Record describing tag search;
* will be initialized here. */
{
- char *tag;
+ Tk_Uid tag;
int i;
TagSearch *search;
Item group = wi->top_group;
@@ -1428,8 +1431,8 @@ ZnTagSearchScan(WidgetInfo *wi,
* tag and search for a matching group.
*/
if (strpbrk(tag, ".*")) {
- char *path, *next;
- char c;
+ Tk_Uid path;
+ char c, *next;
unsigned long id;
Tcl_HashEntry *entry;
@@ -2090,7 +2093,7 @@ FindItems(WidgetInfo *wi,
Item item;
ZnBool recursive = True;
ZnPickStruct ps;
- static char *search_cmd_strings[] = {
+ static CONST char *search_cmd_strings[] = {
"above", "ancestors", "atpriority", "below", "closest", "enclosed",
"overlapping", "withtag", "withtype", NULL
};
@@ -2441,7 +2444,9 @@ ZnParseCoordList(WidgetInfo *wi,
if (Tcl_GetDoubleFromObj(wi->interp, elems[i+1], &p->y) == ZN_ERROR) {
goto coord_error;
}
+ /*printf("Parsed a point: %g@%g, ", p->x, p->y);*/
}
+ /*printf("\n");*/
}
else {
Tcl_ResetResult(wi->interp);
@@ -2502,7 +2507,7 @@ Contour(WidgetInfo *wi,
ZnTransfo t, inv;
ZnContour *contours;
/* Keep this array in sync with ZnContourCmd in Types.h */
- static char *op_strings[] = {
+ static CONST char *op_strings[] = {
"add", "addhole", "remove", NULL
};
@@ -2556,7 +2561,7 @@ Contour(WidgetInfo *wi,
if (ZnParseCoordList(wi, args[4], &points, &controls, &num_points) == ZN_ERROR) {
return ZN_ERROR;
}
- POLY_CONTOUR1(&poly, NULL, num_points);
+ POLY_CONTOUR1(&poly, NULL, num_points, False);
/*
* Allocate a fresh point array, ZnParseCoordList returns a shared
* array.
@@ -2602,7 +2607,7 @@ Contour(WidgetInfo *wi,
if (!simple) {
goto noshape;
}
- POLY_CONTOUR1(&poly, tristrip.strip1.points, tristrip.strip1.num_points);
+ POLY_CONTOUR1(&poly, tristrip.strip1.points, tristrip.strip1.num_points, False);
poly.contours[0].controls = NULL;
}
else {
@@ -2712,7 +2717,7 @@ Coords(WidgetInfo *wi,
long index, contour = 0;
char *str, *controls = NULL;
char c[2] = " ";
- Tcl_Obj *l;
+ Tcl_Obj *l, *entries[3];
result = ZnItemWithTagOrId(wi, args[2], &item, search_var);
if ((result == ZN_ERROR) || (item == ZN_NO_ITEM)) {
@@ -2734,11 +2739,15 @@ Coords(WidgetInfo *wi,
num_points, points->x, points->y);*/
l = Tcl_GetObjResult(wi->interp);
for (i = 0; i < num_points; i++, points++) {
- Tcl_ListObjAppendElement(wi->interp, l, NewDoubleObj(points->x));
- Tcl_ListObjAppendElement(wi->interp, l, NewDoubleObj(points->y));
- if (controls) {
+ entries[0] = NewDoubleObj(points->x);
+ entries[1] = NewDoubleObj(points->y);
+ if (controls && controls[i]) {
c[0] = controls[i];
- Tcl_ListObjAppendElement(wi->interp, l, NewStringObj(c));
+ entries[2] = NewStringObj(c);
+ Tcl_ListObjAppendElement(wi->interp, l, Tcl_NewListObj(3, entries));
+ }
+ else {
+ Tcl_ListObjAppendElement(wi->interp, l, Tcl_NewListObj(2, entries));
}
}
return ZN_OK;
@@ -2866,7 +2875,18 @@ Coords(WidgetInfo *wi,
&points, &controls, &num_points) == ZN_ERROR) {
return ZN_ERROR;
}
- goto coords_read;
+ if (num_points) {
+ /*printf(" coords: read contour:%d, index:%d, point is %g@%g\n",
+ contour, index, points->x, points->y); */
+ l = Tcl_GetObjResult(wi->interp);
+ Tcl_ListObjAppendElement(wi->interp, l, NewDoubleObj(points->x));
+ Tcl_ListObjAppendElement(wi->interp, l, NewDoubleObj(points->y));
+ if (controls && controls[0]) {
+ c[0] = controls[0];
+ Tcl_ListObjAppendElement(wi->interp, l, NewStringObj(c));
+ }
+ }
+ return ZN_OK;
}
else if ((argc == 6) && (cmd == COORDS_REMOVE)) {
/* Remove coord of contour at index. */
@@ -2929,7 +2949,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
Tcl_Obj *l;
TagSearch *search_var = NULL;
Tcl_HashEntry *entry;
- static char *sub_cmd_strings[] = {
+ static CONST char *sub_cmd_strings[] = {
"add", "addtag", "anchorxy", "bbox", "becomes", "bind",
"cget", "chggroup", "clone", "configure", "contour",
"coords", "currentpart", "cursor", "dchars",
@@ -2953,7 +2973,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
ZN_W_TAPPLY, ZN_W_TDELETE, ZN_W_TRANSFORM, ZN_W_TRANSLATE, ZN_W_TRESET,
ZN_W_TRESTORE, ZN_W_TSAVE, ZN_W_TYPE, ZN_W_VERTEX_AT,
};
- static char *sel_cmd_strings[] = {
+ static CONST char *sel_cmd_strings[] = {
"adjust", "clear", "from", "item", "to", NULL
};
enum sel_cmds {
@@ -3225,7 +3245,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
#ifdef PTK
Tcl_Obj *command;
#else
- char *command;
+ CONST char *command;
#endif
command = Tk_GetBinding(interp, wi->binding_table, elem, Tcl_GetString(args[3]));
if (command == NULL) {
@@ -4768,7 +4788,7 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
#ifdef PTK
(Tcl_Obj **) args, (char *) wi, flags) != TCL_OK) {
#else
- (char **) args, (char *) wi, flags|TK_CONFIG_OBJS) != TCL_OK) {
+ (CONST char **) args, (char *) wi, flags|TK_CONFIG_OBJS) != TCL_OK) {
#endif
return TCL_ERROR;
}
@@ -5187,13 +5207,13 @@ DoEvent(WidgetInfo *wi,
#define BIND_ITEM(test) \
if (bind_item && (test)) { \
- its[ptr] = all_uid; \
+ its[ptr] = (ClientData) all_uid; \
ptr++; \
for (i = 0; i < num_tags; i++) { \
its[ptr] = tag_list[i]; \
ptr++; \
} \
- its[ptr] = item; \
+ its[ptr] = (ClientData) item; \
ptr++; \
}
@@ -5281,7 +5301,7 @@ DoEvent(WidgetInfo *wi,
workspace = ZnRealloc(workspace, len);
}
sprintf(workspace, "%s:%d", (char *) tag_list[i], wi->current_part);
- its[ptr] = Tk_GetUid(workspace);
+ its[ptr] = (ClientData) Tk_GetUid(workspace);
ptr++;
}
/*
@@ -6089,7 +6109,9 @@ Repair(WidgetInfo *wi)
XGCValues values;
ZnPoint pts[2];
ZnTriStrip tristrip;
+#ifdef GLX
XColor *color;
+#endif
ZnReal int_width = Tk_Width(wi->win);
ZnReal int_height = Tk_Height(wi->win);