diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/Item.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/generic/Item.c b/generic/Item.c index 54a0d42..7210729 100644 --- a/generic/Item.c +++ b/generic/Item.c @@ -127,7 +127,7 @@ ZnAttrConfig field_attrs[] = { { ZN_CONFIG_BOOL, "-sensitive", NULL, Tk_Offset(FieldStruct, flags), FIELD_SENSITIVE_BIT, ZN_REPICK_FLAG, False }, { ZN_CONFIG_TEXT, "-text", NULL, - Tk_Offset(FieldStruct, text), 0, ZN_COORDS_FLAG, False }, + Tk_Offset(FieldStruct, text), 0, ZN_COORDS_FLAG|ZN_CLFC_FLAG, False }, { ZN_CONFIG_IMAGE, "-tile", NULL, Tk_Offset(FieldStruct, tile_name), 0, ZN_COORDS_FLAG|ZN_TILE_FLAG|ZN_CLFC_FLAG, False }, @@ -2113,12 +2113,9 @@ ComputeFieldTextLocation(Field field_ptr, ZnPoint *pos, ZnBBox *text_bbox) { - ZnBool relief_thickness; ZnDim w, h; Tk_FontMetrics fm; - relief_thickness = (field_ptr->relief != RELIEF_FLAT && - field_ptr->relief_thickness > 1) ? field_ptr->relief_thickness : 0; Tk_GetFontMetrics(field_ptr->font, &fm); w = ZnTextWidth(field_ptr->font, field_ptr->text, strlen(field_ptr->text)); h = fm.ascent + fm.descent; @@ -2128,10 +2125,10 @@ ComputeFieldTextLocation(Field field_ptr, switch (field_ptr->alignment) { case ZnJustifyLeft: - text_bbox->orig.x = bbox->orig.x + 1 + relief_thickness; + text_bbox->orig.x = bbox->orig.x; break; case ZnJustifyRight: - text_bbox->orig.x = bbox->corner.x - w - 1 - relief_thickness; + text_bbox->orig.x = bbox->corner.x - w - 1; break; default: text_bbox->orig.x = (bbox->orig.x + bbox->corner.x - w) / 2; @@ -2817,7 +2814,8 @@ CreateItem(WidgetInfo *wi, Item item; item = (Item) ZnMalloc(item_class->item_size); - + wi->num_items++; + /* Initialize common state */ item->class = item_class; item->wi = wi; @@ -3384,6 +3382,7 @@ DestroyItem(Item item) * Free the item own memory */ ZnFree(item); + wi->num_items--; } @@ -3439,7 +3438,7 @@ FieldTileChange(ClientData client_data, if (field->tile != ZnUnspecifiedImage) { i = (((char *) field) - ((char *) field->field_set->fields)) / sizeof(FieldStruct); - InvalidateImage(field->tile); + InvalidateImage(field->tile_name); GetFieldBBox(field->field_set, i, &bbox); Damage(field->field_set->wi, &bbox); ZnNeedRedisplay(field->field_set->wi); @@ -3735,20 +3734,20 @@ FreeFields(FieldSet field_set) if (field->gradient) { ZnFreeColorGradient(field->gradient); } - if (strlen(field->image_name) != 0) { - ZnFree(field->image_name); - } if (field->image != ZnUnspecifiedImage) { Tk_FreeImage(field->image); field->image = ZnUnspecifiedImage; } - if (strlen(field->tile_name) != 0) { - ZnFree(field->tile_name); + if (strlen(field->image_name) != 0) { + ZnFree(field->image_name); } if (field->tile != ZnUnspecifiedImage) { Tk_FreeImage(field->tile); field->tile = ZnUnspecifiedImage; } + if (strlen(field->tile_name) != 0) { + ZnFree(field->tile_name); + } if (field->fill_pattern != ZnUnspecifiedPattern) { Tk_FreeBitmap(wi->dpy, field->fill_pattern); field->fill_pattern = ZnUnspecifiedPattern; @@ -3779,21 +3778,18 @@ ComputeFieldImageLocation(Field field_ptr, ZnBBox *bbox, ZnBBox *pm_bbox) { - ZnBool relief_thickness; int width, height; Tk_SizeOfImage(field_ptr->image, &width, &height); pm_bbox->orig.y = (bbox->orig.y + bbox->corner.y - height) / 2; pm_bbox->corner.y = pm_bbox->orig.y + height; - relief_thickness = (field_ptr->relief != RELIEF_FLAT && - field_ptr->relief_thickness > 1) ? field_ptr->relief_thickness : 0; switch (field_ptr->alignment) { case ZnJustifyLeft: - pm_bbox->orig.x = bbox->orig.x + 1 + relief_thickness; + pm_bbox->orig.x = bbox->orig.x; break; case ZnJustifyRight: - pm_bbox->orig.x = bbox->corner.x - width - 1 - relief_thickness; + pm_bbox->orig.x = bbox->corner.x - width - 1; break; default: pm_bbox->orig.x = (bbox->orig.x + bbox->corner.x - width) / 2; @@ -3923,7 +3919,8 @@ DrawFields(FieldSet field_set) values.foreground = ZnPixel(field_ptr->back_color); if (field_ptr->tile != ZnUnspecifiedImage) { /* Fill tiled */ - Pixmap pmap = GetImagePixmap(wi->win, field_ptr->tile); + Pixmap pmap = GetImagePixmap(wi->win, field_ptr->tile_name, + field_ptr->tile, NULL); values.fill_style = FillTiled; values.tile = pmap; values.ts_x_origin = (int) bbox.orig.x; @@ -4278,7 +4275,7 @@ Repair(WidgetInfo *wi) } else { values.fill_style = FillTiled; - values.tile = GetImagePixmap(wi->win, wi->tile); + values.tile = GetImagePixmap(wi->win, wi->tile_name, wi->tile, NULL); values.ts_x_origin = values.ts_y_origin = 0; XChangeGC(wi->dpy, wi->gc, GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin, |