[gimp] Implement select-all / unselect-all bindings



commit 877844214c7a9ee0a4a8db75873637c6e124138e
Author: Michael Natterer <mitch gimp org>
Date:   Thu Jun 25 10:21:56 2009 +0200

    Implement select-all / unselect-all bindings

 app/tools/gimptexttool.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index fe1acfb..1a6c7c6 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -144,6 +144,8 @@ static void      gimp_text_tool_backspace       (GimpTextTool      *text_tool);
 static void      gimp_text_tool_cut_clipboard   (GimpTextTool      *text_tool);
 static void      gimp_text_tool_copy_clipboard  (GimpTextTool      *text_tool);
 static void      gimp_text_tool_paste_clipboard (GimpTextTool      *text_tool);
+static void      gimp_text_tool_select_all      (GimpTextTool      *text_tool,
+                                                 gboolean           select);
 
 static void      gimp_text_tool_connect         (GimpTextTool      *text_tool,
                                                  GimpTextLayer     *layer,
@@ -1399,6 +1401,9 @@ gimp_text_tool_ensure_proxy (GimpTextTool *text_tool)
       g_signal_connect_swapped (text_tool->proxy_text_view, "paste-clipboard",
                                 G_CALLBACK (gimp_text_tool_paste_clipboard),
                                 text_tool);
+      g_signal_connect_swapped (text_tool->proxy_text_view, "select-all",
+                                G_CALLBACK (gimp_text_tool_select_all),
+                                text_tool);
     }
 }
 
@@ -1773,6 +1778,33 @@ gimp_text_tool_paste_clipboard (GimpTextTool *text_tool)
   gimp_text_tool_clipboard_paste (text_tool, TRUE);
 }
 
+static void
+gimp_text_tool_select_all (GimpTextTool *text_tool,
+                           gboolean      select)
+{
+  GtkTextBuffer *buffer = text_tool->text_buffer;
+
+  gimp_draw_tool_pause (GIMP_DRAW_TOOL (text_tool));
+
+  if (select)
+    {
+      GtkTextIter start, end;
+
+      gtk_text_buffer_get_bounds (buffer, &start, &end);
+      gtk_text_buffer_select_range (buffer, &start, &end);
+    }
+  else
+    {
+      GtkTextIter cursor;
+
+      gtk_text_buffer_get_iter_at_mark (buffer, &cursor,
+					gtk_text_buffer_get_insert (buffer));
+      gtk_text_buffer_move_mark_by_name (buffer, "selection_bound", &cursor);
+    }
+
+  gimp_draw_tool_resume (GIMP_DRAW_TOOL (text_tool));
+}
+
 
 /*  private functions  */
 



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