[gimp/gimp-2-8] Bug 735906 - Transform tools give unexpected results when transforming...



commit 1a14fed7b5fca05180ec2ace392f6785f08fd0cd
Author: Michael Natterer <mitch gimp org>
Date:   Fri Jun 26 12:05:14 2015 +0200

    Bug 735906 - Transform tools give unexpected results when transforming...
    
    ...certain sets of linked layers
    
    Fix for translating layers from the PDB, and with the cursor keys
    for gimpeditselectiontool. Moving layers with the mouse is still broken.
    
    The approach is exactly the same as in 25a696c7.
    
    (cherry picked from commit 3c706d00c67d675bdb8c255b3fff88490fde82bc)

 app/core/gimpitem-linked.c        |   17 ++++++++++-------
 app/pdb/layer-cmds.c              |   37 ++++++++++++++++---------------------
 app/tools/gimpeditselectiontool.c |   11 +++++++----
 tools/pdbgen/pdb/layer.pdb        |   37 ++++++++++++++++---------------------
 4 files changed, 49 insertions(+), 53 deletions(-)
---
diff --git a/app/core/gimpitem-linked.c b/app/core/gimpitem-linked.c
index f5fcb60..efee934 100644
--- a/app/core/gimpitem-linked.c
+++ b/app/core/gimpitem-linked.c
@@ -41,22 +41,25 @@ gimp_item_linked_translate (GimpItem *item,
                             gint      offset_y,
                             gboolean  push_undo)
 {
-  GList *list;
+  GimpImage *image;
+  GList     *items;
 
   g_return_if_fail (GIMP_IS_ITEM (item));
   g_return_if_fail (gimp_item_get_linked (item) == TRUE);
   g_return_if_fail (gimp_item_is_attached (item));
 
-  list = gimp_image_item_list_get_list (gimp_item_get_image (item), item,
-                                        GIMP_ITEM_TYPE_ALL,
-                                        GIMP_ITEM_SET_LINKED);
+  image = gimp_item_get_image (item);
 
-  list = gimp_image_item_list_filter (item, list);
+  items = gimp_image_item_list_get_list (image, NULL,
+                                         GIMP_ITEM_TYPE_ALL,
+                                         GIMP_ITEM_SET_LINKED);
+
+  items = gimp_image_item_list_filter (NULL, items);
 
-  gimp_image_item_list_translate (gimp_item_get_image (item), list,
+  gimp_image_item_list_translate (gimp_item_get_image (item), items,
                                   offset_x, offset_y, push_undo);
 
-  g_list_free (list);
+  g_list_free (items);
 }
 
 void
diff --git a/app/pdb/layer-cmds.c b/app/pdb/layer-cmds.c
index 766ede1..eae50ca 100644
--- a/app/pdb/layer-cmds.c
+++ b/app/pdb/layer-cmds.c
@@ -469,17 +469,14 @@ layer_translate_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
-
-      gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_ITEM_DISPLACE,
-                                   _("Move Layer"));
-
-      gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
-
       if (gimp_item_get_linked (GIMP_ITEM (layer)))
-        gimp_item_linked_translate (GIMP_ITEM (layer), offx, offy, TRUE);
-
-      gimp_image_undo_group_end (image);
+        {
+          gimp_item_linked_translate (GIMP_ITEM (layer), offx, offy, TRUE);
+        }
+      else
+        {
+          gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
+        }
     }
 
   return gimp_procedure_get_return_values (procedure, success,
@@ -505,23 +502,21 @@ layer_set_offsets_invoker (GimpProcedure      *procedure,
 
   if (success)
     {
-      GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
-      gint       offset_x;
-      gint       offset_y;
-
-      gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_ITEM_DISPLACE,
-                                   _("Move Layer"));
+      gint offset_x;
+      gint offset_y;
 
       gimp_item_get_offset (GIMP_ITEM (layer), &offset_x, &offset_y);
       offx -= offset_x;
       offy -= offset_y;
 
-      gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
-
       if (gimp_item_get_linked (GIMP_ITEM (layer)))
-        gimp_item_linked_translate (GIMP_ITEM (layer), offx, offy, TRUE);
-
-      gimp_image_undo_group_end (image);
+        {
+          gimp_item_linked_translate (GIMP_ITEM (layer), offx, offy, TRUE);
+        }
+      else
+        {
+          gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
+        }
     }
 
   return gimp_procedure_get_return_values (procedure, success,
diff --git a/app/tools/gimpeditselectiontool.c b/app/tools/gimpeditselectiontool.c
index d2ebbe9..9851789 100644
--- a/app/tools/gimpeditselectiontool.c
+++ b/app/tools/gimpeditselectiontool.c
@@ -1289,11 +1289,14 @@ gimp_edit_selection_tool_translate (GimpTool          *tool,
     case GIMP_TRANSLATE_MODE_VECTORS:
     case GIMP_TRANSLATE_MODE_CHANNEL:
     case GIMP_TRANSLATE_MODE_LAYER:
-      gimp_item_translate (item, inc_x, inc_y, push_undo);
-
-      /*  translate all linked items as well  */
       if (gimp_item_get_linked (item))
-        gimp_item_linked_translate (item, inc_x, inc_y, push_undo);
+        {
+          gimp_item_linked_translate (item, inc_x, inc_y, push_undo);
+        }
+      else
+        {
+          gimp_item_translate (item, inc_x, inc_y, push_undo);
+        }
       break;
 
     case GIMP_TRANSLATE_MODE_FLOATING_SEL:
diff --git a/tools/pdbgen/pdb/layer.pdb b/tools/pdbgen/pdb/layer.pdb
index ce32047..f992284 100644
--- a/tools/pdbgen/pdb/layer.pdb
+++ b/tools/pdbgen/pdb/layer.pdb
@@ -538,17 +538,14 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
-
-  gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_ITEM_DISPLACE,
-                               _("Move Layer"));
-
-  gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
-
   if (gimp_item_get_linked (GIMP_ITEM (layer)))
-    gimp_item_linked_translate (GIMP_ITEM (layer), offx, offy, TRUE);
-
-  gimp_image_undo_group_end (image);
+    {
+      gimp_item_linked_translate (GIMP_ITEM (layer), offx, offy, TRUE);
+    }
+  else
+    {
+      gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
+    }
 }
 CODE
     );
@@ -642,23 +639,21 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
-  gint       offset_x;
-  gint       offset_y;
-
-  gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_ITEM_DISPLACE,
-                               _("Move Layer"));
+  gint offset_x;
+  gint offset_y;
 
   gimp_item_get_offset (GIMP_ITEM (layer), &offset_x, &offset_y);
   offx -= offset_x;
   offy -= offset_y;
 
-  gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
-
   if (gimp_item_get_linked (GIMP_ITEM (layer)))
-    gimp_item_linked_translate (GIMP_ITEM (layer), offx, offy, TRUE);
-
-  gimp_image_undo_group_end (image);
+    {
+      gimp_item_linked_translate (GIMP_ITEM (layer), offx, offy, TRUE);
+    }
+  else
+    {
+      gimp_item_translate (GIMP_ITEM (layer), offx, offy, TRUE);
+    }
 }
 CODE
     );


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