Commit 0778559f authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

app/core/core-enums.[ch] handle a floating selection attached to the layer

2005-04-05  Sven Neumann  <sven@gimp.org>

	* app/core/core-enums.[ch]
	* app/core/gimpimage.c
	(gimp_image_remove_layer, gimp_image_remove_channel): handle a
	floating selection attached to the layer or channel that is being
	removed.  Fixes bug #168582 but doesn't handle floating selections
	attached to layer masks.
parent 7792951f
2005-04-05 Sven Neumann <sven@gimp.org>
* app/core/core-enums.[ch]
* app/core/gimpimage.c
(gimp_image_remove_layer, gimp_image_remove_channel): handle a
floating selection attached to the layer or channel that is being
removed. Fixes bug #168582 but doesn't handle floating selections
attached to layer masks.
2005-04-05 Sven Neumann <sven@gimp.org>
* configure.in: renamed localedir to gimplocaledir.
......
......@@ -686,6 +686,7 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_GROUP_IMAGE_ROTATE, "GIMP_UNDO_GROUP_IMAGE_ROTATE", "group-image-rotate" },
{ GIMP_UNDO_GROUP_IMAGE_CROP, "GIMP_UNDO_GROUP_IMAGE_CROP", "group-image-crop" },
{ GIMP_UNDO_GROUP_IMAGE_CONVERT, "GIMP_UNDO_GROUP_IMAGE_CONVERT", "group-image-convert" },
{ GIMP_UNDO_GROUP_IMAGE_ITEM_REMOVE, "GIMP_UNDO_GROUP_IMAGE_ITEM_REMOVE", "group-image-item-remove" },
{ GIMP_UNDO_GROUP_IMAGE_LAYERS_MERGE, "GIMP_UNDO_GROUP_IMAGE_LAYERS_MERGE", "group-image-layers-merge" },
{ GIMP_UNDO_GROUP_IMAGE_VECTORS_MERGE, "GIMP_UNDO_GROUP_IMAGE_VECTORS_MERGE", "group-image-vectors-merge" },
{ GIMP_UNDO_GROUP_IMAGE_QMASK, "GIMP_UNDO_GROUP_IMAGE_QMASK", "group-image-qmask" },
......@@ -771,6 +772,7 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_GROUP_IMAGE_ROTATE, N_("Rotate image"), NULL },
{ GIMP_UNDO_GROUP_IMAGE_CROP, N_("Crop image"), NULL },
{ GIMP_UNDO_GROUP_IMAGE_CONVERT, N_("Convert image"), NULL },
{ GIMP_UNDO_GROUP_IMAGE_ITEM_REMOVE, N_("Remove item"), NULL },
{ GIMP_UNDO_GROUP_IMAGE_LAYERS_MERGE, N_("Merge layers"), NULL },
{ GIMP_UNDO_GROUP_IMAGE_VECTORS_MERGE, N_("Merge vectors"), NULL },
{ GIMP_UNDO_GROUP_IMAGE_QMASK, N_("Quick Mask"), NULL },
......
......@@ -331,6 +331,7 @@ typedef enum /*< pdb-skip >*/
GIMP_UNDO_GROUP_IMAGE_ROTATE, /*< desc="Rotate image" >*/
GIMP_UNDO_GROUP_IMAGE_CROP, /*< desc="Crop image" >*/
GIMP_UNDO_GROUP_IMAGE_CONVERT, /*< desc="Convert image" >*/
GIMP_UNDO_GROUP_IMAGE_ITEM_REMOVE, /*< desc="Remove item" >*/
GIMP_UNDO_GROUP_IMAGE_LAYERS_MERGE, /*< desc="Merge layers" >*/
GIMP_UNDO_GROUP_IMAGE_VECTORS_MERGE,/*< desc="Merge vectors" >*/
GIMP_UNDO_GROUP_IMAGE_QMASK, /*< desc="Quick Mask" >*/
......
......@@ -2808,12 +2808,22 @@ gimp_image_remove_layer (GimpImage *gimage,
GimpLayer *active_layer;
gint index;
gboolean old_has_alpha;
gboolean undo_group = FALSE;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (GIMP_IS_LAYER (layer));
g_return_if_fail (gimp_container_have (gimage->layers,
GIMP_OBJECT (layer)));
if (gimp_drawable_has_floating_sel (GIMP_DRAWABLE (layer)))
{
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_IMAGE_ITEM_REMOVE,
_("Remove Layer"));
undo_group = TRUE;
floating_sel_remove (gimp_image_floating_sel (gimage));
}
active_layer = gimp_image_get_active_layer (gimage);
index = gimp_container_get_child_index (gimage->layers,
......@@ -2876,6 +2886,9 @@ gimp_image_remove_layer (GimpImage *gimage,
if (old_has_alpha != gimp_image_has_alpha (gimage))
gimp_image_alpha_changed (gimage);
if (undo_group)
gimp_image_undo_group_end (gimage);
}
gboolean
......@@ -3103,12 +3116,22 @@ gimp_image_remove_channel (GimpImage *gimage,
{
GimpChannel *active_channel;
gint index;
gboolean undo_group = FALSE;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (gimp_container_have (gimage->channels,
GIMP_OBJECT (channel)));
if (gimp_drawable_has_floating_sel (GIMP_DRAWABLE (channel)))
{
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_IMAGE_ITEM_REMOVE,
_("Remove Channel"));
undo_group = TRUE;
floating_sel_remove (gimp_image_floating_sel (gimage));
}
active_channel = gimp_image_get_active_channel (gimage);
index = gimp_container_get_child_index (gimage->channels,
......@@ -3142,6 +3165,9 @@ gimp_image_remove_channel (GimpImage *gimage,
}
g_object_unref (channel);
if (undo_group)
gimp_image_undo_group_end (gimage);
}
gboolean
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment