[gimp/wip/Jehan/layers-dockable-refresh: 122/126] app, devel-docs, libgimp, pdb: remove item link ref in flip code.




commit 6b237b202708696d8d84649f0199f23d92cc1503
Author: Jehan <jehan girinstud io>
Date:   Thu Nov 18 17:27:48 2021 +0100

    app, devel-docs, libgimp, pdb: remove item link ref in flip code.
    
    "Item links" concept is no more in the GUI so we are progressively
    removing reference and implementation of this in the core code.

 app/actions/drawable-commands.c | 11 ++---------
 app/core/gimpimage-item-list.c  |  5 +++--
 app/core/gimpimage-item-list.h  |  2 +-
 app/core/gimpitem-linked.c      | 28 ----------------------------
 app/core/gimpitem-linked.h      |  5 -----
 app/gimpcore.def                |  1 -
 app/pdb/item-transform-cmds.c   | 10 ++--------
 app/tools/gimpfliptool.c        | 29 ++++-------------------------
 devel-docs/app/app-sections.txt |  1 -
 libgimp/gimpitemtransform_pdb.c | 12 +++---------
 pdb/groups/item_transform.pdb   | 18 +++---------------
 11 files changed, 18 insertions(+), 104 deletions(-)
---
diff --git a/app/actions/drawable-commands.c b/app/actions/drawable-commands.c
index c89fc08451..aa69ad9660 100644
--- a/app/actions/drawable-commands.c
+++ b/app/actions/drawable-commands.c
@@ -260,15 +260,8 @@ drawable_flip_cmd_callback (GimpAction *action,
       break;
     }
 
-  if (gimp_item_get_linked (item))
-    {
-      gimp_item_linked_flip (item, context, orientation, axis, FALSE);
-    }
-  else
-    {
-      gimp_item_flip (item, context, orientation, axis,
-                      gimp_item_get_clip (item, FALSE));
-    }
+  gimp_item_flip (item, context, orientation, axis,
+                  gimp_item_get_clip (item, FALSE));
 
   gimp_image_flush (image);
 }
diff --git a/app/core/gimpimage-item-list.c b/app/core/gimpimage-item-list.c
index 8d512c477a..5c368bcb3e 100644
--- a/app/core/gimpimage-item-list.c
+++ b/app/core/gimpimage-item-list.c
@@ -146,7 +146,7 @@ gimp_image_item_list_flip (GimpImage           *image,
                            GimpContext         *context,
                            GimpOrientationType  flip_type,
                            gdouble              axis,
-                           gboolean             clip_result)
+                           GimpTransformResize  expected_clip_result)
 {
   g_return_if_fail (GIMP_IS_IMAGE (image));
   g_return_if_fail (GIMP_IS_CONTEXT (context));
@@ -170,7 +170,8 @@ gimp_image_item_list_flip (GimpImage           *image,
 
           gimp_item_flip (item, context,
                           flip_type, axis,
-                          gimp_item_get_clip (item, clip_result));
+                          gimp_item_get_clip (item, expected_clip_result) !=
+                          GIMP_TRANSFORM_RESIZE_ADJUST);
         }
 
       if (list->next)
diff --git a/app/core/gimpimage-item-list.h b/app/core/gimpimage-item-list.h
index b67046be16..24a45f4645 100644
--- a/app/core/gimpimage-item-list.h
+++ b/app/core/gimpimage-item-list.h
@@ -36,7 +36,7 @@ void       gimp_image_item_list_flip      (GimpImage              *image,
                                            GimpContext            *context,
                                            GimpOrientationType     flip_type,
                                            gdouble                 axis,
-                                           gboolean                clip_result);
+                                           GimpTransformResize     expected_clip_result);
 void       gimp_image_item_list_rotate    (GimpImage              *image,
                                            GList                  *list,
                                            GimpContext            *context,
diff --git a/app/core/gimpitem-linked.c b/app/core/gimpitem-linked.c
index 9c876e3829..46ea087e5d 100644
--- a/app/core/gimpitem-linked.c
+++ b/app/core/gimpitem-linked.c
@@ -96,34 +96,6 @@ gimp_item_linked_translate (GimpItem *item,
   g_list_free (items);
 }
 
-void
-gimp_item_linked_flip (GimpItem            *item,
-                       GimpContext         *context,
-                       GimpOrientationType  flip_type,
-                       gdouble              axis,
-                       gboolean             clip_result)
-{
-  GimpImage *image;
-  GList     *items;
-
-  g_return_if_fail (GIMP_IS_ITEM (item));
-  g_return_if_fail (GIMP_IS_CONTEXT (context));
-  g_return_if_fail (gimp_item_get_linked (item) == TRUE);
-  g_return_if_fail (gimp_item_is_attached (item));
-
-  image = gimp_item_get_image (item);
-
-  items = gimp_image_item_list_get_list (image,
-                                         GIMP_ITEM_TYPE_ALL,
-                                         GIMP_ITEM_SET_LINKED);
-  items = gimp_image_item_list_filter (items);
-
-  gimp_image_item_list_flip (image, items, context,
-                             flip_type, axis, clip_result);
-
-  g_list_free (items);
-}
-
 void
 gimp_item_linked_rotate (GimpItem         *item,
                          GimpContext      *context,
diff --git a/app/core/gimpitem-linked.h b/app/core/gimpitem-linked.h
index c82d85a900..ab5c1fd4c2 100644
--- a/app/core/gimpitem-linked.h
+++ b/app/core/gimpitem-linked.h
@@ -25,11 +25,6 @@ void     gimp_item_linked_translate (GimpItem               *item,
                                      gint                    offset_x,
                                      gint                    offset_y,
                                      gboolean                push_undo);
-void     gimp_item_linked_flip      (GimpItem               *item,
-                                     GimpContext            *context,
-                                     GimpOrientationType     flip_type,
-                                     gdouble                 axis,
-                                     gboolean                clip_result);
 void     gimp_item_linked_rotate    (GimpItem               *item,
                                      GimpContext            *context,
                                      GimpRotationType        rotate_type,
diff --git a/app/gimpcore.def b/app/gimpcore.def
index ca5d6cd8fa..360cb708da 100644
--- a/app/gimpcore.def
+++ b/app/gimpcore.def
@@ -400,7 +400,6 @@ EXPORTS
        gimp_item_get_visible
        gimp_item_height
        gimp_item_is_text_layer
-       gimp_item_linked_flip
        gimp_item_linked_rotate
        gimp_item_linked_transform
        gimp_item_linked_translate
diff --git a/app/pdb/item-transform-cmds.c b/app/pdb/item-transform-cmds.c
index 5237c7a719..bf0d27ddd4 100644
--- a/app/pdb/item-transform-cmds.c
+++ b/app/pdb/item-transform-cmds.c
@@ -152,12 +152,6 @@ item_transform_flip_simple_invoker (GimpProcedure         *procedure,
               else
                 success = FALSE;
             }
-          else if (gimp_item_get_linked (item))
-            {
-              gimp_item_linked_flip (item, context,
-                                     flip_type, axis,
-                                     pdb_context->transform_resize);
-            }
           else
             {
               gimp_item_flip (item, context,
@@ -1077,7 +1071,7 @@ register_item_transform_procs (GimpPDB *pdb)
                                      "\n"
                                      "If a selection exists and the item is a drawable, the portion of the 
drawable which lies under the selection is cut from the drawable and made into a floating selection which is 
then flipped. If auto_center is set to TRUE, the flip is around the selection's center. Otherwise, the 
coordinate of the axis needs to be specified. The return value is the ID of the flipped floating selection.\n"
                                      "\n"
-                                     "If there is no selection or the item is not a drawable, the entire 
item will be flipped around its center if auto_center is set to TRUE, otherwise the coordinate of the axis 
needs to be specified. Additionally, if the item has its linked flag set to TRUE, all additional items 
contained in the image which have the linked flag set to TRUE will also be flipped around the same axis. The 
return value will be equal to the item ID supplied as input.\n"
+                                     "If there is no selection or the item is not a drawable, the entire 
item will be flipped around its center if auto_center is set to TRUE, otherwise the coordinate of the axis 
needs to be specified. The return value will be equal to the item ID supplied as input.\n"
                                      "\n"
                                      "This procedure is affected by the following context setters: 
'gimp-context-set-transform-resize'.",
                                   NULL);
@@ -1133,7 +1127,7 @@ register_item_transform_procs (GimpPDB *pdb)
                                      "\n"
                                      "If a selection exists and the item is a drawable, the portion of the 
drawable which lies under the selection is cut from the drawable and made into a floating selection which is 
then flipped. The axis to flip around is specified by specifying two points from that line. The return value 
is the ID of the flipped floating selection.\n"
                                      "\n"
-                                     "If there is no selection or the item is not a drawable, the entire 
item will be flipped around the specified axis. Additionally, if the item has its linked flag set to TRUE, 
all additional items contained in the image which have the linked flag set to TRUE will also be flipped 
around the same axis. The return value will be equal to the item ID supplied as input.\n"
+                                     "If there is no selection or the item is not a drawable, the entire 
item will be flipped around the specified axis. The return value will be equal to the item ID supplied as 
input.\n"
                                      "\n"
                                      "This procedure is affected by the following context setters: 
'gimp-context-set-interpolation', 'gimp-context-set-transform-direction', 
'gimp-context-set-transform-resize'.",
                                   NULL);
diff --git a/app/tools/gimpfliptool.c b/app/tools/gimpfliptool.c
index 855ae73f08..f25fe5c893 100644
--- a/app/tools/gimpfliptool.c
+++ b/app/tools/gimpfliptool.c
@@ -32,8 +32,8 @@
 #include "core/gimpguide.h"
 #include "core/gimpimage.h"
 #include "core/gimpimage-flip.h"
+#include "core/gimpimage-item-list.h"
 #include "core/gimpimage-pick-item.h"
-#include "core/gimpitem-linked.h"
 #include "core/gimplayer.h"
 #include "core/gimplayermask.h"
 #include "core/gimppickable.h"
@@ -416,30 +416,9 @@ gimp_flip_tool_transform (GimpTransformTool *tr_tool,
   else
     {
       /*  this happens for entire drawables, paths and layer groups  */
-
-      GList *iter;
-
-      for (iter = objects; iter; iter = iter->next)
-        {
-          GimpItem *item;
-
-          g_return_val_if_fail (GIMP_IS_ITEM (iter->data), NULL);
-
-          item = GIMP_ITEM (iter->data);
-
-          if (gimp_item_get_linked (item))
-            {
-              gimp_item_linked_flip (item, context,
-                                     flip_type, axis, clip_result);
-            }
-          else
-            {
-              clip_result = gimp_item_get_clip (item, clip_result);
-
-              gimp_item_flip (item, context,
-                              flip_type, axis, clip_result);
-            }
-        }
+      gimp_image_item_list_flip (gimp_item_get_image (objects->data),
+                                 objects, context,
+                                 flip_type, axis, clip_result);
     }
 
   return ret;
diff --git a/devel-docs/app/app-sections.txt b/devel-docs/app/app-sections.txt
index 527ce529bf..9baac6ab34 100644
--- a/devel-docs/app/app-sections.txt
+++ b/devel-docs/app/app-sections.txt
@@ -11423,7 +11423,6 @@ gimp_item_toggle_exclusive_visible
 <FILE>gimpitem-linked</FILE>
 <TITLE>GimpItem-linked</TITLE>
 gimp_item_linked_translate
-gimp_item_linked_flip
 gimp_item_linked_rotate
 gimp_item_linked_transform
 </SECTION>
diff --git a/libgimp/gimpitemtransform_pdb.c b/libgimp/gimpitemtransform_pdb.c
index 7dc305e949..ba18942265 100644
--- a/libgimp/gimpitemtransform_pdb.c
+++ b/libgimp/gimpitemtransform_pdb.c
@@ -105,10 +105,7 @@ gimp_item_transform_translate (GimpItem *item,
  * If there is no selection or the item is not a drawable, the entire
  * item will be flipped around its center if auto_center is set to
  * TRUE, otherwise the coordinate of the axis needs to be specified.
- * Additionally, if the item has its linked flag set to TRUE, all
- * additional items contained in the image which have the linked flag
- * set to TRUE will also be flipped around the same axis. The return
- * value will be equal to the item ID supplied as input.
+ * The return value will be equal to the item ID supplied as input.
  *
  * This procedure is affected by the following context setters:
  * gimp_context_set_transform_resize().
@@ -166,11 +163,8 @@ gimp_item_transform_flip_simple (GimpItem            *item,
  * The return value is the ID of the flipped floating selection.
  *
  * If there is no selection or the item is not a drawable, the entire
- * item will be flipped around the specified axis. Additionally, if the
- * item has its linked flag set to TRUE, all additional items contained
- * in the image which have the linked flag set to TRUE will also be
- * flipped around the same axis. The return value will be equal to the
- * item ID supplied as input.
+ * item will be flipped around the specified axis. The return value
+ * will be equal to the item ID supplied as input.
  *
  * This procedure is affected by the following context setters:
  * gimp_context_set_interpolation(),
diff --git a/pdb/groups/item_transform.pdb b/pdb/groups/item_transform.pdb
index 81ee4175ef..174df6d396 100644
--- a/pdb/groups/item_transform.pdb
+++ b/pdb/groups/item_transform.pdb
@@ -184,10 +184,7 @@ the ID of the flipped floating selection.
 If there is no selection or the item is not a drawable, the entire
 item will be flipped around its center if auto_center is set to TRUE,
 otherwise the coordinate of the axis needs to be specified.
-Additionally, if the item has its linked flag set to TRUE, all
-additional items contained in the image which have the linked flag set
-to TRUE will also be flipped around the same axis. The return value
-will be equal to the item ID supplied as input.
+The return value will be equal to the item ID supplied as input.
 
 
 This procedure is affected by the following context setters:
@@ -253,12 +250,6 @@ HELP
           else
             success = FALSE;
         }
-      else if (gimp_item_get_linked (item))
-        {
-          gimp_item_linked_flip (item, context,
-                                 flip_type, axis,
-                                 pdb_context->transform_resize);
-        }
       else
         {
           gimp_item_flip (item, context,
@@ -290,11 +281,8 @@ return value is the ID of the flipped floating selection.
 
 
 If there is no selection or the item is not a drawable, the entire
-item will be flipped around the specified axis. Additionally, if the
-item has its linked flag set to TRUE, all additional items contained
-in the image which have the linked flag set to TRUE will also be
-flipped around the same axis. The return value will be equal to the
-item ID supplied as input.
+item will be flipped around the specified axis.
+The return value will be equal to the item ID supplied as input.
 
 
 This procedure is affected by the following context setters:


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