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



commit a13c63a3f1de118a7e62fdee76b9f020db851f71
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.

 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 6e20938..cd31d6a 100644
--- a/app/core/gimpimage-item-list.c
+++ b/app/core/gimpimage-item-list.c
@@ -47,7 +47,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"));
 
@@ -55,7 +55,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);
     }
 }
@@ -75,14 +75,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);
     }
 }
 
@@ -102,14 +104,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,
                              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]