gimp r27583 - in trunk: . app/actions app/core app/pdb tools/pdbgen/pdb



Author: mitch
Date: Sun Nov  9 18:45:16 2008
New Revision: 27583
URL: http://svn.gnome.org/viewvc/gimp?rev=27583&view=rev

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

	* app/core/gimplayer-floating-sel.[ch]: remove
	floating_sel_remove() and reorder one function.

	* app/core/gimpimage.c (gimp_image_remove_layer): add the single
	line of special code that needs to be done when removing a
	floating selection.

	* app/core/gimpselection.c
	* app/actions/layers-commands.c
	* tools/pdbgen/pdb/floating_sel.pdb: changed accordingly.

	* app/pdb/floating-sel-cmds.c: regenerated.

	* app/core/core-enums.[ch]
	* app/core/gimpimage-undo.c: remove enum value
	GIMP_UNDO_GROUP_FS_REMOVE.



Modified:
   trunk/ChangeLog
   trunk/app/actions/layers-commands.c
   trunk/app/core/core-enums.c
   trunk/app/core/core-enums.h
   trunk/app/core/gimpimage-undo.c
   trunk/app/core/gimpimage.c
   trunk/app/core/gimplayer-floating-sel.c
   trunk/app/core/gimplayer-floating-sel.h
   trunk/app/core/gimpselection.c
   trunk/app/pdb/floating-sel-cmds.c
   trunk/tools/pdbgen/pdb/floating_sel.pdb

Modified: trunk/app/actions/layers-commands.c
==============================================================================
--- trunk/app/actions/layers-commands.c	(original)
+++ trunk/app/actions/layers-commands.c	Sun Nov  9 18:45:16 2008
@@ -481,11 +481,7 @@
   GimpLayer *layer;
   return_if_no_layer (image, layer, data);
 
-  if (gimp_layer_is_floating_sel (layer))
-    floating_sel_remove (layer);
-  else
-    gimp_image_remove_layer (image, layer, TRUE, NULL);
-
+  gimp_image_remove_layer (image, layer, TRUE, NULL);
   gimp_image_flush (image);
 }
 

Modified: trunk/app/core/core-enums.c
==============================================================================
--- trunk/app/core/core-enums.c	(original)
+++ trunk/app/core/core-enums.c	Sun Nov  9 18:45:16 2008
@@ -810,7 +810,6 @@
     { GIMP_UNDO_GROUP_FS_TO_LAYER, "GIMP_UNDO_GROUP_FS_TO_LAYER", "group-fs-to-layer" },
     { GIMP_UNDO_GROUP_FS_FLOAT, "GIMP_UNDO_GROUP_FS_FLOAT", "group-fs-float" },
     { GIMP_UNDO_GROUP_FS_ANCHOR, "GIMP_UNDO_GROUP_FS_ANCHOR", "group-fs-anchor" },
-    { GIMP_UNDO_GROUP_FS_REMOVE, "GIMP_UNDO_GROUP_FS_REMOVE", "group-fs-remove" },
     { GIMP_UNDO_GROUP_EDIT_PASTE, "GIMP_UNDO_GROUP_EDIT_PASTE", "group-edit-paste" },
     { GIMP_UNDO_GROUP_EDIT_CUT, "GIMP_UNDO_GROUP_EDIT_CUT", "group-edit-cut" },
     { GIMP_UNDO_GROUP_TEXT, "GIMP_UNDO_GROUP_TEXT", "group-text" },
@@ -896,7 +895,6 @@
     { GIMP_UNDO_GROUP_FS_TO_LAYER, NC_("undo-type", "Floating selection to layer"), NULL },
     { GIMP_UNDO_GROUP_FS_FLOAT, NC_("undo-type", "Float selection"), NULL },
     { GIMP_UNDO_GROUP_FS_ANCHOR, NC_("undo-type", "Anchor floating selection"), NULL },
-    { GIMP_UNDO_GROUP_FS_REMOVE, NC_("undo-type", "Remove floating selection"), NULL },
     { GIMP_UNDO_GROUP_EDIT_PASTE, NC_("undo-type", "Paste"), NULL },
     { GIMP_UNDO_GROUP_EDIT_CUT, NC_("undo-type", "Cut"), NULL },
     { GIMP_UNDO_GROUP_TEXT, NC_("undo-type", "Text"), NULL },

Modified: trunk/app/core/core-enums.h
==============================================================================
--- trunk/app/core/core-enums.h	(original)
+++ trunk/app/core/core-enums.h	Sun Nov  9 18:45:16 2008
@@ -387,7 +387,6 @@
   GIMP_UNDO_GROUP_FS_TO_LAYER,        /*< desc="Floating selection to layer" >*/
   GIMP_UNDO_GROUP_FS_FLOAT,           /*< desc="Float selection"             >*/
   GIMP_UNDO_GROUP_FS_ANCHOR,          /*< desc="Anchor floating selection"   >*/
-  GIMP_UNDO_GROUP_FS_REMOVE,          /*< desc="Remove floating selection"   >*/
   GIMP_UNDO_GROUP_EDIT_PASTE,         /*< desc="Paste"                       >*/
   GIMP_UNDO_GROUP_EDIT_CUT,           /*< desc="Cut"                         >*/
   GIMP_UNDO_GROUP_TEXT,               /*< desc="Text"                        >*/

Modified: trunk/app/core/gimpimage-undo.c
==============================================================================
--- trunk/app/core/gimpimage-undo.c	(original)
+++ trunk/app/core/gimpimage-undo.c	Sun Nov  9 18:45:16 2008
@@ -554,7 +554,6 @@
     case GIMP_UNDO_GROUP_FS_TO_LAYER:
     case GIMP_UNDO_GROUP_FS_FLOAT:
     case GIMP_UNDO_GROUP_FS_ANCHOR:
-    case GIMP_UNDO_GROUP_FS_REMOVE:
       return GIMP_DIRTY_IMAGE_STRUCTURE;
 
     case GIMP_UNDO_GROUP_EDIT_PASTE:

Modified: trunk/app/core/gimpimage.c
==============================================================================
--- trunk/app/core/gimpimage.c	(original)
+++ trunk/app/core/gimpimage.c	Sun Nov  9 18:45:16 2008
@@ -2950,10 +2950,11 @@
                          gboolean   push_undo,
                          GimpLayer *new_active)
 {
-  GimpLayer *active_layer;
-  gint       index;
-  gboolean   old_has_alpha;
-  gboolean   undo_group = FALSE;
+  GimpLayer   *active_layer;
+  gint         index;
+  gboolean     old_has_alpha;
+  gboolean     undo_group = FALSE;
+  const gchar *undo_desc;
 
   g_return_if_fail (GIMP_IS_IMAGE (image));
   g_return_if_fail (GIMP_IS_LAYER (layer));
@@ -2974,7 +2975,8 @@
                                    _("Remove Layer"));
       undo_group = TRUE;
 
-      floating_sel_remove (gimp_image_floating_sel (image));
+      gimp_image_remove_layer (image, gimp_image_floating_sel (image),
+                               TRUE, NULL);
     }
 
   active_layer = gimp_image_get_active_layer (image);
@@ -2984,8 +2986,24 @@
 
   old_has_alpha = gimp_image_has_alpha (image);
 
+  if (image->floating_sel == layer)
+    {
+      undo_desc = _("Remove Floating Selection");
+
+      /*  Invalidate the preview of the obscured drawable.  We do this here
+       *  because it will not be done until the floating selection is removed,
+       *  at which point the obscured drawable's preview will not be declared
+       *  invalid.
+       */
+      gimp_viewable_invalidate_preview (GIMP_VIEWABLE (layer));
+    }
+  else
+    {
+      undo_desc = _("Remove Layer");
+    }
+
   if (push_undo)
-    gimp_image_undo_push_layer_remove (image, _("Remove Layer"),
+    gimp_image_undo_push_layer_remove (image, undo_desc,
                                        layer, index, active_layer);
 
   g_object_ref (layer);
@@ -3293,7 +3311,8 @@
                                    _("Remove Channel"));
       undo_group = TRUE;
 
-      floating_sel_remove (gimp_image_floating_sel (image));
+      gimp_image_remove_layer (image, gimp_image_floating_sel (image),
+                               TRUE, NULL);
     }
 
   active_channel = gimp_image_get_active_channel (image);

Modified: trunk/app/core/gimplayer-floating-sel.c
==============================================================================
--- trunk/app/core/gimplayer-floating-sel.c	(original)
+++ trunk/app/core/gimplayer-floating-sel.c	Sun Nov  9 18:45:16 2008
@@ -87,32 +87,6 @@
 }
 
 void
-floating_sel_remove (GimpLayer *layer)
-{
-  GimpImage *image;
-
-  g_return_if_fail (GIMP_IS_LAYER (layer));
-  g_return_if_fail (gimp_layer_is_floating_sel (layer));
-
-  image = gimp_item_get_image (GIMP_ITEM (layer->fs.drawable));
-
-  gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_FS_REMOVE,
-                               _("Remove Floating Selection"));
-
-  /*  Invalidate the preview of the obscured drawable.  We do this here
-   *  because it will not be done until the floating selection is removed,
-   *  at which point the obscured drawable's preview will not be declared
-   *  invalid.
-   */
-  gimp_viewable_invalidate_preview (GIMP_VIEWABLE (layer));
-
-  /*  remove the layer from the image  */
-  gimp_image_remove_layer (image, layer, TRUE, NULL);
-
-  gimp_image_undo_group_end (image);
-}
-
-void
 floating_sel_anchor (GimpLayer *layer)
 {
   GimpImage    *image;
@@ -142,33 +116,6 @@
   gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (gimp_image_get_mask (image)));
 }
 
-void
-floating_sel_activate_drawable (GimpLayer *layer)
-{
-  GimpImage *image;
-
-  g_return_if_fail (GIMP_IS_LAYER (layer));
-  g_return_if_fail (gimp_layer_is_floating_sel (layer));
-
-  image = gimp_item_get_image (GIMP_ITEM (layer));
-
-  /*  set the underlying drawable to active  */
-  if (GIMP_IS_LAYER_MASK (layer->fs.drawable))
-    {
-      GimpLayerMask *mask = GIMP_LAYER_MASK (layer->fs.drawable);
-
-      gimp_image_set_active_layer (image, gimp_layer_mask_get_layer (mask));
-    }
-  else if (GIMP_IS_CHANNEL (layer->fs.drawable))
-    {
-      gimp_image_set_active_channel (image, GIMP_CHANNEL (layer->fs.drawable));
-    }
-  else
-    {
-      gimp_image_set_active_layer (image, GIMP_LAYER (layer->fs.drawable));
-    }
-}
-
 gboolean
 floating_sel_to_layer (GimpLayer  *layer,
                        GError    **error)
@@ -222,6 +169,33 @@
   return TRUE;
 }
 
+void
+floating_sel_activate_drawable (GimpLayer *layer)
+{
+  GimpImage *image;
+
+  g_return_if_fail (GIMP_IS_LAYER (layer));
+  g_return_if_fail (gimp_layer_is_floating_sel (layer));
+
+  image = gimp_item_get_image (GIMP_ITEM (layer));
+
+  /*  set the underlying drawable to active  */
+  if (GIMP_IS_LAYER_MASK (layer->fs.drawable))
+    {
+      GimpLayerMask *mask = GIMP_LAYER_MASK (layer->fs.drawable);
+
+      gimp_image_set_active_layer (image, gimp_layer_mask_get_layer (mask));
+    }
+  else if (GIMP_IS_CHANNEL (layer->fs.drawable))
+    {
+      gimp_image_set_active_channel (image, GIMP_CHANNEL (layer->fs.drawable));
+    }
+  else
+    {
+      gimp_image_set_active_layer (image, GIMP_LAYER (layer->fs.drawable));
+    }
+}
+
 const BoundSeg *
 floating_sel_boundary (GimpLayer *layer,
                        gint      *n_segs)

Modified: trunk/app/core/gimplayer-floating-sel.h
==============================================================================
--- trunk/app/core/gimplayer-floating-sel.h	(original)
+++ trunk/app/core/gimplayer-floating-sel.h	Sun Nov  9 18:45:16 2008
@@ -22,11 +22,10 @@
 
 void             floating_sel_attach            (GimpLayer     *layer,
                                                  GimpDrawable  *drawable);
-void             floating_sel_remove            (GimpLayer     *layer);
 void             floating_sel_anchor            (GimpLayer     *layer);
-void             floating_sel_activate_drawable (GimpLayer     *layer);
 gboolean         floating_sel_to_layer          (GimpLayer     *layer,
                                                  GError       **error);
+void             floating_sel_activate_drawable (GimpLayer     *layer);
 const BoundSeg * floating_sel_boundary          (GimpLayer     *layer,
                                                  gint          *n_segs);
 void             floating_sel_invalidate        (GimpLayer     *layer);

Modified: trunk/app/core/gimpselection.c
==============================================================================
--- trunk/app/core/gimpselection.c	(original)
+++ trunk/app/core/gimpselection.c	Sun Nov  9 18:45:16 2008
@@ -786,11 +786,8 @@
         {
           if (GIMP_IS_LAYER (pickable))
             {
-              if (gimp_layer_is_floating_sel (GIMP_LAYER (pickable)))
-                floating_sel_remove (GIMP_LAYER (pickable));
-              else
-                gimp_image_remove_layer (image, GIMP_LAYER (pickable),
-                                         TRUE, NULL);
+              gimp_image_remove_layer (image, GIMP_LAYER (pickable),
+                                       TRUE, NULL);
             }
           else if (GIMP_IS_LAYER_MASK (pickable))
             {

Modified: trunk/app/pdb/floating-sel-cmds.c
==============================================================================
--- trunk/app/pdb/floating-sel-cmds.c	(original)
+++ trunk/app/pdb/floating-sel-cmds.c	Sun Nov  9 18:45:16 2008
@@ -25,6 +25,7 @@
 #include "pdb-types.h"
 
 #include "core/gimpdrawable.h"
+#include "core/gimpimage.h"
 #include "core/gimplayer-floating-sel.h"
 #include "core/gimplayer.h"
 #include "core/gimpparamspecs.h"
@@ -55,7 +56,8 @@
     {
       if (gimp_layer_is_floating_sel (floating_sel))
         {
-          floating_sel_remove (floating_sel);
+          gimp_image_remove_layer (gimp_item_get_image (GIMP_ITEM (floating_sel)),
+                                   floating_sel, TRUE, NULL);
         }
       else
         {

Modified: trunk/tools/pdbgen/pdb/floating_sel.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/floating_sel.pdb	(original)
+++ trunk/tools/pdbgen/pdb/floating_sel.pdb	Sun Nov  9 18:45:16 2008
@@ -39,7 +39,8 @@
 {
   if (gimp_layer_is_floating_sel (floating_sel))
     {
-      floating_sel_remove (floating_sel);
+      gimp_image_remove_layer (gimp_item_get_image (GIMP_ITEM (floating_sel)),
+                               floating_sel, TRUE, NULL);
     }
   else
     {
@@ -194,7 +195,8 @@
 }
 
 
- headers = qw("core/gimplayer-floating-sel.h"
+ headers = qw("core/gimpimage.h"
+              "core/gimplayer-floating-sel.h"
               "gimppdberror.h"
               "gimppdb-utils.h"
               "gimp-intl.h");



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