diff options
Diffstat (limited to 'generic/Field.c')
-rw-r--r-- | generic/Field.c | 35 |
1 files changed, 13 insertions, 22 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); |