Commit 2e61d12e authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Moved the calls to floating_sel_relax()/rigor() from various places to two

2004-04-13  Michael Natterer  <mitch@gimp.org>

	Moved the calls to floating_sel_relax()/rigor() from various
	places to two single spots in the core where they are actually
	needed. Fixes bug #138356 (which was caused by the projection
	being triggered in the middle of changing the floating selection's
	size or the size of the drawable it is attached to). This commit
	effectively removes floating selection fiddling from the core's
	public API.

	* app/core/gimpdrawable.[ch] (gimp_drawable_has_floating_sel): new
	function which returns TRUE if there is a floating selection
	attached to the drawable.

	* app/core/gimpdrawable.c (gimp_drawable_translate)
	(gimp_drawable_set_tiles_full): if the drawable *has* a floating
	selection, relax/rigor it before/after modifying the drawable.

	* app/core/gimplayer.c (gimp_layer_translate)
	(gimp_layer_set_tiles): if the layer *is* the floating selection,
	relax/rigor it before/after modifying it.

	* app/core/gimpdrawable-transform.c
	* app/core/gimpimage-convert.c
	* app/core/gimpimage-crop.c
	* app/core/gimpimage-flip.c
	* app/core/gimpimage-resize.c
	* app/core/gimpimage-rotate.c
	* app/core/gimpimage-scale.c
	* app/gui/layers-commands.c
	* app/tools/gimpeditselectiontool.c
	* tools/pdbgen/pdb/layer.pdb: removed calls to
	floating_sel_rigor()/relax() all over the place. Also removed
	lots of undo groups which are obsolete now.

	* app/pdb/layer_cmds.c: regenerated.
parent 44770220
2004-04-13 Michael Natterer <mitch@gimp.org>
Moved the calls to floating_sel_relax()/rigor() from various
places to two single spots in the core where they are actually
needed. Fixes bug #138356 (which was caused by the projection
being triggered in the middle of changing the floating selection's
size or the size of the drawable it is attached to). This commit
effectively removes floating selection fiddling from the core's
public API.
* app/core/gimpdrawable.[ch] (gimp_drawable_has_floating_sel): new
function which returns TRUE if there is a floating selection
attached to the drawable.
* app/core/gimpdrawable.c (gimp_drawable_translate)
(gimp_drawable_set_tiles_full): if the drawable *has* a floating
selection, relax/rigor it before/after modifying the drawable.
* app/core/gimplayer.c (gimp_layer_translate)
(gimp_layer_set_tiles): if the layer *is* the floating selection,
relax/rigor it before/after modifying it.
* app/core/gimpdrawable-transform.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-crop.c
* app/core/gimpimage-flip.c
* app/core/gimpimage-resize.c
* app/core/gimpimage-rotate.c
* app/core/gimpimage-scale.c
* app/gui/layers-commands.c
* app/tools/gimpeditselectiontool.c
* tools/pdbgen/pdb/layer.pdb: removed calls to
floating_sel_rigor()/relax() all over the place. Also removed
lots of undo groups which are obsolete now.
* app/pdb/layer_cmds.c: regenerated.
2004-04-13 Sven Neumann <sven@gimp.org>
* plug-ins/imagemap/imap_file.c (do_file_error_dialog): convert
......@@ -7,7 +44,7 @@
GimpItem undo group cleanup in preparation of fixing bug #138356:
* app/core/core-enums.[c]: renamed LAYER_SCALE and LAYER_RESIZE
* app/core/core-enums.[ch]: renamed LAYER_SCALE and LAYER_RESIZE
undo groups to ITEM_SCALE and ITEM_RESIZE.
* app/core/gimpitem.[ch]: always push undo groups around
......
......@@ -382,14 +382,8 @@ layers_crop_cmd_callback (GtkWidget *widget,
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_RESIZE,
_("Crop Layer"));
if (gimp_layer_is_floating_sel (active_layer))
floating_sel_relax (active_layer, TRUE);
gimp_item_resize (GIMP_ITEM (active_layer), x2 - x1, y2 - y1, off_x, off_y);
if (gimp_layer_is_floating_sel (active_layer))
floating_sel_rigor (active_layer, TRUE);
gimp_image_undo_group_end (gimage);
gimp_image_flush (gimage);
......@@ -1167,46 +1161,25 @@ scale_layer_query_ok_callback (GtkWidget *widget,
if (options->resize->width > 0 && options->resize->height > 0 &&
(layer = (options->layer)))
{
GimpImage *gimage;
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (layer));
GimpProgress *progress;
gtk_widget_set_sensitive (options->resize->resize_shell, FALSE);
gimage = gimp_item_get_image (GIMP_ITEM (layer));
progress = gimp_progress_start (options->gdisp,
_("Scaling..."),
TRUE, NULL, NULL);
if (gimage)
{
GimpProgress *progress;
progress = gimp_progress_start (options->gdisp,
_("Scaling..."),
TRUE, NULL, NULL);
gimp_item_scale_by_origin (GIMP_ITEM (layer),
options->resize->width,
options->resize->height,
options->resize->interpolation,
gimp_progress_update_and_flush, progress,
TRUE);
if (gimp_layer_is_floating_sel (layer))
{
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_SCALE,
_("Scale Layer"));
gimp_progress_end (progress);
floating_sel_relax (layer, TRUE);
}
gimp_item_scale_by_origin (GIMP_ITEM (layer),
options->resize->width,
options->resize->height,
options->resize->interpolation,
gimp_progress_update_and_flush, progress,
TRUE);
if (gimp_layer_is_floating_sel (layer))
{
floating_sel_rigor (layer, TRUE);
gimp_image_undo_group_end (gimage);
}
gimp_progress_end (progress);
gimp_image_flush (gimage);
}
gimp_image_flush (gimage);
gtk_widget_destroy (options->resize->resize_shell);
}
......@@ -1272,37 +1245,17 @@ resize_layer_query_ok_callback (GtkWidget *widget,
if (options->resize->width > 0 && options->resize->height > 0 &&
(layer = (options->layer)))
{
GimpImage *gimage;
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (layer));
gtk_widget_set_sensitive (options->resize->resize_shell, FALSE);
gimage = gimp_item_get_image (GIMP_ITEM (layer));
if (gimage)
{
if (gimp_layer_is_floating_sel (layer))
{
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_RESIZE,
_("Resize Layer"));
floating_sel_relax (layer, TRUE);
}
gimp_item_resize (GIMP_ITEM (layer),
options->resize->width,
options->resize->height,
options->resize->offset_x,
options->resize->offset_y);
if (gimp_layer_is_floating_sel (layer))
{
floating_sel_rigor (layer, TRUE);
gimp_image_undo_group_end (gimage);
}
gimp_item_resize (GIMP_ITEM (layer),
options->resize->width,
options->resize->height,
options->resize->offset_x,
options->resize->offset_y);
gimp_image_flush (gimage);
}
gimp_image_flush (gimage);
gtk_widget_destroy (options->resize->resize_shell);
}
......
......@@ -1100,8 +1100,7 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
}
else
{
GimpLayer *floating_layer = gimp_image_floating_sel (gimage);
GimpImageType drawable_type;
GimpImageType drawable_type;
if (GIMP_IS_LAYER (drawable) && (tile_manager_bpp (tiles) == 2 ||
tile_manager_bpp (tiles) == 4))
......@@ -1113,15 +1112,9 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
drawable_type = gimp_drawable_type (drawable);
}
if (floating_layer)
floating_sel_relax (floating_layer, TRUE);
gimp_drawable_set_tiles_full (drawable, TRUE, NULL,
tiles, drawable_type,
offset_x, offset_y);
if (floating_layer)
floating_sel_rigor (floating_layer, TRUE);
}
gimp_image_undo_group_end (gimage);
......
......@@ -1100,8 +1100,7 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
}
else
{
GimpLayer *floating_layer = gimp_image_floating_sel (gimage);
GimpImageType drawable_type;
GimpImageType drawable_type;
if (GIMP_IS_LAYER (drawable) && (tile_manager_bpp (tiles) == 2 ||
tile_manager_bpp (tiles) == 4))
......@@ -1113,15 +1112,9 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
drawable_type = gimp_drawable_type (drawable);
}
if (floating_layer)
floating_sel_relax (floating_layer, TRUE);
gimp_drawable_set_tiles_full (drawable, TRUE, NULL,
tiles, drawable_type,
offset_x, offset_y);
if (floating_layer)
floating_sel_rigor (floating_layer, TRUE);
}
gimp_image_undo_group_end (gimage);
......
......@@ -40,6 +40,8 @@
#include "gimpdrawable-transform.h"
#include "gimpimage.h"
#include "gimpimage-undo-push.h"
#include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimpmarshal.h"
#include "gimppattern.h"
#include "gimppreviewcache.h"
......@@ -70,6 +72,10 @@ static void gimp_drawable_invalidate_preview (GimpViewable *viewable)
static GimpItem * gimp_drawable_duplicate (GimpItem *item,
GType new_type,
gboolean add_alpha);
static void gimp_drawable_translate (GimpItem *item,
gint offset_x,
gint offset_y,
gboolean push_undo);
static void gimp_drawable_scale (GimpItem *item,
gint new_width,
gint new_height,
......@@ -213,6 +219,7 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
viewable_class->get_preview = gimp_drawable_get_preview;
item_class->duplicate = gimp_drawable_duplicate;
item_class->translate = gimp_drawable_translate;
item_class->scale = gimp_drawable_scale;
item_class->resize = gimp_drawable_resize;
item_class->flip = gimp_drawable_flip;
......@@ -349,6 +356,25 @@ gimp_drawable_duplicate (GimpItem *item,
return new_item;
}
static void
gimp_drawable_translate (GimpItem *item,
gint offset_x,
gint offset_y,
gboolean push_undo)
{
GimpDrawable *drawable = GIMP_DRAWABLE (item);
GimpImage *gimage = gimp_item_get_image (item);
if (gimp_drawable_has_floating_sel (drawable))
floating_sel_relax (gimp_image_floating_sel (gimage), FALSE);
GIMP_ITEM_CLASS (parent_class)->translate (item, offset_x, offset_y,
push_undo);
if (gimp_drawable_has_floating_sel (drawable))
floating_sel_rigor (gimp_image_floating_sel (gimage), FALSE);
}
static void
gimp_drawable_scale (GimpItem *item,
gint new_width,
......@@ -862,7 +888,8 @@ gimp_drawable_set_tiles_full (GimpDrawable *drawable,
gint offset_x,
gint offset_y)
{
GimpItem *item;
GimpItem *item;
GimpImage *gimage;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (tiles != NULL);
......@@ -870,6 +897,8 @@ gimp_drawable_set_tiles_full (GimpDrawable *drawable,
item = GIMP_ITEM (drawable);
gimage = gimp_item_get_image (item);
if (item->width != tile_manager_width (tiles) ||
item->height != tile_manager_height (tiles) ||
item->offset_x != offset_x ||
......@@ -878,11 +907,17 @@ gimp_drawable_set_tiles_full (GimpDrawable *drawable,
gimp_drawable_update (drawable, 0, 0, item->width, item->height);
}
if (gimp_drawable_has_floating_sel (drawable))
floating_sel_relax (gimp_image_floating_sel (gimage), FALSE);
GIMP_DRAWABLE_GET_CLASS (drawable)->set_tiles (drawable,
push_undo, undo_desc,
tiles, type,
offset_x, offset_y);
if (gimp_drawable_has_floating_sel (drawable))
floating_sel_rigor (gimp_image_floating_sel (gimage), FALSE);
gimp_drawable_update (drawable, 0, 0, item->width, item->height);
}
......@@ -1236,6 +1271,21 @@ gimp_drawable_bytes_without_alpha (const GimpDrawable *drawable)
return GIMP_IMAGE_TYPE_BYTES (type);
}
gboolean
gimp_drawable_has_floating_sel (const GimpDrawable *drawable)
{
GimpImage *gimage;
GimpLayer *floating_sel;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
floating_sel = gimp_image_floating_sel (gimage);
return (floating_sel && floating_sel->fs.drawable == drawable);
}
TileManager *
gimp_drawable_data (const GimpDrawable *drawable)
{
......
......@@ -205,6 +205,8 @@ gint gimp_drawable_bytes (const GimpDrawable *drawable);
gint gimp_drawable_bytes_with_alpha (const GimpDrawable *drawable);
gint gimp_drawable_bytes_without_alpha(const GimpDrawable *drawable);
gboolean gimp_drawable_has_floating_sel (const GimpDrawable *drawable);
TileManager * gimp_drawable_data (const GimpDrawable *drawable);
guchar * gimp_drawable_cmap (const GimpDrawable *drawable);
......
......@@ -144,7 +144,6 @@
#include "gimpimage-undo-push.h"
#include "gimplist.h"
#include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimppalette.h"
#include "cpercep.h"
......@@ -750,7 +749,6 @@ gimp_image_convert (GimpImage *gimage,
{
QuantizeObj *quantobj = NULL;
GimpLayer *layer;
GimpLayer *floating_layer;
GimpImageBaseType old_type;
GList *list;
GimpImageType new_layer_type;
......@@ -764,9 +762,6 @@ gimp_image_convert (GimpImage *gimage,
gimp_set_busy (gimage->gimp);
/* Get the floating layer if one exists */
floating_layer = gimp_image_floating_sel (gimage);
switch (new_type)
{
case GIMP_RGB:
......@@ -785,10 +780,6 @@ gimp_image_convert (GimpImage *gimage,
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_IMAGE_CONVERT,
undo_desc);
/* Relax the floating selection */
if (floating_layer)
floating_sel_relax (floating_layer, TRUE);
/* Push the image type to the stack */
gimp_image_undo_push_image_type (gimage, NULL);
......@@ -1029,10 +1020,6 @@ gimp_image_convert (GimpImage *gimage,
if (quantobj)
quantobj->delete_func (quantobj);
/* Rigor the floating selection */
if (floating_layer)
floating_sel_rigor (floating_layer, TRUE);
gimp_image_undo_group_end (gimage);
gimp_image_invalidate_layer_previews (gimage);
......
......@@ -34,7 +34,6 @@
#include "gimpimage-undo.h"
#include "gimpimage-undo-push.h"
#include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplist.h"
#include "gimp-intl.h"
......@@ -111,30 +110,12 @@ gimp_image_crop (GimpImage *gimage,
off_x -= x1;
off_y -= y1;
if (gimp_layer_is_floating_sel (layer))
{
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_RESIZE,
_("Resize Layer"));
floating_sel_relax (layer, TRUE);
}
gimp_item_resize (GIMP_ITEM (layer), width, height, off_x, off_y);
if (gimp_layer_is_floating_sel (layer))
{
floating_sel_rigor (layer, TRUE);
gimp_image_undo_group_end (gimage);
}
}
else
{
GimpLayer *floating_layer;
GimpItem *item;
GList *list;
floating_layer = gimp_image_floating_sel (gimage);
GimpItem *item;
GList *list;
if (crop_layers)
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_IMAGE_CROP,
......@@ -143,10 +124,6 @@ gimp_image_crop (GimpImage *gimage,
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_IMAGE_RESIZE,
_("Resize Image"));
/* relax the floating layer */
if (floating_layer)
floating_sel_relax (floating_layer, TRUE);
/* Push the image size to the stack */
gimp_image_undo_push_image_size (gimage, NULL);
......@@ -249,10 +226,6 @@ gimp_image_crop (GimpImage *gimage,
gimp_image_move_guide (gimage, guide, new_position, TRUE);
}
/* rigor the floating layer */
if (floating_layer)
floating_sel_rigor (floating_layer, TRUE);
gimp_image_undo_group_end (gimage);
gimp_image_update (gimage, 0, 0, gimage->width, gimage->height);
......
......@@ -29,7 +29,6 @@
#include "gimpimage-undo.h"
#include "gimpimage-undo-push.h"
#include "gimpitem.h"
#include "gimplayer-floating-sel.h"
#include "gimplist.h"
......@@ -39,12 +38,11 @@ gimp_image_flip (GimpImage *gimage,
GimpProgressFunc progress_func,
gpointer progress_data)
{
GimpLayer *floating_layer;
GimpItem *item;
GList *list;
gdouble axis;
gint progress_max;
gint progress_current = 1;
GimpItem *item;
GList *list;
gdouble axis;
gint progress_max;
gint progress_current = 1;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
......@@ -70,15 +68,8 @@ gimp_image_flip (GimpImage *gimage,
gimage->vectors->num_children +
1 /* selection */);
/* Get the floating layer if one exists */
floating_layer = gimp_image_floating_sel (gimage);
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_IMAGE_FLIP, NULL);
/* Relax the floating selection */
if (floating_layer)
floating_sel_relax (floating_layer, TRUE);
/* Flip all channels */
for (list = GIMP_LIST (gimage->channels)->list;
list;
......@@ -149,10 +140,6 @@ gimp_image_flip (GimpImage *gimage,
}
}
/* Rigor the floating selection */
if (floating_layer)
floating_sel_rigor (floating_layer, TRUE);
gimp_image_undo_group_end (gimage);
gimp_unset_busy (gimage->gimp);
......
......@@ -29,7 +29,6 @@
#include "gimpimage-undo.h"
#include "gimpimage-undo-push.h"
#include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplist.h"
#include "gimp-intl.h"
......@@ -44,10 +43,9 @@ gimp_image_resize (GimpImage *gimage,
GimpProgressFunc progress_func,
gpointer progress_data)
{
GimpLayer *floating_layer;
GList *list;
gint progress_max;
gint progress_current = 1;
GList *list;
gint progress_max;
gint progress_current = 1;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (new_width > 0 && new_height > 0);
......@@ -59,16 +57,9 @@ gimp_image_resize (GimpImage *gimage,
gimage->vectors->num_children +
1 /* selection */);
/* Get the floating layer if one exists */
floating_layer = gimp_image_floating_sel (gimage);
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_IMAGE_RESIZE,
_("Resize Image"));
/* Relax the floating selection */
if (floating_layer)
floating_sel_relax (floating_layer, TRUE);
/* Push the image size to the stack */
gimp_image_undo_push_image_size (gimage, NULL);
......@@ -156,10 +147,6 @@ gimp_image_resize (GimpImage *gimage,
gimp_image_move_guide (gimage, guide, new_position, TRUE);
}
/* Rigor the floating selection */
if (floating_layer)
floating_sel_rigor (floating_layer, TRUE);
gimp_image_undo_group_end (gimage);
gimp_viewable_size_changed (GIMP_VIEWABLE (gimage));
......
......@@ -29,7 +29,6 @@
#include "gimpimage-undo.h"
#include "gimpimage-undo-push.h"
#include "gimpitem.h"
#include "gimplayer-floating-sel.h"
#include "gimplist.h"
......@@ -48,16 +47,15 @@ gimp_image_rotate (GimpImage *gimage,
GimpProgressFunc progress_func,
gpointer progress_data)
{
GimpLayer *floating_layer;
GimpItem *item;
GList *list;
gdouble center_x;
gdouble center_y;
gint progress_max;
gint progress_current = 1;
gint new_image_width;
gint new_image_height;
gboolean size_changed;
GimpItem *item;
GList *list;
gdouble center_x;
gdouble center_y;
gint progress_max;
gint progress_current = 1;
gint new_image_width;
gint new_image_height;
gboolean size_changed;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
......@@ -71,15 +69,8 @@ gimp_image_rotate (GimpImage *gimage,
gimage->vectors->num_children +
1 /* selection */);
/* Get the floating layer if one exists */
floating_layer = gimp_image_floating_sel (gimage);
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_IMAGE_ROTATE, NULL);
/* Relax the floating selection */
if (floating_layer)
floating_sel_relax (floating_layer, TRUE);
/* Resize the image (if needed) */
switch (rotate_type)
{
......@@ -192,10 +183,6 @@ gimp_image_rotate (GimpImage *gimage,
}
}
/* Rigor the floating selection */
if (floating_layer)
floating_sel_rigor (floating_layer, TRUE);
gimp_image_undo_group_end (gimage);
if (size_changed)
......
......@@ -31,7 +31,6 @@
#include "gimpimage-undo.h"
#include "gimpimage-undo-push.h"
#include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplist.h"
#include "config/gimpguiconfig.h"
......@@ -47,16 +46,15 @@ gimp_image_scale (GimpImage *gimage,
GimpProgressFunc progress_func,
gpointer progress_data)
{
GimpLayer *floating_layer;
GimpItem *item;
GList *list;
GList *remove = NULL;
gint old_width;
gint old_height;
gdouble img_scale_w = 1.0;
gdouble img_scale_h = 1.0;
gint progress_max;
gint progress_current = 1;
GimpItem *item;
GList *list;
GList *remove = NULL;
gint old_width;
gint old_height;
gdouble img_scale_w = 1.0;
gdouble img_scale_h = 1.0;
gint progress_max;
gint progress_current = 1;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (new_width > 0 && new_height > 0);
......@@ -68,16 +66,9 @@ gimp_image_scale (GimpImage *gimage,
gimage->vectors->num_children +
1 /* selection */);
/* Get the floating layer if one exists */
floating_layer = gimp_image_floating_sel (gimage);
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_IMAGE_SCALE,
_("Scale Image"));
/* Relax the floating selection */
if (floating_layer)
floating_sel_relax (floating_layer, TRUE);
/* Push the image size to the stack */
gimp_image_undo_push_image_size (gimage, NULL);
......@@ -187,10 +178,6 @@ gimp_image_scale (GimpImage *gimage,
}
}
/* Rigor the floating selection */
if (floating_layer)
floating_sel_rigor (floating_layer, TRUE);
gimp_image_undo_group_end (gimage);
gimp_viewable_size_changed (GIMP_VIEWABLE (gimage));
......
......@@ -396,11 +396,17 @@ gimp_layer_set_tiles (GimpDrawable *drawable,
{
GimpLayer *layer = GIMP_LAYER (drawable);
if (gimp_layer_is_floating_sel (layer))
floating_sel_relax (layer, FALSE);
GIMP_DRAWABLE_CLASS (parent_class)->set_tiles (drawable,
push_undo, undo_desc,
tiles, type,
offset_x, offset_y);
if (gimp_layer_is_floating_sel (layer))
floating_sel_rigor (layer, FALSE);
if (layer->mask)
{
GIMP_ITEM (layer->mask)->offset_x = offset_x;
......@@ -615,9 +621,15 @@ gimp_layer_translate (GimpItem *item,
/* invalidate the selection boundary because of a layer modification */
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (layer));
if (gimp_layer_is_floating_sel (layer))
floating_sel_relax (layer, FALSE);
GIMP_ITEM_CLASS (parent_class)->translate (item, offset_x, offset_y,
push_undo);
if (gimp_layer_is_floating_sel (layer))
floating_sel_rigor (layer, FALSE);
/* update the new region */
gimp_drawable_update (GIMP_DRAWABLE (layer), 0, 0, item->width, item->height);
......@@ -1355,16 +1367,10 @@ gimp_layer_resize_to_image (GimpLayer *layer)
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_RESIZE,
_("Layer to Image Size"));
if (gimp_layer_is_floating_sel (layer))
floating_sel_relax (layer, TRUE);
gimp_item_offsets (GIMP_ITEM (layer), &offset_x, &offset_y);
gimp_item_resize (GIMP_ITEM (layer), gimage->width, gimage->height,
offset_x, offset_y);
if (gimp_layer_is_floating_sel (layer))
floating_sel_rigor (layer, TRUE);
gimp_image_undo_group_end (gimage);
}
......
......@@ -382,14 +382,8 @@ layers_crop_cmd_callback (GtkWidget *widget,
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_ITEM_RESIZE,
_("Crop Layer"));
if (gimp_layer_is_floating_sel (active_layer))
floating_sel_relax (active_layer, TRUE);
gimp_item_resize (GIMP_ITEM (active_layer), x2 - x1, y2 - y1, off_x, off_y);
if (gimp_layer_is_floating_sel (active_layer))
floating_sel_rigor (active_layer, TRUE);
gimp_image_undo_group_end (gimage);
gimp_image_flush (gimage);
......@@ -1167,46 +1161,25 @@ scale_layer_query_ok_callback (GtkWidget *widget,
if (options->resize->width > 0 && options->resize->height > 0 &&
(layer = (options->layer)))
{
GimpImage *gimage;
GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (layer));
GimpProgress *progress;
gtk_widget_set_sensitive (options->resize->resize_shell, FALSE);
gimage = gimp_item_get_image (GIMP_ITEM (layer));
progress = gimp_progress_start (options->gdisp,