mirror of https://github.com/GNOME/gimp.git
Add get_parent() API for items, layers, channels and vectors
this is pretty pointless from an abstraction point of view, but using these functions will make the code a lot more readable by getting rid of tons of ugly casts to and from GimpViewable whenever getting an item's parent.
This commit is contained in:
parent
f2c56cb363
commit
e0224cdbfb
|
@ -1684,6 +1684,14 @@ gimp_channel_new_from_component (GimpImage *image,
|
|||
return channel;
|
||||
}
|
||||
|
||||
GimpChannel *
|
||||
gimp_channel_get_parent (GimpChannel *channel)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), NULL);
|
||||
|
||||
return GIMP_CHANNEL (gimp_viewable_get_parent (GIMP_VIEWABLE (channel)));
|
||||
}
|
||||
|
||||
void
|
||||
gimp_channel_set_color (GimpChannel *channel,
|
||||
const GimpRGB *color,
|
||||
|
|
|
@ -138,6 +138,8 @@ GimpChannel * gimp_channel_new_from_component (GimpImage *image,
|
|||
const gchar *name,
|
||||
const GimpRGB *color);
|
||||
|
||||
GimpChannel * gimp_channel_get_parent (GimpChannel *channel);
|
||||
|
||||
gdouble gimp_channel_get_opacity (const GimpChannel *channel);
|
||||
void gimp_channel_set_opacity (GimpChannel *channel,
|
||||
gdouble opacity,
|
||||
|
|
|
@ -689,6 +689,14 @@ gimp_item_is_attached (const GimpItem *item)
|
|||
return GIMP_ITEM_GET_CLASS (item)->is_attached (item);
|
||||
}
|
||||
|
||||
GimpItem *
|
||||
gimp_item_get_parent (GimpItem *item)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
||||
|
||||
return GIMP_ITEM (gimp_viewable_get_parent (GIMP_VIEWABLE (item)));
|
||||
}
|
||||
|
||||
GimpItemTree *
|
||||
gimp_item_get_tree (GimpItem *item)
|
||||
{
|
||||
|
|
|
@ -143,6 +143,8 @@ gboolean gimp_item_is_removed (const GimpItem *item);
|
|||
|
||||
gboolean gimp_item_is_attached (const GimpItem *item);
|
||||
|
||||
GimpItem * gimp_item_get_parent (GimpItem *item);
|
||||
|
||||
GimpItemTree * gimp_item_get_tree (GimpItem *item);
|
||||
GimpContainer * gimp_item_get_container (GimpItem *item);
|
||||
GList * gimp_item_get_container_iter (GimpItem *item);
|
||||
|
|
|
@ -1339,6 +1339,14 @@ gimp_layer_new_from_region (PixelRegion *region,
|
|||
return new_layer;
|
||||
}
|
||||
|
||||
GimpLayer *
|
||||
gimp_layer_get_parent (GimpLayer *layer)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
||||
|
||||
return GIMP_LAYER (gimp_viewable_get_parent (GIMP_VIEWABLE (layer)));
|
||||
}
|
||||
|
||||
GimpLayerMask *
|
||||
gimp_layer_get_mask (const GimpLayer *layer)
|
||||
{
|
||||
|
|
|
@ -96,6 +96,8 @@ GimpLayer * gimp_layer_new_from_region (PixelRegion *region,
|
|||
gdouble opacity,
|
||||
GimpLayerModeEffects mode);
|
||||
|
||||
GimpLayer * gimp_layer_get_parent (GimpLayer *layer);
|
||||
|
||||
GimpLayerMask * gimp_layer_get_mask (const GimpLayer *layer);
|
||||
GimpLayerMask * gimp_layer_create_mask (const GimpLayer *layer,
|
||||
GimpAddMaskType mask_type,
|
||||
|
|
|
@ -587,6 +587,14 @@ gimp_vectors_new (GimpImage *image,
|
|||
return vectors;
|
||||
}
|
||||
|
||||
GimpVectors *
|
||||
gimp_vectors_get_parent (GimpVectors *vectors)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), NULL);
|
||||
|
||||
return GIMP_VECTORS (gimp_viewable_get_parent (GIMP_VIEWABLE (vectors)));
|
||||
}
|
||||
|
||||
void
|
||||
gimp_vectors_freeze (GimpVectors *vectors)
|
||||
{
|
||||
|
|
|
@ -88,6 +88,8 @@ GType gimp_vectors_get_type (void) G_GNUC_CONST;
|
|||
GimpVectors * gimp_vectors_new (GimpImage *image,
|
||||
const gchar *name);
|
||||
|
||||
GimpVectors * gimp_vectors_get_parent (GimpVectors *vectors);
|
||||
|
||||
void gimp_vectors_freeze (GimpVectors *vectors);
|
||||
void gimp_vectors_thaw (GimpVectors *vectors);
|
||||
|
||||
|
@ -97,7 +99,6 @@ void gimp_vectors_add_strokes (const GimpVectors *src_vectors,
|
|||
GimpVectors *dest_vectors);
|
||||
|
||||
|
||||
|
||||
/* accessing / modifying the anchors */
|
||||
|
||||
GimpAnchor * gimp_vectors_anchor_get (const GimpVectors *vectors,
|
||||
|
|
Loading…
Reference in New Issue