mirror of https://github.com/GNOME/gimp.git
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.
This commit is contained in:
parent
34bccb0876
commit
d52d7e77b3
|
@ -1642,6 +1642,17 @@ gimp_item_get_lock_content (const GimpItem *item)
|
|||
return item->lock_content;
|
||||
}
|
||||
|
||||
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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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__ */
|
||||
|
|
Loading…
Reference in New Issue