[gimp] app: fix the transition to modified text layer and back



commit f13204e0a4df052ceb57b6c7a730124fbf8f5fe0
Author: Michael Natterer <mitch gimp org>
Date:   Sun Feb 21 12:04:19 2010 +0100

    app: fix the transition to modified text layer and back
    
    - when the layer becomes modified, completely shut down the text tool
      completely instead of leaving it in some bastard hybrid
      half-attached state.
    - when re-editing a modified layer (like after confirming the edit in
      the dialog), push a *drawable* undo, not a drawable_mod undo because
      the latter only refs the layer's tiles and doesn't copy them, so when
      the text layer re-render happens to not change the layer's size, it
      would overwrite the modified pixels without any chance of ever going
      back.
    
    Unrelated:
    
    - in button_press(), fix my recent fix for the condition that triggers a
      mouse-select and set the "seleting" state to FALSE when the
      condition is not met.
    - in confirm_response(), don't check if the proxy exists because its
      existence is an invariant.

 app/tools/gimptexttool.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 720ffc3..042c847 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -441,13 +441,17 @@ gimp_text_tool_button_press (GimpTool            *tool,
                 }
             }
 
-          if (text_tool->selecting)
+          if (text_tool->text)
             {
               if (! text_tool->layout)
                 gimp_text_tool_update_layout (text_tool);
 
               gimp_text_tool_editor_button_press (text_tool, x, y, press_type);
             }
+          else
+            {
+              text_tool->selecting = FALSE;
+            }
 
           gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
 
@@ -1012,7 +1016,8 @@ gimp_text_tool_layer_notify (GimpTextLayer *layer,
                              GimpTextTool  *text_tool)
 {
   if (layer->modified)
-    gimp_text_tool_connect (text_tool, NULL, NULL);
+    gimp_tool_control (GIMP_TOOL (text_tool), GIMP_TOOL_ACTION_HALT,
+                       GIMP_TOOL (text_tool)->display);
 }
 
 static void
@@ -1178,8 +1183,11 @@ gimp_text_tool_apply (GimpTextTool *text_tool)
           gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TEXT, NULL);
 
           gimp_image_undo_push_text_layer_modified (image, NULL, layer);
-          gimp_image_undo_push_drawable_mod (image,
-                                             NULL, GIMP_DRAWABLE (layer));
+          gimp_drawable_push_undo (GIMP_DRAWABLE (layer), NULL,
+                                   0, 0,
+                                   gimp_item_get_width  (GIMP_ITEM (layer)),
+                                   gimp_item_get_height (GIMP_ITEM (layer)),
+                                   NULL, FALSE);
         }
 
       gimp_image_undo_push_text_layer (image, NULL, layer, pspec);
@@ -1345,8 +1353,7 @@ gimp_text_tool_confirm_response (GtkWidget    *widget,
           gimp_text_tool_connect (text_tool, layer, layer->text);
 
           /*  cause the text layer to be rerendered  */
-          if (text_tool->proxy)
-            g_object_notify (G_OBJECT (text_tool->proxy), "text");
+          g_object_notify (G_OBJECT (text_tool->proxy), "text");
 
           gimp_text_tool_editor_start (text_tool);
           break;



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