[gimp] Revert almost all item tree related changed in this file
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Revert almost all item tree related changed in this file
- Date: Tue, 25 Aug 2009 19:31:31 +0000 (UTC)
commit 764af4879e0e73c2bbe3ba42cc89a67d8c71aa72
Author: Michael Natterer <mitch gimp org>
Date: Tue Aug 25 16:25:26 2009 +0200
Revert almost all item tree related changed in this file
Don't recursively duplicate all items. Instead, just duplicate the
items in the toplevel image containers, because group items duplicate
their children correctly all by themselves.
app/core/gimpimage-duplicate.c | 76 ++++-----------------------------------
1 files changed, 8 insertions(+), 68 deletions(-)
---
diff --git a/app/core/gimpimage-duplicate.c b/app/core/gimpimage-duplicate.c
index b3099ff..d7994f9 100644
--- a/app/core/gimpimage-duplicate.c
+++ b/app/core/gimpimage-duplicate.c
@@ -138,7 +138,7 @@ gimp_image_duplicate (GimpImage *image)
if (active_vectors)
gimp_image_set_active_vectors (new_image, active_vectors);
- /* Copy state of all color channels */
+ /* Copy state of all color components */
gimp_image_duplicate_components (image, new_image);
/* Copy any guides */
@@ -202,7 +202,6 @@ gimp_image_duplicate_layers (GimpImage *image,
{
GimpLayer *active_layer = NULL;
GimpLayer *floating_selection;
- GList *all_layers;
GList *list;
gint count;
@@ -212,9 +211,7 @@ gimp_image_duplicate_layers (GimpImage *image,
if (floating_selection)
*floating_sel_drawable = gimp_layer_get_floating_sel_drawable (floating_selection);
- all_layers = gimp_image_get_layer_list (image);
-
- for (list = all_layers, count = 0;
+ for (list = gimp_image_get_layer_iter (image), count = 0;
list;
list = g_list_next (list))
{
@@ -225,9 +222,6 @@ gimp_image_duplicate_layers (GimpImage *image,
new_image,
G_TYPE_FROM_INSTANCE (layer)));
- g_object_set_data (G_OBJECT (layer), "gimp-image-duplicate-item",
- new_layer);
-
/* Make sure the copied layer doesn't say: "<old layer> copy" */
gimp_object_set_name (GIMP_OBJECT (new_layer),
gimp_object_get_name (GIMP_OBJECT (layer)));
@@ -249,26 +243,10 @@ gimp_image_duplicate_layers (GimpImage *image,
*new_floating_sel_drawable = GIMP_DRAWABLE (new_layer);
if (*floating_layer != new_layer)
- {
- GimpViewable *parent;
- GimpLayer *new_parent = NULL;
-
- parent = gimp_viewable_get_parent (GIMP_VIEWABLE (layer));
-
- if (parent)
- new_parent = g_object_get_data (G_OBJECT (parent),
- "gimp-image-duplicate-item");
-
- gimp_image_add_layer (new_image, new_layer,
- new_parent, count++, FALSE);
- }
+ gimp_image_add_layer (new_image, new_layer,
+ NULL, count++, FALSE);
}
- for (list = all_layers; list; list = g_list_next (list))
- g_object_set_data (list->data, "gimp-image-duplicate-item", NULL);
-
- g_list_free (all_layers);
-
return active_layer;
}
@@ -279,28 +257,20 @@ gimp_image_duplicate_channels (GimpImage *image,
GimpDrawable **new_floating_sel_drawable)
{
GimpChannel *active_channel = NULL;
- GList *all_channels;
GList *list;
gint count;
- all_channels = gimp_image_get_channel_list (image);
-
- for (list = all_channels, count = 0;
+ for (list = gimp_image_get_channel_iter (image), count = 0;
list;
list = g_list_next (list))
{
GimpChannel *channel = list->data;
GimpChannel *new_channel;
- GimpViewable *parent;
- GimpChannel *new_parent = NULL;
new_channel = GIMP_CHANNEL (gimp_item_convert (GIMP_ITEM (channel),
new_image,
G_TYPE_FROM_INSTANCE (channel)));
- g_object_set_data (G_OBJECT (channel), "gimp-image-duplicate-item",
- new_channel);
-
/* Make sure the copied channel doesn't say: "<old channel> copy" */
gimp_object_set_name (GIMP_OBJECT (new_channel),
gimp_object_get_name (GIMP_OBJECT (channel)));
@@ -311,21 +281,10 @@ gimp_image_duplicate_channels (GimpImage *image,
if (floating_sel_drawable == GIMP_DRAWABLE (channel))
*new_floating_sel_drawable = GIMP_DRAWABLE (new_channel);
- parent = gimp_viewable_get_parent (GIMP_VIEWABLE (channel));
-
- if (parent)
- new_parent = g_object_get_data (G_OBJECT (parent),
- "gimp-image-duplicate-item");
-
gimp_image_add_channel (new_image, new_channel,
- new_parent, count++, FALSE);
+ NULL, count++, FALSE);
}
- for (list = all_channels; list; list = g_list_next (list))
- g_object_set_data (list->data, "gimp-image-duplicate-item", NULL);
-
- g_list_free (all_channels);
-
return active_channel;
}
@@ -334,28 +293,20 @@ gimp_image_duplicate_vectors (GimpImage *image,
GimpImage *new_image)
{
GimpVectors *active_vectors = NULL;
- GList *all_vectors;
GList *list;
gint count;
- all_vectors = gimp_image_get_vectors_list (image);
-
- for (list = all_vectors, count = 0;
+ for (list = gimp_image_get_vectors_iter (image), count = 0;
list;
list = g_list_next (list))
{
GimpVectors *vectors = list->data;
GimpVectors *new_vectors;
- GimpViewable *parent;
- GimpVectors *new_parent = NULL;
new_vectors = GIMP_VECTORS (gimp_item_convert (GIMP_ITEM (vectors),
new_image,
G_TYPE_FROM_INSTANCE (vectors)));
- g_object_set_data (G_OBJECT (vectors), "gimp-image-duplicate-item",
- new_vectors);
-
/* Make sure the copied vectors doesn't say: "<old vectors> copy" */
gimp_object_set_name (GIMP_OBJECT (new_vectors),
gimp_object_get_name (GIMP_OBJECT (vectors)));
@@ -363,21 +314,10 @@ gimp_image_duplicate_vectors (GimpImage *image,
if (gimp_image_get_active_vectors (image) == vectors)
active_vectors = new_vectors;
- parent = gimp_viewable_get_parent (GIMP_VIEWABLE (vectors));
-
- if (parent)
- new_parent = g_object_get_data (G_OBJECT (parent),
- "gimp-image-duplicate-item");
-
gimp_image_add_vectors (new_image, new_vectors,
- new_parent, count++, FALSE);
+ NULL, count++, FALSE);
}
- for (list = all_vectors; list; list = g_list_next (list))
- g_object_set_data (list->data, "gimp-image-duplicate-item", NULL);
-
- g_list_free (all_vectors);
-
return active_vectors;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]