aboutsummaryrefslogtreecommitdiff
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/Field.c35
-rw-r--r--generic/Map.c23
2 files changed, 23 insertions, 35 deletions
diff --git a/generic/Field.c b/generic/Field.c
index 2c69fd8..a1d00c2 100644
--- a/generic/Field.c
+++ b/generic/Field.c
@@ -75,7 +75,6 @@ typedef struct _FieldStruct {
short orig_y;
short corner_x;
short corner_y;
- ZnFieldSet field_set; /* Only used by the image update callbacks */
int insert_index;
#ifdef GL
ZnTexFontInfo *tfi;
@@ -819,7 +818,6 @@ InitFields(ZnFieldSet field_set)
for (i = 0; i < num_fields; i++){
field = &field_set->fields[i];
- field->field_set = field_set;
field->color = ZnGetGradientByValue(wi->fore_color);
field->fill_color = ZnGetGradientByValue(wi->back_color);
field->border_color = ZnGetGradientByValue(wi->fore_color);
@@ -833,9 +831,6 @@ InitFields(ZnFieldSet field_set)
field->font = Tk_GetFont(wi->interp, wi->win, Tk_NameOfFont(wi->font));
#ifdef GL
field->tfi = NULL;
- if (wi->render) {
- field->tfi = ZnGetTexFont(wi, field->font);
- }
#endif
field->border_edges = ZN_NO_BORDER;
field->alignment = TK_JUSTIFY_LEFT;
@@ -890,16 +885,14 @@ CloneFields(ZnFieldSet field_set)
field->grad_geo = grad_geo;
}
if (field->image != ZnUnspecifiedImage) {
- field->image = ZnGetImageByValue(field->image);
+ field->image = ZnGetImageByValue(field->image, ZnUpdateItemImage, field_set->item);
}
if (field->tile != ZnUnspecifiedImage) {
- field->tile = ZnGetImageByValue(field->tile);
+ field->tile = ZnGetImageByValue(field->tile, ZnUpdateItemImage, field_set->item);
}
field->font = Tk_GetFont(wi->interp, wi->win, Tk_NameOfFont(field->font));
#ifdef GL
- if (wi->render) {
- field->tfi = ZnGetTexFont(wi, field->font);
- }
+ field->tfi = NULL;
#endif
field->color = ZnGetGradientByValue(field->color);
field->fill_color = ZnGetGradientByValue(field->fill_color);
@@ -953,7 +946,7 @@ ConfigureField(ZnFieldSet fs,
old_num_chars = Tcl_NumUtfChars(fptr->text, (int) strlen(fptr->text));
}
- if (ZnConfigureAttributes(wi, fptr, field_attrs,
+ if (ZnConfigureAttributes(wi, fs->item, fptr, field_attrs,
argc, argv, flags) == TCL_ERROR) {
return TCL_ERROR;
}
@@ -990,14 +983,7 @@ ConfigureField(ZnFieldSet fs,
if (old_font != fptr->font) {
if (fptr->tfi) {
ZnFreeTexFont(fptr->tfi);
- }
- if (wi->render) {
- fptr->tfi = ZnGetTexFont(wi, fptr->font);
- if (!fptr->tfi) {
- Tcl_AppendResult(wi->interp, "impossible to get the texture for font \"",
- Tk_NameOfFont(fptr->font), "\"", NULL);
- return TCL_ERROR;
- }
+ fptr->tfi = NULL;
}
}
#endif
@@ -1100,11 +1086,11 @@ FreeFields(ZnFieldSet field_set)
ZnFree(field->grad_geo);
}
if (field->image != ZnUnspecifiedImage) {
- ZnFreeImage(field->image);
+ ZnFreeImage(field->image, ZnUpdateItemImage, &field->image);
field->image = ZnUnspecifiedImage;
}
if (field->tile != ZnUnspecifiedImage) {
- ZnFreeImage(field->tile);
+ ZnFreeImage(field->tile, ZnUpdateItemImage, &field->tile);
field->tile = ZnUnspecifiedImage;
}
Tk_FreeFont(field->font);
@@ -2053,7 +2039,12 @@ RenderField(ZnWInfo *wi,
* Draw the text.
*/
num_bytes = strlen(fptr->text);
- if (num_bytes && fptr->tfi) {
+ if (num_bytes) {
+ if (!fptr->tfi) {
+ if (! (fptr->tfi = ZnGetTexFont(wi, fptr->font))) {
+ continue;
+ }
+ }
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (sel_start >= 0) {
color = ZnGetGradientColor(ti->sel_color, 0.0, &alpha);
diff --git a/generic/Map.c b/generic/Map.c
index 5cdaa78..da36243 100644
--- a/generic/Map.c
+++ b/generic/Map.c
@@ -216,9 +216,6 @@ Init(ZnItem item,
Tk_NameOfFont(wi->map_text_font));
#ifdef GL
map->tfi = NULL;
- if (wi->render) {
- map->tfi = ZnGetTexFont(wi, map->text_font);
- }
#endif
map->map_info_name = NULL;
@@ -304,10 +301,10 @@ Clone(ZnItem item)
map->color = ZnGetGradientByValue(map->color);
map->text_font = Tk_GetFont(wi->interp, wi->win, Tk_NameOfFont(map->text_font));
#ifdef GL
- map->tfi = ZnGetTexFont(wi, map->text_font);
+ map->tfi = NULL;
#endif
if (map->fill_pattern != ZnUnspecifiedImage) {
- map->fill_pattern = ZnGetImageByValue(map->fill_pattern);
+ map->fill_pattern = ZnGetImageByValue(map->fill_pattern, NULL, NULL);
}
if (map->symbol_patterns) {
ZnImage *pats, *new_pats;
@@ -318,7 +315,7 @@ Clone(ZnItem item)
map->symbol_patterns = ZnListNew(num_pats, sizeof(ZnImage));
new_pats = ZnListArray(map->symbol_patterns);
for (i = 0; i < num_pats; i++) {
- new_pats[i] = ZnGetImageByValue(pats[i]);
+ new_pats[i] = ZnGetImageByValue(pats[i], NULL, NULL);
}
}
}
@@ -346,7 +343,7 @@ Destroy(ZnItem item)
}
#endif
if (map->fill_pattern != ZnUnspecifiedImage) {
- ZnFreeImage(map->fill_pattern);
+ ZnFreeImage(map->fill_pattern, NULL, NULL);
map->fill_pattern = ZnUnspecifiedImage;
}
if (map->symbol_patterns) {
@@ -357,7 +354,7 @@ Destroy(ZnItem item)
num_pats = ZnListSize(map->symbol_patterns);
for (i = 0; i < num_pats; i++) {
if (pats[i] != ZnUnspecifiedImage) {
- ZnFreeImage(pats[i]);
+ ZnFreeImage(pats[i], NULL, NULL);
}
}
ZnListFree(map->symbol_patterns);
@@ -390,7 +387,7 @@ Configure(ZnItem item,
Tk_Font old_font = map->text_font;
#endif
- if (ZnConfigureAttributes(wi, item, map_attrs, argc, argv, flags) == TCL_ERROR) {
+ if (ZnConfigureAttributes(wi, item, item, map_attrs, argc, argv, flags) == TCL_ERROR) {
return TCL_ERROR;
}
@@ -398,10 +395,7 @@ Configure(ZnItem item,
if (old_font != map->text_font) {
if (map->tfi) {
ZnFreeTexFont(map->tfi);
- }
- map->tfi = ZnGetTexFont(wi, map->text_font);
- if (!map->tfi) {
- return TCL_ERROR;
+ map->tfi = NULL;
}
}
#endif
@@ -1463,6 +1457,9 @@ Render(ZnItem item)
glDisable(GL_LINE_STIPPLE);
}
+ if (! map->tfi) {
+ map->tfi = ZnGetTexFont(wi, map->text_font);
+ }
if (ZnListSize(map->texts) && map->tfi) {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glEnable(GL_TEXTURE_2D);