[gimp] app: add gimp_text_buffer_insert() and use it



commit 6c556698e5d9e0a36b0f6c39d7d6233f91738211
Author: Michael Natterer <mitch gimp org>
Date:   Fri Feb 26 02:34:01 2010 +0100

    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.

 app/tools/gimptexttool-editor.c |    5 ++---
 app/widgets/gimptextbuffer.c    |    9 +++++++++
 app/widgets/gimptextbuffer.h    |    3 +++
 3 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/app/tools/gimptexttool-editor.c b/app/tools/gimptexttool-editor.c
index 76d8567..f0eb1df 100644
--- a/app/tools/gimptexttool-editor.c
+++ b/app/tools/gimptexttool-editor.c
@@ -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));
 }
diff --git a/app/widgets/gimptextbuffer.c b/app/widgets/gimptextbuffer.c
index c133a93..5d42ab0 100644
--- a/app/widgets/gimptextbuffer.c
+++ b/app/widgets/gimptextbuffer.c
@@ -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)
diff --git a/app/widgets/gimptextbuffer.h b/app/widgets/gimptextbuffer.h
index d34c876..5c3485c 100644
--- a/app/widgets/gimptextbuffer.h
+++ b/app/widgets/gimptextbuffer.h
@@ -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);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]