[gimp] app: cleanup



commit 838f2d567d24fb3fcdec67247300da0863679894
Author: Michael Natterer <mitch gimp org>
Date:   Wed Feb 17 21:39:33 2010 +0100

    app: cleanup

 app/tools/gimptexttool-editor.c |   75 +++++++++++++++++++++------------------
 app/tools/gimptexttool-editor.h |    4 ++-
 app/tools/gimptexttool.c        |   47 ++++++++++++------------
 app/tools/gimptexttool.h        |    5 +++
 4 files changed, 71 insertions(+), 60 deletions(-)
---
diff --git a/app/tools/gimptexttool-editor.c b/app/tools/gimptexttool-editor.c
index dbdefdf..d5d0fa8 100644
--- a/app/tools/gimptexttool-editor.c
+++ b/app/tools/gimptexttool-editor.c
@@ -2,7 +2,9 @@
  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
  *
  * GimpTextTool
- * Copyright (C) 2002-2004  Sven Neumann <sven gimp org>
+ * Copyright (C) 2002-2010  Sven Neumann <sven gimp org>
+ *                          Daniel Eddeland <danedde svn gnome org>
+ *                          Michael Natterer <mitch gimp org>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -229,6 +231,43 @@ gimp_text_tool_editor_key_press (GimpTextTool *text_tool,
   return retval;
 }
 
+gchar *
+gimp_text_tool_editor_get_text (GimpTextTool *text_tool)
+{
+  GtkTextBuffer *buffer = text_tool->text_buffer;
+  GtkTextIter    start, end;
+  GtkTextIter    selstart, selend;
+  gchar         *string;
+  gchar         *fb;
+  gchar         *lb;
+
+  gtk_text_buffer_get_bounds (buffer, &start, &end);
+  gtk_text_buffer_get_selection_bounds (buffer, &selstart, &selend);
+
+  fb = gtk_text_buffer_get_text (buffer, &start, &selstart, TRUE);
+  lb = gtk_text_buffer_get_text (buffer, &selstart, &end, TRUE);
+
+  if (text_tool->preedit_string)
+    {
+      if (fb == NULL)
+        string = g_strconcat (text_tool->preedit_string, lb, NULL);
+      else
+        string = g_strconcat (fb, text_tool->preedit_string, lb, NULL);
+    }
+  else
+    {
+      string = g_strconcat (fb, lb, NULL);
+    }
+
+  g_free (fb);
+  g_free (lb);
+
+  return string;
+}
+
+
+/*  private functions  */
+
 static void
 gimp_text_tool_ensure_proxy (GimpTextTool *text_tool)
 {
@@ -739,40 +778,6 @@ gimp_text_tool_editor_dialog (GimpTextTool *text_tool)
   gtk_widget_show (text_tool->editor);
 }
 
-gchar *
-gimp_text_tool_editor_get_text (GimpTextTool *text_tool)
-{
-  GtkTextBuffer *buffer = text_tool->text_buffer;
-  GtkTextIter    start, end;
-  GtkTextIter    selstart, selend;
-  gchar         *string;
-  gchar         *fb;
-  gchar         *lb;
-
-  gtk_text_buffer_get_bounds (buffer, &start, &end);
-  gtk_text_buffer_get_selection_bounds (buffer, &selstart, &selend);
-
-  fb = gtk_text_buffer_get_text (buffer, &start, &selstart, TRUE);
-  lb = gtk_text_buffer_get_text (buffer, &selstart, &end, TRUE);
-
-  if (text_tool->preedit_string)
-    {
-      if (fb == NULL)
-        string = g_strconcat (text_tool->preedit_string, lb, NULL);
-      else
-        string = g_strconcat (fb, text_tool->preedit_string, lb, NULL);
-    }
-  else
-    {
-      string = g_strconcat (fb, lb, NULL);
-    }
-
-  g_free (fb);
-  g_free (lb);
-
-  return string;
-}
-
 static void
 gimp_text_tool_enter_text (GimpTextTool *text_tool,
                            const gchar  *str)
diff --git a/app/tools/gimptexttool-editor.h b/app/tools/gimptexttool-editor.h
index 28aaad2..2b2c60a 100644
--- a/app/tools/gimptexttool-editor.h
+++ b/app/tools/gimptexttool-editor.h
@@ -2,7 +2,9 @@
  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
  *
  * GimpTextTool
- * Copyright (C) 2002-2004  Sven Neumann <sven gimp org>
+ * Copyright (C) 2002-2010  Sven Neumann <sven gimp org>
+ *                          Daniel Eddeland <danedde svn gnome org>
+ *                          Michael Natterer <mitch gimp org>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 823b5e2..0d75505 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -2,7 +2,9 @@
  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
  *
  * GimpTextTool
- * Copyright (C) 2002-2004  Sven Neumann <sven gimp org>
+ * Copyright (C) 2002-2010  Sven Neumann <sven gimp org>
+ *                          Daniel Eddeland <danedde svn gnome org>
+ *                          Michael Natterer <mitch gimp org>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -734,12 +736,12 @@ gimp_text_tool_key_press (GimpTool    *tool,
                           GdkEventKey *kevent,
                           GimpDisplay *display)
 {
-  GimpTextTool  *text_tool = GIMP_TEXT_TOOL (tool);
+  GimpTextTool *text_tool = GIMP_TEXT_TOOL (tool);
 
-  if (display != tool->display)
-    return FALSE;
+  if (display == tool->display)
+    return gimp_text_tool_editor_key_press (text_tool, kevent, display);
 
-  return gimp_text_tool_editor_key_press (text_tool, kevent, display);
+  return FALSE;
 }
 
 static void
@@ -1241,9 +1243,6 @@ gimp_text_tool_halt (GimpTextTool *text_tool)
   gimp_text_tool_editor_halt (text_tool);
 }
 
-
-/*  private functions  */
-
 static void
 gimp_text_tool_connect (GimpTextTool  *text_tool,
                         GimpTextLayer *layer,
@@ -1836,6 +1835,22 @@ gimp_text_tool_set_drawable (GimpTextTool *text_tool,
   return FALSE;
 }
 
+static void
+gimp_text_tool_text_buffer_changed (GtkTextBuffer *text_buffer,
+                                    GimpTextTool  *text_tool)
+{
+  gimp_text_tool_update_proxy (text_tool);
+}
+
+static void
+gimp_text_tool_text_buffer_mark_set (GtkTextBuffer *text_buffer,
+                                     GtkTextIter   *iter,
+                                     GtkTextMark   *mark,
+                                     GimpTextTool  *text_tool)
+{
+  gimp_text_tool_update_layout (text_tool);
+}
+
 void
 gimp_text_tool_update_proxy (GimpTextTool *text_tool)
 {
@@ -1855,22 +1870,6 @@ gimp_text_tool_update_proxy (GimpTextTool *text_tool)
     }
 }
 
-static void
-gimp_text_tool_text_buffer_changed (GtkTextBuffer *text_buffer,
-                                    GimpTextTool  *text_tool)
-{
-  gimp_text_tool_update_proxy (text_tool);
-}
-
-static void
-gimp_text_tool_text_buffer_mark_set (GtkTextBuffer *text_buffer,
-                                     GtkTextIter   *iter,
-                                     GtkTextMark   *mark,
-                                     GimpTextTool  *text_tool)
-{
-  gimp_text_tool_update_layout (text_tool);
-}
-
 void
 gimp_text_tool_update_layout (GimpTextTool *text_tool)
 {
diff --git a/app/tools/gimptexttool.h b/app/tools/gimptexttool.h
index da56cbf..96cf5fe 100644
--- a/app/tools/gimptexttool.h
+++ b/app/tools/gimptexttool.h
@@ -1,6 +1,11 @@
 /* GIMP - The GNU Image Manipulation Program
  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
  *
+ * GimpTextTool
+ * Copyright (C) 2002-2010  Sven Neumann <sven gimp org>
+ *                          Daniel Eddeland <danedde svn gnome org>
+ *                          Michael Natterer <mitch gimp org>
+ *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3 of the License, or



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