[gimp/wip/Jehan/layers-dockable-refresh: 126/126] app: more removal of item link related code.




commit c0ea7b36695c968ba4e07136f1f1540324ab4c0f
Author: Jehan <jehan girinstud io>
Date:   Thu Dec 16 00:08:15 2021 +0100

    app: more removal of item link related code.
    
    - removing the GIMP_ITEM_SET_LINKED enum value.
    - removing gimp_image_item_list_linked(). Now we should directly use
      gimp_image_item_list_filter() instead.
    - "preview-linked" option for transform tools is no more.

 app/core/core-enums.c                |  2 --
 app/core/core-enums.h                |  1 -
 app/core/gimpimage-item-list.c       | 62 ------------------------------------
 app/core/gimpimage-item-list.h       |  3 --
 app/core/gimpitem.c                  |  3 --
 app/tools/gimptransformgridoptions.c | 18 -----------
 app/tools/gimptransformgridoptions.h |  1 -
 app/tools/gimptransformgridtool.c    | 11 +------
 app/tools/gimptransformtool.c        |  4 +--
 9 files changed, 3 insertions(+), 102 deletions(-)
---
diff --git a/app/core/core-enums.c b/app/core/core-enums.c
index c42d8258ac..f2d805d53c 100644
--- a/app/core/core-enums.c
+++ b/app/core/core-enums.c
@@ -831,7 +831,6 @@ gimp_item_set_get_type (void)
     { GIMP_ITEM_SET_ALL, "GIMP_ITEM_SET_ALL", "all" },
     { GIMP_ITEM_SET_IMAGE_SIZED, "GIMP_ITEM_SET_IMAGE_SIZED", "image-sized" },
     { GIMP_ITEM_SET_VISIBLE, "GIMP_ITEM_SET_VISIBLE", "visible" },
-    { GIMP_ITEM_SET_LINKED, "GIMP_ITEM_SET_LINKED", "linked" },
     { 0, NULL, NULL }
   };
 
@@ -841,7 +840,6 @@ gimp_item_set_get_type (void)
     { GIMP_ITEM_SET_ALL, NC_("item-set", "All layers"), NULL },
     { GIMP_ITEM_SET_IMAGE_SIZED, NC_("item-set", "Image-sized layers"), NULL },
     { GIMP_ITEM_SET_VISIBLE, NC_("item-set", "All visible layers"), NULL },
-    { GIMP_ITEM_SET_LINKED, NC_("item-set", "All linked layers"), NULL },
     { 0, NULL, NULL }
   };
 
diff --git a/app/core/core-enums.h b/app/core/core-enums.h
index 77145b5bf3..409605c50c 100644
--- a/app/core/core-enums.h
+++ b/app/core/core-enums.h
@@ -391,7 +391,6 @@ typedef enum  /*< pdb-skip >*/
   GIMP_ITEM_SET_ALL,         /*< desc="All layers"         >*/
   GIMP_ITEM_SET_IMAGE_SIZED, /*< desc="Image-sized layers" >*/
   GIMP_ITEM_SET_VISIBLE,     /*< desc="All visible layers" >*/
-  GIMP_ITEM_SET_LINKED       /*< desc="All linked layers"  >*/
 } GimpItemSet;
 
 
diff --git a/app/core/gimpimage-item-list.c b/app/core/gimpimage-item-list.c
index 445a8a50ea..7b705744b3 100644
--- a/app/core/gimpimage-item-list.c
+++ b/app/core/gimpimage-item-list.c
@@ -360,68 +360,6 @@ gimp_image_item_list_get_list (GimpImage        *image,
   return g_list_reverse (return_list);
 }
 
-/**
- * gimp_image_item_list_linked:
- * @image:
- * @items: the original list of items. This list is untouched.
- *
- * Returns: a newly allocated list of items, containing @items and their
- * linked items if relevant. Note that the returned list is also
- * filtered by removing redundant children, so the result may sometimes
- * be smaller than the original list.
- * The order of the list is not meaningful and not guaranteed to stay
- * the same even if the contents is not changed.
- */
-GList *
-gimp_image_item_list_linked (GimpImage *image,
-                             GList     *items)
-{
-  GList            *new_items = NULL;
-  GList            *iter;
-  GimpItemTypeMask  type   = 0;
-  gboolean          linked = FALSE;
-
-  g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
-  g_return_val_if_fail (g_list_length (items) > 0, NULL);
-
-  for (iter = items; iter; iter = iter->next)
-    {
-      GimpItem *item;
-
-      g_return_val_if_fail (GIMP_IS_ITEM (iter->data), NULL);
-      g_return_val_if_fail (image == gimp_item_get_image (iter->data), NULL);
-
-      item = iter->data;
-
-      if (gimp_item_get_linked (item))
-        linked = TRUE;
-
-      if (GIMP_IS_LAYER (item))
-        type |= GIMP_ITEM_TYPE_LAYERS;
-      else if (GIMP_IS_VECTORS (item))
-        type |= GIMP_ITEM_TYPE_VECTORS;
-      else if (GIMP_IS_CHANNEL (item))
-        type |= GIMP_ITEM_TYPE_CHANNELS;
-    }
-
-  if (linked)
-    {
-      new_items = gimp_image_item_list_get_list (image, type, GIMP_ITEM_SET_LINKED);
-
-      for (iter = items; iter; iter = iter->next)
-        if (! g_list_find (new_items, iter->data))
-          new_items = g_list_prepend (new_items, iter->data);
-    }
-  else
-    {
-      new_items = g_list_copy (items);
-    }
-
-  new_items = gimp_image_item_list_filter (new_items);
-
-  return new_items;
-}
-
 static GList *
 gimp_image_item_list_remove_children (GList          *list,
                                       const GimpItem *parent)
diff --git a/app/core/gimpimage-item-list.h b/app/core/gimpimage-item-list.h
index 24a45f4645..75472d14a7 100644
--- a/app/core/gimpimage-item-list.h
+++ b/app/core/gimpimage-item-list.h
@@ -57,9 +57,6 @@ GList    * gimp_image_item_list_get_list  (GimpImage              *image,
                                            GimpItemTypeMask        type,
                                            GimpItemSet             set);
 
-GList    * gimp_image_item_list_linked    (GimpImage              *image,
-                                           GList                  *items);
-
 GList    * gimp_image_item_list_filter    (GList                  *list);
 
 
diff --git a/app/core/gimpitem.c b/app/core/gimpitem.c
index 0731f9f818..fb236debab 100644
--- a/app/core/gimpitem.c
+++ b/app/core/gimpitem.c
@@ -2785,9 +2785,6 @@ gimp_item_is_in_set (GimpItem    *item,
 
     case GIMP_ITEM_SET_VISIBLE:
       return gimp_item_get_visible (item);
-
-    case GIMP_ITEM_SET_LINKED:
-      return gimp_item_get_linked (item);
     }
 
   return FALSE;
diff --git a/app/tools/gimptransformgridoptions.c b/app/tools/gimptransformgridoptions.c
index 1cfbc09458..a48b437053 100644
--- a/app/tools/gimptransformgridoptions.c
+++ b/app/tools/gimptransformgridoptions.c
@@ -51,7 +51,6 @@ enum
   PROP_DIRECTION_LINKED,
   PROP_SHOW_PREVIEW,
   PROP_COMPOSITED_PREVIEW,
-  PROP_PREVIEW_LINKED,
   PROP_SYNCHRONOUS_PREVIEW,
   PROP_PREVIEW_OPACITY,
   PROP_GRID_TYPE,
@@ -122,13 +121,6 @@ gimp_transform_grid_options_class_init (GimpTransformGridOptionsClass *klass)
                             FALSE,
                             GIMP_PARAM_STATIC_STRINGS);
 
-  GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_PREVIEW_LINKED,
-                            "preview-linked",
-                            _("Preview linked items"),
-                            _("Include linked items in the preview"),
-                            FALSE,
-                            GIMP_PARAM_STATIC_STRINGS);
-
   GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_SYNCHRONOUS_PREVIEW,
                             "synchronous-preview",
                             _("Synchronous preview"),
@@ -256,9 +248,6 @@ gimp_transform_grid_options_set_property (GObject      *object,
     case PROP_COMPOSITED_PREVIEW:
       options->composited_preview = g_value_get_boolean (value);
       break;
-    case PROP_PREVIEW_LINKED:
-      options->preview_linked = g_value_get_boolean (value);
-      break;
     case PROP_SYNCHRONOUS_PREVIEW:
       options->synchronous_preview = g_value_get_boolean (value);
       break;
@@ -330,9 +319,6 @@ gimp_transform_grid_options_get_property (GObject    *object,
     case PROP_COMPOSITED_PREVIEW:
       g_value_set_boolean (value, options->composited_preview);
       break;
-    case PROP_PREVIEW_LINKED:
-      g_value_set_boolean (value, options->preview_linked);
-      break;
     case PROP_SYNCHRONOUS_PREVIEW:
       g_value_set_boolean (value, options->synchronous_preview);
       break;
@@ -449,10 +435,6 @@ gimp_transform_grid_options_gui (GimpToolOptions *tool_options)
 
   vbox3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
 
-  button = gimp_prop_check_button_new (config, "preview-linked", NULL);
-  gtk_box_pack_start (GTK_BOX (vbox3), button, FALSE, FALSE, 0);
-  gtk_widget_show (button);
-
   button = gimp_prop_check_button_new (config, "synchronous-preview", NULL);
   gtk_box_pack_start (GTK_BOX (vbox3), button, FALSE, FALSE, 0);
   gtk_widget_show (button);
diff --git a/app/tools/gimptransformgridoptions.h b/app/tools/gimptransformgridoptions.h
index e20b2e8dec..3a45f35b76 100644
--- a/app/tools/gimptransformgridoptions.h
+++ b/app/tools/gimptransformgridoptions.h
@@ -40,7 +40,6 @@ struct _GimpTransformGridOptions
   gboolean              direction_linked;
   gboolean              show_preview;
   gboolean              composited_preview;
-  gboolean              preview_linked;
   gboolean              synchronous_preview;
   gdouble               preview_opacity;
   GimpGuidesType        grid_type;
diff --git a/app/tools/gimptransformgridtool.c b/app/tools/gimptransformgridtool.c
index 197f9ad356..899397ad7e 100644
--- a/app/tools/gimptransformgridtool.c
+++ b/app/tools/gimptransformgridtool.c
@@ -727,12 +727,6 @@ gimp_transform_grid_tool_options_notify (GimpTool         *tool,
           gimp_transform_grid_tool_update_preview (tg_tool);
         }
     }
-  else if (! strcmp (pspec->name, "preview-linked") &&
-           tg_tool->filters)
-    {
-      gimp_transform_grid_tool_update_filters (tg_tool);
-      gimp_transform_grid_tool_update_preview (tg_tool);
-    }
   else if (! strcmp (pspec->name, "interpolation") ||
            ! strcmp (pspec->name, "clip")          ||
            ! strcmp (pspec->name, "preview-opacity"))
@@ -1804,10 +1798,7 @@ gimp_transform_grid_tool_update_filters (GimpTransformGridTool *tg_tool)
   if (! tg_tool->filters)
     return;
 
-  if (options->preview_linked)
-    drawables = gimp_image_item_list_linked (image, tool->drawables);
-  else
-    drawables = gimp_image_item_list_filter (g_list_copy (tool->drawables));
+  drawables = gimp_image_item_list_filter (g_list_copy (tool->drawables));
 
   new_drawables = g_hash_table_new (g_direct_hash, g_direct_equal);
 
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index f4b15cb731..8a7f7234a1 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -221,7 +221,7 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
       /*  this happens for entire drawables, paths and layer groups  */
       g_return_val_if_fail (g_list_length (objects) > 0, NULL);
 
-      items = gimp_image_item_list_linked (gimp_item_get_image (objects->data), objects);
+      items = gimp_image_item_list_filter (g_list_copy (objects));
 
       gimp_image_item_list_transform (gimp_item_get_image (objects->data),
                                       items, context,
@@ -307,7 +307,7 @@ gimp_transform_tool_confirm (GimpTransformTool *tr_tool,
           selected_objects &&
           GIMP_IS_ITEM (selected_objects->data))
         {
-          objects = gimp_image_item_list_linked (image, selected_objects);
+          objects = gimp_image_item_list_filter (g_list_copy (selected_objects));
           g_list_free (selected_objects);
         }
       else


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