mirror of https://github.com/GNOME/gimp.git
Make sure duplicated item groups end up at the right place
Use the actual parent item when adding to the image, not GIMP_IMAGE_ACTIVE_PARENT because the latter would add a duplicated group inside itself instead of above it
This commit is contained in:
parent
a53d4566da
commit
6f555cc407
|
@ -228,6 +228,7 @@ channels_duplicate_cmd_callback (GtkAction *action,
|
|||
{
|
||||
GimpImage *image;
|
||||
GimpChannel *new_channel;
|
||||
GimpChannel *parent = GIMP_IMAGE_ACTIVE_PARENT;
|
||||
|
||||
if (GIMP_IS_COMPONENT_EDITOR (data))
|
||||
{
|
||||
|
@ -261,10 +262,15 @@ channels_duplicate_cmd_callback (GtkAction *action,
|
|||
new_channel =
|
||||
GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
|
||||
G_TYPE_FROM_INSTANCE (channel)));
|
||||
|
||||
/* use the actual parent here, not GIMP_IMAGE_ACTIVE_PARENT because
|
||||
* the latter would add a duplicated group inside itself instead of
|
||||
* above it
|
||||
*/
|
||||
parent = GIMP_CHANNEL (gimp_viewable_get_parent (GIMP_VIEWABLE (channel)));
|
||||
}
|
||||
|
||||
gimp_image_add_channel (image, new_channel,
|
||||
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
|
||||
gimp_image_add_channel (image, new_channel, parent, -1, TRUE);
|
||||
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
|
|
@ -444,13 +444,19 @@ layers_duplicate_cmd_callback (GtkAction *action,
|
|||
GimpImage *image;
|
||||
GimpLayer *layer;
|
||||
GimpLayer *new_layer;
|
||||
GimpLayer *parent;
|
||||
return_if_no_layer (image, layer, data);
|
||||
|
||||
new_layer = GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (layer),
|
||||
G_TYPE_FROM_INSTANCE (layer)));
|
||||
|
||||
gimp_image_add_layer (image, new_layer,
|
||||
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
|
||||
/* use the actual parent here, not GIMP_IMAGE_ACTIVE_PARENT because
|
||||
* the latter would add a duplicated group inside itself instead of
|
||||
* above it
|
||||
*/
|
||||
parent = GIMP_LAYER (gimp_viewable_get_parent (GIMP_VIEWABLE (layer)));
|
||||
|
||||
gimp_image_add_layer (image, new_layer, parent, -1, TRUE);
|
||||
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
|
|
@ -248,13 +248,19 @@ vectors_duplicate_cmd_callback (GtkAction *action,
|
|||
GimpImage *image;
|
||||
GimpVectors *vectors;
|
||||
GimpVectors *new_vectors;
|
||||
GimpVectors *parent;
|
||||
return_if_no_vectors (image, vectors, data);
|
||||
|
||||
new_vectors = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
|
||||
G_TYPE_FROM_INSTANCE (vectors)));
|
||||
|
||||
gimp_image_add_vectors (image, new_vectors,
|
||||
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
|
||||
/* use the actual parent here, not GIMP_IMAGE_ACTIVE_PARENT because
|
||||
* the latter would add a duplicated group inside itself instead of
|
||||
* above it
|
||||
*/
|
||||
parent = GIMP_VECTORS (gimp_viewable_get_parent (GIMP_VIEWABLE (vectors)));
|
||||
|
||||
gimp_image_add_vectors (image, new_vectors, parent, -1, TRUE);
|
||||
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue