From 9f1939cbd5aa8fb9ee98e5400780194c9bbb25cf Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 21 Jul 2010 03:16:47 +0200 Subject: [PATCH] API: Remove GtkTextTag's stipple properties They seem pretty much unused and the only reason why GtkTextView uses a GdkPangoRenderer and not a PangoCairoRenderer. --- docs/reference/gtk/tmpl/gtktexttag.sgml | 22 --- gtk/gtktextdisplay.c | 26 ---- gtk/gtktextlayout.c | 12 -- gtk/gtktexttag.c | 149 --------------------- gtk/gtktexttag.h | 4 - modules/other/gail/libgail-util/gailmisc.c | 32 ----- 6 files changed, 245 deletions(-) diff --git a/docs/reference/gtk/tmpl/gtktexttag.sgml b/docs/reference/gtk/tmpl/gtktexttag.sgml index 3126342702..c807da83e3 100644 --- a/docs/reference/gtk/tmpl/gtktexttag.sgml +++ b/docs/reference/gtk/tmpl/gtktexttag.sgml @@ -84,16 +84,6 @@ It is working (with minor issues) since 2.8. - - - - - - - - - - @@ -144,16 +134,6 @@ It is working (with minor issues) since 2.8. - - - - - - - - - - @@ -466,8 +446,6 @@ modified directly. @bg_color: @fg_color: -@bg_stipple: -@fg_stipple: @rise: @underline: @strikethrough: diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c index 0769150e32..b50e757984 100644 --- a/gtk/gtktextdisplay.c +++ b/gtk/gtktextdisplay.c @@ -184,7 +184,6 @@ gtk_text_renderer_prepare_run (PangoRenderer *renderer, GtkTextRenderer *text_renderer = GTK_TEXT_RENDERER (renderer); GdkPangoRenderer *gdk_renderer = GDK_PANGO_RENDERER (renderer); GdkColor *bg_color, *fg_color, *underline_color; - GdkPixmap *fg_stipple, *bg_stipple; GtkTextAppearance *appearance; PANGO_RENDERER_CLASS (_gtk_text_renderer_parent_class)->prepare_run (renderer, run); @@ -220,31 +219,6 @@ gtk_text_renderer_prepare_run (PangoRenderer *renderer, underline_color = fg_color; text_renderer_set_gdk_color (text_renderer, PANGO_RENDER_PART_UNDERLINE, underline_color); - - fg_stipple = appearance->fg_stipple; - if (fg_stipple && text_renderer->screen != gdk_drawable_get_screen (fg_stipple)) - { - g_warning ("gtk_text_renderer_prepare_run:\n" - "The foreground stipple bitmap has been created on the wrong screen.\n" - "Ignoring the stipple bitmap information."); - fg_stipple = NULL; - } - - gdk_pango_renderer_set_stipple (gdk_renderer, PANGO_RENDER_PART_FOREGROUND, fg_stipple); - gdk_pango_renderer_set_stipple (gdk_renderer, PANGO_RENDER_PART_STRIKETHROUGH, fg_stipple); - gdk_pango_renderer_set_stipple (gdk_renderer, PANGO_RENDER_PART_UNDERLINE, fg_stipple); - - bg_stipple = appearance->draw_bg ? appearance->bg_stipple : NULL; - - if (bg_stipple && text_renderer->screen != gdk_drawable_get_screen (bg_stipple)) - { - g_warning ("gtk_text_renderer_prepare_run:\n" - "The background stipple bitmap has been created on the wrong screen.\n" - "Ignoring the stipple bitmap information."); - bg_stipple = NULL; - } - - gdk_pango_renderer_set_stipple (gdk_renderer, PANGO_RENDER_PART_BACKGROUND, bg_stipple); } static void diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index cf40247b67..fba9de5780 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -1424,11 +1424,6 @@ gtk_text_attr_appearance_destroy (PangoAttribute *attr) { GtkTextAttrAppearance *appearance_attr = (GtkTextAttrAppearance *)attr; - if (appearance_attr->appearance.bg_stipple) - g_object_unref (appearance_attr->appearance.bg_stipple); - if (appearance_attr->appearance.fg_stipple) - g_object_unref (appearance_attr->appearance.fg_stipple); - g_slice_free (GtkTextAttrAppearance, appearance_attr); } @@ -1441,8 +1436,6 @@ gtk_text_attr_appearance_compare (const PangoAttribute *attr1, return (gdk_color_equal (&appearance1->fg_color, &appearance2->fg_color) && gdk_color_equal (&appearance1->bg_color, &appearance2->bg_color) && - appearance1->fg_stipple == appearance2->fg_stipple && - appearance1->bg_stipple == appearance2->bg_stipple && appearance1->underline == appearance2->underline && appearance1->strikethrough == appearance2->strikethrough && appearance1->draw_bg == appearance2->draw_bg); @@ -1479,11 +1472,6 @@ gtk_text_attr_appearance_new (const GtkTextAppearance *appearance) result->appearance = *appearance; - if (appearance->bg_stipple) - g_object_ref (appearance->bg_stipple); - if (appearance->fg_stipple) - g_object_ref (appearance->fg_stipple); - return (PangoAttribute *)result; } diff --git a/gtk/gtktexttag.c b/gtk/gtktexttag.c index 500418c870..9131e4179c 100644 --- a/gtk/gtktexttag.c +++ b/gtk/gtktexttag.c @@ -74,8 +74,6 @@ enum { PROP_FOREGROUND, PROP_BACKGROUND_GDK, PROP_FOREGROUND_GDK, - PROP_BACKGROUND_STIPPLE, - PROP_FOREGROUND_STIPPLE, PROP_FONT, PROP_FONT_DESC, PROP_FAMILY, @@ -112,8 +110,6 @@ enum { /* Whether-a-style-arg-is-set args */ PROP_BACKGROUND_SET, PROP_FOREGROUND_SET, - PROP_BACKGROUND_STIPPLE_SET, - PROP_FOREGROUND_STIPPLE_SET, PROP_FAMILY_SET, PROP_STYLE_SET, PROP_VARIANT_SET, @@ -199,17 +195,7 @@ gtk_text_tag_class_init (GtkTextTagClass *klass) P_("Whether the background color fills the entire line height or only the height of the tagged characters"), FALSE, GTK_PARAM_READWRITE)); - - g_object_class_install_property (object_class, - PROP_BACKGROUND_STIPPLE, - g_param_spec_object ("background-stipple", - P_("Background stipple mask"), - P_("Bitmap to use as a mask when drawing the text background"), - GDK_TYPE_PIXMAP, - GTK_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_FOREGROUND, g_param_spec_string ("foreground", @@ -226,15 +212,6 @@ gtk_text_tag_class_init (GtkTextTagClass *klass) GDK_TYPE_COLOR, GTK_PARAM_READWRITE)); - - g_object_class_install_property (object_class, - PROP_FOREGROUND_STIPPLE, - g_param_spec_object ("foreground-stipple", - P_("Foreground stipple mask"), - P_("Bitmap to use as a mask when drawing the text foreground"), - GDK_TYPE_PIXMAP, - GTK_PARAM_READWRITE)); - g_object_class_install_property (object_class, PROP_DIRECTION, g_param_spec_enum ("direction", @@ -567,18 +544,10 @@ gtk_text_tag_class_init (GtkTextTagClass *klass) P_("Background full height set"), P_("Whether this tag affects background height")); - ADD_SET_PROP ("background-stipple-set", PROP_BACKGROUND_STIPPLE_SET, - P_("Background stipple set"), - P_("Whether this tag affects the background stipple")); - ADD_SET_PROP ("foreground-set", PROP_FOREGROUND_SET, P_("Foreground set"), P_("Whether this tag affects the foreground color")); - ADD_SET_PROP ("foreground-stipple-set", PROP_FOREGROUND_STIPPLE_SET, - P_("Foreground stipple set"), - P_("Whether this tag affects the foreground stipple")); - ADD_SET_PROP ("editable-set", PROP_EDITABLE_SET, P_("Editability set"), P_("Whether this tag affects text editability")); @@ -1043,46 +1012,6 @@ gtk_text_tag_set_property (GObject *object, } break; - case PROP_BACKGROUND_STIPPLE: - { - GdkBitmap *bitmap = g_value_get_object (value); - - text_tag->bg_stipple_set = TRUE; - g_object_notify (object, "background-stipple-set"); - - if (text_tag->values->appearance.bg_stipple != bitmap) - { - if (bitmap != NULL) - g_object_ref (bitmap); - - if (text_tag->values->appearance.bg_stipple) - g_object_unref (text_tag->values->appearance.bg_stipple); - - text_tag->values->appearance.bg_stipple = bitmap; - } - } - break; - - case PROP_FOREGROUND_STIPPLE: - { - GdkBitmap *bitmap = g_value_get_object (value); - - text_tag->fg_stipple_set = TRUE; - g_object_notify (object, "foreground-stipple-set"); - - if (text_tag->values->appearance.fg_stipple != bitmap) - { - if (bitmap != NULL) - g_object_ref (bitmap); - - if (text_tag->values->appearance.fg_stipple) - g_object_unref (text_tag->values->appearance.fg_stipple); - - text_tag->values->appearance.fg_stipple = bitmap; - } - } - break; - case PROP_FONT: { PangoFontDescription *font_desc = NULL; @@ -1333,26 +1262,6 @@ gtk_text_tag_set_property (GObject *object, text_tag->fg_color_set = g_value_get_boolean (value); break; - case PROP_BACKGROUND_STIPPLE_SET: - text_tag->bg_stipple_set = g_value_get_boolean (value); - if (!text_tag->bg_stipple_set && - text_tag->values->appearance.bg_stipple) - { - g_object_unref (text_tag->values->appearance.bg_stipple); - text_tag->values->appearance.bg_stipple = NULL; - } - break; - - case PROP_FOREGROUND_STIPPLE_SET: - text_tag->fg_stipple_set = g_value_get_boolean (value); - if (!text_tag->fg_stipple_set && - text_tag->values->appearance.fg_stipple) - { - g_object_unref (text_tag->values->appearance.fg_stipple); - text_tag->values->appearance.fg_stipple = NULL; - } - break; - case PROP_FAMILY_SET: case PROP_STYLE_SET: case PROP_VARIANT_SET: @@ -1506,16 +1415,6 @@ gtk_text_tag_get_property (GObject *object, g_value_set_boxed (value, &tag->values->appearance.fg_color); break; - case PROP_BACKGROUND_STIPPLE: - if (tag->bg_stipple_set) - g_value_set_object (value, tag->values->appearance.bg_stipple); - break; - - case PROP_FOREGROUND_STIPPLE: - if (tag->fg_stipple_set) - g_value_set_object (value, tag->values->appearance.fg_stipple); - break; - case PROP_FONT: { gchar *str; @@ -1661,14 +1560,6 @@ gtk_text_tag_get_property (GObject *object, g_value_set_boolean (value, tag->fg_color_set); break; - case PROP_BACKGROUND_STIPPLE_SET: - g_value_set_boolean (value, tag->bg_stipple_set); - break; - - case PROP_FOREGROUND_STIPPLE_SET: - g_value_set_boolean (value, tag->fg_stipple_set); - break; - case PROP_FAMILY_SET: case PROP_STYLE_SET: case PROP_VARIANT_SET: @@ -2028,22 +1919,8 @@ gtk_text_attributes_copy_values (GtkTextAttributes *src, if (src == dest) return; - /* Add refs */ - - if (src->appearance.bg_stipple) - g_object_ref (src->appearance.bg_stipple); - - if (src->appearance.fg_stipple) - g_object_ref (src->appearance.fg_stipple); - /* Remove refs */ - if (dest->appearance.bg_stipple) - g_object_unref (dest->appearance.bg_stipple); - - if (dest->appearance.fg_stipple) - g_object_unref (dest->appearance.fg_stipple); - if (dest->font) pango_font_description_free (dest->font); @@ -2104,12 +1981,6 @@ gtk_text_attributes_unref (GtkTextAttributes *values) { g_assert (!values->realized); - if (values->appearance.bg_stipple) - g_object_unref (values->appearance.bg_stipple); - - if (values->appearance.fg_stipple) - g_object_unref (values->appearance.fg_stipple); - if (values->tabs) pango_tab_array_free (values->tabs); @@ -2213,24 +2084,6 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest, dest->pg_bg_color = gdk_color_copy (vals->pg_bg_color); } - if (tag->bg_stipple_set) - { - g_object_ref (vals->appearance.bg_stipple); - if (dest->appearance.bg_stipple) - g_object_unref (dest->appearance.bg_stipple); - dest->appearance.bg_stipple = vals->appearance.bg_stipple; - - dest->appearance.draw_bg = TRUE; - } - - if (tag->fg_stipple_set) - { - g_object_ref (vals->appearance.fg_stipple); - if (dest->appearance.fg_stipple) - g_object_unref (dest->appearance.fg_stipple); - dest->appearance.fg_stipple = vals->appearance.fg_stipple; - } - if (vals->font) { if (dest->font) @@ -2344,9 +2197,7 @@ _gtk_text_tag_affects_nonsize_appearance (GtkTextTag *tag) return tag->bg_color_set || - tag->bg_stipple_set || tag->fg_color_set || - tag->fg_stipple_set || tag->strikethrough_set || tag->bg_full_height_set || tag->pg_bg_color_set; diff --git a/gtk/gtktexttag.h b/gtk/gtktexttag.h index 39c9f73d92..fd74270138 100644 --- a/gtk/gtktexttag.h +++ b/gtk/gtktexttag.h @@ -109,10 +109,8 @@ struct _GtkTextTag * this tag does not affect it. */ guint GSEAL (bg_color_set) : 1; - guint GSEAL (bg_stipple_set) : 1; guint GSEAL (fg_color_set) : 1; guint GSEAL (scale_set) : 1; - guint GSEAL (fg_stipple_set) : 1; guint GSEAL (justification_set) : 1; guint GSEAL (left_margin_set) : 1; guint GSEAL (indent_set) : 1; @@ -174,8 +172,6 @@ struct _GtkTextAppearance /*< public >*/ GdkColor bg_color; GdkColor fg_color; - GdkBitmap *bg_stipple; - GdkBitmap *fg_stipple; /* super/subscript rise, can be negative */ gint rise; diff --git a/modules/other/gail/libgail-util/gailmisc.c b/modules/other/gail/libgail-util/gailmisc.c index 349478ed28..57320d2c1b 100644 --- a/modules/other/gail/libgail-util/gailmisc.c +++ b/modules/other/gail/libgail-util/gailmisc.c @@ -640,12 +640,6 @@ gail_misc_add_to_attr_set (AtkAttributeSet *attrib_set, attrs->appearance.fg_color.green, attrs->appearance.fg_color.blue); break; - case ATK_TEXT_ATTR_BG_STIPPLE: - value = g_strdup (atk_text_attribute_get_value (attr, attrs->appearance.bg_stipple ? 1 : 0)); - break; - case ATK_TEXT_ATTR_FG_STIPPLE: - value = g_strdup (atk_text_attribute_get_value (attr, attrs->appearance.fg_stipple ? 1 : 0)); - break; case ATK_TEXT_ATTR_WRAP_MODE: value = g_strdup (atk_text_attribute_get_value (attr, attrs->wrap_mode)); break; @@ -814,32 +808,6 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, } val_set = FALSE; - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - val_set = tag->fg_stipple_set; - if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_FG_STIPPLE); - temp_tags = temp_tags->next; - } - val_set = FALSE; - - temp_tags = tags; - while (temp_tags && !val_set) - { - GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - val_set = tag->bg_stipple_set; - if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_BG_STIPPLE); - temp_tags = temp_tags->next; - } - val_set = FALSE; - temp_tags = tags; while (temp_tags && !val_set) {