[gimp] Implement insert_at_cursor() so bindings can insert text
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Subject: [gimp] Implement insert_at_cursor() so bindings can insert text
- Date: Wed, 24 Jun 2009 19:32:17 +0000 (UTC)
commit e78bda44b332ed7c90e461c10c0ca6c1eb3c7bc5
Author: Michael Natterer <mitch gimp org>
Date: Wed Jun 24 21:31:39 2009 +0200
Implement insert_at_cursor() so bindings can insert text
app/tools/gimptexttool.c | 13 +++++++++++++
app/widgets/gimptextproxy.c | 9 +++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 369ae4e..fe1acfb 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -135,6 +135,8 @@ static void gimp_text_tool_move_cursor (GimpTextTool *text_tool,
GtkMovementStep step,
gint count,
gboolean extend_selection);
+static void gimp_text_tool_insert_at_cursor (GimpTextTool *text_tool,
+ const gchar *str);
static void gimp_text_tool_delete_from_cursor (GimpTextTool *text_tool,
GtkDeleteType type,
gint count);
@@ -1379,6 +1381,9 @@ gimp_text_tool_ensure_proxy (GimpTextTool *text_tool)
g_signal_connect_swapped (text_tool->proxy_text_view, "move-cursor",
G_CALLBACK (gimp_text_tool_move_cursor),
text_tool);
+ g_signal_connect_swapped (text_tool->proxy_text_view, "insert-at-cursor",
+ G_CALLBACK (gimp_text_tool_insert_at_cursor),
+ text_tool);
g_signal_connect_swapped (text_tool->proxy_text_view, "delete-from-cursor",
G_CALLBACK (gimp_text_tool_delete_from_cursor),
text_tool);
@@ -1598,6 +1603,14 @@ gimp_text_tool_move_cursor (GimpTextTool *text_tool,
gimp_draw_tool_resume (GIMP_DRAW_TOOL (text_tool));
}
+static void
+gimp_text_tool_insert_at_cursor (GimpTextTool *text_tool,
+ const gchar *str)
+{
+ gtk_text_buffer_insert_interactive_at_cursor (text_tool->text_buffer,
+ str, -1, TRUE);
+}
+
static gboolean
is_whitespace (gunichar ch,
gpointer user_data)
diff --git a/app/widgets/gimptextproxy.c b/app/widgets/gimptextproxy.c
index 4cfbc4e..8965bdc 100644
--- a/app/widgets/gimptextproxy.c
+++ b/app/widgets/gimptextproxy.c
@@ -29,6 +29,8 @@ static void gimp_text_proxy_move_cursor (GtkTextView *text_view,
GtkMovementStep step,
gint count,
gboolean extend_selection);
+static void gimp_text_proxy_insert_at_cursor (GtkTextView *text_view,
+ const gchar *str);
static void gimp_text_proxy_delete_from_cursor (GtkTextView *text_view,
GtkDeleteType type,
gint count);
@@ -47,6 +49,7 @@ gimp_text_proxy_class_init (GimpTextProxyClass *klass)
GtkTextViewClass *tv_class = GTK_TEXT_VIEW_CLASS (klass);
tv_class->move_cursor = gimp_text_proxy_move_cursor;
+ tv_class->insert_at_cursor = gimp_text_proxy_insert_at_cursor;
tv_class->delete_from_cursor = gimp_text_proxy_delete_from_cursor;
tv_class->backspace = gimp_text_proxy_backspace;
tv_class->cut_clipboard = gimp_text_proxy_cut_clipboard;
@@ -68,6 +71,12 @@ gimp_text_proxy_move_cursor (GtkTextView *text_view,
}
static void
+gimp_text_proxy_insert_at_cursor (GtkTextView *text_view,
+ const gchar *str)
+{
+}
+
+static void
gimp_text_proxy_delete_from_cursor (GtkTextView *text_view,
GtkDeleteType type,
gint count)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]