gimp r27200 - in trunk: . app/actions app/core app/display app/pdb app/text app/tools app/vectors app/widgets app/xcf tools/pdbgen/pdb



Author: mitch
Date: Thu Oct  9 19:40:41 2008
New Revision: 27200
URL: http://svn.gnome.org/viewvc/gimp?rev=27200&view=rev

Log:
2008-10-09  Michael Natterer  <mitch gimp org>

	Remove the last code duplication from the undo system (or if not
	the last then at least the most ugly):

	* app/core/gimpimage.[ch] (gimp_image_add_layer,channel,vectors):
	add "gboolean push_undo" parameter and add the item without
	touching undo if it's TRUE. Changed assertions from
	g_object_is_floating() to !gimp_item_is_attached() so they also
	take items from the undo stack and not only newly created ones.

	(gimp_image_remove_layer,channel,vectors): add "push_undo"
	parameter here too. Also add a "new_active" parameter where an
	optional new active item can be passed.

	(gimp_image_remove_layer,channel): these functions must not be
	called with push_undo=FALSE and a floating selection attached to
	the layer/channel. This can't currently happen; added warnings in
	case other code is changed and makes it happen anyway.

	* app/core/gimpchannelundo.c
	* app/core/gimplayerundo.c
	* app/vectors/gimpvectorsundo.c: use above functions to add/remove
	items instead of duplicating (parts of) their code. Pass
	push_undo=FALSE and the previously active item to the remove()
	functions.

	* app/actions/channels-commands.c
	* app/actions/edit-commands.c
	* app/actions/layers-commands.c
	* app/actions/vectors-commands.c
	* app/core/gimp-edit.c
	* app/core/gimpchannelundo.c
	* app/core/gimpimage-crop.c
	* app/core/gimpimage-duplicate.c
	* app/core/gimpimage-merge.c
	* app/core/gimpimage-quick-mask.c
	* app/core/gimpimage-scale.c
	* app/core/gimplayer-floating-sel.c
	* app/core/gimplayerundo.c
	* app/core/gimpselection.c
	* app/core/gimptemplate.c
	* app/display/gimpdisplayshell-dnd.c
	* app/text/gimptext-compat.c
	* app/tools/gimptexttool.c
	* app/tools/gimpvectortool.c
	* app/vectors/gimpvectors-import.c
	* app/vectors/gimpvectorsundo.c
	* app/widgets/gimpchanneltreeview.c
	* app/widgets/gimpitemtreeview.[ch]
	* app/widgets/gimplayertreeview.c
	* app/widgets/gimptoolbox-dnd.c
	* app/widgets/gimpvectorstreeview.c
	* app/xcf/xcf-load.c
	* tools/pdbgen/pdb/image.pdb
	* tools/pdbgen/pdb/paths.pdb: changed accordingly (pass TRUE
	unless it's a new image like when loading and XCF file).

	* app/pdb/image-cmds.c
	* app/pdb/paths-cmds.c: regenerated.



Modified:
   trunk/ChangeLog
   trunk/app/actions/channels-commands.c
   trunk/app/actions/edit-commands.c
   trunk/app/actions/layers-commands.c
   trunk/app/actions/vectors-commands.c
   trunk/app/core/gimp-edit.c
   trunk/app/core/gimpchannelundo.c
   trunk/app/core/gimpimage-crop.c
   trunk/app/core/gimpimage-duplicate.c
   trunk/app/core/gimpimage-merge.c
   trunk/app/core/gimpimage-quick-mask.c
   trunk/app/core/gimpimage-scale.c
   trunk/app/core/gimpimage.c
   trunk/app/core/gimpimage.h
   trunk/app/core/gimplayer-floating-sel.c
   trunk/app/core/gimplayerundo.c
   trunk/app/core/gimpselection.c
   trunk/app/core/gimptemplate.c
   trunk/app/display/gimpdisplayshell-dnd.c
   trunk/app/pdb/image-cmds.c
   trunk/app/pdb/paths-cmds.c
   trunk/app/text/gimptext-compat.c
   trunk/app/tools/gimptexttool.c
   trunk/app/tools/gimpvectortool.c
   trunk/app/vectors/gimpvectors-import.c
   trunk/app/vectors/gimpvectorsundo.c
   trunk/app/widgets/gimpchanneltreeview.c
   trunk/app/widgets/gimpitemtreeview.c
   trunk/app/widgets/gimpitemtreeview.h
   trunk/app/widgets/gimplayertreeview.c
   trunk/app/widgets/gimptoolbox-dnd.c
   trunk/app/widgets/gimpvectorstreeview.c
   trunk/app/xcf/xcf-load.c
   trunk/tools/pdbgen/pdb/image.pdb
   trunk/tools/pdbgen/pdb/paths.pdb

Modified: trunk/app/actions/channels-commands.c
==============================================================================
--- trunk/app/actions/channels-commands.c	(original)
+++ trunk/app/actions/channels-commands.c	Thu Oct  9 19:40:41 2008
@@ -166,7 +166,7 @@
                               action_data_get_context (data),
                               GIMP_TRANSPARENT_FILL);
 
-  gimp_image_add_channel (image, new_channel, -1);
+  gimp_image_add_channel (image, new_channel, -1, TRUE);
 
   gimp_image_undo_group_end (image);
 
@@ -262,7 +262,7 @@
                                            G_TYPE_FROM_INSTANCE (channel)));
     }
 
-  gimp_image_add_channel (image, new_channel, -1);
+  gimp_image_add_channel (image, new_channel, -1, TRUE);
   gimp_image_flush (image);
 }
 
@@ -274,7 +274,7 @@
   GimpChannel *channel;
   return_if_no_channel (image, channel, data);
 
-  gimp_image_remove_channel (image, channel);
+  gimp_image_remove_channel (image, channel, TRUE, NULL);
   gimp_image_flush (image);
 }
 
@@ -356,7 +356,7 @@
                                       GIMP_TRANSPARENT_FILL);
         }
 
-      gimp_image_add_channel (options->image, new_channel, -1);
+      gimp_image_add_channel (options->image, new_channel, -1, TRUE);
       gimp_image_flush (options->image);
     }
 

Modified: trunk/app/actions/edit-commands.c
==============================================================================
--- trunk/app/actions/edit-commands.c	(original)
+++ trunk/app/actions/edit-commands.c	Thu Oct  9 19:40:41 2008
@@ -339,7 +339,7 @@
                                          GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
       g_object_unref (buffer);
 
-      gimp_image_add_layer (image, layer, -1);
+      gimp_image_add_layer (image, layer, -1, TRUE);
 
       gimp_image_flush (image);
     }

Modified: trunk/app/actions/layers-commands.c
==============================================================================
--- trunk/app/actions/layers-commands.c	(original)
+++ trunk/app/actions/layers-commands.c	Thu Oct  9 19:40:41 2008
@@ -328,7 +328,7 @@
                               layer_fill_type);
   gimp_item_translate (GIMP_ITEM (new_layer), off_x, off_y, FALSE);
 
-  gimp_image_add_layer (image, new_layer, -1);
+  gimp_image_add_layer (image, new_layer, -1, TRUE);
 
   gimp_image_undo_group_end (image);
 
@@ -351,7 +351,7 @@
                                      gimp_image_base_type_with_alpha (image),
                                      _("Visible"),
                                      GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
-  gimp_image_add_layer (image, layer, -1);
+  gimp_image_add_layer (image, layer, -1, TRUE);
 
   gimp_image_flush (image);
 }
@@ -438,7 +438,7 @@
 
   new_layer = GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (layer),
                                                G_TYPE_FROM_INSTANCE (layer)));
-  gimp_image_add_layer (image, new_layer, -1);
+  gimp_image_add_layer (image, new_layer, -1, TRUE);
 
   gimp_image_flush (image);
 }
@@ -482,7 +482,7 @@
   if (gimp_layer_is_floating_sel (layer))
     floating_sel_remove (layer);
   else
-    gimp_image_remove_layer (image, layer);
+    gimp_image_remove_layer (image, layer, TRUE, NULL);
 
   gimp_image_flush (image);
 }
@@ -517,7 +517,7 @@
       gimp_item_offsets (GIMP_ITEM (layer), &x, &y);
       gimp_item_translate (GIMP_ITEM (vectors), x, y, FALSE);
 
-      gimp_image_add_vectors (image, vectors, -1);
+      gimp_image_add_vectors (image, vectors, -1, TRUE);
       gimp_image_set_active_vectors (image, vectors);
 
       gimp_image_flush (image);
@@ -545,7 +545,7 @@
 
       gimp_item_set_visible (GIMP_ITEM (new_vectors), TRUE, FALSE);
 
-      gimp_image_add_vectors (image, new_vectors, -1);
+      gimp_image_add_vectors (image, new_vectors, -1, TRUE);
       gimp_image_set_active_vectors (image, new_vectors);
 
       gimp_image_flush (image);
@@ -961,7 +961,7 @@
           gimp_drawable_fill_by_type (GIMP_DRAWABLE (layer),
                                       dialog->context,
                                       layer_fill_type);
-          gimp_image_add_layer (dialog->image, layer, -1);
+          gimp_image_add_layer (dialog->image, layer, -1, TRUE);
 
           gimp_image_flush (dialog->image);
         }

Modified: trunk/app/actions/vectors-commands.c
==============================================================================
--- trunk/app/actions/vectors-commands.c	(original)
+++ trunk/app/actions/vectors-commands.c	Thu Oct  9 19:40:41 2008
@@ -187,7 +187,7 @@
   new_vectors = gimp_vectors_new (image,
                                   vectors_name ? vectors_name : _("New Path"));
 
-  gimp_image_add_vectors (image, new_vectors, -1);
+  gimp_image_add_vectors (image, new_vectors, -1, TRUE);
 
   gimp_image_flush (image);
 }
@@ -251,7 +251,7 @@
 
   new_vectors = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
                                                    G_TYPE_FROM_INSTANCE (vectors)));
-  gimp_image_add_vectors (image, new_vectors, -1);
+  gimp_image_add_vectors (image, new_vectors, -1, TRUE);
   gimp_image_flush (image);
 }
 
@@ -263,7 +263,7 @@
   GimpVectors *vectors;
   return_if_no_vectors (image, vectors, data);
 
-  gimp_image_remove_vectors (image, vectors);
+  gimp_image_remove_vectors (image, vectors, TRUE, NULL);
   gimp_image_flush (image);
 }
 
@@ -603,7 +603,7 @@
 
       new_vectors = gimp_vectors_new (options->image, vectors_name);
 
-      gimp_image_add_vectors (options->image, new_vectors, -1);
+      gimp_image_add_vectors (options->image, new_vectors, -1, TRUE);
 
       gimp_image_flush (options->image);
     }

Modified: trunk/app/core/gimp-edit.c
==============================================================================
--- trunk/app/core/gimp-edit.c	(original)
+++ trunk/app/core/gimp-edit.c	Thu Oct  9 19:40:41 2008
@@ -272,7 +272,7 @@
   if (drawable)
     floating_sel_attach (layer, drawable);
   else
-    gimp_image_add_layer (image, layer, 0);
+    gimp_image_add_layer (image, layer, 0, TRUE);
 
   /*  end the group undo  */
   gimp_image_undo_group_end (image);
@@ -332,7 +332,7 @@
       return NULL;
     }
 
-  gimp_image_add_layer (image, layer, 0);
+  gimp_image_add_layer (image, layer, 0, TRUE);
 
   gimp_image_undo_enable (image);
 

Modified: trunk/app/core/gimpchannelundo.c
==============================================================================
--- trunk/app/core/gimpchannelundo.c	(original)
+++ trunk/app/core/gimpchannelundo.c	Thu Oct  9 19:40:41 2008
@@ -22,7 +22,6 @@
 
 #include "core-types.h"
 
-#include "gimpcontainer.h"
 #include "gimpimage.h"
 #include "gimpchannel.h"
 #include "gimpchannelundo.h"
@@ -193,17 +192,8 @@
       channel_undo->prev_position = gimp_image_get_channel_index (undo->image,
                                                                   channel);
 
-      gimp_container_remove (undo->image->channels, GIMP_OBJECT (channel));
-      gimp_item_removed (GIMP_ITEM (channel));
-
-      if (channel == gimp_image_get_active_channel (undo->image))
-        {
-          if (channel_undo->prev_channel)
-            gimp_image_set_active_channel (undo->image,
-                                           channel_undo->prev_channel);
-          else
-            gimp_image_unset_active_channel (undo->image);
-        }
+      gimp_image_remove_channel (undo->image, channel, FALSE,
+                                 channel_undo->prev_channel);
     }
   else
     {
@@ -212,9 +202,8 @@
       /*  record the active channel  */
       channel_undo->prev_channel = gimp_image_get_active_channel (undo->image);
 
-      gimp_container_insert (undo->image->channels, GIMP_OBJECT (channel),
-                             channel_undo->prev_position);
-      gimp_image_set_active_channel (undo->image, channel);
+      gimp_image_add_channel (undo->image, channel,
+                              channel_undo->prev_position, FALSE);
 
       GIMP_ITEM (channel)->removed = FALSE;
     }

Modified: trunk/app/core/gimpimage-crop.c
==============================================================================
--- trunk/app/core/gimpimage-crop.c	(original)
+++ trunk/app/core/gimpimage-crop.c	Thu Oct  9 19:40:41 2008
@@ -203,7 +203,7 @@
                                   -(lx1 - off_x),
                                   -(ly1 - off_y));
               else
-                gimp_image_remove_layer (image, GIMP_LAYER (item));
+                gimp_image_remove_layer (image, GIMP_LAYER (item), TRUE, NULL);
             }
         }
 

Modified: trunk/app/core/gimpimage-duplicate.c
==============================================================================
--- trunk/app/core/gimpimage-duplicate.c	(original)
+++ trunk/app/core/gimpimage-duplicate.c	Thu Oct  9 19:40:41 2008
@@ -137,7 +137,7 @@
         new_floating_sel_drawable = GIMP_DRAWABLE (new_layer);
 
       if (floating_layer != new_layer)
-        gimp_image_add_layer (new_image, new_layer, count++);
+        gimp_image_add_layer (new_image, new_layer, count++, FALSE);
     }
 
   /*  Copy the channels  */
@@ -162,7 +162,7 @@
       if (floating_sel_drawable == GIMP_DRAWABLE (channel))
         new_floating_sel_drawable = GIMP_DRAWABLE (new_channel);
 
-      gimp_image_add_channel (new_image, new_channel, count++);
+      gimp_image_add_channel (new_image, new_channel, count++, FALSE);
     }
 
   /*  Copy any vectors  */
@@ -184,7 +184,7 @@
       if (gimp_image_get_active_vectors (image) == vectors)
         active_vectors = new_vectors;
 
-      gimp_image_add_vectors (new_image, new_vectors, count++);
+      gimp_image_add_vectors (new_image, new_vectors, count++, FALSE);
     }
 
   /*  Copy the selection mask  */

Modified: trunk/app/core/gimpimage-merge.c
==============================================================================
--- trunk/app/core/gimpimage-merge.c	(original)
+++ trunk/app/core/gimpimage-merge.c	Thu Oct  9 19:40:41 2008
@@ -119,7 +119,7 @@
           GSList *list;
 
           for (list = invisible_list; list; list = g_slist_next (list))
-            gimp_image_remove_layer (image, list->data);
+            gimp_image_remove_layer (image, list->data, TRUE, NULL);
 
           gimp_image_undo_group_end (image);
           g_slist_free (invisible_list);
@@ -260,14 +260,14 @@
       target_vectors = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
                                                           GIMP_TYPE_VECTORS));
       pos = gimp_image_get_vectors_index (image, vectors);
-      gimp_image_remove_vectors (image, vectors);
+      gimp_image_remove_vectors (image, vectors, TRUE, NULL);
       cur_item = cur_item->next;
 
       while (cur_item)
         {
           vectors = GIMP_VECTORS (cur_item->data);
           gimp_vectors_add_strokes (vectors, target_vectors);
-          gimp_image_remove_vectors (image, vectors);
+          gimp_image_remove_vectors (image, vectors, TRUE, NULL);
 
           cur_item = g_slist_next (cur_item);
         }
@@ -276,7 +276,7 @@
 
       g_slist_free (merge_list);
 
-      gimp_image_add_vectors (image, target_vectors, pos);
+      gimp_image_add_vectors (image, target_vectors, pos, TRUE);
       gimp_unset_busy (image->gimp);
 
       gimp_image_undo_group_end (image);
@@ -574,7 +574,7 @@
                        active,
                        operation);
 
-      gimp_image_remove_layer (image, layer);
+      gimp_image_remove_layer (image, layer, TRUE, NULL);
 
       reverse_list = g_slist_next (reverse_list);
     }
@@ -590,16 +590,18 @@
           layer = list->data;
 
           list = g_list_next (list);
-          gimp_image_remove_layer (image, layer);
+          gimp_image_remove_layer (image, layer, TRUE, NULL);
         }
 
-      gimp_image_add_layer (image, merge_layer, position);
+      gimp_image_add_layer (image, merge_layer, position, TRUE);
     }
   else
     {
       /*  Add the layer to the image  */
-      gimp_image_add_layer (image, merge_layer,
-         gimp_container_num_children (image->layers) - position + 1);
+      gimp_image_add_layer
+        (image, merge_layer,
+         gimp_container_num_children (image->layers) - position + 1,
+         TRUE);
     }
 
   /* set the name after the original layers have been removed so we

Modified: trunk/app/core/gimpimage-quick-mask.c
==============================================================================
--- trunk/app/core/gimpimage-quick-mask.c	(original)
+++ trunk/app/core/gimpimage-quick-mask.c	Thu Oct  9 19:40:41 2008
@@ -117,7 +117,7 @@
           if (image->quick_mask_inverted)
             gimp_channel_invert (mask, FALSE);
 
-          gimp_image_add_channel (image, mask, 0);
+          gimp_image_add_channel (image, mask, 0, TRUE);
 
           gimp_image_undo_group_end (image);
         }
@@ -138,7 +138,7 @@
             floating_sel_anchor (floating_sel);
 
           gimp_selection_load (gimp_image_get_mask (image), mask);
-          gimp_image_remove_channel (image, mask);
+          gimp_image_remove_channel (image, mask, TRUE, NULL);
 
           if (! channel_was_active)
             gimp_image_unset_active_channel (image);

Modified: trunk/app/core/gimpimage-scale.c
==============================================================================
--- trunk/app/core/gimpimage-scale.c	(original)
+++ trunk/app/core/gimpimage-scale.c	Thu Oct  9 19:40:41 2008
@@ -173,7 +173,7 @@
     {
       GimpLayer *layer = list->data;
 
-      gimp_image_remove_layer (image, layer);
+      gimp_image_remove_layer (image, layer, TRUE, NULL);
     }
 
   g_list_free (remove);

Modified: trunk/app/core/gimpimage.c
==============================================================================
--- trunk/app/core/gimpimage.c	(original)
+++ trunk/app/core/gimpimage.c	Thu Oct  9 19:40:41 2008
@@ -2854,7 +2854,8 @@
 gboolean
 gimp_image_add_layer (GimpImage *image,
                       GimpLayer *layer,
-                      gint       position)
+                      gint       position,
+                      gboolean   push_undo)
 {
   GimpLayer *active_layer;
   GimpLayer *floating_sel;
@@ -2862,7 +2863,7 @@
 
   g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
   g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
-  g_return_val_if_fail (g_object_is_floating (layer), FALSE);
+  g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (layer)), FALSE);
   g_return_val_if_fail (gimp_item_get_image (GIMP_ITEM (layer)) == image,
                         FALSE);
 
@@ -2872,10 +2873,11 @@
 
   old_has_alpha = gimp_image_has_alpha (image);
 
-  gimp_image_undo_push_layer_add (image, _("Add Layer"),
-                                  layer, active_layer);
+  if (push_undo)
+    gimp_image_undo_push_layer_add (image, _("Add Layer"),
+                                    layer, active_layer);
 
-  /*  If the layer is a floating selection, set the ID  */
+  /*  If the layer is a floating selection, set the fs pointer  */
   if (gimp_layer_is_floating_sel (layer))
     image->floating_sel = layer;
 
@@ -2907,7 +2909,7 @@
   gimp_image_set_active_layer (image, layer);
 
   if (old_has_alpha != gimp_image_has_alpha (image))
-    gimp_image_alpha_changed (image);
+    image->flush_accum.alpha_changed = TRUE;
 
   if (gimp_layer_is_floating_sel (layer))
     gimp_image_floating_selection_changed (image);
@@ -2917,7 +2919,9 @@
 
 void
 gimp_image_remove_layer (GimpImage *image,
-                         GimpLayer *layer)
+                         GimpLayer *layer,
+                         gboolean   push_undo,
+                         GimpLayer *new_active)
 {
   GimpLayer *active_layer;
   gint       index;
@@ -2931,6 +2935,14 @@
 
   if (gimp_drawable_has_floating_sel (GIMP_DRAWABLE (layer)))
     {
+      if (! push_undo)
+        {
+          g_warning ("%s() was called from an undo function while the layer "
+                     "had a floating selection. Please report this at "
+                     "http://www.gimp.org/bugs/";, G_STRFUNC);
+          return;
+        }
+
       gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_ITEM_REMOVE,
                                    _("Remove Layer"));
       undo_group = TRUE;
@@ -2945,8 +2957,9 @@
 
   old_has_alpha = gimp_image_has_alpha (image);
 
-  gimp_image_undo_push_layer_remove (image, _("Remove Layer"),
-                                     layer, index, active_layer);
+  if (push_undo)
+    gimp_image_undo_push_layer_remove (image, _("Remove Layer"),
+                                       layer, index, active_layer);
 
   g_object_ref (layer);
 
@@ -2970,7 +2983,11 @@
     }
   else if (layer == active_layer)
     {
-      if (image->layer_stack)
+      if (new_active)
+        {
+          active_layer = new_active;
+        }
+      else if (image->layer_stack)
         {
           active_layer = image->layer_stack->data;
         }
@@ -2999,7 +3016,7 @@
   g_object_unref (layer);
 
   if (old_has_alpha != gimp_image_has_alpha (image))
-    gimp_image_alpha_changed (image);
+    image->flush_accum.alpha_changed = TRUE;
 
   if (undo_group)
     gimp_image_undo_group_end (image);
@@ -3063,7 +3080,7 @@
 
       gimp_item_translate (new_item, offset_x, offset_y, FALSE);
 
-      gimp_image_add_layer (image, GIMP_LAYER (new_item), position);
+      gimp_image_add_layer (image, GIMP_LAYER (new_item), position, TRUE);
       position++;
     }
 
@@ -3194,20 +3211,22 @@
 gboolean
 gimp_image_add_channel (GimpImage   *image,
                         GimpChannel *channel,
-                        gint         position)
+                        gint         position,
+                        gboolean     push_undo)
 {
   GimpChannel *active_channel;
 
   g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
   g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
-  g_return_val_if_fail (g_object_is_floating (channel), FALSE);
+  g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (channel)), FALSE);
   g_return_val_if_fail (gimp_item_get_image (GIMP_ITEM (channel)) == image,
                         FALSE);
 
   active_channel = gimp_image_get_active_channel (image);
 
-  gimp_image_undo_push_channel_add (image, _("Add Channel"),
-                                    channel, active_channel);
+  if (push_undo)
+    gimp_image_undo_push_channel_add (image, _("Add Channel"),
+                                      channel, active_channel);
 
   /*  add the layer to the list at the specified position  */
   if (position == -1)
@@ -3235,7 +3254,9 @@
 
 void
 gimp_image_remove_channel (GimpImage   *image,
-                           GimpChannel *channel)
+                           GimpChannel *channel,
+                           gboolean     push_undo,
+                           GimpChannel *new_active)
 {
   GimpChannel *active_channel;
   gint         index;
@@ -3248,6 +3269,14 @@
 
   if (gimp_drawable_has_floating_sel (GIMP_DRAWABLE (channel)))
     {
+      if (! push_undo)
+        {
+          g_warning ("%s() was called from an undo function while the channel "
+                     "had a floating selection. Please report this at "
+                     "http://www.gimp.org/bugs/";, G_STRFUNC);
+          return;
+        }
+
       gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_ITEM_REMOVE,
                                    _("Remove Channel"));
       undo_group = TRUE;
@@ -3260,8 +3289,9 @@
   index = gimp_container_get_child_index (image->channels,
                                           GIMP_OBJECT (channel));
 
-  gimp_image_undo_push_channel_remove (image, _("Remove Channel"),
-                                       channel, index, active_channel);
+  if (push_undo)
+    gimp_image_undo_push_channel_remove (image, _("Remove Channel"),
+                                         channel, index, active_channel);
 
   g_object_ref (channel);
 
@@ -3270,21 +3300,31 @@
 
   if (channel == active_channel)
     {
-      gint n_children = gimp_container_num_children (image->channels);
-
-      if (n_children > 0)
+      if (new_active)
         {
-          index = CLAMP (index, 0, n_children - 1);
-
-          active_channel = (GimpChannel *)
-            gimp_container_get_child_by_index (image->channels, index);
-
-          gimp_image_set_active_channel (image, active_channel);
+          active_channel = new_active;
         }
       else
         {
-          gimp_image_unset_active_channel (image);
+          gint n_children = gimp_container_num_children (image->channels);
+
+          if (n_children > 0)
+            {
+              index = CLAMP (index, 0, n_children - 1);
+
+              active_channel = (GimpChannel *)
+                gimp_container_get_child_by_index (image->channels, index);
+            }
+          else
+            {
+              active_channel = NULL;
+            }
         }
+
+      if (active_channel)
+        gimp_image_set_active_channel (image, active_channel);
+      else
+        gimp_image_unset_active_channel (image);
     }
 
   g_object_unref (channel);
@@ -3417,20 +3457,22 @@
 gboolean
 gimp_image_add_vectors (GimpImage   *image,
                         GimpVectors *vectors,
-                        gint         position)
+                        gint         position,
+                        gboolean     push_undo)
 {
   GimpVectors *active_vectors;
 
   g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
   g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
-  g_return_val_if_fail (g_object_is_floating (vectors), FALSE);
+  g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (vectors)), FALSE);
   g_return_val_if_fail (gimp_item_get_image (GIMP_ITEM (vectors)) == image,
                         FALSE);
 
   active_vectors = gimp_image_get_active_vectors (image);
 
-  gimp_image_undo_push_vectors_add (image, _("Add Path"),
-                                    vectors, active_vectors);
+  if (push_undo)
+    gimp_image_undo_push_vectors_add (image, _("Add Path"),
+                                      vectors, active_vectors);
 
   /*  add the layer to the list at the specified position  */
   if (position == -1)
@@ -3458,7 +3500,9 @@
 
 void
 gimp_image_remove_vectors (GimpImage   *image,
-                           GimpVectors *vectors)
+                           GimpVectors *vectors,
+                           gboolean     push_undo,
+                           GimpVectors *new_active)
 {
   GimpVectors *active_vectors;
   gint         index;
@@ -3473,8 +3517,9 @@
   index = gimp_container_get_child_index (image->vectors,
                                           GIMP_OBJECT (vectors));
 
-  gimp_image_undo_push_vectors_remove (image, _("Remove Path"),
-                                       vectors, index, active_vectors);
+  if (push_undo)
+    gimp_image_undo_push_vectors_remove (image, _("Remove Path"),
+                                         vectors, index, active_vectors);
 
   g_object_ref (vectors);
 
@@ -3483,18 +3528,25 @@
 
   if (vectors == active_vectors)
     {
-      gint n_children = gimp_container_num_children (image->vectors);
-
-      if (n_children > 0)
+      if (new_active)
         {
-          index = CLAMP (index, 0, n_children - 1);
-
-          active_vectors = (GimpVectors *)
-            gimp_container_get_child_by_index (image->vectors, index);
+          active_vectors = new_active;
         }
       else
         {
-          active_vectors = NULL;
+          gint n_children = gimp_container_num_children (image->vectors);
+
+          if (n_children > 0)
+            {
+              index = CLAMP (index, 0, n_children - 1);
+
+              active_vectors = (GimpVectors *)
+                gimp_container_get_child_by_index (image->vectors, index);
+            }
+          else
+            {
+              active_vectors = NULL;
+            }
         }
 
       gimp_image_set_active_vectors (image, active_vectors);

Modified: trunk/app/core/gimpimage.h
==============================================================================
--- trunk/app/core/gimpimage.h	(original)
+++ trunk/app/core/gimpimage.h	Thu Oct  9 19:40:41 2008
@@ -458,9 +458,12 @@
 
 gboolean        gimp_image_add_layer             (GimpImage          *image,
                                                   GimpLayer          *layer,
-                                                  gint                position);
+                                                  gint                position,
+                                                  gboolean            push_undo);
 void            gimp_image_remove_layer          (GimpImage          *image,
-                                                  GimpLayer          *layer);
+                                                  GimpLayer          *layer,
+                                                  gboolean            push_undo,
+                                                  GimpLayer          *new_active);
 
 void            gimp_image_add_layers            (GimpImage          *image,
                                                   GList              *layers,
@@ -489,9 +492,12 @@
 
 gboolean        gimp_image_add_channel           (GimpImage          *image,
                                                   GimpChannel        *channel,
-                                                  gint                position);
+                                                  gint                position,
+                                                  gboolean            push_undo);
 void            gimp_image_remove_channel        (GimpImage          *image,
-                                                  GimpChannel        *channel);
+                                                  GimpChannel        *channel,
+                                                  gboolean            push_undo,
+                                                  GimpChannel        *new_active);
 
 gboolean        gimp_image_raise_channel         (GimpImage          *image,
                                                   GimpChannel        *channel,
@@ -511,9 +517,12 @@
 
 gboolean        gimp_image_add_vectors           (GimpImage          *image,
                                                   GimpVectors        *vectors,
-                                                  gint                position);
+                                                  gint                position,
+                                                  gboolean            push_undo);
 void            gimp_image_remove_vectors        (GimpImage          *image,
-                                                  GimpVectors        *vectors);
+                                                  GimpVectors        *vectors,
+                                                  gboolean            push_undo,
+                                                  GimpVectors        *new_active);
 
 gboolean        gimp_image_raise_vectors         (GimpImage          *image,
                                                   GimpVectors        *vectors,

Modified: trunk/app/core/gimplayer-floating-sel.c
==============================================================================
--- trunk/app/core/gimplayer-floating-sel.c	(original)
+++ trunk/app/core/gimplayer-floating-sel.c	Thu Oct  9 19:40:41 2008
@@ -79,7 +79,7 @@
                                               gimp_drawable_bytes (drawable));
 
   /*  add the layer to the image  */
-  gimp_image_add_layer (image, layer, 0);
+  gimp_image_add_layer (image, layer, 0, TRUE);
 
   /*  store the affected area from the drawable in the backing store  */
   floating_sel_rigor (layer, TRUE);
@@ -109,7 +109,7 @@
   gimp_viewable_invalidate_preview (GIMP_VIEWABLE (layer));
 
   /*  remove the layer from the image  */
-  gimp_image_remove_layer (image, layer);
+  gimp_image_remove_layer (image, layer, TRUE, NULL);
 
   gimp_image_undo_group_end (image);
 }
@@ -148,7 +148,7 @@
   drawable = layer->fs.drawable;
 
   /*  remove the floating selection  */
-  gimp_image_remove_layer (image, layer);
+  gimp_image_remove_layer (image, layer, TRUE, NULL);
 
   /*  end the group undo  */
   gimp_image_undo_group_end (image);

Modified: trunk/app/core/gimplayerundo.c
==============================================================================
--- trunk/app/core/gimplayerundo.c	(original)
+++ trunk/app/core/gimplayerundo.c	Thu Oct  9 19:40:41 2008
@@ -22,10 +22,8 @@
 
 #include "core-types.h"
 
-#include "gimpcontainer.h"
 #include "gimpimage.h"
 #include "gimplayer.h"
-#include "gimplayer-floating-sel.h"
 #include "gimplayerundo.h"
 
 
@@ -197,44 +195,8 @@
       layer_undo->prev_position = gimp_image_get_layer_index (undo->image,
                                                               layer);
 
-      gimp_container_remove (undo->image->layers, GIMP_OBJECT (layer));
-      undo->image->layer_stack = g_slist_remove (undo->image->layer_stack,
-                                                 layer);
-
-      if (gimp_layer_is_floating_sel (layer))
-        {
-          /*  invalidate the boundary *before* setting the
-           *  floating_sel pointer to NULL because the selection's
-           *  outline is affected by the floating_sel and won't be
-           *  completely cleared otherwise (bug #160247).
-           */
-          gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (layer));
-
-          undo->image->floating_sel = NULL;
-
-          /*  activate the underlying drawable  */
-          floating_sel_activate_drawable (layer);
-
-          gimp_image_floating_selection_changed (undo->image);
-        }
-      else if (layer == gimp_image_get_active_layer (undo->image))
-        {
-          if (layer_undo->prev_layer)
-            {
-              gimp_image_set_active_layer (undo->image, layer_undo->prev_layer);
-            }
-          else if (undo->image->layer_stack)
-            {
-              gimp_image_set_active_layer (undo->image,
-                                           undo->image->layer_stack->data);
-            }
-          else
-            {
-              gimp_image_set_active_layer (undo->image, NULL);
-            }
-        }
-
-      gimp_item_removed (GIMP_ITEM (layer));
+      gimp_image_remove_layer (undo->image, layer, FALSE,
+                               layer_undo->prev_layer);
     }
   else
     {
@@ -243,16 +205,8 @@
       /*  record the active layer  */
       layer_undo->prev_layer = gimp_image_get_active_layer (undo->image);
 
-      /*  if this is a floating selection, set the fs pointer  */
-      if (gimp_layer_is_floating_sel (layer))
-        undo->image->floating_sel = layer;
-
-      gimp_container_insert (undo->image->layers,
-                             GIMP_OBJECT (layer), layer_undo->prev_position);
-      gimp_image_set_active_layer (undo->image, layer);
-
-      if (gimp_layer_is_floating_sel (layer))
-        gimp_image_floating_selection_changed (undo->image);
+      gimp_image_add_layer (undo->image, layer,
+                            layer_undo->prev_position, FALSE);
 
       GIMP_ITEM (layer)->removed = FALSE;
 

Modified: trunk/app/core/gimpselection.c
==============================================================================
--- trunk/app/core/gimpselection.c	(original)
+++ trunk/app/core/gimpselection.c	Thu Oct  9 19:40:41 2008
@@ -587,7 +587,7 @@
   /*  saved selections are not visible by default  */
   gimp_item_set_visible (GIMP_ITEM (new_channel), FALSE, FALSE);
 
-  gimp_image_add_channel (image, new_channel, -1);
+  gimp_image_add_channel (image, new_channel, -1, TRUE);
 
   return new_channel;
 }
@@ -766,7 +766,8 @@
               if (gimp_layer_is_floating_sel (GIMP_LAYER (pickable)))
                 floating_sel_remove (GIMP_LAYER (pickable));
               else
-                gimp_image_remove_layer (image, GIMP_LAYER (pickable));
+                gimp_image_remove_layer (image, GIMP_LAYER (pickable),
+                                         TRUE, NULL);
             }
           else if (GIMP_IS_LAYER_MASK (pickable))
             {
@@ -775,7 +776,8 @@
             }
           else if (GIMP_IS_CHANNEL (pickable))
             {
-              gimp_image_remove_channel (image, GIMP_CHANNEL (pickable));
+              gimp_image_remove_channel (image, GIMP_CHANNEL (pickable),
+                                         TRUE, NULL);
             }
         }
     }

Modified: trunk/app/core/gimptemplate.c
==============================================================================
--- trunk/app/core/gimptemplate.c	(original)
+++ trunk/app/core/gimptemplate.c	Thu Oct  9 19:40:41 2008
@@ -408,7 +408,7 @@
   gimp_drawable_fill_by_type (GIMP_DRAWABLE (layer),
                               context, template->fill_type);
 
-  gimp_image_add_layer (image, layer, 0);
+  gimp_image_add_layer (image, layer, 0, FALSE);
 
   gimp_image_undo_enable (image);
   gimp_image_clean_all (image);

Modified: trunk/app/display/gimpdisplayshell-dnd.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-dnd.c	(original)
+++ trunk/app/display/gimpdisplayshell-dnd.c	Thu Oct  9 19:40:41 2008
@@ -260,7 +260,7 @@
       gimp_item_set_visible (new_item, TRUE, FALSE);
       gimp_item_set_linked (new_item, FALSE, FALSE);
 
-      gimp_image_add_layer (image, new_layer, -1);
+      gimp_image_add_layer (image, new_layer, -1, TRUE);
 
       gimp_image_undo_group_end (image);
 
@@ -300,7 +300,7 @@
       gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_EDIT_PASTE,
                                    _("Drop New Path"));
 
-      gimp_image_add_vectors (image, new_vectors, -1);
+      gimp_image_add_vectors (image, new_vectors, -1, TRUE);
 
       gimp_image_undo_group_end (image);
 
@@ -571,7 +571,7 @@
 
       gimp_display_shell_dnd_position_item (shell, new_item);
 
-      gimp_image_add_layer (dest_image, new_layer, -1);
+      gimp_image_add_layer (dest_image, new_layer, -1, TRUE);
 
       gimp_image_undo_group_end (dest_image);
 
@@ -643,7 +643,7 @@
       if (! new_image)
         gimp_display_shell_dnd_position_item (shell, new_item);
 
-      gimp_image_add_layer (image, new_layer, -1);
+      gimp_image_add_layer (image, new_layer, -1, TRUE);
 
       gimp_image_undo_group_end (image);
 

Modified: trunk/app/pdb/image-cmds.c
==============================================================================
--- trunk/app/pdb/image-cmds.c	(original)
+++ trunk/app/pdb/image-cmds.c	Thu Oct  9 19:40:41 2008
@@ -915,7 +915,7 @@
                                        GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (layer))),
                                        error))
         {
-          success = gimp_image_add_layer (image, layer, MAX (position, -1));
+          success = gimp_image_add_layer (image, layer, MAX (position, -1), TRUE);
         }
       else
         {
@@ -945,7 +945,7 @@
   if (success)
     {
       if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
-        gimp_image_remove_layer (image, layer);
+        gimp_image_remove_layer (image, layer, TRUE, NULL);
       else
         success = FALSE;
     }
@@ -1105,7 +1105,7 @@
     {
       if (gimp_pdb_item_is_floating (GIMP_ITEM (channel), image, error))
         {
-          success = gimp_image_add_channel (image, channel, MAX (position, -1));
+          success = gimp_image_add_channel (image, channel, MAX (position, -1), TRUE);
         }
       else
         {
@@ -1135,7 +1135,7 @@
   if (success)
     {
       if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), error))
-        gimp_image_remove_channel (image, channel);
+        gimp_image_remove_channel (image, channel, TRUE, NULL);
       else
         success = FALSE;
     }
@@ -1247,7 +1247,7 @@
     {
       if (gimp_pdb_item_is_floating (GIMP_ITEM (vectors), image, error))
         {
-          success = gimp_image_add_vectors (image, vectors, MAX (position, -1));
+          success = gimp_image_add_vectors (image, vectors, MAX (position, -1), TRUE);
         }
       else
         {
@@ -1277,7 +1277,7 @@
   if (success)
     {
       if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), error))
-        gimp_image_remove_vectors (image, vectors);
+        gimp_image_remove_vectors (image, vectors, TRUE, NULL);
       else
         success = FALSE;
     }

Modified: trunk/app/pdb/paths-cmds.c
==============================================================================
--- trunk/app/pdb/paths-cmds.c	(original)
+++ trunk/app/pdb/paths-cmds.c	Thu Oct  9 19:40:41 2008
@@ -162,7 +162,7 @@
       GimpVectors *vectors = gimp_image_get_vectors_by_name (image, name);
 
       if (vectors)
-        gimp_image_remove_vectors (image, vectors);
+        gimp_image_remove_vectors (image, vectors, TRUE, NULL);
       else
         success = FALSE;
     }
@@ -303,7 +303,7 @@
           g_free (points);
 
           if (vectors)
-            success = gimp_image_add_vectors (image, vectors, 0);
+            success = gimp_image_add_vectors (image, vectors, 0, TRUE);
           else
             success = FALSE;
         }

Modified: trunk/app/text/gimptext-compat.c
==============================================================================
--- trunk/app/text/gimptext-compat.c	(original)
+++ trunk/app/text/gimptext-compat.c	Thu Oct  9 19:40:41 2008
@@ -118,12 +118,16 @@
   if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
     gimp_channel_clear (gimp_image_get_mask (image), NULL, TRUE);
 
-  /*  If the drawable is NULL, create a new layer  */
   if (drawable == NULL)
-    gimp_image_add_layer (image, layer, -1);
-  /*  Otherwise, instantiate the text as the new floating selection */
+    {
+      /*  If the drawable is NULL, create a new layer  */
+      gimp_image_add_layer (image, layer, -1, TRUE);
+    }
   else
-    floating_sel_attach (layer, drawable);
+    {
+      /*  Otherwise, instantiate the text as the new floating selection */
+      floating_sel_attach (layer, drawable);
+    }
 
   /*  end the group undo  */
   gimp_image_undo_group_end (image);

Modified: trunk/app/tools/gimptexttool.c
==============================================================================
--- trunk/app/tools/gimptexttool.c	(original)
+++ trunk/app/tools/gimptexttool.c	Thu Oct  9 19:40:41 2008
@@ -803,7 +803,7 @@
       gimp_item_translate (GIMP_ITEM (vectors), x, y, FALSE);
     }
 
-  gimp_image_add_vectors (text_tool->image, vectors, -1);
+  gimp_image_add_vectors (text_tool->image, vectors, -1, TRUE);
 
   gimp_image_flush (text_tool->image);
 }
@@ -829,7 +829,7 @@
 
   gimp_vectors_warp_vectors (vectors0, vectors, 0.5 * box_height);
 
-  gimp_image_add_vectors (text_tool->image, vectors, -1);
+  gimp_image_add_vectors (text_tool->image, vectors, -1, TRUE);
   gimp_image_set_active_vectors (text_tool->image, vectors);
   gimp_item_set_visible (GIMP_ITEM (vectors), TRUE, FALSE);
 
@@ -892,7 +892,7 @@
   GIMP_ITEM (layer)->offset_x = text_tool->x1;
   GIMP_ITEM (layer)->offset_y = text_tool->y1;
 
-  gimp_image_add_layer (image, layer, -1);
+  gimp_image_add_layer (image, layer, -1, TRUE);
 
   if (text_tool->text_box_fixed)
     {

Modified: trunk/app/tools/gimpvectortool.c
==============================================================================
--- trunk/app/tools/gimpvectortool.c	(original)
+++ trunk/app/tools/gimpvectortool.c	Thu Oct  9 19:40:41 2008
@@ -303,7 +303,7 @@
 
       vector_tool->undo_motion = TRUE;
 
-      gimp_image_add_vectors (display->image, vectors, -1);
+      gimp_image_add_vectors (display->image, vectors, -1, TRUE);
       gimp_image_flush (display->image);
 
       gimp_vector_tool_set_vectors (vector_tool, vectors);

Modified: trunk/app/vectors/gimpvectors-import.c
==============================================================================
--- trunk/app/vectors/gimpvectors-import.c	(original)
+++ trunk/app/vectors/gimpvectors-import.c	Thu Oct  9 19:40:41 2008
@@ -305,7 +305,7 @@
                   vectors = gimp_vectors_new (image,
                                               ((merge || !path->id) ?
                                                _("Imported Path") : path->id));
-                  gimp_image_add_vectors (image, vectors, position);
+                  gimp_image_add_vectors (image, vectors, position, TRUE);
                   gimp_vectors_freeze (vectors);
 
                   if (ret_vectors)

Modified: trunk/app/vectors/gimpvectorsundo.c
==============================================================================
--- trunk/app/vectors/gimpvectorsundo.c	(original)
+++ trunk/app/vectors/gimpvectorsundo.c	Thu Oct  9 19:40:41 2008
@@ -22,7 +22,6 @@
 
 #include "vectors-types.h"
 
-#include "core/gimpcontainer.h"
 #include "core/gimpimage.h"
 
 #include "gimpvectors.h"
@@ -194,12 +193,8 @@
       vectors_undo->prev_position = gimp_image_get_vectors_index (undo->image,
                                                                   vectors);
 
-      gimp_container_remove (undo->image->vectors, GIMP_OBJECT (vectors));
-      gimp_item_removed (GIMP_ITEM (vectors));
-
-      if (vectors == gimp_image_get_active_vectors (undo->image))
-        gimp_image_set_active_vectors (undo->image,
-                                       vectors_undo->prev_vectors);
+      gimp_image_remove_vectors (undo->image, vectors, FALSE,
+                                 vectors_undo->prev_vectors);
     }
   else
     {
@@ -208,9 +203,8 @@
       /*  record the active vectors  */
       vectors_undo->prev_vectors = gimp_image_get_active_vectors (undo->image);
 
-      gimp_container_insert (undo->image->vectors, GIMP_OBJECT (vectors),
-                             vectors_undo->prev_position);
-      gimp_image_set_active_vectors (undo->image, vectors);
+      gimp_image_add_vectors (undo->image, vectors,
+                              vectors_undo->prev_position, FALSE);
 
       GIMP_ITEM (vectors)->removed = FALSE;
     }

Modified: trunk/app/widgets/gimpchanneltreeview.c
==============================================================================
--- trunk/app/widgets/gimpchanneltreeview.c	(original)
+++ trunk/app/widgets/gimpchanneltreeview.c	Thu Oct  9 19:40:41 2008
@@ -211,7 +211,7 @@
 
       gimp_item_set_linked (new_item, FALSE, FALSE);
 
-      item_view_class->add_item (item_view->image, new_item, index);
+      item_view_class->add_item (item_view->image, new_item, index, TRUE);
       gimp_image_flush (item_view->image);
       return;
     }
@@ -261,7 +261,8 @@
   if (src_image != item_view->image)
     GIMP_ITEM_GET_CLASS (new_item)->convert (new_item, item_view->image);
 
-  gimp_image_add_channel (item_view->image, GIMP_CHANNEL (new_item), index);
+  gimp_image_add_channel (item_view->image, GIMP_CHANNEL (new_item), index,
+                          TRUE);
   gimp_image_flush (item_view->image);
 }
 
@@ -320,7 +321,7 @@
                                   gimp_image_get_height (image),
                                   _("Empty Channel"), &color);
 
-  gimp_image_add_channel (image, new_channel, -1);
+  gimp_image_add_channel (image, new_channel, -1, TRUE);
 
   gimp_image_undo_group_end (image);
 

Modified: trunk/app/widgets/gimpitemtreeview.c
==============================================================================
--- trunk/app/widgets/gimpitemtreeview.c	(original)
+++ trunk/app/widgets/gimpitemtreeview.c	Thu Oct  9 19:40:41 2008
@@ -734,7 +734,7 @@
 
       gimp_item_set_linked (new_item, FALSE, FALSE);
 
-      item_view_class->add_item (item_view->image, new_item, dest_index);
+      item_view_class->add_item (item_view->image, new_item, dest_index, TRUE);
     }
   else if (dest_viewable)
     {

Modified: trunk/app/widgets/gimpitemtreeview.h
==============================================================================
--- trunk/app/widgets/gimpitemtreeview.h	(original)
+++ trunk/app/widgets/gimpitemtreeview.h	Thu Oct  9 19:40:41 2008
@@ -37,9 +37,12 @@
                                                   const gchar     *undo_desc);
 typedef void            (* GimpAddItemFunc)      (GimpImage       *image,
                                                   GimpItem        *item,
-                                                  gint             index);
+                                                  gint             index,
+                                                  gboolean         push_undo);
 typedef void            (* GimpRemoveItemFunc)   (GimpImage       *image,
-                                                  GimpItem        *item);
+                                                  GimpItem        *item,
+                                                  gboolean         push_undo,
+                                                  GimpItem        *new_active);
 typedef GimpItem      * (* GimpNewItemFunc)      (GimpImage       *image);
 
 

Modified: trunk/app/widgets/gimplayertreeview.c
==============================================================================
--- trunk/app/widgets/gimplayertreeview.c	(original)
+++ trunk/app/widgets/gimplayertreeview.c	Thu Oct  9 19:40:41 2008
@@ -772,7 +772,7 @@
   gimp_object_take_name (GIMP_OBJECT (new_item),
                          g_strdup_printf (_("%s Channel Copy"), desc));
 
-  gimp_image_add_layer (item_view->image, GIMP_LAYER (new_item), index);
+  gimp_image_add_layer (item_view->image, GIMP_LAYER (new_item), index, TRUE);
   gimp_image_flush (item_view->image);
 }
 
@@ -801,7 +801,7 @@
                                 _("Dropped Buffer"),
                                 GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
 
-  gimp_image_add_layer (image, new_layer, index);
+  gimp_image_add_layer (image, new_layer, index, TRUE);
   gimp_image_flush (image);
 }
 
@@ -840,7 +840,7 @@
                               gimp_image_base_type_with_alpha (image),
                               _("Empty Layer"), 1.0, GIMP_NORMAL_MODE);
 
-  gimp_image_add_layer (image, new_layer, -1);
+  gimp_image_add_layer (image, new_layer, -1, TRUE);
 
   gimp_image_undo_group_end (image);
 

Modified: trunk/app/widgets/gimptoolbox-dnd.c
==============================================================================
--- trunk/app/widgets/gimptoolbox-dnd.c	(original)
+++ trunk/app/widgets/gimptoolbox-dnd.c	Thu Oct  9 19:40:41 2008
@@ -226,7 +226,7 @@
   gimp_layer_set_opacity (new_layer, GIMP_OPACITY_OPAQUE, FALSE);
   gimp_layer_set_lock_alpha (new_layer, FALSE, FALSE);
 
-  gimp_image_add_layer (new_image, new_layer, 0);
+  gimp_image_add_layer (new_image, new_layer, 0, TRUE);
 
   gimp_image_undo_enable (new_image);
 
@@ -312,7 +312,7 @@
   gimp_object_take_name (GIMP_OBJECT (new_layer),
                          g_strdup_printf (_("%s Channel Copy"), desc));
 
-  gimp_image_add_layer (new_image, new_layer, 0);
+  gimp_image_add_layer (new_image, new_layer, 0, TRUE);
 
   gimp_image_undo_enable (new_image);
 
@@ -361,7 +361,7 @@
                                 _("Dropped Buffer"),
                                 GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
 
-  gimp_image_add_layer (new_image, new_layer, 0);
+  gimp_image_add_layer (new_image, new_layer, 0, TRUE);
 
   gimp_image_undo_enable (new_image);
 

Modified: trunk/app/widgets/gimpvectorstreeview.c
==============================================================================
--- trunk/app/widgets/gimpvectorstreeview.c	(original)
+++ trunk/app/widgets/gimpvectorstreeview.c	Thu Oct  9 19:40:41 2008
@@ -252,7 +252,7 @@
 
   new_vectors = gimp_vectors_new (image, _("Empty Path"));
 
-  gimp_image_add_vectors (image, new_vectors, -1);
+  gimp_image_add_vectors (image, new_vectors, -1, TRUE);
 
   return GIMP_ITEM (new_vectors);
 }

Modified: trunk/app/xcf/xcf-load.c
==============================================================================
--- trunk/app/xcf/xcf-load.c	(original)
+++ trunk/app/xcf/xcf-load.c	Thu Oct  9 19:40:41 2008
@@ -201,7 +201,8 @@
       /* add the layer to the image if its not the floating selection */
       if (layer != info->floating_sel)
         gimp_image_add_layer (image, layer,
-                              gimp_container_num_children (image->layers));
+                              gimp_container_num_children (image->layers),
+                              FALSE);
 
       /* restore the saved position so we'll be ready to
        *  read the next offset.
@@ -242,7 +243,8 @@
       /* add the channel to the image if its not the selection */
       if (channel != gimp_image_get_mask (image))
         gimp_image_add_channel (image, channel,
-                                gimp_container_num_children (image->channels));
+                                gimp_container_num_children (image->channels),
+                                FALSE);
 
       /* restore the saved position so we'll be ready to
        *  read the next offset.
@@ -1625,7 +1627,8 @@
     gimp_item_set_tattoo (GIMP_ITEM (vectors), tattoo);
 
   gimp_image_add_vectors (image, vectors,
-                          gimp_container_num_children (image->vectors));
+                          gimp_container_num_children (image->vectors),
+                          FALSE);
 
   return TRUE;
 }
@@ -1814,7 +1817,8 @@
     }
 
   gimp_image_add_vectors (image, vectors,
-                          gimp_container_num_children (image->vectors));
+                          gimp_container_num_children (image->vectors),
+                          FALSE);
 
   return TRUE;
 }

Modified: trunk/tools/pdbgen/pdb/image.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/image.pdb	(original)
+++ trunk/tools/pdbgen/pdb/image.pdb	Thu Oct  9 19:40:41 2008
@@ -1014,7 +1014,7 @@
 				   GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (layer))),
 				   error))
     {
-      success = gimp_image_add_layer (image, layer, MAX (position, -1));
+      success = gimp_image_add_layer (image, layer, MAX (position, -1), TRUE);
     }
   else
     {
@@ -1047,7 +1047,7 @@
 	code => <<'CODE'
 {
   if (gimp_pdb_item_is_attached (GIMP_ITEM (layer), error))
-    gimp_image_remove_layer (image, layer);
+    gimp_image_remove_layer (image, layer, TRUE, NULL);
   else
     success = FALSE;
 }
@@ -1219,7 +1219,7 @@
 {
   if (gimp_pdb_item_is_floating (GIMP_ITEM (channel), image, error))
     {
-      success = gimp_image_add_channel (image, channel, MAX (position, -1));
+      success = gimp_image_add_channel (image, channel, MAX (position, -1), TRUE);
     }
   else
     {
@@ -1251,7 +1251,7 @@
 	code => <<'CODE'
 {
   if (gimp_pdb_item_is_attached (GIMP_ITEM (channel), error))
-    gimp_image_remove_channel (image, channel);
+    gimp_image_remove_channel (image, channel, TRUE, NULL);
   else
     success = FALSE;
 }
@@ -1283,7 +1283,7 @@
 {
   if (gimp_pdb_item_is_floating (GIMP_ITEM (vectors), image, error))
     {
-      success = gimp_image_add_vectors (image, vectors, MAX (position, -1));
+      success = gimp_image_add_vectors (image, vectors, MAX (position, -1), TRUE);
     }
   else
     {
@@ -1314,7 +1314,7 @@
 	code => <<'CODE'
 {
   if (gimp_pdb_item_is_attached (GIMP_ITEM (vectors), error))
-    gimp_image_remove_vectors (image, vectors);
+    gimp_image_remove_vectors (image, vectors, TRUE, NULL);
   else
     success = FALSE;
 }

Modified: trunk/tools/pdbgen/pdb/paths.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/paths.pdb	(original)
+++ trunk/tools/pdbgen/pdb/paths.pdb	Thu Oct  9 19:40:41 2008
@@ -242,7 +242,7 @@
       g_free (points);
 
       if (vectors)
-        success = gimp_image_add_vectors (image, vectors, 0);
+        success = gimp_image_add_vectors (image, vectors, 0, TRUE);
       else
         success = FALSE;
     }
@@ -462,7 +462,7 @@
   GimpVectors *vectors = gimp_image_get_vectors_by_name (image, name);
 
   if (vectors)
-    gimp_image_remove_vectors (image, vectors);
+    gimp_image_remove_vectors (image, vectors, TRUE, NULL);
   else
     success = FALSE;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]