[gimp] Add API to determine whether "lock" properties can ba changed
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Add API to determine whether "lock" properties can ba changed
- Date: Sun, 23 Aug 2009 16:47:30 +0000 (UTC)
commit d52d7e77b3c58385cd2914fe518bf0b5050743c3
Author: Michael Natterer <mitch gimp org>
Date: Sun Aug 23 18:44:05 2009 +0200
Add API to determine whether "lock" properties can ba changed
Add gimp_item_can_lock_content() and gimp_layer_can_lock_alpha() which
return TRUE unless the item is a grop (has children), because group
items will be considered to have lock_content always TRUE and
lock_alpha always FALSE.
app/core/gimpitem.c | 11 +++++++++++
app/core/gimpitem.h | 1 +
app/core/gimplayer.c | 11 +++++++++++
app/core/gimplayer.h | 1 +
4 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpitem.c b/app/core/gimpitem.c
index 8205b50..9a71966 100644
--- a/app/core/gimpitem.c
+++ b/app/core/gimpitem.c
@@ -1643,6 +1643,17 @@ gimp_item_get_lock_content (const GimpItem *item)
}
gboolean
+gimp_item_can_lock_content (const GimpItem *item)
+{
+ g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
+
+ if (gimp_viewable_get_children (GIMP_VIEWABLE (item)))
+ return FALSE;
+
+ return TRUE;
+}
+
+gboolean
gimp_item_is_in_set (GimpItem *item,
GimpItemSet set)
{
diff --git a/app/core/gimpitem.h b/app/core/gimpitem.h
index 49ae46b..1e36ec4 100644
--- a/app/core/gimpitem.h
+++ b/app/core/gimpitem.h
@@ -277,6 +277,7 @@ void gimp_item_set_lock_content (GimpItem *item,
gboolean lock_content,
gboolean push_undo);
gboolean gimp_item_get_lock_content (const GimpItem *item);
+gboolean gimp_item_can_lock_content (const GimpItem *item);
gboolean gimp_item_is_in_set (GimpItem *item,
GimpItemSet set);
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index ce1bf23..bb79e02 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -2055,3 +2055,14 @@ gimp_layer_get_lock_alpha (const GimpLayer *layer)
return layer->lock_alpha;
}
+
+gboolean
+gimp_layer_can_lock_alpha (const GimpLayer *layer)
+{
+ g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
+
+ if (gimp_viewable_get_children (GIMP_VIEWABLE (layer)))
+ return FALSE;
+
+ return TRUE;
+}
diff --git a/app/core/gimplayer.h b/app/core/gimplayer.h
index b092b82..c45d245 100644
--- a/app/core/gimplayer.h
+++ b/app/core/gimplayer.h
@@ -136,6 +136,7 @@ void gimp_layer_set_lock_alpha (GimpLayer *layer,
gboolean lock_alpha,
gboolean push_undo);
gboolean gimp_layer_get_lock_alpha (const GimpLayer *layer);
+gboolean gimp_layer_can_lock_alpha (const GimpLayer *layer);
#endif /* __GIMP_LAYER_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]