[gimp] app: more text tool



commit a6ca7e184c140235360105ba4e587b1737005aef
Author: Michael Natterer <mitch gimp org>
Date:   Sun Feb 21 01:39:38 2010 +0100

    app: more text tool
    
    - drop the layout in gimp_text_tool_halt()
    - reinitialize the tool completely when clicking another display
    - therefore, have to recreate the layout in button_press() instead
      of bailing out if it doesn't exist

 app/tools/gimptexttool.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 8f344d1..6907c4d 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -314,12 +314,6 @@ gimp_text_tool_finalize (GObject *object)
       text_tool->proxy = NULL;
     }
 
-  if (text_tool->layout)
-    {
-      g_object_unref (text_tool->layout);
-      text_tool->layout = NULL;
-    }
-
   if (text_tool->text_buffer)
     {
       g_object_unref (text_tool->text_buffer);
@@ -369,6 +363,9 @@ gimp_text_tool_button_press (GimpTool            *tool,
 
   gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
 
+  if (tool->display && tool->display != display)
+    gimp_text_tool_halt (text_tool);
+
   if (press_type == GIMP_BUTTON_PRESS_NORMAL)
     {
       gimp_text_tool_reset_im_context (text_tool);
@@ -444,8 +441,11 @@ gimp_text_tool_button_press (GimpTool            *tool,
                 }
             }
 
-          if (text_tool->layout && ! text_tool->moving)
+          if (text_tool->selecting)
             {
+              if (! text_tool->layout)
+                gimp_text_tool_update_layout (text_tool);
+
               gimp_text_tool_editor_button_press (text_tool, x, y, press_type);
             }
 
@@ -927,6 +927,12 @@ gimp_text_tool_halt (GimpTextTool *text_tool)
 
   gimp_text_tool_set_drawable (text_tool, NULL, FALSE);
 
+  if (text_tool->layout)
+    {
+      g_object_unref (text_tool->layout);
+      text_tool->layout = NULL;
+    }
+
   gimp_draw_tool_resume (GIMP_DRAW_TOOL (text_tool));
 }
 



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