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:
Michael Natterer 2009-08-23 18:44:05 +02:00
parent 34bccb0876
commit d52d7e77b3
4 changed files with 24 additions and 0 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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;
}

View File

@ -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__ */