Commit 58b4b410 authored by Matthias Clasen's avatar Matthias Clasen

More text properties

parent 76f71b8f
......@@ -221,6 +221,42 @@ dump_attribute_set (GString *string,
}
}
static void
dump_text_attributes (GString *string,
gint depth,
const gchar *name,
AtkAttributeSet *attributes)
{
GSList *l;
AtkAttribute *attr;
const gchar *value;
if (attributes == NULL)
return;
g_string_append_printf (string, "%*s%s:", depth, "", name);
for (l = attributes; l; l = l->next)
{
attr = l->data;
/* don't dump values that depend on the environment */
if (strcmp (attr->name, "family-name") == 0 ||
strcmp (attr->name, "size") == 0 ||
strcmp (attr->name, "weight") == 0 ||
strcmp (attr->name, "stretch") == 0 ||
strcmp (attr->name, "variant") == 0 ||
strcmp (attr->name, "style") == 0 ||
strcmp (attr->name, "language") == 0 ||
strcmp (attr->name, "direction") == 0)
value = "<omitted>";
else
value = attr->value;
g_string_append_printf (string, " %s:%s", attr->name, value);
}
g_string_append_c (string, '\n');
atk_attribute_set_free (attributes);
}
static void
dump_atk_text (AtkText *atk_text,
guint depth,
......@@ -233,6 +269,8 @@ dump_atk_text (AtkText *atk_text,
g_string_append_printf (string, "%*stext: %s\n", depth, "", text);
g_free (text);
g_string_append_printf (string, "%*scharacter count: %d\n", depth, "", atk_text_get_character_count (atk_text));
g_string_append_printf (string, "%*scaret offset: %d\n", depth, "", atk_text_get_caret_offset (atk_text));
for (i = 0; i < atk_text_get_n_selections (atk_text); i++)
......@@ -242,6 +280,8 @@ dump_atk_text (AtkText *atk_text,
g_string_append_printf (string, "%*sselection %d: (%d, %d) %s\n", depth, "", i, start, end, text);
g_free (text);
}
dump_text_attributes (string, depth, "default attributes", atk_text_get_default_attributes (atk_text));
}
static void
......
......@@ -11,4 +11,6 @@ window1
state: enabled focusable sensitive showing visible
toolkit: gail
text: Hello World!
character count: 12
caret offset: 0
default attributes: left-margin:0 right-margin:0 indent:0 invisible:false editable:false pixels-above-lines:0 pixels-below-lines:0 pixels-inside-wrap:0 bg-full-height:0 scale:1 rise:0 underline:none strikethrough:false bg-stipple:false fg-stipple:false fg-color:0,0,0 bg-color:56540,56026,54741 wrap-mode:word justification:left size:<omitted> weight:<omitted> family-name:<omitted> stretch:<omitted> variant:<omitted> style:<omitted> language:<omitted> direction:<omitted>
......@@ -11,4 +11,6 @@ window1
state: enabled focusable sensitive showing visible
toolkit: gail
text: Hello World!
character count: 12
caret offset: 0
default attributes: left-margin:0 right-margin:0 indent:0 invisible:false editable:false pixels-above-lines:0 pixels-below-lines:0 pixels-inside-wrap:0 bg-full-height:0 scale:1 rise:0 underline:none strikethrough:false bg-stipple:false fg-stipple:false fg-color:0,0,0 bg-color:56540,56026,54741 wrap-mode:word justification:left size:<omitted> weight:<omitted> family-name:<omitted> stretch:<omitted> variant:<omitted> style:<omitted> language:<omitted> direction:<omitted>
......@@ -18,7 +18,9 @@ window1
state: enabled multi-line sensitive visible
toolkit: gail
text: Entry:
character count: 6
caret offset: 0
default attributes: left-margin:0 right-margin:0 indent:0 invisible:false editable:false pixels-above-lines:0 pixels-below-lines:0 pixels-inside-wrap:0 bg-full-height:0 scale:1 rise:0 underline:none strikethrough:false bg-stipple:false fg-stipple:false fg-color:0,0,0 bg-color:56540,56026,54741 wrap-mode:word justification:left size:<omitted> weight:<omitted> family-name:<omitted> stretch:<omitted> variant:<omitted> style:<omitted> language:<omitted> direction:<omitted>
entry1
"text"
parent: box1
......@@ -27,4 +29,6 @@ window1
state: editable enabled focusable sensitive single-line visible
toolkit: gail
text: text
character count: 4
caret offset: 0
default attributes: left-margin:0 right-margin:0 indent:0 invisible:false editable:false pixels-above-lines:0 pixels-below-lines:0 pixels-inside-wrap:0 bg-full-height:0 scale:1 rise:0 underline:none strikethrough:false bg-stipple:false fg-stipple:false fg-color:0,0,0 bg-color:65535,65535,65535 wrap-mode:word justification:left size:<omitted> weight:<omitted> family-name:<omitted> stretch:<omitted> variant:<omitted> style:<omitted> language:<omitted> direction:<omitted>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment