aboutsummaryrefslogtreecommitdiff
path: root/generic/tkZinc.c
diff options
context:
space:
mode:
authorlecoanet2003-01-14 11:06:55 +0000
committerlecoanet2003-01-14 11:06:55 +0000
commite439a6c4888ddc1784e3d92996b279411793160b (patch)
tree2ae6f9a6633e2a35e481429fb1c1f689bac2e390 /generic/tkZinc.c
parent10a0c9000072c7f8d6d622c69028a641b49af8ff (diff)
downloadtkzinc-e439a6c4888ddc1784e3d92996b279411793160b.zip
tkzinc-e439a6c4888ddc1784e3d92996b279411793160b.tar.gz
tkzinc-e439a6c4888ddc1784e3d92996b279411793160b.tar.bz2
tkzinc-e439a6c4888ddc1784e3d92996b279411793160b.tar.xz
* Modification de la commande contour: la sous-commande
addhole est supprim�e, un flag est ajout� � la commande add pour indiquer si le contour doit �tre ajout� CW(-1), CCW(1) ou tel quel(0), cette derni�re valeur uniquement si on sp�cifie une liste de points. * Modification de la commande transform afin qu'elle retourne une liste de m�me forme que la liste d'entr�e (avec les points de contr�les et tout). * Modification de la commande smooth afin qu'elle retourne une liste de points de nouvelle forme. * Modification de la commande fit afin qu'elle retourne une liste de points de nouvelle forme. * (Contour): la sous commande add retourne un entier sign� d�crivant l'index du contour ajout� et le signe informe si la liste de points fournie a �t� retourn�e par la commande (n'a pas d'effet si on a sp�cifi� un item). * Modification de ParseCoordList pour retourner un booleen indiquant si il a pars� une liste nouvelle forme ou non. * Ajout de code pour maintenir en m�moire la texture des fontes par d�faut, autrement elles sont sans arr�t lib�r�es puis recharg�es � chaque cr�ation d'item contenant du texte jusqu'� ce qu'un item garde la fonte par d�faut. * Lib�ration des fontes et des textures associ�es dans Destroy. Pour l'instant le code de lib�ration des fontes Tk est comment� car il provoque un core dump en Perl/Tk
Diffstat (limited to 'generic/tkZinc.c')
-rw-r--r--generic/tkZinc.c357
1 files changed, 264 insertions, 93 deletions
diff --git a/generic/tkZinc.c b/generic/tkZinc.c
index 1b5471c..0a0dd15 100644
--- a/generic/tkZinc.c
+++ b/generic/tkZinc.c
@@ -688,6 +688,10 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
wi->opt_height = None;
wi->font = 0;
wi->map_text_font = 0;
+#ifdef GLX
+ wi->font_tfi = NULL;
+ wi->map_font_tfi = NULL;
+#endif
wi->map_distance_symbol = None;
wi->cursor = None;
wi->hot_item = ZN_NO_ITEM;
@@ -2470,7 +2474,8 @@ ZnParseCoordList(WidgetInfo *wi,
Tcl_Obj *arg,
ZnPoint **pts,
char **controls,
- int *num_pts)
+ int *num_pts,
+ ZnBool *old_format)
{
Tcl_Obj **elems, **selems;
int i, result, num_elems, num_selems;
@@ -2482,6 +2487,9 @@ ZnParseCoordList(WidgetInfo *wi,
if (controls) {
*controls = NULL;
}
+ if (old_format) {
+ *old_format = True;
+ }
result = Tcl_ListObjGetElements(wi->interp, arg, &num_elems, &elems);
if (result == ZN_ERROR) {
coord_error:
@@ -2496,7 +2504,8 @@ ZnParseCoordList(WidgetInfo *wi,
/*
* If first element is not a sublist, consider the whole list
- * as a flat array of coordinates in the old style.
+ * as a flat array of coordinates in the old style. It can still
+ * be
* If not, the list consists in sublists describing each point
* with its control flag.
*/
@@ -2505,22 +2514,44 @@ ZnParseCoordList(WidgetInfo *wi,
if (old_style) {
if ((num_elems%2) != 0) {
- goto coord_error;
+ *num_pts = num_elems/2;
+ ZnListAssertSize(wi->work_pts, *num_pts);
+ *pts = p = (ZnPoint *) ZnListArray(wi->work_pts);
+ for (i = 0; i < num_elems; i += 2, p++) {
+ if (Tcl_GetDoubleFromObj(wi->interp, elems[i], &p->x) == ZN_ERROR) {
+ goto coord_error;
+ }
+ 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");*/
}
-
- *num_pts = num_elems/2;
- ZnListAssertSize(wi->work_pts, *num_pts);
- *pts = p = (ZnPoint *) ZnListArray(wi->work_pts);
- for (i = 0; i < num_elems; i += 2, p++) {
- if (Tcl_GetDoubleFromObj(wi->interp, elems[i], &p->x) == ZN_ERROR) {
+ else if (num_elems == 3) {
+ *num_pts = 1;
+ ZnListAssertSize(wi->work_pts, *num_pts);
+ *pts = p = (ZnPoint *) ZnListArray(wi->work_pts);
+ if (Tcl_GetDoubleFromObj(wi->interp, elems[0], &p->x) == ZN_ERROR) {
goto coord_error;
}
- if (Tcl_GetDoubleFromObj(wi->interp, elems[i+1], &p->y) == ZN_ERROR) {
+ if (Tcl_GetDoubleFromObj(wi->interp, elems[1], &p->y) == ZN_ERROR) {
goto coord_error;
}
- /*printf("Parsed a point: %g@%g, ", p->x, p->y);*/
+ if (controls) {
+ if (! *controls) {
+ *controls = ZnMalloc(*num_pts * sizeof(char));
+ memset(*controls, 0, *num_pts * sizeof(char));
+ }
+ str = Tcl_GetStringFromObj(elems[2], &len);
+ if (len) {
+ (*controls)[0] = str[0];
+ }
+ }
+ }
+ else {
+ goto coord_error;
}
- /*printf("\n");*/
}
else {
Tcl_ResetResult(wi->interp);
@@ -2553,6 +2584,9 @@ ZnParseCoordList(WidgetInfo *wi,
}
}
+ if (old_format) {
+ *old_format = old_style;
+ }
return ZN_OK;
}
@@ -2570,19 +2604,20 @@ Contour(WidgetInfo *wi,
Tcl_Obj *CONST args[],
TagSearch **search_var)
{
- ZnPoint *points, *points2;
- ZnPoint p[4], xp[4];
+ ZnPoint *points;
Item item, shape;
- int cmd, num_points, cw, result, i, j;
+ int cmd, num_points, cw, result, i, j, k;
long index;
- char *controls;
+ char *controls, winding_flag;
ZnBool simple=False;
ZnPoly poly;
ZnTransfo t, inv;
ZnContour *contours;
+ int revert = False;
+
/* Keep this array in sync with ZnContourCmd in Types.h */
static CONST char *op_strings[] = {
- "add", "addhole", "remove", NULL
+ "add", "remove", NULL
};
result = ZnItemWithTagOrId(wi, args[2], &item, search_var);
@@ -2608,17 +2643,28 @@ Contour(WidgetInfo *wi,
Tcl_SetObjResult(wi->interp, Tcl_NewIntObj(item->class->Contour(item, -1, 0, NULL)));
return ZN_OK;
}
+ /*
+ * Get the sub-command
+ */
if (Tcl_GetIndexFromObj(wi->interp, args[3], op_strings,
"contour operation", 0, &cmd) != ZN_OK) {
return ZN_ERROR;
}
-
+ /*
+ * Get the winding flag.
+ */
+ if ((Tcl_GetIntFromObj(wi->interp, args[4], &winding_flag) != ZN_OK) ||
+ (winding_flag < -1) || (winding_flag > 1)) {
+ Tcl_AppendResult(wi->interp, " incorrect winding flag, should be -1, 0, 1, \"",
+ Tcl_GetString(args[4]), "\"", NULL);
+ return ZN_ERROR;
+ }
index = ZnListTail;
- if (((argc == 5) && (cmd == ZN_CONTOUR_REMOVE)) || (argc == 6)) {
+ if (((argc == 6) && (cmd == ZN_CONTOUR_REMOVE)) || (argc == 7)) {
/* Look for an index value. */
- if (Tcl_GetLongFromObj(wi->interp, args[4], &index) != ZN_OK) {
+ if (Tcl_GetLongFromObj(wi->interp, args[5], &index) != ZN_OK) {
Tcl_AppendResult(wi->interp, " incorrect contour index \"",
- Tcl_GetString(args[4]), "\"", NULL);
+ Tcl_GetString(args[5]), "\"", NULL);
return ZN_ERROR;
}
argc--;
@@ -2629,34 +2675,49 @@ Contour(WidgetInfo *wi,
Tcl_SetObjResult(wi->interp, Tcl_NewIntObj(item->class->Contour(item, ZN_CONTOUR_REMOVE, index, NULL)));
}
else {
- result = ZnItemWithTagOrId(wi, args[4], &shape, search_var);
+ result = ZnItemWithTagOrId(wi, args[5], &shape, search_var);
if ((result == ZN_ERROR) || (shape == ZN_NO_ITEM)) {
Tcl_ResetResult(wi->interp);
- if (ZnParseCoordList(wi, args[4], &points, &controls, &num_points) == ZN_ERROR) {
+ if (ZnParseCoordList(wi, args[5], &points,
+ &controls, &num_points, NULL) == ZN_ERROR) {
return ZN_ERROR;
}
POLY_CONTOUR1(&poly, NULL, num_points, False);
/*
* Allocate a fresh point array, ZnParseCoordList returns a shared
- * array.
+ * array. The control array is not shared and can be passed along.
*/
- poly.contours[0].points = (ZnPoint *) ZnMalloc(num_points*sizeof(ZnPoint));
- poly.contours[0].cw = (cmd == ZN_CONTOUR_ADD_HOLE);
- if (!TestCCW(points, num_points) ^ (cmd == ZN_CONTOUR_ADD_HOLE)) {
+ poly.contours[0].points = ZnMalloc(num_points*sizeof(ZnPoint));
+ cw = poly.contours[0].cw = !TestCCW(points, num_points);
+ if (winding_flag != 0) {
+ revert = cw ^ (winding_flag == -1);
+ }
+ if (revert) {
/* Revert the contour */
for (i = 0; i < num_points; i++) {
poly.contours[0].points[num_points-i-1] = points[i];
}
+ if (controls) {
+ char ch;
+ for (i = 0, j = num_points-1; i < j; i++, j--) {
+ ch = controls[i];
+ controls[i] = controls[j];
+ controls[j] = ch;
+ }
+ }
}
else {
memcpy(poly.contours[0].points, points, num_points*sizeof(ZnPoint));
}
- poly.contours[0].controls = NULL;
- if (controls) {
- poly.contours[0].controls = controls;
- }
+ poly.contours[0].controls = controls;
}
else {
+ if (winding_flag == 0) {
+ Tcl_AppendResult(wi->interp,
+ "Must supply an explicit winding direction (-1, 1)\nwhen adding a contour from an item",
+ NULL);
+ return ZN_ERROR;
+ }
/*
* If something has changed in the geometry we need to
* update or the shape will be erroneous.
@@ -2698,12 +2759,14 @@ Contour(WidgetInfo *wi,
ITEM.GetItemTransform(item, &t);
ZnTransfoInvert(&t, &inv);
/*
- * Make a new transformed poly.
+ * Make a new transformed poly and unshare
+ * the contour(s) returned by the item.
*/
if (simple) {
+ ZnPoint p[4];
p[0] = poly.contours[0].points[0];
p[2] = poly.contours[0].points[1];
- if (cmd == ZN_CONTOUR_ADD_HOLE) {
+ if (winding_flag == -1) {
p[1].x = p[2].x;
p[1].y = p[0].y;
p[3].x = p[0].x;
@@ -2715,19 +2778,21 @@ Contour(WidgetInfo *wi,
p[3].x = p[2].x;
p[3].y = p[0].y;
}
- ZnTransformPoints(&inv, p, xp, 4);
- poly.contours[0].points = xp;
+ points = ZnMalloc(4*sizeof(ZnPoint));
+ ZnTransformPoints(&inv, p, points, 4);
+ poly.contours[0].points = points;
poly.contours[0].num_points = 4;
- poly.contours[0].cw = (cmd == ZN_CONTOUR_ADD_HOLE);
+ poly.contours[0].cw = (winding_flag == -1);
poly.contours[0].controls = NULL;
}
else {
+ /* Unshare the contour array */
contours = poly.contours;
if (poly.num_contours == 1) {
poly.contours = &poly.contour1;
}
else {
- poly.contours = (ZnContour *) ZnMalloc(poly.num_contours*sizeof(ZnContour));
+ poly.contours = ZnMalloc(poly.num_contours*sizeof(ZnContour));
}
for (i = 0; i < poly.num_contours; i++) {
points = contours[i].points;
@@ -2737,33 +2802,58 @@ Contour(WidgetInfo *wi,
poly.contours[i].cw = cw;
if (contours[i].controls) {
/*
- * The controls array is shared DO NOT deallocate !!
+ * The controls array returned by GetContour is shared.
+ * Here we unshare it.
*/
- poly.contours[i].controls = contours[i].controls;
+ poly.contours[i].controls = ZnMalloc(num_points*sizeof(char));
}
+ /*
+ * Unshare the point array.
+ */
poly.contours[i].points = ZnMalloc(num_points*sizeof(ZnPoint));
- if (((poly.num_contours == 1) && ((cmd == ZN_CONTOUR_ADD_HOLE) ^ cw)) ||
- ((poly.num_contours > 1) && (cmd == ZN_CONTOUR_ADD_HOLE))) {
- /* Revert the contour */
+
+ if (((poly.num_contours == 1) && ((winding_flag == -1) ^ cw)) ||
+ ((poly.num_contours > 1) && (winding_flag == -1))) {
+ ZnPoint p;
+
+ /* Revert and transform the coords */
poly.contours[i].cw = ! cw;
- points2 = ZnMalloc(num_points*sizeof(ZnPoint));
- for (j = 0; j < num_points; j++) {
- points2[num_points-j-1] = points[j];
+ for (j = 0, k = num_points-1; j < k; j++, k--) {
+ p = points[j];
+ points[j] = points[k];
+ points[k] = p;
+ }
+ ZnTransformPoints(&inv, points, poly.contours[i].points, num_points);
+
+ /* Revert the controls */
+ if (contours[i].controls) {
+ for (j = 0; j < num_points; j++) {
+ poly.contours[i].controls[num_points-j-1] = contours[i].controls[j];
+ }
}
- ZnTransformPoints(&inv, points2, poly.contours[i].points, num_points);
- ZnFree(points2);
}
else {
ZnTransformPoints(&inv, points, poly.contours[i].points, num_points);
+ if (contours[i].controls) {
+ memcpy(poly.contours[i].controls, contours[i].controls, num_points);
+ }
}
}
}
}
- Tcl_SetObjResult(wi->interp, Tcl_NewIntObj(item->class->Contour(item, ZN_CONTOUR_ADD, index, &poly)));
+ result = item->class->Contour(item, ZN_CONTOUR_ADD, index, &poly);
+ if (revert) {
+ result = -result;
+ }
+ Tcl_SetObjResult(wi->interp, Tcl_NewIntObj(result));
- if (!simple) {
- POLY_FREE(&poly);
+ if (poly.contours != &poly.contour1) {
+ /*
+ * Must not use POLY_FREE: the point and controls arrays
+ * are passed along to the item and no longer ours.
+ */
+ ZnFree(poly.contours);
}
}
@@ -2800,8 +2890,8 @@ Coords(WidgetInfo *wi,
return ZN_ERROR;
}
num_points = 0;
- /* printf(" coords: argc=%d, item %d class: %s\n",
- argc, item->id, item->class->name); */
+ /*printf(" coords: argc=%d, item %d class: %s\n",
+ argc, item->id, item->class->name);*/
if (argc == 3) {
/* Get all coords of default contour (0). */
if (item->class->Coords(item, 0, 0, COORDS_READ_ALL,
@@ -2869,7 +2959,8 @@ Coords(WidgetInfo *wi,
Tcl_GetString(args[i]), "\"", NULL);
return ZN_ERROR;
}
- else if (ZnParseCoordList(wi, args[i], &points, &controls, &num_points) == ZN_ERROR) {
+ else if (ZnParseCoordList(wi, args[argc-1], &points,
+ &controls, &num_points, NULL) == ZN_ERROR) {
return ZN_ERROR;
}
if (cmd == COORDS_ADD) {
@@ -2921,7 +3012,8 @@ Coords(WidgetInfo *wi,
Tcl_GetString(args[i]), "\"", NULL);
return ZN_ERROR;
}
- else if (ZnParseCoordList(wi, args[i], &points, &controls, &num_points) == ZN_ERROR) {
+ else if (ZnParseCoordList(wi, args[argc-1], &points,
+ &controls, &num_points, NULL) == ZN_ERROR) {
return ZN_ERROR;
}
if (cmd == COORDS_ADD) {
@@ -2972,7 +3064,8 @@ Coords(WidgetInfo *wi,
}
/* Set a single coord or add coords at index in contour. */
- if (ZnParseCoordList(wi, args[i+1], &points, &controls, &num_points) == ZN_ERROR) {
+ if (ZnParseCoordList(wi, args[argc-1], &points,
+ &controls, &num_points, NULL) == ZN_ERROR) {
return ZN_ERROR;
}
if (argc == 6) {
@@ -3023,6 +3116,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
Tcl_Obj *l;
TagSearch *search_var = NULL;
Tcl_HashEntry *entry;
+ ZnPoint *points;
+ int num_points;
+ ZnList to_points;
+ Tcl_Obj *entries[3];
+ char c[] = "c";
+
static CONST char *sub_cmd_strings[] = {
"add", "addtag", "anchorxy", "bbox", "becomes", "bind",
"cget", "chggroup", "clone", "configure", "contour",
@@ -3451,9 +3550,9 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_CONTOUR:
{
- if ((argc < 3) || (argc > 6)) {
+ if ((argc < 3) || (argc > 7)) {
Tcl_WrongNumArgs(interp, 1, args,
- "contour tagOrId ?operator? ?index? ?coordListOrTagOrId?");
+ "contour tagOrId ?operator windingFlag? ?index? ?coordListOrTagOrId?");
goto error;
}
if (Contour(wi, argc, args, &search_var) == ZN_ERROR) {
@@ -3669,16 +3768,14 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_FIT:
{
- ZnPoint *points;
- int num_points;
ZnReal error;
- ZnList to_points;
if (argc != 4) {
Tcl_WrongNumArgs(interp, 1, args, "fit coordList error");
goto error;
}
- if (ZnParseCoordList(wi, args[2], &points, NULL, &num_points) == ZN_ERROR) {
+ if (ZnParseCoordList(wi, args[2], &points,
+ NULL, &num_points, NULL) == ZN_ERROR) {
return ZN_ERROR;
}
if (Tcl_GetDoubleFromObj(interp, args[3], &error) == ZN_ERROR) {
@@ -3690,9 +3787,16 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
num_points = ZnListSize(to_points);
l = Tcl_GetObjResult(interp);
for (i = 0; i < num_points; i++, points++) {
- Tcl_ListObjAppendElement(interp, l, NewDoubleObj(points->x));
- Tcl_ListObjAppendElement(interp, l, NewDoubleObj(points->y));
- }
+ entries[0] = NewDoubleObj(points->x);
+ entries[1] = NewDoubleObj(points->y);
+ if (i % 3) {
+ entries[2] = NewStringObj(c);
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewListObj(3, entries));
+ }
+ else {
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewListObj(2, entries));
+ }
+ }
ZnListFree(to_points);
}
break;
@@ -4506,15 +4610,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_SMOOTH:
{
- ZnPoint *points;
- int num_points;
- ZnList to_points;
-
if (argc != 3) {
Tcl_WrongNumArgs(interp, 1, args, "smooth coordList");
goto error;
}
- if (ZnParseCoordList(wi, args[2], &points, NULL, &num_points) == ZN_ERROR) {
+ if (ZnParseCoordList(wi, args[2], &points,
+ NULL, &num_points, NULL) == ZN_ERROR) {
return ZN_ERROR;
}
to_points = ZnListNew(32, sizeof(ZnPoint));
@@ -4523,9 +4624,16 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
num_points = ZnListSize(to_points);
l = Tcl_GetObjResult(interp);
for (i = 0; i < num_points; i++, points++) {
- Tcl_ListObjAppendElement(interp, l, NewDoubleObj(points->x));
- Tcl_ListObjAppendElement(interp, l, NewDoubleObj(points->y));
- }
+ entries[0] = NewDoubleObj(points->x);
+ entries[1] = NewDoubleObj(points->y);
+ if (i % 3) {
+ entries[2] = NewStringObj(c);
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewListObj(3, entries));
+ }
+ else {
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewListObj(2, entries));
+ }
+ }
ZnListFree(to_points);
}
break;
@@ -4564,11 +4672,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*/
case ZN_W_TRANSFORM:
{
- int num_points;
+ char *controls;
ZnPoint *p, xp;
ZnTransfo t, t2, inv, *this_one;
Item from, to;
-
+ ZnBool old_format;
+
if ((argc != 4) && (argc != 5)) {
Tcl_WrongNumArgs(interp, 1, args, "transform ?tagOrIdFrom? tagOrIdTo coordlist");
goto error;
@@ -4609,17 +4718,43 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
/*ZnPrintTransfo(&t);
ZnPrintTransfo(&inv);*/
- if (ZnParseCoordList(wi, args[argc-1], &p, NULL, &num_points) == ZN_ERROR) {
+ if (ZnParseCoordList(wi, args[argc-1], &p,
+ &controls, &num_points, &old_format) == ZN_ERROR) {
Tcl_AppendResult(interp, " invalid coord list \"",
Tcl_GetString(args[argc-1]), "\"", NULL);
goto error;
}
l = Tcl_GetObjResult(interp);
- for (i = 0; i < num_points; i++, p++) {
- ZnTransformPoint(this_one, p, &xp);
- /*printf("p->x=%g, p->y=%g, xp.x=%g, xp.y=%g\n", p->x, p->y, xp.x, xp.y);*/
- Tcl_ListObjAppendElement(interp, l, NewDoubleObj(xp.x));
- Tcl_ListObjAppendElement(interp, l, NewDoubleObj(xp.y));
+ if (old_format) {
+ for (i = 0; i < num_points; i++, p++) {
+ ZnTransformPoint(this_one, p, &xp);
+ /*printf("p->x=%g, p->y=%g, xp.x=%g, xp.y=%g\n", p->x, p->y, xp.x, xp.y);*/
+ Tcl_ListObjAppendElement(interp, l, NewDoubleObj(xp.x));
+ Tcl_ListObjAppendElement(interp, l, NewDoubleObj(xp.y));
+ /* The next case only applies for a one point
+ * list with a control flag.
+ */
+ if (controls && controls[i]) {
+ c[0] = controls[i];
+ Tcl_ListObjAppendElement(interp, l, NewStringObj(c));
+ }
+ }
+ }
+ else {
+ for (i = 0; i < num_points; i++, p++) {
+ ZnTransformPoint(this_one, p, &xp);
+ /*printf("p->x=%g, p->y=%g, xp.x=%g, xp.y=%g\n", p->x, p->y, xp.x, xp.y);*/
+ entries[0] = NewDoubleObj(xp.x);
+ entries[1] = NewDoubleObj(xp.y);
+ if (controls && controls[i]) {
+ c[0] = controls[i];
+ entries[2] = NewStringObj(c);
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewListObj(3, entries));
+ }
+ else {
+ Tcl_ListObjAppendElement(interp, l, Tcl_NewListObj(2, entries));
+ }
+ }
}
}
break;
@@ -4845,7 +4980,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
*
* This procedure is called to process an args/argc list in
* conjunction with the Tk option database to configure (or
- * reconfigure) a Act widget.
+ * reconfigure) a Zinc widget.
*
* Results:
* The return value is a standard Tcl result. If ZN_ERROR is
@@ -4888,6 +5023,25 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
wi->render = render;
}
+#ifdef GLX
+ if (CONFIG_PROBE(FONT_SPEC) || !wi->font_tfi) {
+ if (wi->font_tfi) {
+ ZnFreeTexFont(wi->font_tfi);
+ }
+ if (wi->render) {
+ wi->font_tfi = ZnGetTexFont(wi, wi->font);
+ }
+ }
+ if (CONFIG_PROBE(MAP_TEXT_FONT_SPEC) || !wi->map_font_tfi) {
+ if (wi->map_font_tfi) {
+ ZnFreeTexFont(wi->map_font_tfi);
+ }
+ if (wi->render) {
+ wi->map_font_tfi = ZnGetTexFont(wi, wi->map_text_font);
+ }
+ }
+#endif
+
/*
* Maintain the pick aperture within meaningful bounds.
*/
@@ -6002,6 +6156,22 @@ Destroy(char *mem_ptr) /* Info about the widget. */
Tcl_CancelIdleCall(Redisplay, (ClientData) wi);
}
+#ifdef GLX
+ if (wi->font_tfi) {
+ ZnFreeTexFont(wi->font_tfi);
+ }
+ if (wi->map_font_tfi) {
+ ZnFreeTexFont(wi->map_font_tfi);
+ }
+#endif
+ /*
+ if (wi->font) {
+ Tk_FreeFont(wi->font);
+ }
+ if (wi->map_text_font) {
+ Tk_FreeFont(wi->map_text_font);
+ }*/
+
for (num = 0; num < NUM_ALPHA_STEPS; num++) {
if (wi->alpha_stipples[num] != None) {
Tk_FreeBitmap(wi->dpy, wi->alpha_stipples[num]);
@@ -6036,17 +6206,6 @@ Destroy(char *mem_ptr) /* Info about the widget. */
if (wi->draw_buffer) {
XFreePixmap(wi->dpy, wi->draw_buffer);
}
-#ifdef GLX
- if (wi->gl_context) {
- glXDestroyContext(wi->dpy, wi->gl_context);
- }
- if (wi->gl_visual) {
- XFree(wi->gl_visual);
- }
- if (wi->tess) {
- gluDeleteTess(wi->tess);
- }
-#endif
if (wi->fore_color) {
ZnFreeGradient(wi->fore_color);
@@ -6057,7 +6216,7 @@ Destroy(char *mem_ptr) /* Info about the widget. */
if (wi->relief_grad) {
ZnFreeGradient(wi->relief_grad);
}
-
+
Tcl_DeleteTimerHandler(wi->blink_handler);
Tk_FreeOptions(config_specs, (char *) wi, wi->dpy, 0);
@@ -6078,6 +6237,18 @@ Destroy(char *mem_ptr) /* Info about the widget. */
FreeChrono(wi->total_draw_chrono);
FreeChrono(wi->this_draw_chrono);
+#ifdef GLX
+ if (wi->gl_context) {
+ glXDestroyContext(wi->dpy, wi->gl_context);
+ }
+ if (wi->gl_visual) {
+ XFree(wi->gl_visual);
+ }
+ if (wi->tess) {
+ gluDeleteTess(wi->tess);
+ }
+#endif
+
ZnFree(wi);
/*printf("Destroy ending\n");*/
}