Commit a3c3e7d3 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

General undo cleanup:

2002-02-23  Michael Natterer  <mitch@gimp.org>

	General undo cleanup:

	* app/undo.[ch]: made all undo structs private. Changed all
	undo_push_foo() functions to take useful parameters instead of
	"gpointer foo_ptr" and create the undo structs internally.
	Renamed lots of functions so they are more self-explanatory
	(like undo_push_gimage_mod -> undo_push_image_size). Added some
	undo functions (channel reordering is undoable now).  Never pass
	in a UndoType, as they are reseved for groups now (see below).
	Lots of cleanup and stuff...

	* app/undo_types.h: is a private header now which defines "enum
	UndoImplType" which is reserved for actual undo operations.
	All enum values are named "FOO_UNDO".

	* app/core/core-types.h: added the "UndoType" enum here and don't
	include "undo_types.h" any more. The UndoType values are all
	named "FOO_UNDO_GROUP" and are reserved for undo groups.

	The ID space of actual undo operations and undo groups
	is now strictly disjunct.

	* app/core/gimpchannel.h
	* app/core/gimpimage.h
	* app/core/gimplayer.h
	* app/core/gimplayermask.h
	* app/paint/gimppaintcore.h
	* app/tools/gimptransformtool.h: removed undo stuct definitions.

	* app/undo_history.c
	* app/path_transform.h
	* app/core/gimpchannel.c
	* app/core/gimpdrawable-transform.c
	* app/core/gimpedit.c
	* app/core/gimpimage-convert.c
	* app/core/gimpimage-crop.c
	* app/core/gimpimage-mask.c
	* app/core/gimpimage-merge.c
	* app/core/gimpimage-qmask.c
	* app/core/gimpimage-resize.c
	* app/core/gimpimage-scale.c
	* app/core/gimpimage.c
	* app/core/gimplayer-floating-sel.c
	* app/core/gimplayer.c
	* app/display/gimpdisplayshell-dnd.c
	* app/gui/channels-commands.c
	* app/gui/image-commands.c
	* app/gui/layers-commands.c
	* app/gui/paths-dialog.c
	* app/paint/gimppaintcore.c
	* app/tools/gimpbezierselecttool.c
	* app/tools/gimpeditselectiontool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimpmovetool.c
	* app/tools/gimptexttool.c
	* app/tools/gimptransformtool.c
	* tools/pdbgen/pdb/guides.pdb
	* tools/pdbgen/pdb/layer.pdb
	* tools/pdbgen/pdb/undo.pdb: changed accordingly.

	* app/pdb/guides_cmds.c
	* app/pdb/layer_cmds.c
	* app/pdb/undo_cmds.c: regenerated.

	* app/core/gimpimage.[ch]: added infrastructure for holding a
	GimpList of GimpVectors objects. The API is the same as for layers
	and channels. Not used yet.
parent b414ec7c
2002-02-23 Michael Natterer <mitch@gimp.org>
General undo cleanup:
* app/undo.[ch]: made all undo structs private. Changed all
undo_push_foo() functions to take useful parameters instead of
"gpointer foo_ptr" and create the undo structs internally.
Renamed lots of functions so they are more self-explanatory
(like undo_push_gimage_mod -> undo_push_image_size). Added some
undo functions (channel reordering is undoable now). Never pass
in a UndoType, as they are reseved for groups now (see below).
Lots of cleanup and stuff...
* app/undo_types.h: is a private header now which defines "enum
UndoImplType" which is reserved for actual undo operations.
All enum values are named "FOO_UNDO".
* app/core/core-types.h: added the "UndoType" enum here and don't
include "undo_types.h" any more. The UndoType values are all
named "FOO_UNDO_GROUP" and are reserved for undo groups.
The ID space of actual undo operations and undo groups
is now strictly disjunct.
* app/core/gimpchannel.h
* app/core/gimpimage.h
* app/core/gimplayer.h
* app/core/gimplayermask.h
* app/paint/gimppaintcore.h
* app/tools/gimptransformtool.h: removed undo stuct definitions.
* app/undo_history.c
* app/path_transform.h
* app/core/gimpchannel.c
* app/core/gimpdrawable-transform.c
* app/core/gimpedit.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-crop.c
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimpimage-qmask.c
* app/core/gimpimage-resize.c
* app/core/gimpimage-scale.c
* app/core/gimpimage.c
* app/core/gimplayer-floating-sel.c
* app/core/gimplayer.c
* app/display/gimpdisplayshell-dnd.c
* app/gui/channels-commands.c
* app/gui/image-commands.c
* app/gui/layers-commands.c
* app/gui/paths-dialog.c
* app/paint/gimppaintcore.c
* app/tools/gimpbezierselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/tools/gimptexttool.c
* app/tools/gimptransformtool.c
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/layer.pdb
* tools/pdbgen/pdb/undo.pdb: changed accordingly.
* app/pdb/guides_cmds.c
* app/pdb/layer_cmds.c
* app/pdb/undo_cmds.c: regenerated.
* app/core/gimpimage.[ch]: added infrastructure for holding a
GimpList of GimpVectors objects. The API is the same as for layers
and channels. Not used yet.
2002-02-22 Sven Neumann <sven@gimp.org>
* HACKING
......
......@@ -359,7 +359,7 @@ channels_new_channel_query (GimpImage *gimage,
height = gimp_drawable_height (GIMP_DRAWABLE (template));
gimp_drawable_offsets (GIMP_DRAWABLE (template), &off_x, &off_y);
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
undo_push_group_start (gimage, EDIT_PASTE_UNDO_GROUP);
new_channel = gimp_channel_new (gimage,
width, height,
......
......@@ -432,7 +432,7 @@ image_scale_implement (ImageResize *image_scale)
if (image_scale->resize->resolution_x != gimage->xresolution ||
image_scale->resize->resolution_y != gimage->yresolution)
{
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
undo_push_group_start (gimage, IMAGE_SCALE_UNDO_GROUP);
gimp_image_set_resolution (gimage,
image_scale->resize->resolution_x,
......@@ -444,7 +444,7 @@ image_scale_implement (ImageResize *image_scale)
if (image_scale->resize->unit != gimage->unit)
{
if (! display_flush)
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
undo_push_group_start (gimage, IMAGE_SCALE_UNDO_GROUP);
gimp_image_set_unit (gimage, image_scale->resize->unit);
......@@ -460,7 +460,7 @@ image_scale_implement (ImageResize *image_scale)
GimpProgress *progress;
if (! display_flush)
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
undo_push_group_start (gimage, IMAGE_SCALE_UNDO_GROUP);
progress = gimp_progress_start (image_scale->gdisp,
_("Scaling..."),
......
......@@ -512,9 +512,6 @@ new_layer_query_ok_callback (GtkWidget *widget,
if ((gimage = options->gimage))
{
/* Start a group undo */
undo_push_group_start (gimage, LAYER_ADD_UNDO);
layer = gimp_layer_new (gimage, options->xsize, options->ysize,
gimp_image_base_type_with_alpha (gimage),
layer_name, OPAQUE_OPACITY, GIMP_NORMAL_MODE);
......@@ -525,9 +522,6 @@ new_layer_query_ok_callback (GtkWidget *widget,
fill_type);
gimp_image_add_layer (gimage, layer, -1);
/* End the group undo */
undo_push_group_end (gimage);
gdisplays_flush ();
}
else
......@@ -577,7 +571,7 @@ layers_new_layer_query (GimpImage *gimage,
height = gimp_drawable_height (GIMP_DRAWABLE (template));
gimp_drawable_offsets (GIMP_DRAWABLE (template), &off_x, &off_y);
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
undo_push_group_start (gimage, EDIT_PASTE_UNDO_GROUP);
new_layer = gimp_layer_new (gimage, width, height,
gimp_image_base_type_with_alpha (gimage),
......@@ -1008,7 +1002,7 @@ scale_layer_query_ok_callback (GtkWidget *widget,
if ((gimage = GIMP_DRAWABLE (layer)->gimage) != NULL)
{
undo_push_group_start (gimage, LAYER_SCALE_UNDO);
undo_push_group_start (gimage, LAYER_SCALE_UNDO_GROUP);
if (gimp_layer_is_floating_sel (layer))
floating_sel_relax (layer, TRUE);
......@@ -1097,7 +1091,7 @@ resize_layer_query_ok_callback (GtkWidget *widget,
if ((gimage = GIMP_DRAWABLE (layer)->gimage) != NULL)
{
undo_push_group_start (gimage, LAYER_RESIZE_UNDO);
undo_push_group_start (gimage, LAYER_RESIZE_UNDO_GROUP);
if (gimp_layer_is_floating_sel (layer))
floating_sel_relax (layer, TRUE);
......
......@@ -28,8 +28,6 @@
#include "plug-in/plug-in-types.h"
#include "vectors/vectors-types.h"
#include "undo_types.h" /* EEK */
#include "core/core-enums.h"
......@@ -124,6 +122,43 @@ typedef enum
PATTERN_BUCKET_FILL
} BucketFillMode;
typedef enum /*< pdb-skip >*/ /*< skip >*/
{
/* NOTE: If you change this list, please update the textual mapping at
* the bottom of undo.c as well.
*/
/* Type NO_UNDO_GROUP (0) is special - in the gimpimage structure it
* means there is no undo group currently being added to.
*/
NO_UNDO_GROUP = 0,
FIRST_UNDO_GROUP = NO_UNDO_GROUP,
IMAGE_SCALE_UNDO_GROUP,
IMAGE_RESIZE_UNDO_GROUP,
IMAGE_CONVERT_UNDO_GROUP,
IMAGE_CROP_UNDO_GROUP,
IMAGE_LAYERS_MERGE_UNDO_GROUP,
IMAGE_QMASK_UNDO_GROUP,
IMAGE_GUIDE_UNDO_GROUP,
LAYER_SCALE_UNDO_GROUP,
LAYER_RESIZE_UNDO_GROUP,
LAYER_DISPLACE_UNDO_GROUP,
LAYER_LINKED_UNDO_GROUP,
LAYER_APPLY_MASK_UNDO_GROUP,
FS_FLOAT_UNDO_GROUP,
FS_ANCHOR_UNDO_GROUP,
EDIT_PASTE_UNDO_GROUP,
EDIT_CUT_UNDO_GROUP,
TEXT_UNDO_GROUP,
TRANSFORM_UNDO_GROUP,
PAINT_UNDO_GROUP,
MISC_UNDO_GROUP,
LAST_UNDO_GROUP = MISC_UNDO_GROUP
} UndoType;
/* base objects */
......
......@@ -59,7 +59,7 @@ gimp_edit_cut (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
/* Start a group undo */
undo_push_group_start (gimage, EDIT_CUT_UNDO);
undo_push_group_start (gimage, EDIT_CUT_UNDO_GROUP);
/* See if the gimage mask is empty */
empty = gimp_image_mask_is_empty (gimage);
......@@ -187,7 +187,7 @@ gimp_edit_paste (GimpImage *gimage,
return NULL;
/* Start a group undo */
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
undo_push_group_start (gimage, EDIT_PASTE_UNDO_GROUP);
/* Set the offsets to the center of the image */
if (drawable)
......
......@@ -612,7 +612,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
/* Start a transform undo group */
undo_push_group_start (gimage, TRANSFORM_CORE_UNDO);
undo_push_group_start (gimage, TRANSFORM_UNDO_GROUP);
/* Cut/Copy from the specified drawable */
float_tiles = gimp_drawable_transform_cut (drawable, &new_layer);
......@@ -659,7 +659,7 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
/* Start a transform undo group */
undo_push_group_start (gimage, TRANSFORM_CORE_UNDO);
undo_push_group_start (gimage, TRANSFORM_UNDO_GROUP);
/* Cut/Copy from the specified drawable */
float_tiles = gimp_drawable_transform_cut (drawable, &new_layer);
......@@ -761,7 +761,7 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
&(GIMP_DRAWABLE (layer)->offset_y));
/* Start a group undo */
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
undo_push_group_start (gimage, EDIT_PASTE_UNDO_GROUP);
floating_sel_attach (layer, drawable);
......
......@@ -1199,12 +1199,10 @@ void
gimp_channel_push_undo (GimpChannel *mask)
{
gint x1, y1, x2, y2;
MaskUndo *mask_undo;
TileManager *undo_tiles;
PixelRegion srcPR, destPR;
GimpImage *gimage;
mask_undo = g_new (MaskUndo, 1);
if (gimp_channel_bounds (mask, &x1, &y1, &x2, &y2))
{
undo_tiles = tile_manager_new ((x2 - x1), (y2 - y1), 1);
......@@ -1216,13 +1214,10 @@ gimp_channel_push_undo (GimpChannel *mask)
else
undo_tiles = NULL;
mask_undo->tiles = undo_tiles;
mask_undo->x = x1;
mask_undo->y = y1;
/* push the undo buffer onto the undo stack */
gimage = GIMP_DRAWABLE (mask)->gimage;
undo_push_mask (gimage, mask_undo);
undo_push_image_mask (gimage, undo_tiles, x1, y1);
gimp_image_mask_invalidate (gimage);
/* invalidate the preview */
......
......@@ -63,25 +63,6 @@ struct _GimpChannelClass
};
/* Special undo types */
typedef struct _ChannelUndo ChannelUndo;
typedef struct _MaskUndo MaskUndo;
struct _ChannelUndo
{
GimpChannel *channel; /* the actual channel */
gint prev_position; /* former position in list */
GimpChannel *prev_channel; /* previous active channel */
};
struct _MaskUndo
{
TileManager *tiles; /* the actual mask */
gint x, y; /* offsets */
};
/* function declarations */
GType gimp_channel_get_type (void) G_GNUC_CONST;
......@@ -114,7 +95,7 @@ void gimp_channel_resize (GimpChannel *channel,
gint offy);
/* selection mask functions */
/* selection mask functions */
GimpChannel * gimp_channel_new_mask (GimpImage *gimage,
gint width,
......
......@@ -1199,12 +1199,10 @@ void
gimp_channel_push_undo (GimpChannel *mask)
{
gint x1, y1, x2, y2;
MaskUndo *mask_undo;
TileManager *undo_tiles;
PixelRegion srcPR, destPR;
GimpImage *gimage;
mask_undo = g_new (MaskUndo, 1);
if (gimp_channel_bounds (mask, &x1, &y1, &x2, &y2))
{
undo_tiles = tile_manager_new ((x2 - x1), (y2 - y1), 1);
......@@ -1216,13 +1214,10 @@ gimp_channel_push_undo (GimpChannel *mask)
else
undo_tiles = NULL;
mask_undo->tiles = undo_tiles;
mask_undo->x = x1;
mask_undo->y = y1;
/* push the undo buffer onto the undo stack */
gimage = GIMP_DRAWABLE (mask)->gimage;
undo_push_mask (gimage, mask_undo);
undo_push_image_mask (gimage, undo_tiles, x1, y1);
gimp_image_mask_invalidate (gimage);
/* invalidate the preview */
......
......@@ -63,25 +63,6 @@ struct _GimpChannelClass
};
/* Special undo types */
typedef struct _ChannelUndo ChannelUndo;
typedef struct _MaskUndo MaskUndo;
struct _ChannelUndo
{
GimpChannel *channel; /* the actual channel */
gint prev_position; /* former position in list */
GimpChannel *prev_channel; /* previous active channel */
};
struct _MaskUndo
{
TileManager *tiles; /* the actual mask */
gint x, y; /* offsets */
};
/* function declarations */
GType gimp_channel_get_type (void) G_GNUC_CONST;
......@@ -114,7 +95,7 @@ void gimp_channel_resize (GimpChannel *channel,
gint offy);
/* selection mask functions */
/* selection mask functions */
GimpChannel * gimp_channel_new_mask (GimpImage *gimage,
gint width,
......
......@@ -612,7 +612,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
/* Start a transform undo group */
undo_push_group_start (gimage, TRANSFORM_CORE_UNDO);
undo_push_group_start (gimage, TRANSFORM_UNDO_GROUP);
/* Cut/Copy from the specified drawable */
float_tiles = gimp_drawable_transform_cut (drawable, &new_layer);
......@@ -659,7 +659,7 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
/* Start a transform undo group */
undo_push_group_start (gimage, TRANSFORM_CORE_UNDO);
undo_push_group_start (gimage, TRANSFORM_UNDO_GROUP);
/* Cut/Copy from the specified drawable */
float_tiles = gimp_drawable_transform_cut (drawable, &new_layer);
......@@ -761,7 +761,7 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
&(GIMP_DRAWABLE (layer)->offset_y));
/* Start a group undo */
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
undo_push_group_start (gimage, EDIT_PASTE_UNDO_GROUP);
floating_sel_attach (layer, drawable);
......
......@@ -59,7 +59,7 @@ gimp_edit_cut (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
/* Start a group undo */
undo_push_group_start (gimage, EDIT_CUT_UNDO);
undo_push_group_start (gimage, EDIT_CUT_UNDO_GROUP);
/* See if the gimage mask is empty */
empty = gimp_image_mask_is_empty (gimage);
......@@ -187,7 +187,7 @@ gimp_edit_paste (GimpImage *gimage,
return NULL;
/* Start a group undo */
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
undo_push_group_start (gimage, EDIT_PASTE_UNDO_GROUP);
/* Set the offsets to the center of the image */
if (drawable)
......
......@@ -737,14 +737,14 @@ gimp_image_convert (GimpImage *gimage,
/* Get the floating layer if one exists */
floating_layer = gimp_image_floating_sel (gimage);
undo_push_group_start (gimage, GIMAGE_MOD_UNDO);
undo_push_group_start (gimage, IMAGE_CONVERT_UNDO_GROUP);
/* Relax the floating selection */
if (floating_layer)
floating_sel_relax (floating_layer, TRUE);
/* Push the image size to the stack */
undo_push_gimage_mod (gimage);
undo_push_image_size (gimage);
/* Set the new base type */
old_type = gimage->base_type;
......
......@@ -115,7 +115,7 @@ gimp_image_crop (GimpImage *gimage,
if (active_layer_only)
{
undo_push_group_start (gimage, LAYER_RESIZE_UNDO);
undo_push_group_start (gimage, LAYER_RESIZE_UNDO_GROUP);
layer = gimp_image_get_active_layer (gimage);
......@@ -138,14 +138,14 @@ gimp_image_crop (GimpImage *gimage,
{
floating_layer = gimp_image_floating_sel (gimage);
undo_push_group_start (gimage, CROP_UNDO);
undo_push_group_start (gimage, IMAGE_CROP_UNDO_GROUP);
/* relax the floating layer */
if (floating_layer)
floating_sel_relax (floating_layer, TRUE);
/* Push the image size to the stack */
undo_push_gimage_mod (gimage);
undo_push_image_size (gimage);
/* Set the new width and height */
gimage->width = width;
......@@ -214,7 +214,7 @@ gimp_image_crop (GimpImage *gimage,
guide_list_ptr = gimage->guides;
while ( guide_list_ptr != NULL)
{
undo_push_guide (gimage, (GimpGuide *) guide_list_ptr->data);
undo_push_image_guide (gimage, (GimpGuide *) guide_list_ptr->data);
guide_list_ptr = guide_list_ptr->next;
}
undo_push_group_end (gimage);
......
......@@ -385,7 +385,7 @@ gimp_image_mask_float (GimpImage *gimage,
}
/* Start an undo group */
undo_push_group_start (gimage, FLOAT_MASK_UNDO);
undo_push_group_start (gimage, FS_FLOAT_UNDO_GROUP);
/* Cut the selected region */
tiles = gimp_image_mask_extract (gimage, drawable, TRUE, FALSE, TRUE);
......@@ -616,7 +616,7 @@ gimp_image_mask_stroke (GimpImage *gimage,
gimp_image_mask_stroking = TRUE;
/* Start an undo group */
undo_push_group_start (gimage, PAINT_CORE_UNDO);
undo_push_group_start (gimage, PAINT_UNDO_GROUP);
seg = 0;
cpnt = 0;
......
......@@ -298,7 +298,7 @@ gimp_image_merge_layers (GimpImage *gimage,
return NULL;
/* Start a merge undo group */
undo_push_group_start (gimage, LAYER_MERGE_UNDO);
undo_push_group_start (gimage, IMAGE_LAYERS_MERGE_UNDO_GROUP);
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (layer)));
......
......@@ -67,7 +67,7 @@ gimp_image_set_qmask_state (GimpImage *gimage,
if (! mask)
{
undo_push_group_start (gimage, QMASK_UNDO);
undo_push_group_start (gimage, IMAGE_QMASK_UNDO_GROUP);
if (gimp_image_mask_is_empty (gimage))
{
......@@ -106,7 +106,7 @@ gimp_image_set_qmask_state (GimpImage *gimage,
if (gimage->qmask_inverted)
gimp_channel_invert (mask);
undo_push_qmask (gimage);
undo_push_image_qmask (gimage);
undo_push_group_end (gimage);
......@@ -122,13 +122,13 @@ gimp_image_set_qmask_state (GimpImage *gimage,
if (mask)
{
undo_push_group_start (gimage, QMASK_UNDO);
undo_push_group_start (gimage, IMAGE_QMASK_UNDO_GROUP);
/* push the undo here since removing the mask will
* call the qmask_removed_callback() which will set
* the qmask_state to FALSE
*/
undo_push_qmask (gimage);
undo_push_image_qmask (gimage);
if (gimage->qmask_inverted)
gimp_channel_invert (mask);
......
......@@ -67,7 +67,7 @@ gimp_image_set_qmask_state (GimpImage *gimage,
if (! mask)
{
undo_push_group_start (gimage, QMASK_UNDO);
undo_push_group_start (gimage, IMAGE_QMASK_UNDO_GROUP);
if (gimp_image_mask_is_empty (gimage))
{
......@@ -106,7 +106,7 @@ gimp_image_set_qmask_state (GimpImage *gimage,
if (gimage->qmask_inverted)
gimp_channel_invert (mask);
undo_push_qmask (gimage);
undo_push_image_qmask (gimage);
undo_push_group_end (gimage);
......@@ -122,13 +122,13 @@ gimp_image_set_qmask_state (GimpImage *gimage,
if (mask)
{
undo_push_group_start (gimage, QMASK_UNDO);
undo_push_group_start (gimage, IMAGE_QMASK_UNDO_GROUP);
/* push the undo here since removing the mask will
* call the qmask_removed_callback() which will set
* the qmask_state to FALSE
*/
undo_push_qmask (gimage);
undo_push_image_qmask (gimage);
if (gimage->qmask_inverted)
gimp_channel_invert (mask);
......
......@@ -57,14 +57,14 @@ gimp_image_resize (GimpImage *gimage,
/* Get the floating layer if one exists */
floating_layer = gimp_image_floating_sel (gimage);
undo_push_group_start (gimage, IMAGE_RESIZE_UNDO);
undo_push_group_start (gimage, IMAGE_RESIZE_UNDO_GROUP);
/* Relax the floating selection */
if (floating_layer)
floating_sel_relax (floating_layer, TRUE);
/* Push the image size to the stack */
undo_push_gimage_mod (gimage);
undo_push_image_size (gimage);
/* Set the new width and height */
gimage->width = new_width;
......@@ -92,14 +92,14 @@ gimp_image_resize (GimpImage *gimage,
switch (guide->orientation)
{
case ORIENTATION_HORIZONTAL:
undo_push_guide (gimage, guide);
undo_push_image_guide (gimage, guide);
guide->position += offset_y;
if (guide->position < 0 || guide->position > new_height)
gimp_image_delete_guide (gimage, guide);
break;
case ORIENTATION_VERTICAL:
undo_push_guide (gimage, guide);
undo_push_image_guide (gimage, guide);
guide->position += offset_x;
if (guide->position < 0 || guide->position > new_width)
gimp_image_delete_guide (gimage, guide);
......
......@@ -69,14 +69,14 @@ gimp_image_scale (GimpImage *gimage,
/* Get the floating layer if one exists */
floating_layer = gimp_image_floating_sel (gimage);
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
undo_push_group_start (gimage, IMAGE_SCALE_UNDO_GROUP);
/* Relax the floating selection */
if (floating_layer)
floating_sel_relax (floating_layer, TRUE);
/* Push the image size to the stack */
undo_push_gimage_mod (gimage);
undo_push_image_size (gimage);
/* Set the new width and height */
......@@ -158,11 +158,11 @@ gimp_image_scale (GimpImage *gimage,
switch (guide->orientation)
{
case ORIENTATION_HORIZONTAL:
undo_push_guide (gimage, guide);
undo_push_image_guide (gimage, guide);
guide->position = (guide->position * new_height) / old_height;
break;
case ORIENTATION_VERTICAL:
undo_push_guide (gimage, guide);
undo_push_image_guide (gimage, guide);
guide->position = (guide->position * new_width) / old_width;
break;
default:
......
This diff is collapsed.
......@@ -20,98 +20,8 @@
#define __UNDO_H__
gboolean undo_push_group_start (GimpImage *gimage,
UndoType type);
gboolean undo_push_group_end (GimpImage *gimage);
gboolean undo_push_image (GimpImage *gimage,
GimpDrawable *drawable,
gint x1,
gint y1,
gint x2,
gint y2);
gboolean undo_push_image_mod (GimpImage *gimage,
GimpDrawable *drawable,
gint x1,
gint y1,
gint x2,
gint y2,
gpointer tiles_ptr,
gboolean sparse);
gboolean undo_push_mask (GimpImage *gimage,
gpointer mask_ptr);
gboolean undo_push_layer_displace (GimpImage *gimage,
GimpLayer *layer);
gboolean undo_push_transform (GimpImage *gimage,
gpointer tu_ptr);
gboolean undo_push_paint (GimpImage *gimage,
gpointer pu_ptr);
gboolean undo_push_layer (GimpImage *gimage,
UndoType type,
gpointer lu_ptr);
gboolean undo_push_layer_mod (GimpImage *gimage,
gpointer layer_ptr);
gboolean undo_push_layer_mask (GimpImage *gimage,
UndoType type,
gpointer lmu_prt);
gboolean undo_push_layer_change (GimpImage *gimage,
GimpLayer *layer);
gboolean undo_push_layer_reposition (GimpImage *gimage,
GimpLayer *layer);
gboolean undo_push_channel (GimpImage *gimage,
UndoType type,
gpointer cu_ptr);
gboolean undo_push_channel_mod (GimpImage *gimage,
gpointer cmu_ptr);
gboolean undo_push_fs_to_layer (GimpImage *gimage,
gpointer fsu_ptr);
gboolean undo_push_fs_rigor (GimpImage *gimage,
gint32 layer_ID);
gboolean undo_push_fs_relax (GimpImage *gimage,
gint32 layer_ID);
gboolean undo_push_gimage_mod (GimpImage *gimage);
gboolean undo_push_guide (GimpImage *gimage,
gpointer guide);
gboolean undo_push_image_parasite (GimpImage *gimage,
gpointer parasite);
gboolean undo_push_drawable_parasite (GimpImage *gimage,
GimpDrawable *drawable,
gpointer parasite);
gboolean undo_push_image_parasite_remove
(GimpImage *gimage,
const gchar *name);
gboolean undo_push_drawable_parasite_remove
(GimpImage *gimage,
GimpDrawable *drabable,
const gchar *name);
gboolean undo_push_qmask (GimpImage *gimage);
gboolean undo_push_resolution (GimpImage *gimage);
gboolean undo_push_layer_rename (GimpImage *gimage,
GimpLayer *layer);
gboolean undo_push_cantundo (GimpImage *gimage,
const gchar *action);
gboolean undo_pop (GimpImage *gimage);
gboolean undo_redo (GimpImage *gimage);
void undo_free (GimpImage *gimage);
const gchar *undo_get_undo_name (GimpImage *gimage);
const gchar *undo_get_redo_name (GimpImage *gimage);
/* Stack peeking functions */
typedef gint (*undo_map_fn) (const gchar *undoitemname,
gpointer data);
void undo_map_over_undo_stack (GimpImage *gimage,