app: add gimp_text_buffer_insert() and use it

Does nothing special yet, but will soon apply the currently active
tags to the inserted text.
This commit is contained in:
Michael Natterer 2010-02-26 02:34:01 +01:00
parent ebfbc5a030
commit 6c556698e5
3 changed files with 14 additions and 3 deletions

View File

@ -821,8 +821,7 @@ gimp_text_tool_insert_at_cursor (GimpTextTool *text_tool,
{
gimp_draw_tool_pause (GIMP_DRAW_TOOL (text_tool));
gtk_text_buffer_insert_at_cursor (GTK_TEXT_BUFFER (text_tool->buffer),
str, -1);
gimp_text_buffer_insert (text_tool->buffer, str);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (text_tool));
}
@ -1120,7 +1119,7 @@ gimp_text_tool_enter_text (GimpTextTool *text_tool,
gimp_text_tool_delete_from_cursor (text_tool, GTK_DELETE_CHARS, 1);
}
gtk_text_buffer_insert_at_cursor (buffer, str, -1);
gimp_text_buffer_insert (text_tool->buffer, str);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (text_tool));
}

View File

@ -275,6 +275,15 @@ gimp_text_buffer_name_to_tag (GimpTextBuffer *buffer,
return NULL;
}
void
gimp_text_buffer_insert (GimpTextBuffer *buffer,
const gchar *text)
{
g_return_if_fail (GIMP_IS_TEXT_BUFFER (buffer));
gtk_text_buffer_insert_at_cursor (GTK_TEXT_BUFFER (buffer), text, -1);
}
gint
gimp_text_buffer_get_iter_index (GimpTextBuffer *buffer,
GtkTextIter *iter)

View File

@ -66,6 +66,9 @@ const gchar * gimp_text_buffer_tag_to_name (GimpTextBuffer *buffer,
GtkTextTag * gimp_text_buffer_name_to_tag (GimpTextBuffer *buffer,
const gchar *name);
void gimp_text_buffer_insert (GimpTextBuffer *buffer,
const gchar *text);
gint gimp_text_buffer_get_iter_index (GimpTextBuffer *buffer,
GtkTextIter *iter);