[gimp] app: update the item visibility lock logics.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: update the item visibility lock logics.
- Date: Tue, 15 Feb 2022 21:08:36 +0000 (UTC)
commit 50496b8fb1d7ceb538c6bd7cec950920530054b0
Author: Jehan <jehan girinstud io>
Date: Tue Feb 15 21:08:07 2022 +0100
app: update the item visibility lock logics.
Unlike other locks, visibility lock is less useful for locking a whole
hierarchy of item and their children. On the other hand, being able to
lock a group visibility while editing the children visibility is quite
useful.
app/core/gimpitem-exclusive.c | 10 +++++-----
app/core/gimpitem.c | 22 +++++++++++++---------
app/core/gimpitem.h | 6 ++++--
3 files changed, 22 insertions(+), 16 deletions(-)
---
diff --git a/app/core/gimpitem-exclusive.c b/app/core/gimpitem-exclusive.c
index d449922c1c..301f2d9074 100644
--- a/app/core/gimpitem-exclusive.c
+++ b/app/core/gimpitem-exclusive.c
@@ -60,7 +60,7 @@ gimp_item_toggle_exclusive_visible (GimpItem *item,
(GimpItemIsEnabledFunc) gimp_item_is_visible,
(GimpItemSetFunc) gimp_item_set_visible,
NULL,
- (GimpItemIsPropLocked) gimp_item_is_visibility_locked,
+ (GimpItemIsPropLocked) gimp_item_get_lock_visibility,
(GimpItemUndoPush) gimp_image_undo_push_item_visibility,
_("Set Item Exclusive Visibility"),
GIMP_UNDO_GROUP_ITEM_VISIBILITY,
@@ -79,10 +79,10 @@ gimp_item_toggle_exclusive (GimpItem *item,
gboolean only_selected,
GimpContext *context)
{
- GList *ancestry;
- GList *on;
- GList *off;
- GList *list;
+ GList *ancestry;
+ GList *on;
+ GList *off;
+ GList *list;
g_return_if_fail (GIMP_IS_ITEM (item));
g_return_if_fail (gimp_item_is_attached (item));
diff --git a/app/core/gimpitem.c b/app/core/gimpitem.c
index 6918d3cb54..d2f4f016be 100644
--- a/app/core/gimpitem.c
+++ b/app/core/gimpitem.c
@@ -130,7 +130,8 @@ static gboolean gimp_item_real_is_content_locked (GimpItem *item,
static gboolean gimp_item_real_is_position_locked (GimpItem *item,
GimpItem **locked_item,
gboolean check_children);
-static gboolean gimp_item_real_is_visibility_locked (GimpItem *item);
+static gboolean gimp_item_real_is_visibility_locked (GimpItem *item,
+ GimpItem **locked_item);
static gboolean gimp_item_real_bounds (GimpItem *item,
gdouble *x,
gdouble *y,
@@ -514,13 +515,15 @@ gimp_item_real_is_position_locked (GimpItem *item,
}
static gboolean
-gimp_item_real_is_visibility_locked (GimpItem *item)
+gimp_item_real_is_visibility_locked (GimpItem *item,
+ GimpItem **locked_item)
{
- GimpItem *parent = gimp_item_get_parent (item);
+ /* Unlike other locks, the visibility lock does not propagate from
+ * parents or children.
+ */
- /* Locking visibility of a group item locks all child items. */
- if (parent && gimp_item_is_visibility_locked (parent))
- return TRUE;
+ if (GET_PRIVATE (item)->lock_visibility && locked_item)
+ *locked_item = item;
return GET_PRIVATE (item)->lock_visibility;
}
@@ -2320,7 +2323,7 @@ gimp_item_set_visible (GimpItem *item,
if (gimp_item_get_visible (item) != visible)
{
- if (gimp_item_is_visibility_locked (item))
+ if (gimp_item_is_visibility_locked (item, NULL))
{
return FALSE;
}
@@ -2591,11 +2594,12 @@ gimp_item_can_lock_visibility (GimpItem *item)
}
gboolean
-gimp_item_is_visibility_locked (GimpItem *item)
+gimp_item_is_visibility_locked (GimpItem *item,
+ GimpItem **locked_item)
{
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
- return GIMP_ITEM_GET_CLASS (item)->is_visibility_locked (item);
+ return GIMP_ITEM_GET_CLASS (item)->is_visibility_locked (item, locked_item);
}
gboolean
diff --git a/app/core/gimpitem.h b/app/core/gimpitem.h
index ef66e14893..2be9a355bf 100644
--- a/app/core/gimpitem.h
+++ b/app/core/gimpitem.h
@@ -57,7 +57,8 @@ struct _GimpItemClass
gboolean (* is_position_locked) (GimpItem *item,
GimpItem **locked_item,
gboolean checking_children);
- gboolean (* is_visibility_locked) (GimpItem *item);
+ gboolean (* is_visibility_locked) (GimpItem *item,
+ GimpItem **locked_item);
GimpItemTree * (* get_tree) (GimpItem *item);
gboolean (* bounds) (GimpItem *item,
gdouble *x,
@@ -392,7 +393,8 @@ void gimp_item_set_lock_visibility (GimpItem *item,
gboolean push_undo);
gboolean gimp_item_get_lock_visibility (GimpItem *item);
gboolean gimp_item_can_lock_visibility (GimpItem *item);
-gboolean gimp_item_is_visibility_locked (GimpItem *item);
+gboolean gimp_item_is_visibility_locked (GimpItem *item,
+ GimpItem **locked_item);
gboolean gimp_item_mask_bounds (GimpItem *item,
gint *x1,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]