[gimp] Fix undo when going back from a modified text layer to an	editable one
- From: Michael Natterer <mitch src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gimp] Fix undo when going back from a modified text layer to an	editable one
 
- Date: Thu, 18 Mar 2010 09:36:27 +0000 (UTC)
 
commit f9e68fe0ee83630028d1fc8ca35a1e40becdd0d5
Author: Michael Natterer <mitch gimp org>
Date:   Thu Mar 18 10:32:52 2010 +0100
    Fix undo when going back from a modified text layer to an editable one
    
    My earlier change to using gimp_drawable_push_undo() here was a very
    bad idea. Go back to using gimp_image_undo_push_drawable_mod(), but
    make use of its new tile-copying feature so the problem that made me
    do the earlier change is fixed too. See comments in the changed code.
 app/text/gimptextlayer.c |   15 ++++++++++-----
 app/tools/gimptexttool.c |    9 ++++-----
 2 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/app/text/gimptextlayer.c b/app/text/gimptextlayer.c
index aaaa499..433395b 100644
--- a/app/text/gimptextlayer.c
+++ b/app/text/gimptextlayer.c
@@ -460,11 +460,16 @@ gimp_text_layer_set (GimpTextLayer *layer,
   if (layer->modified)
     {
       gimp_image_undo_push_text_layer_modified (image, NULL, 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);
+
+      /*  pass copy_tiles = TRUE so we not only ref the tiles; after
+       *  being a text layer again, undo doesn't care about the
+       *  layer's pixels any longer because they are generated, so
+       *  changing the text would happily overwrite the layer's
+       *  pixels, changing the pixels on the undo stack too without
+       *  any chance to ever undo again.
+       */
+      gimp_image_undo_push_drawable_mod (image, NULL,
+                                         GIMP_DRAWABLE (layer), TRUE);
     }
 
   gimp_image_undo_push_text_layer (image, undo_desc, layer, NULL);
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 0069f8c..11e90ca 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -1239,11 +1239,10 @@ 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_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);
+
+          /*  see comment in gimp_text_layer_set()  */
+          gimp_image_undo_push_drawable_mod (image, NULL,
+                                             GIMP_DRAWABLE (layer), TRUE);
         }
 
       gimp_image_undo_push_text_layer (image, NULL, layer, pspec);
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]