gtktexttag: Move public members to private header

And fix gail to not poke at GtkTextTag internals
This commit is contained in:
Javier Jardón 2010-12-23 20:03:06 +01:00 committed by Matthias Clasen
parent 6a11c59290
commit 55016f72f2
9 changed files with 634 additions and 512 deletions

View File

@ -59,6 +59,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "gtktexttag.h"
#include "gtktexttagprivate.h"
#include "gtktexttagtable.h"
#include "gtktextlayout.h"
#include "gtktextiterprivate.h"
@ -1778,7 +1779,7 @@ _gtk_text_btree_tag (const GtkTextIter *start_orig,
g_return_if_fail (GTK_IS_TEXT_TAG (tag));
g_return_if_fail (_gtk_text_iter_get_btree (start_orig) ==
_gtk_text_iter_get_btree (end_orig));
g_return_if_fail (tag->table == _gtk_text_iter_get_btree (start_orig)->table);
g_return_if_fail (tag->priv->table == _gtk_text_iter_get_btree (start_orig)->table);
#if 0
printf ("%s tag %s from %d to %d\n",
@ -2505,10 +2506,10 @@ _gtk_text_btree_char_is_invisible (const GtkTextIter *iter)
|| (seg->type == &gtk_text_toggle_off_type))
{
tag = seg->body.toggle.info->tag;
if (tag->invisible_set)
if (tag->priv->invisible_set)
{
tags[tag->priority] = tag;
tagCnts[tag->priority]++;
tags[tag->priv->priority] = tag;
tagCnts[tag->priv->priority]++;
}
}
}
@ -2529,10 +2530,10 @@ _gtk_text_btree_char_is_invisible (const GtkTextIter *iter)
|| (seg->type == &gtk_text_toggle_off_type))
{
tag = seg->body.toggle.info->tag;
if (tag->invisible_set)
if (tag->priv->invisible_set)
{
tags[tag->priority] = tag;
tagCnts[tag->priority]++;
tags[tag->priv->priority] = tag;
tagCnts[tag->priv->priority]++;
}
}
}
@ -2558,10 +2559,10 @@ _gtk_text_btree_char_is_invisible (const GtkTextIter *iter)
if (summary->toggle_count & 1)
{
tag = summary->info->tag;
if (tag->invisible_set)
if (tag->priv->invisible_set)
{
tags[tag->priority] = tag;
tagCnts[tag->priority] += summary->toggle_count;
tags[tag->priv->priority] = tag;
tagCnts[tag->priv->priority] += summary->toggle_count;
}
}
}
@ -2588,7 +2589,7 @@ _gtk_text_btree_char_is_invisible (const GtkTextIter *iter)
}
#endif
#endif
invisible = tags[i]->values->invisible;
invisible = tags[i]->priv->values->invisible;
break;
}
}
@ -6798,7 +6799,7 @@ gtk_text_btree_node_check_consistency (GtkTextBTree *tree,
break;
}
g_error ("gtk_text_btree_node_check_consistency: GtkTextBTreeNode tag \"%s\" not %s",
summary->info->tag->name,
summary->info->tag->priv->name,
"present in parent summaries");
}
if (summary->info == summary2->info)
@ -6834,7 +6835,7 @@ gtk_text_btree_node_check_consistency (GtkTextBTree *tree,
if (summary->info->toggle_count == summary->toggle_count)
{
g_error ("gtk_text_btree_node_check_consistency: found unpruned root for \"%s\"",
summary->info->tag->name);
summary->info->tag->priv->name);
}
toggle_count = 0;
if (node->level == 0)
@ -6888,7 +6889,7 @@ gtk_text_btree_node_check_consistency (GtkTextBTree *tree,
if (summary2->info == summary->info)
{
g_error ("gtk_text_btree_node_check_consistency: duplicated GtkTextBTreeNode tag: %s",
summary->info->tag->name);
summary->info->tag->priv->name);
}
}
}
@ -6940,19 +6941,19 @@ _gtk_text_btree_check (GtkTextBTree *tree)
if (info->toggle_count != 0)
{
g_error ("_gtk_text_btree_check found \"%s\" with toggles (%d) but no root",
tag->name, info->toggle_count);
tag->priv->name, info->toggle_count);
}
continue; /* no ranges for the tag */
}
else if (info->toggle_count == 0)
{
g_error ("_gtk_text_btree_check found root for \"%s\" with no toggles",
tag->name);
tag->priv->name);
}
else if (info->toggle_count & 1)
{
g_error ("_gtk_text_btree_check found odd toggle count for \"%s\" (%d)",
tag->name, info->toggle_count);
tag->priv->name, info->toggle_count);
}
for (summary = node->summary; summary != NULL;
summary = summary->next)
@ -7007,7 +7008,7 @@ _gtk_text_btree_check (GtkTextBTree *tree)
if (count != info->toggle_count)
{
g_error ("_gtk_text_btree_check toggle_count (%d) wrong for \"%s\" should be (%d)",
info->toggle_count, tag->name, count);
info->toggle_count, tag->priv->name, count);
}
}
}
@ -7116,7 +7117,7 @@ _gtk_text_btree_spew (GtkTextBTree *tree)
info = list->data;
printf (" tag `%s': root at %p, toggle count %d\n",
info->tag->name, info->tag_root, info->toggle_count);
info->tag->priv->name, info->tag_root, info->toggle_count);
list = g_slist_next (list);
}
@ -7182,7 +7183,7 @@ _gtk_text_btree_spew_line_short (GtkTextLine *line, int indent)
seg->type == &gtk_text_toggle_off_type)
{
printf ("%s tag `%s' %s\n",
spaces, seg->body.toggle.info->tag->name,
spaces, seg->body.toggle.info->tag->priv->name,
seg->type == &gtk_text_toggle_off_type ? "off" : "on");
}
@ -7209,7 +7210,7 @@ _gtk_text_btree_spew_node (GtkTextBTreeNode *node, int indent)
while (s)
{
printf ("%s %d toggles of `%s' below this node\n",
spaces, s->toggle_count, s->info->tag->name);
spaces, s->toggle_count, s->info->tag->priv->name);
s = s->next;
}
@ -7284,7 +7285,7 @@ _gtk_text_btree_spew_segment (GtkTextBTree* tree, GtkTextLineSegment * seg)
seg->type == &gtk_text_toggle_off_type)
{
printf (" tag `%s' priority %d\n",
seg->body.toggle.info->tag->name,
seg->body.toggle.info->tag->priority);
seg->body.toggle.info->tag->priv->name,
seg->body.toggle.info->tag->priv->priority);
}
}

View File

@ -38,6 +38,7 @@
#include "gtktextbufferrichtext.h"
#include "gtktextbtree.h"
#include "gtktextiterprivate.h"
#include "gtktexttagprivate.h"
#include "gtkprivate.h"
#include "gtkintl.h"
@ -2504,7 +2505,7 @@ gtk_text_buffer_real_apply_tag (GtkTextBuffer *buffer,
const GtkTextIter *start,
const GtkTextIter *end)
{
if (tag->table != buffer->priv->tag_table)
if (tag->priv->table != buffer->priv->tag_table)
{
g_warning ("Can only apply tags that are in the tag table for the buffer");
return;
@ -2519,7 +2520,7 @@ gtk_text_buffer_real_remove_tag (GtkTextBuffer *buffer,
const GtkTextIter *start,
const GtkTextIter *end)
{
if (tag->table != buffer->priv->tag_table)
if (tag->priv->table != buffer->priv->tag_table)
{
g_warning ("Can only remove tags that are in the tag table for the buffer");
return;
@ -2611,7 +2612,7 @@ gtk_text_buffer_apply_tag (GtkTextBuffer *buffer,
g_return_if_fail (end != NULL);
g_return_if_fail (gtk_text_iter_get_buffer (start) == buffer);
g_return_if_fail (gtk_text_iter_get_buffer (end) == buffer);
g_return_if_fail (tag->table == buffer->priv->tag_table);
g_return_if_fail (tag->priv->table == buffer->priv->tag_table);
gtk_text_buffer_emit_tag (buffer, tag, TRUE, start, end);
}
@ -2640,7 +2641,7 @@ gtk_text_buffer_remove_tag (GtkTextBuffer *buffer,
g_return_if_fail (end != NULL);
g_return_if_fail (gtk_text_iter_get_buffer (start) == buffer);
g_return_if_fail (gtk_text_iter_get_buffer (end) == buffer);
g_return_if_fail (tag->table == buffer->priv->tag_table);
g_return_if_fail (tag->priv->table == buffer->priv->tag_table);
gtk_text_buffer_emit_tag (buffer, tag, FALSE, start, end);
}

View File

@ -32,6 +32,7 @@
#include "gdk-pixbuf/gdk-pixdata.h"
#include "gtktextbufferserialize.h"
#include "gtktexttagprivate.h"
#include "gtkintl.h"
@ -292,9 +293,9 @@ serialize_tag (gpointer key,
g_string_append (context->tag_table_str, " <tag ");
/* Handle anonymous tags */
if (tag->name)
if (tag->priv->name)
{
tag_name = g_markup_escape_text (tag->name, -1);
tag_name = g_markup_escape_text (tag->priv->name, -1);
g_string_append_printf (context->tag_table_str, "name=\"%s\"", tag_name);
g_free (tag_name);
}
@ -305,7 +306,7 @@ serialize_tag (gpointer key,
g_string_append_printf (context->tag_table_str, "id=\"%d\"", tag_id);
}
g_string_append_printf (context->tag_table_str, " priority=\"%d\">\n", tag->priority);
g_string_append_printf (context->tag_table_str, " priority=\"%d\">\n", tag->priv->priority);
/* Serialize properties */
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (tag), &n_pspecs);
@ -489,9 +490,9 @@ serialize_text (GtkTextBuffer *buffer,
/* Add it to the tag hash table */
g_hash_table_insert (context->tags, tag, tag);
if (tag->name)
if (tag->priv->name)
{
tag_name = g_markup_escape_text (tag->name, -1);
tag_name = g_markup_escape_text (tag->priv->name, -1);
g_string_append_printf (context->text_str, "<apply_tag name=\"%s\">", tag_name);
g_free (tag_name);
@ -1481,10 +1482,10 @@ end_element_handler (GMarkupParseContext *context,
pop_state (info);
g_assert (peek_state (info) == STATE_TAGS);
if (info->current_tag->name)
if (info->current_tag->priv->name)
{
/* Add tag to defined tags hash */
tmp = g_strdup (info->current_tag->name);
tmp = g_strdup (info->current_tag->priv->name);
g_hash_table_insert (info->defined_tags,
tmp, tmp);
}

View File

@ -1283,8 +1283,8 @@ totally_invisible_line (GtkTextLayout *layout,
invalidate_cached_style (layout);
/* Bail out if an elision-unsetting tag begins */
if (seg->body.toggle.info->tag->invisible_set &&
!seg->body.toggle.info->tag->values->invisible)
if (seg->body.toggle.info->tag->priv->invisible_set &&
!seg->body.toggle.info->tag->priv->values->invisible)
break;
}
else if (seg->type == &gtk_text_toggle_off_type)
@ -1292,8 +1292,8 @@ totally_invisible_line (GtkTextLayout *layout,
invalidate_cached_style (layout);
/* Bail out if an elision-setting tag ends */
if (seg->body.toggle.info->tag->invisible_set &&
seg->body.toggle.info->tag->values->invisible)
if (seg->body.toggle.info->tag->priv->invisible_set &&
seg->body.toggle.info->tag->priv->values->invisible)
break;
}
@ -2103,7 +2103,7 @@ tags_array_toggle_tag (GPtrArray *array,
tags = (GtkTextTag**) array->pdata;
for (pos = 0; pos < array->len && tags[pos]->priority < tag->priority; pos++) ;
for (pos = 0; pos < array->len && tags[pos]->priv->priority < tag->priv->priority; pos++) ;
if (pos < array->len && tags[pos] == tag)
g_ptr_array_remove_index (array, pos);

File diff suppressed because it is too large Load Diff

View File

@ -75,61 +75,15 @@ typedef struct _GtkTextAttributes GtkTextAttributes;
#define GTK_TYPE_TEXT_ATTRIBUTES (gtk_text_attributes_get_type ())
typedef struct _GtkTextTag GtkTextTag;
typedef struct _GtkTextTagClass GtkTextTagClass;
typedef struct _GtkTextTag GtkTextTag;
typedef struct _GtkTextTagPrivate GtkTextTagPrivate;
typedef struct _GtkTextTagClass GtkTextTagClass;
struct _GtkTextTag
{
GObject parent_instance;
GtkTextTagTable *GSEAL (table);
char *GSEAL (name); /* Name of this tag. This field is actually
* a pointer to the key from the entry in
* tkxt->tagTable, so it needn't be freed
* explicitly. */
int GSEAL (priority); /* Priority of this tag within widget. 0
* means lowest priority. Exactly one tag
* has each integer value between 0 and
* numTags-1. */
/*
* Information for displaying text with this tag. The information
* belows acts as an override on information specified by lower-priority
* tags. If no value is specified, then the next-lower-priority tag
* on the text determins the value. The text widget itself provides
* defaults if no tag specifies an override.
*/
GtkTextAttributes *GSEAL (values);
/* Flags for whether a given value is set; if a value is unset, then
* this tag does not affect it.
*/
guint GSEAL (bg_color_set) : 1;
guint GSEAL (fg_color_set) : 1;
guint GSEAL (scale_set) : 1;
guint GSEAL (justification_set) : 1;
guint GSEAL (left_margin_set) : 1;
guint GSEAL (indent_set) : 1;
guint GSEAL (rise_set) : 1;
guint GSEAL (strikethrough_set) : 1;
guint GSEAL (right_margin_set) : 1;
guint GSEAL (pixels_above_lines_set) : 1;
guint GSEAL (pixels_below_lines_set) : 1;
guint GSEAL (pixels_inside_wrap_set) : 1;
guint GSEAL (tabs_set) : 1;
guint GSEAL (underline_set) : 1;
guint GSEAL (wrap_mode_set) : 1;
guint GSEAL (bg_full_height_set) : 1;
guint GSEAL (invisible_set) : 1;
guint GSEAL (editable_set) : 1;
guint GSEAL (language_set) : 1;
guint GSEAL (pg_bg_color_set) : 1;
/* Whether these margins accumulate or override */
guint GSEAL (accumulative_margin) : 1;
guint GSEAL (pad1) : 1;
GtkTextTagPrivate *priv;
};
struct _GtkTextTagClass

View File

@ -31,6 +31,60 @@
typedef struct _GtkTextBTreeNode GtkTextBTreeNode;
struct _GtkTextTagPrivate
{
GtkTextTagTable *table;
char *name; /* Name of this tag. This field is actually
* a pointer to the key from the entry in
* tkxt->tagTable, so it needn't be freed
* explicitly. */
int priority; /* Priority of this tag within widget. 0
* means lowest priority. Exactly one tag
* has each integer value between 0 and
* numTags-1. */
/*
* Information for displaying text with this tag. The information
* belows acts as an override on information specified by lower-priority
* tags. If no value is specified, then the next-lower-priority tag
* on the text determins the value. The text widget itself provides
* defaults if no tag specifies an override.
*/
GtkTextAttributes *values;
/* Flags for whether a given value is set; if a value is unset, then
* this tag does not affect it.
*/
guint bg_color_set : 1;
guint fg_color_set : 1;
guint scale_set : 1;
guint justification_set : 1;
guint left_margin_set : 1;
guint indent_set : 1;
guint rise_set : 1;
guint strikethrough_set : 1;
guint right_margin_set : 1;
guint pixels_above_lines_set : 1;
guint pixels_below_lines_set : 1;
guint pixels_inside_wrap_set : 1;
guint tabs_set : 1;
guint underline_set : 1;
guint wrap_mode_set : 1;
guint bg_full_height_set : 1;
guint invisible_set : 1;
guint editable_set : 1;
guint language_set : 1;
guint pg_bg_color_set : 1;
/* Whether these margins accumulate or override */
guint accumulative_margin : 1;
guint pad1 : 1;
};
/* values should already have desired defaults; this function will override
* the defaults with settings in the given tags, which should be sorted in
* ascending order of priority

View File

@ -25,7 +25,10 @@
*/
#include "config.h"
#include "gtktexttagtable.h"
#include "gtktexttagprivate.h"
#include "gtkmarshalers.h"
#include "gtktextbuffer.h" /* just for the lame notify_will_remove_tag hack */
#include "gtkintl.h"
@ -176,7 +179,7 @@ gtk_text_tag_table_new (void)
static void
foreach_unref (GtkTextTag *tag, gpointer data)
{
GtkTextTagTable *table = GTK_TEXT_TAG_TABLE (tag->table);
GtkTextTagTable *table = GTK_TEXT_TAG_TABLE (tag->priv->table);
GtkTextTagTablePrivate *priv = table->priv;
GSList *tmp;
@ -193,7 +196,7 @@ foreach_unref (GtkTextTag *tag, gpointer data)
tmp = tmp->next;
}
tag->table = NULL;
tag->priv->table = NULL;
g_object_unref (tag);
}
@ -263,35 +266,35 @@ gtk_text_tag_table_add (GtkTextTagTable *table,
g_return_if_fail (GTK_IS_TEXT_TAG_TABLE (table));
g_return_if_fail (GTK_IS_TEXT_TAG (tag));
g_return_if_fail (tag->table == NULL);
g_return_if_fail (tag->priv->table == NULL);
priv = table->priv;
if (tag->name && g_hash_table_lookup (priv->hash, tag->name))
if (tag->priv->name && g_hash_table_lookup (priv->hash, tag->priv->name))
{
g_warning ("A tag named '%s' is already in the tag table.",
tag->name);
tag->priv->name);
return;
}
g_object_ref (tag);
if (tag->name)
g_hash_table_insert (priv->hash, tag->name, tag);
if (tag->priv->name)
g_hash_table_insert (priv->hash, tag->priv->name, tag);
else
{
priv->anonymous = g_slist_prepend (priv->anonymous, tag);
priv->anon_count += 1;
}
tag->table = table;
tag->priv->table = table;
/* We get the highest tag priority, as the most-recently-added
tag. Note that we do NOT use gtk_text_tag_set_priority,
as it assumes the tag is already in the table. */
size = gtk_text_tag_table_get_size (table);
g_assert (size > 0);
tag->priority = size - 1;
tag->priv->priority = size - 1;
g_signal_emit (table, signals[TAG_ADDED], 0, tag);
}
@ -337,7 +340,7 @@ gtk_text_tag_table_remove (GtkTextTagTable *table,
g_return_if_fail (GTK_IS_TEXT_TAG_TABLE (table));
g_return_if_fail (GTK_IS_TEXT_TAG (tag));
g_return_if_fail (tag->table == table);
g_return_if_fail (tag->priv->table == table);
priv = table->priv;
@ -358,10 +361,10 @@ gtk_text_tag_table_remove (GtkTextTagTable *table,
priorities of the tags in the table. */
gtk_text_tag_set_priority (tag, gtk_text_tag_table_get_size (table) - 1);
tag->table = NULL;
tag->priv->table = NULL;
if (tag->name)
g_hash_table_remove (priv->hash, tag->name);
if (tag->priv->name)
g_hash_table_remove (priv->hash, tag->priv->name);
else
{
priv->anonymous = g_slist_remove (priv->anonymous, tag);

View File

@ -697,7 +697,6 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
GSList *tags, *temp_tags;
gdouble scale = 1;
gboolean val_set = FALSE;
PangoFontMask mask;
gtk_text_buffer_get_iter_at_offset (buffer, &iter, offset);
@ -716,71 +715,17 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
PangoFontDescription *font;
font = tag->values->font;
if (font)
{
mask = pango_font_description_get_set_fields (font);
val_set = mask & PANGO_FONT_MASK_STYLE;
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_STYLE);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
PangoFontDescription *font;
font = tag->values->font;
if (font)
{
mask = pango_font_description_get_set_fields (font);
val_set = mask & PANGO_FONT_MASK_VARIANT;
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_VARIANT);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
PangoFontDescription *font;
font = tag->values->font;
if (font)
{
mask = pango_font_description_get_set_fields (font);
val_set = mask & PANGO_FONT_MASK_STRETCH;
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_STRETCH);
}
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->justification_set;
g_object_get (tag, "style-set", &val_set, NULL);
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_JUSTIFICATION);
{
PangoStyle style;
gchar *value;
g_object_get (tag, "style", &style, NULL);
value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_STYLE, style));
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_STYLE, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
@ -790,11 +735,72 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
if (tag->values->direction != GTK_TEXT_DIR_NONE)
g_object_get (tag, "variant-set", &val_set, NULL);
if (val_set)
{
PangoVariant variant;
gchar *value;
g_object_get (tag, "variant", &variant, NULL);
value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_VARIANT, variant));
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_VARIANT, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
g_object_get (tag, "stretch-set", &val_set, NULL);
if (val_set)
{
PangoStretch stretch;
gchar *value;
g_object_get (tag, "stretch", &stretch, NULL);
value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_STRETCH, stretch));
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_STRETCH, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
g_object_get (tag, "justification-set", &val_set, NULL);
if (val_set)
{
GtkJustification justification;
gchar *value;
g_object_get (tag, "justification", &justification, NULL);
value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_JUSTIFICATION, justification));
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_JUSTIFICATION, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
GtkTextDirection direction;
g_object_get (tag, "direction", &direction, NULL);
if (direction != GTK_TEXT_DIR_NONE)
{
gchar *value;
val_set = TRUE;
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_DIRECTION);
value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_DIRECTION, direction));
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_DIRECTION, value);
}
temp_tags = temp_tags->next;
}
@ -805,55 +811,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
val_set = tag->wrap_mode_set;
g_object_get (tag, "wrap-mode-set", &val_set, NULL);
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_WRAP_MODE);
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->fg_color_set;
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_FG_COLOR);
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_color_set;
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_BG_COLOR);
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
PangoFontDescription *font;
font = tag->values->font;
if (font)
{
mask = pango_font_description_get_set_fields (font);
val_set = mask & PANGO_FONT_MASK_FAMILY;
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_FAMILY_NAME);
GtkWrapMode wrap_mode;
gchar *value;
g_object_get (tag, "wrap-mode", &wrap_mode, NULL);
value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_WRAP_MODE, wrap_mode));
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_WRAP_MODE, value);
}
temp_tags = temp_tags->next;
}
@ -864,10 +830,16 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
val_set = tag->language_set;
g_object_get (tag, "foreground-set", &val_set, NULL);
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_LANGUAGE);
{
GdkColor c;
gchar *value;
g_object_get (tag, "foreground-gdk", &c, NULL);
value = g_strdup_printf ("%u,%u,%u", c.red, c.green, c.blue);
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_FG_COLOR, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
@ -876,17 +848,70 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
PangoFontDescription *font;
font = tag->values->font;
if (font)
g_object_get (tag, "background-set", &val_set, NULL);
if (val_set)
{
mask = pango_font_description_get_set_fields (font);
val_set = mask & PANGO_FONT_MASK_WEIGHT;
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_WEIGHT);
GdkColor c;
gchar *value;
g_object_get (tag, "background-gdk", &c, NULL);
value = g_strdup_printf ("%u,%u,%u", c.red, c.green, c.blue);
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_BG_COLOR, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
g_object_get (tag, "family-set", &val_set, NULL);
if (val_set)
{
gchar *value;
g_object_get (tag, "family", &value, NULL);
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_FAMILY_NAME, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
g_object_get (tag, "language-set", &val_set, NULL);
if (val_set)
{
gchar *value;
g_object_get (tag, "language", &value, NULL);
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_LANGUAGE, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
temp_tags = tags;
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
g_object_get (tag, "weight-set", &val_set, NULL);
if (val_set)
{
gint weight;
gchar *value;
g_object_get (tag, "weight", &weight, NULL);
value = g_strdup_printf ("%d", weight);
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_WEIGHT, value);
}
temp_tags = temp_tags->next;
}
@ -901,11 +926,16 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
while (temp_tags)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
gboolean scale_set;
if (tag->scale_set)
g_object_get (tag, "scale-set", &scale_set, NULL);
if (scale_set)
{
gdouble font_scale;
g_object_get (tag, "scale", &font_scale, NULL);
val_set = TRUE;
scale *= tag->values->font_scale;
scale *= font_scale;
}
temp_tags = temp_tags->next;
}
@ -922,17 +952,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
while (temp_tags && !val_set)
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
PangoFontDescription *font;
font = tag->values->font;
if (font)
g_object_get (tag, "size-set", &val_set, NULL);
if (val_set)
{
mask = pango_font_description_get_set_fields (font);
val_set = mask & PANGO_FONT_MASK_SIZE;
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_SIZE);
gint size;
gchar *value;
g_object_get (tag, "size", &size, NULL);
value = g_strdup_printf ("%i", size);
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_SIZE, value);
}
temp_tags = temp_tags->next;
}
@ -943,10 +971,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
val_set = tag->strikethrough_set;
g_object_get (tag, "strikethrough-set", &val_set, NULL);
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_STRIKETHROUGH);
{
gboolean strikethrough;
gchar *value;
g_object_get (tag, "strikethrough", &strikethrough, NULL);
value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_STRIKETHROUGH, strikethrough));
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_STRIKETHROUGH, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
@ -956,10 +989,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
val_set = tag->underline_set;
g_object_get (tag, "underline-set", &val_set, NULL);
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_UNDERLINE);
{
PangoUnderline underline;
gchar *value;
g_object_get (tag, "underline", &underline, NULL);
value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_UNDERLINE, underline));
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_UNDERLINE, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
@ -969,10 +1007,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
val_set = tag->rise_set;
g_object_get (tag, "rise-set", &val_set, NULL);
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_RISE);
{
gint rise;
gchar *value;
g_object_get (tag, "rise", &rise, NULL);
value = g_strdup_printf ("%i", rise);
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_RISE, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
@ -982,10 +1025,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
val_set = tag->bg_full_height_set;
g_object_get (tag, "background-full-height-set", &val_set, NULL);
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_BG_FULL_HEIGHT);
{
gboolean bg_full_height;
gchar *value;
g_object_get (tag, "background-full-height", &bg_full_height, NULL);
value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_BG_FULL_HEIGHT, bg_full_height));
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_BG_FULL_HEIGHT, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
@ -995,10 +1043,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
val_set = tag->pixels_inside_wrap_set;
g_object_get (tag, "pixels-inside-wrap-set", &val_set, NULL);
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP);
{
gint pixels;
gchar *value;
g_object_get (tag, "pixels-inside-wrap", &pixels, NULL);
value = g_strdup_printf ("%i", pixels);
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
@ -1008,10 +1061,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
val_set = tag->pixels_below_lines_set;
g_object_get (tag, "pixels-below-lines-set", &val_set, NULL);
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_PIXELS_BELOW_LINES);
{
gint pixels;
gchar *value;
g_object_get (tag, "pixels-below-lines", &pixels, NULL);
value = g_strdup_printf ("%i", pixels);
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_PIXELS_BELOW_LINES, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
@ -1021,10 +1079,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
val_set = tag->pixels_above_lines_set;
g_object_get (tag, "pixels-above-lines-set", &val_set, NULL);
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_PIXELS_ABOVE_LINES);
{
gint pixels;
gchar *value;
g_object_get (tag, "pixels-above-lines", &pixels, NULL);
value = g_strdup_printf ("%i", pixels);
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_PIXELS_ABOVE_LINES, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
@ -1034,10 +1097,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
val_set = tag->editable_set;
g_object_get (tag, "editable-set", &val_set, NULL);
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_EDITABLE);
{
gboolean editable;
gchar *value;
g_object_get (tag, "editable", &editable, NULL);
value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_EDITABLE, editable));
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_EDITABLE, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
@ -1047,10 +1115,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
val_set = tag->invisible_set;
g_object_get (tag, "invisible-set", &val_set, NULL);
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_INVISIBLE);
{
gboolean invisible;
gchar *value;
g_object_get (tag, "invisible", &invisible, NULL);
value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_INVISIBLE, invisible));
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_INVISIBLE, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
@ -1060,10 +1133,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
val_set = tag->indent_set;
g_object_get (tag, "indent-set", &val_set, NULL);
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_INDENT);
{
gint indent;
gchar *value;
g_object_get (tag, "indent", &indent, NULL);
value = g_strdup_printf ("%i", indent);
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_INDENT, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
@ -1073,10 +1151,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
val_set = tag->right_margin_set;
g_object_get (tag, "right-margin-set", &val_set, NULL);
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_RIGHT_MARGIN);
{
gint margin;
gchar *value;
g_object_get (tag, "right-margin", &margin, NULL);
value = g_strdup_printf ("%i", margin);
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_RIGHT_MARGIN, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;
@ -1086,10 +1169,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
{
GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
val_set = tag->left_margin_set;
g_object_get (tag, "left-margin-set", &val_set, NULL);
if (val_set)
attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values,
ATK_TEXT_ATTR_LEFT_MARGIN);
{
gint margin;
gchar *value;
g_object_get (tag, "left-margin", &margin, NULL);
value = g_strdup_printf ("%i", margin);
gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_LEFT_MARGIN, value);
}
temp_tags = temp_tags->next;
}
val_set = FALSE;