app: create a different tag for underlined text during preedit.
It still shows up as underlined during preedit, but does not toggle the underline button in the style editor.
This commit is contained in:
parent
e7b754087c
commit
a86b0cf0a2
3 changed files with 26 additions and 7 deletions
|
|
@ -1450,7 +1450,7 @@ gimp_text_tool_im_preedit_changed (GtkIMContext *context,
|
|||
{
|
||||
case PANGO_ATTR_UNDERLINE:
|
||||
gtk_text_buffer_apply_tag (buffer,
|
||||
text_tool->buffer->underline_tag,
|
||||
text_tool->buffer->preedit_underline_tag,
|
||||
&start, &end);
|
||||
break;
|
||||
case PANGO_ATTR_BACKGROUND:
|
||||
|
|
|
|||
|
|
@ -106,6 +106,11 @@ gimp_text_buffer_constructed (GObject *object)
|
|||
"underline", PANGO_UNDERLINE_SINGLE,
|
||||
NULL);
|
||||
|
||||
buffer->preedit_underline_tag = gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (buffer),
|
||||
"preedit-underline",
|
||||
"underline", PANGO_UNDERLINE_SINGLE,
|
||||
NULL);
|
||||
|
||||
buffer->strikethrough_tag = gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (buffer),
|
||||
"strikethrough",
|
||||
"strikethrough", TRUE,
|
||||
|
|
@ -1091,12 +1096,14 @@ gimp_text_buffer_set_bg_color (GimpTextBuffer *buffer,
|
|||
|
||||
/* Pango markup attribute names */
|
||||
|
||||
#define GIMP_TEXT_ATTR_NAME_SIZE "size"
|
||||
#define GIMP_TEXT_ATTR_NAME_BASELINE "rise"
|
||||
#define GIMP_TEXT_ATTR_NAME_KERNING "letter_spacing"
|
||||
#define GIMP_TEXT_ATTR_NAME_FONT "font"
|
||||
#define GIMP_TEXT_ATTR_NAME_COLOR "foreground"
|
||||
#define GIMP_TEXT_ATTR_NAME_BG_COLOR "background"
|
||||
#define GIMP_TEXT_ATTR_NAME_SIZE "size"
|
||||
#define GIMP_TEXT_ATTR_NAME_BASELINE "rise"
|
||||
#define GIMP_TEXT_ATTR_NAME_KERNING "letter_spacing"
|
||||
#define GIMP_TEXT_ATTR_NAME_FONT "font"
|
||||
#define GIMP_TEXT_ATTR_NAME_STYLE "style"
|
||||
#define GIMP_TEXT_ATTR_NAME_COLOR "foreground"
|
||||
#define GIMP_TEXT_ATTR_NAME_BG_COLOR "background"
|
||||
#define GIMP_TEXT_ATTR_NAME_UNDERLINE "underline"
|
||||
|
||||
const gchar *
|
||||
gimp_text_buffer_tag_to_name (GimpTextBuffer *buffer,
|
||||
|
|
@ -1205,6 +1212,16 @@ gimp_text_buffer_tag_to_name (GimpTextBuffer *buffer,
|
|||
|
||||
return "span";
|
||||
}
|
||||
else if (tag == buffer->preedit_underline_tag)
|
||||
{
|
||||
if (attribute)
|
||||
*attribute = GIMP_TEXT_ATTR_NAME_UNDERLINE;
|
||||
|
||||
if (value)
|
||||
*value = g_strdup ("single");
|
||||
|
||||
return "span";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ struct _GimpTextBuffer
|
|||
GList *color_tags;
|
||||
GList *bg_color_tags;
|
||||
|
||||
GtkTextTag *preedit_underline_tag;
|
||||
|
||||
gboolean insert_tags_set;
|
||||
GList *insert_tags;
|
||||
GList *remove_tags;
|
||||
|
|
|
|||
Loading…
Reference in a new issue