[gimp/gimp-2-8] app: don't push an undo group if an item list transform has only one item



commit a03d8c42e58bf9121c422ca49724f1fcfb0641d7
Author: Michael Natterer <mitch gimp org>
Date:   Fri Jun 26 13:35:07 2015 +0200

    app: don't push an undo group if an item list transform has only one item
    
    The fixes for bug 735906 made it push too many undo groups.
    
    (cherry picked from commit a13c63a3f1de118a7e62fdee76b9f020db851f71)

 app/core/gimpimage-item-list.c |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/app/core/gimpimage-item-list.c b/app/core/gimpimage-item-list.c
index 1c7ab3b..e76c119 100644
--- a/app/core/gimpimage-item-list.c
+++ b/app/core/gimpimage-item-list.c
@@ -46,7 +46,7 @@ gimp_image_item_list_translate (GimpImage *image,
     {
       GList *l;
 
-      if (push_undo)
+      if (push_undo && list->next)
         gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_ITEM_DISPLACE,
                                      C_("undo-type", "Translate Items"));
 
@@ -54,7 +54,7 @@ gimp_image_item_list_translate (GimpImage *image,
         gimp_item_translate (GIMP_ITEM (l->data),
                              offset_x, offset_y, push_undo);
 
-      if (push_undo)
+      if (push_undo && list->next)
         gimp_image_undo_group_end (image);
     }
 }
@@ -74,14 +74,16 @@ gimp_image_item_list_flip (GimpImage           *image,
     {
       GList *l;
 
-      gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TRANSFORM,
-                                   C_("undo-type", "Flip Items"));
+      if (list->next)
+        gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TRANSFORM,
+                                     C_("undo-type", "Flip Items"));
 
       for (l = list; l; l = g_list_next (l))
         gimp_item_flip (GIMP_ITEM (l->data), context,
                         flip_type, axis, clip_result);
 
-      gimp_image_undo_group_end (image);
+      if (list->next)
+        gimp_image_undo_group_end (image);
     }
 }
 
@@ -101,14 +103,16 @@ gimp_image_item_list_rotate (GimpImage        *image,
     {
       GList *l;
 
-      gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TRANSFORM,
-                                   C_("undo-type", "Rotate Items"));
+      if (list->next)
+        gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TRANSFORM,
+                                     C_("undo-type", "Rotate Items"));
 
       for (l = list; l; l = g_list_next (l))
         gimp_item_rotate (GIMP_ITEM (l->data), context,
                           rotate_type, center_x, center_y, clip_result);
 
-      gimp_image_undo_group_end (image);
+      if (list->next)
+        gimp_image_undo_group_end (image);
     }
 }
 
@@ -131,8 +135,9 @@ gimp_image_item_list_transform (GimpImage              *image,
     {
       GList *l;
 
-      gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TRANSFORM,
-                                   C_("undo-type", "Transform Items"));
+      if (list->next)
+        gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TRANSFORM,
+                                     C_("undo-type", "Transform Items"));
 
       for (l = list; l; l = g_list_next (l))
         gimp_item_transform (GIMP_ITEM (l->data), context,
@@ -140,7 +145,8 @@ gimp_image_item_list_transform (GimpImage              *image,
                              interpolation_type, recursion_level,
                              clip_result, progress);
 
-      gimp_image_undo_group_end (image);
+      if (list->next)
+        gimp_image_undo_group_end (image);
     }
 }
 


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