[gimp] Make sure duplicated item groups end up at the right place
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Make sure duplicated item groups end up at the right place
- Date: Mon, 3 Aug 2009 21:21:10 +0000 (UTC)
commit 6f555cc4072f770f9ed3e203865dbb00afedefca
Author: Michael Natterer <mitch gimp org>
Date: Mon Aug 3 23:19:25 2009 +0200
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
app/actions/channels-commands.c | 10 ++++++++--
app/actions/layers-commands.c | 10 ++++++++--
app/actions/vectors-commands.c | 10 ++++++++--
3 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/app/actions/channels-commands.c b/app/actions/channels-commands.c
index 3580775..51e74a1 100644
--- a/app/actions/channels-commands.c
+++ b/app/actions/channels-commands.c
@@ -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);
}
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index 674a6a6..527d216 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -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);
}
diff --git a/app/actions/vectors-commands.c b/app/actions/vectors-commands.c
index 1f340b8..14a2db9 100644
--- a/app/actions/vectors-commands.c
+++ b/app/actions/vectors-commands.c
@@ -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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]