2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2001-03-05 09:01:16 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2001-03-05 09:01:16 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2001-03-05 09:01:16 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2001-03-05 09:01:16 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2013-10-15 07:58:39 +08:00
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2001-03-05 09:01:16 +08:00
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "core-types.h"
|
2001-03-05 09:01:16 +08:00
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
#include "config/gimpcoreconfig.h"
|
|
|
|
|
|
|
|
#include "gimp.h"
|
2004-07-13 00:59:36 +08:00
|
|
|
#include "gimp-utils.h"
|
2006-10-22 02:46:49 +08:00
|
|
|
#include "gimpdrawableundo.h"
|
2001-03-05 09:01:16 +08:00
|
|
|
#include "gimpimage.h"
|
2010-02-04 03:31:25 +08:00
|
|
|
#include "gimpimage-private.h"
|
2001-03-05 09:01:16 +08:00
|
|
|
#include "gimpimage-undo.h"
|
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
|
|
|
#include "gimpitem.h"
|
2003-02-13 01:11:34 +08:00
|
|
|
#include "gimplist.h"
|
2001-03-05 09:01:16 +08:00
|
|
|
#include "gimpundostack.h"
|
|
|
|
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
/* local function prototypes */
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
static void gimp_image_undo_pop_stack (GimpImage *image,
|
2004-07-29 22:16:21 +08:00
|
|
|
GimpUndoStack *undo_stack,
|
|
|
|
GimpUndoStack *redo_stack,
|
|
|
|
GimpUndoMode undo_mode);
|
2006-03-29 01:08:36 +08:00
|
|
|
static void gimp_image_undo_free_space (GimpImage *image);
|
|
|
|
static void gimp_image_undo_free_redo (GimpImage *image);
|
2004-07-29 22:16:21 +08:00
|
|
|
|
2004-08-03 22:09:49 +08:00
|
|
|
static GimpDirtyMask gimp_image_undo_dirty_from_type (GimpUndoType undo_type);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
2010-02-08 18:11:33 +08:00
|
|
|
gboolean
|
2016-05-20 05:51:44 +08:00
|
|
|
gimp_image_undo_is_enabled (GimpImage *image)
|
2010-02-08 18:11:33 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
|
|
|
|
|
|
|
return (GIMP_IMAGE_GET_PRIVATE (image)->undo_freeze_count == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_image_undo_enable (GimpImage *image)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
|
|
|
|
|
|
|
/* Free all undo steps as they are now invalidated */
|
|
|
|
gimp_image_undo_free (image);
|
|
|
|
|
|
|
|
return gimp_image_undo_thaw (image);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_image_undo_disable (GimpImage *image)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
|
|
|
|
|
|
|
return gimp_image_undo_freeze (image);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_image_undo_freeze (GimpImage *image)
|
|
|
|
{
|
|
|
|
GimpImagePrivate *private;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
|
|
|
|
|
|
|
private = GIMP_IMAGE_GET_PRIVATE (image);
|
|
|
|
|
|
|
|
private->undo_freeze_count++;
|
|
|
|
|
|
|
|
if (private->undo_freeze_count == 1)
|
|
|
|
gimp_image_undo_event (image, GIMP_UNDO_EVENT_UNDO_FREEZE, NULL);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_image_undo_thaw (GimpImage *image)
|
|
|
|
{
|
|
|
|
GimpImagePrivate *private;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
|
|
|
|
|
|
|
private = GIMP_IMAGE_GET_PRIVATE (image);
|
|
|
|
|
|
|
|
g_return_val_if_fail (private->undo_freeze_count > 0, FALSE);
|
|
|
|
|
|
|
|
private->undo_freeze_count--;
|
|
|
|
|
|
|
|
if (private->undo_freeze_count == 0)
|
|
|
|
gimp_image_undo_event (image, GIMP_UNDO_EVENT_UNDO_THAW, NULL);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
gboolean
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo (GimpImage *image)
|
2001-03-05 09:01:16 +08:00
|
|
|
{
|
2010-02-05 03:06:49 +08:00
|
|
|
GimpImagePrivate *private;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2010-02-05 03:06:49 +08:00
|
|
|
|
|
|
|
private = GIMP_IMAGE_GET_PRIVATE (image);
|
|
|
|
|
|
|
|
g_return_val_if_fail (private->pushing_undo_group == GIMP_UNDO_GROUP_NONE,
|
2003-02-13 19:23:50 +08:00
|
|
|
FALSE);
|
2001-03-05 09:01:16 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_pop_stack (image,
|
2010-02-05 03:06:49 +08:00
|
|
|
private->undo_stack,
|
|
|
|
private->redo_stack,
|
2003-02-13 01:11:34 +08:00
|
|
|
GIMP_UNDO_MODE_UNDO);
|
|
|
|
|
|
|
|
return TRUE;
|
2001-03-05 09:01:16 +08:00
|
|
|
}
|
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
gboolean
|
|
|
|
gimp_image_redo (GimpImage *image)
|
|
|
|
{
|
|
|
|
GimpImagePrivate *private;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
|
|
|
|
|
|
|
private = GIMP_IMAGE_GET_PRIVATE (image);
|
|
|
|
|
|
|
|
g_return_val_if_fail (private->pushing_undo_group == GIMP_UNDO_GROUP_NONE,
|
|
|
|
FALSE);
|
|
|
|
|
|
|
|
gimp_image_undo_pop_stack (image,
|
|
|
|
private->redo_stack,
|
|
|
|
private->undo_stack,
|
|
|
|
GIMP_UNDO_MODE_REDO);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2006-06-13 10:03:44 +08:00
|
|
|
/*
|
|
|
|
* this function continues to undo as long as it only sees certain
|
|
|
|
* undo types, in particular visibility changes.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gimp_image_strong_undo (GimpImage *image)
|
|
|
|
{
|
2010-02-05 03:06:49 +08:00
|
|
|
GimpImagePrivate *private;
|
|
|
|
GimpUndo *undo;
|
2006-06-13 10:03:44 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2010-02-05 03:06:49 +08:00
|
|
|
|
|
|
|
private = GIMP_IMAGE_GET_PRIVATE (image);
|
|
|
|
|
|
|
|
g_return_val_if_fail (private->pushing_undo_group == GIMP_UNDO_GROUP_NONE,
|
2006-06-13 10:03:44 +08:00
|
|
|
FALSE);
|
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
undo = gimp_undo_stack_peek (private->undo_stack);
|
2006-06-13 10:03:44 +08:00
|
|
|
|
|
|
|
gimp_image_undo (image);
|
|
|
|
|
|
|
|
while (gimp_undo_is_weak (undo))
|
|
|
|
{
|
2010-02-05 03:06:49 +08:00
|
|
|
undo = gimp_undo_stack_peek (private->undo_stack);
|
2006-06-13 10:03:44 +08:00
|
|
|
if (gimp_undo_is_weak (undo))
|
|
|
|
gimp_image_undo (image);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* this function continues to redo as long as it only sees certain
|
|
|
|
* undo types, in particular visibility changes. Note that the
|
|
|
|
* order of events is set up to make it exactly reverse
|
|
|
|
* gimp_image_strong_undo().
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gimp_image_strong_redo (GimpImage *image)
|
|
|
|
{
|
2010-02-05 03:06:49 +08:00
|
|
|
GimpImagePrivate *private;
|
|
|
|
GimpUndo *undo;
|
2006-06-13 10:03:44 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2010-02-05 03:06:49 +08:00
|
|
|
|
|
|
|
private = GIMP_IMAGE_GET_PRIVATE (image);
|
|
|
|
|
|
|
|
g_return_val_if_fail (private->pushing_undo_group == GIMP_UNDO_GROUP_NONE,
|
2006-06-13 10:03:44 +08:00
|
|
|
FALSE);
|
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
undo = gimp_undo_stack_peek (private->redo_stack);
|
2006-06-13 10:03:44 +08:00
|
|
|
|
|
|
|
gimp_image_redo (image);
|
|
|
|
|
|
|
|
while (gimp_undo_is_weak (undo))
|
|
|
|
{
|
2010-02-05 03:06:49 +08:00
|
|
|
undo = gimp_undo_stack_peek (private->redo_stack);
|
2006-06-13 10:03:44 +08:00
|
|
|
if (gimp_undo_is_weak (undo))
|
|
|
|
gimp_image_redo (image);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
GimpUndoStack *
|
2016-05-20 05:51:44 +08:00
|
|
|
gimp_image_get_undo_stack (GimpImage *image)
|
2010-02-05 03:06:49 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
|
|
|
|
return GIMP_IMAGE_GET_PRIVATE (image)->undo_stack;
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpUndoStack *
|
2016-05-20 05:51:44 +08:00
|
|
|
gimp_image_get_redo_stack (GimpImage *image)
|
2010-02-05 03:06:49 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
|
|
|
|
return GIMP_IMAGE_GET_PRIVATE (image)->redo_stack;
|
|
|
|
}
|
|
|
|
|
2001-03-05 09:01:16 +08:00
|
|
|
void
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_free (GimpImage *image)
|
2003-02-13 01:11:34 +08:00
|
|
|
{
|
2010-02-04 03:31:25 +08:00
|
|
|
GimpImagePrivate *private;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_if_fail (GIMP_IS_IMAGE (image));
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2010-02-04 03:31:25 +08:00
|
|
|
private = GIMP_IMAGE_GET_PRIVATE (image);
|
|
|
|
|
2003-02-20 20:47:42 +08:00
|
|
|
/* Emit the UNDO_FREE event before actually freeing everything
|
|
|
|
* so the views can properly detach from the undo items
|
|
|
|
*/
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_event (image, GIMP_UNDO_EVENT_UNDO_FREE, NULL);
|
2003-02-20 20:47:42 +08:00
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
gimp_undo_free (GIMP_UNDO (private->undo_stack), GIMP_UNDO_MODE_UNDO);
|
|
|
|
gimp_undo_free (GIMP_UNDO (private->redo_stack), GIMP_UNDO_MODE_REDO);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
|
|
|
/* If the image was dirty, but could become clean by redo-ing
|
|
|
|
* some actions, then it should now become 'infinitely' dirty.
|
|
|
|
* This is because we've just nuked the actions that would allow
|
2008-01-24 17:38:44 +08:00
|
|
|
* the image to become clean again.
|
2003-02-13 01:11:34 +08:00
|
|
|
*/
|
2010-02-04 03:31:25 +08:00
|
|
|
if (private->dirty < 0)
|
|
|
|
private->dirty = 100000;
|
2003-02-13 01:11:34 +08:00
|
|
|
|
|
|
|
/* The same applies to the case where the image would become clean
|
|
|
|
* due to undo actions, but since user can't undo without an undo
|
|
|
|
* stack, that's not so much a problem.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
gint
|
2016-05-20 05:51:44 +08:00
|
|
|
gimp_image_get_undo_group_count (GimpImage *image)
|
2010-02-05 03:06:49 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), 0);
|
|
|
|
|
|
|
|
return GIMP_IMAGE_GET_PRIVATE (image)->group_count;
|
|
|
|
}
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
gboolean
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_group_start (GimpImage *image,
|
2004-08-03 22:09:49 +08:00
|
|
|
GimpUndoType undo_type,
|
2003-02-13 01:11:34 +08:00
|
|
|
const gchar *name)
|
|
|
|
{
|
2010-02-04 03:31:25 +08:00
|
|
|
GimpImagePrivate *private;
|
|
|
|
GimpUndoStack *undo_group;
|
|
|
|
GimpDirtyMask dirty_mask;
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2004-08-03 22:09:49 +08:00
|
|
|
g_return_val_if_fail (undo_type > GIMP_UNDO_GROUP_FIRST &&
|
|
|
|
undo_type <= GIMP_UNDO_GROUP_LAST, FALSE);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2010-02-04 03:31:25 +08:00
|
|
|
private = GIMP_IMAGE_GET_PRIVATE (image);
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
if (! name)
|
2004-08-03 22:09:49 +08:00
|
|
|
name = gimp_undo_type_to_name (undo_type);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2004-08-03 22:09:49 +08:00
|
|
|
dirty_mask = gimp_image_undo_dirty_from_type (undo_type);
|
2004-07-29 22:16:21 +08:00
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
/* Notify listeners that the image will be modified */
|
2010-02-05 03:06:49 +08:00
|
|
|
if (private->group_count == 0 && dirty_mask != GIMP_DIRTY_NONE)
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_dirty (image, dirty_mask);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2010-02-04 03:31:25 +08:00
|
|
|
if (private->undo_freeze_count > 0)
|
2003-02-13 01:11:34 +08:00
|
|
|
return FALSE;
|
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
private->group_count++;
|
2003-02-13 01:11:34 +08:00
|
|
|
|
|
|
|
/* If we're already in a group...ignore */
|
2010-02-05 03:06:49 +08:00
|
|
|
if (private->group_count > 1)
|
2003-02-13 01:11:34 +08:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* nuke the redo stack */
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_free_redo (image);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
undo_group = gimp_undo_stack_new (image);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
|
|
|
gimp_object_set_name (GIMP_OBJECT (undo_group), name);
|
2004-08-03 22:09:49 +08:00
|
|
|
GIMP_UNDO (undo_group)->undo_type = undo_type;
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_UNDO (undo_group)->dirty_mask = dirty_mask;
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
gimp_undo_stack_push_undo (private->undo_stack, GIMP_UNDO (undo_group));
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
private->pushing_undo_group = undo_type;
|
2003-02-13 01:11:34 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_group_end (GimpImage *image)
|
2003-02-13 01:11:34 +08:00
|
|
|
{
|
2010-02-04 03:31:25 +08:00
|
|
|
GimpImagePrivate *private;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2010-02-04 03:31:25 +08:00
|
|
|
private = GIMP_IMAGE_GET_PRIVATE (image);
|
|
|
|
|
|
|
|
if (private->undo_freeze_count > 0)
|
2003-02-13 01:11:34 +08:00
|
|
|
return FALSE;
|
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
g_return_val_if_fail (private->group_count > 0, FALSE);
|
2003-02-15 06:33:22 +08:00
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
private->group_count--;
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
if (private->group_count == 0)
|
2003-02-13 01:11:34 +08:00
|
|
|
{
|
2010-02-05 03:06:49 +08:00
|
|
|
private->pushing_undo_group = GIMP_UNDO_GROUP_NONE;
|
2003-02-13 01:11:34 +08:00
|
|
|
|
|
|
|
/* Do it here, since undo_push doesn't emit this event while in
|
|
|
|
* the middle of a group
|
|
|
|
*/
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_event (image, GIMP_UNDO_EVENT_UNDO_PUSHED,
|
2010-02-05 03:06:49 +08:00
|
|
|
gimp_undo_stack_peek (private->undo_stack));
|
2004-07-07 21:58:51 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_free_space (image);
|
2003-02-13 01:11:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpUndo *
|
2008-01-24 17:38:44 +08:00
|
|
|
gimp_image_undo_push (GimpImage *image,
|
|
|
|
GType object_type,
|
|
|
|
GimpUndoType undo_type,
|
|
|
|
const gchar *name,
|
|
|
|
GimpDirtyMask dirty_mask,
|
2004-07-13 00:59:36 +08:00
|
|
|
...)
|
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
|
|
|
{
|
2010-02-04 03:31:25 +08:00
|
|
|
GimpImagePrivate *private;
|
|
|
|
GParameter *params = NULL;
|
|
|
|
gint n_params = 0;
|
|
|
|
va_list args;
|
|
|
|
GimpUndo *undo;
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2004-08-03 22:09:49 +08:00
|
|
|
g_return_val_if_fail (g_type_is_a (object_type, GIMP_TYPE_UNDO), NULL);
|
|
|
|
g_return_val_if_fail (undo_type > GIMP_UNDO_GROUP_LAST, NULL);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2010-02-04 03:31:25 +08:00
|
|
|
private = GIMP_IMAGE_GET_PRIVATE (image);
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
/* Does this undo dirty the image? If so, we always want to mark
|
|
|
|
* image dirty, even if we can't actually push the undo.
|
|
|
|
*/
|
2004-07-29 22:16:21 +08:00
|
|
|
if (dirty_mask != GIMP_DIRTY_NONE)
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_dirty (image, dirty_mask);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2010-02-04 03:31:25 +08:00
|
|
|
if (private->undo_freeze_count > 0)
|
2003-02-13 01:11:34 +08:00
|
|
|
return NULL;
|
|
|
|
|
2004-07-13 00:59:36 +08:00
|
|
|
if (! name)
|
2004-08-03 22:09:49 +08:00
|
|
|
name = gimp_undo_type_to_name (undo_type);
|
2004-07-13 00:59:36 +08:00
|
|
|
|
2004-08-03 22:09:49 +08:00
|
|
|
params = gimp_parameters_append (object_type, params, &n_params,
|
2004-07-29 22:16:21 +08:00
|
|
|
"name", name,
|
2006-03-29 01:08:36 +08:00
|
|
|
"image", image,
|
2004-08-03 22:09:49 +08:00
|
|
|
"undo-type", undo_type,
|
2004-07-29 22:16:21 +08:00
|
|
|
"dirty-mask", dirty_mask,
|
2004-07-13 00:59:36 +08:00
|
|
|
NULL);
|
2004-03-22 07:14:21 +08:00
|
|
|
|
2007-02-04 06:25:32 +08:00
|
|
|
va_start (args, dirty_mask);
|
2004-08-03 22:09:49 +08:00
|
|
|
params = gimp_parameters_append_valist (object_type, params, &n_params, args);
|
2004-07-13 00:59:36 +08:00
|
|
|
va_end (args);
|
2004-03-22 07:14:21 +08:00
|
|
|
|
2004-08-03 22:09:49 +08:00
|
|
|
undo = g_object_newv (object_type, n_params, params);
|
2004-03-22 07:14:21 +08:00
|
|
|
|
2004-07-13 00:59:36 +08:00
|
|
|
gimp_parameters_free (params, n_params);
|
2004-03-22 07:14:21 +08:00
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
/* nuke the redo stack */
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_free_redo (image);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
if (private->pushing_undo_group == GIMP_UNDO_GROUP_NONE)
|
2003-02-13 01:11:34 +08:00
|
|
|
{
|
2010-02-05 03:06:49 +08:00
|
|
|
gimp_undo_stack_push_undo (private->undo_stack, undo);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_event (image, GIMP_UNDO_EVENT_UNDO_PUSHED, undo);
|
2004-07-07 21:58:51 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_free_space (image);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2004-07-07 21:58:51 +08:00
|
|
|
/* freeing undo space may have freed the newly pushed undo */
|
2010-02-05 03:06:49 +08:00
|
|
|
if (gimp_undo_stack_peek (private->undo_stack) == undo)
|
2004-07-13 00:59:36 +08:00
|
|
|
return undo;
|
2003-02-13 01:11:34 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GimpUndoStack *undo_group;
|
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
undo_group = GIMP_UNDO_STACK (gimp_undo_stack_peek (private->undo_stack));
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2004-03-22 07:14:21 +08:00
|
|
|
gimp_undo_stack_push_undo (undo_group, undo);
|
2004-07-07 21:58:51 +08:00
|
|
|
|
2004-07-13 00:59:36 +08:00
|
|
|
return undo;
|
2003-02-13 01:11:34 +08:00
|
|
|
}
|
2004-07-07 21:58:51 +08:00
|
|
|
|
2004-07-13 00:59:36 +08:00
|
|
|
return NULL;
|
2003-02-13 01:11:34 +08:00
|
|
|
}
|
|
|
|
|
2004-08-03 22:09:49 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_can_compress (GimpImage *image,
|
2004-08-03 22:09:49 +08:00
|
|
|
GType object_type,
|
|
|
|
GimpUndoType undo_type)
|
|
|
|
{
|
2010-02-05 03:06:49 +08:00
|
|
|
GimpImagePrivate *private;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2004-08-03 22:09:49 +08:00
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
private = GIMP_IMAGE_GET_PRIVATE (image);
|
|
|
|
|
2009-07-04 03:11:21 +08:00
|
|
|
if (gimp_image_is_dirty (image) &&
|
2010-02-05 03:06:49 +08:00
|
|
|
! gimp_undo_stack_peek (private->redo_stack))
|
2004-08-03 22:09:49 +08:00
|
|
|
{
|
2010-02-05 03:06:49 +08:00
|
|
|
GimpUndo *undo = gimp_undo_stack_peek (private->undo_stack);
|
2004-08-03 22:09:49 +08:00
|
|
|
|
|
|
|
if (undo && undo->undo_type == undo_type &&
|
|
|
|
g_type_is_a (G_TYPE_FROM_INSTANCE (undo), object_type))
|
|
|
|
{
|
|
|
|
return undo;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-10-22 02:46:49 +08:00
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_get_fadeable (GimpImage *image)
|
|
|
|
{
|
2010-02-05 03:06:49 +08:00
|
|
|
GimpImagePrivate *private;
|
|
|
|
GimpUndo *undo;
|
2006-10-22 02:46:49 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
private = GIMP_IMAGE_GET_PRIVATE (image);
|
|
|
|
|
|
|
|
undo = gimp_undo_stack_peek (private->undo_stack);
|
2006-10-22 02:46:49 +08:00
|
|
|
|
|
|
|
if (GIMP_IS_UNDO_STACK (undo) && undo->undo_type == GIMP_UNDO_GROUP_PAINT)
|
|
|
|
{
|
|
|
|
GimpUndoStack *stack = GIMP_UNDO_STACK (undo);
|
|
|
|
|
|
|
|
if (gimp_undo_stack_get_depth (stack) == 2)
|
|
|
|
{
|
|
|
|
undo = gimp_undo_stack_peek (stack);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GIMP_IS_DRAWABLE_UNDO (undo))
|
|
|
|
return undo;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static void
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_pop_stack (GimpImage *image,
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndoStack *undo_stack,
|
|
|
|
GimpUndoStack *redo_stack,
|
|
|
|
GimpUndoMode undo_mode)
|
2001-03-05 09:01:16 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *undo;
|
|
|
|
GimpUndoAccumulator accum = { 0, };
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_object_freeze_notify (G_OBJECT (image));
|
2004-07-14 20:12:50 +08:00
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
undo = gimp_undo_stack_pop_undo (undo_stack, undo_mode, &accum);
|
|
|
|
|
2004-07-14 20:12:50 +08:00
|
|
|
if (undo)
|
|
|
|
{
|
|
|
|
if (GIMP_IS_UNDO_STACK (undo))
|
|
|
|
gimp_list_reverse (GIMP_LIST (GIMP_UNDO_STACK (undo)->undos));
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2004-07-14 20:12:50 +08:00
|
|
|
gimp_undo_stack_push_undo (redo_stack, undo);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2004-07-14 20:12:50 +08:00
|
|
|
if (accum.mode_changed)
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_mode_changed (image);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2012-04-25 22:46:58 +08:00
|
|
|
if (accum.precision_changed)
|
|
|
|
gimp_image_precision_changed (image);
|
|
|
|
|
2004-07-14 20:12:50 +08:00
|
|
|
if (accum.size_changed)
|
2008-08-05 04:11:35 +08:00
|
|
|
gimp_image_size_changed_detailed (image,
|
|
|
|
accum.previous_origin_x,
|
2008-08-29 03:12:03 +08:00
|
|
|
accum.previous_origin_y,
|
|
|
|
accum.previous_width,
|
|
|
|
accum.previous_height);
|
2008-08-05 04:11:35 +08:00
|
|
|
|
2004-07-14 20:12:50 +08:00
|
|
|
if (accum.resolution_changed)
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_resolution_changed (image);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2004-07-14 20:12:50 +08:00
|
|
|
if (accum.unit_changed)
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_unit_changed (image);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2004-07-14 20:12:50 +08:00
|
|
|
/* let others know that we just popped an action */
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_event (image,
|
2004-07-14 20:12:50 +08:00
|
|
|
(undo_mode == GIMP_UNDO_MODE_UNDO) ?
|
|
|
|
GIMP_UNDO_EVENT_UNDO : GIMP_UNDO_EVENT_REDO,
|
|
|
|
undo);
|
|
|
|
}
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_object_thaw_notify (G_OBJECT (image));
|
2003-02-13 01:11:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_free_space (GimpImage *image)
|
2003-02-13 01:11:34 +08:00
|
|
|
{
|
2010-02-05 03:06:49 +08:00
|
|
|
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
|
|
|
|
GimpContainer *container;
|
|
|
|
gint min_undo_levels;
|
|
|
|
gint max_undo_levels;
|
|
|
|
gint64 undo_size;
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2010-02-05 03:06:49 +08:00
|
|
|
container = private->undo_stack->undos;
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
min_undo_levels = image->gimp->config->levels_of_undo;
|
2003-02-13 01:11:34 +08:00
|
|
|
max_undo_levels = 1024; /* FIXME */
|
2006-03-29 01:08:36 +08:00
|
|
|
undo_size = image->gimp->config->undo_size;
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2004-07-13 16:30:22 +08:00
|
|
|
#ifdef DEBUG_IMAGE_UNDO
|
|
|
|
g_printerr ("undo_steps: %d undo_bytes: %ld\n",
|
2008-11-21 06:45:19 +08:00
|
|
|
gimp_container_get_n_children (container),
|
2004-07-13 16:30:22 +08:00
|
|
|
(glong) gimp_object_get_memsize (GIMP_OBJECT (container), NULL));
|
2003-02-14 22:14:29 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* keep at least min_undo_levels undo steps */
|
2008-11-21 06:45:19 +08:00
|
|
|
if (gimp_container_get_n_children (container) <= min_undo_levels)
|
2003-02-13 01:11:34 +08:00
|
|
|
return;
|
|
|
|
|
2003-08-25 18:49:33 +08:00
|
|
|
while ((gimp_object_get_memsize (GIMP_OBJECT (container), NULL) > undo_size) ||
|
2008-11-21 06:45:19 +08:00
|
|
|
(gimp_container_get_n_children (container) > max_undo_levels))
|
2003-02-13 01:11:34 +08:00
|
|
|
{
|
2010-02-05 03:06:49 +08:00
|
|
|
GimpUndo *freed = gimp_undo_stack_free_bottom (private->undo_stack,
|
2004-07-13 16:30:22 +08:00
|
|
|
GIMP_UNDO_MODE_UNDO);
|
|
|
|
|
|
|
|
#ifdef DEBUG_IMAGE_UNDO
|
|
|
|
g_printerr ("freed one step: undo_steps: %d undo_bytes: %ld\n",
|
2008-11-21 06:45:19 +08:00
|
|
|
gimp_container_get_n_children (container),
|
2004-07-13 16:30:22 +08:00
|
|
|
(glong) gimp_object_get_memsize (GIMP_OBJECT (container),
|
|
|
|
NULL));
|
2003-02-14 22:14:29 +08:00
|
|
|
#endif
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_event (image, GIMP_UNDO_EVENT_UNDO_EXPIRED, freed);
|
2003-02-20 20:47:42 +08:00
|
|
|
|
|
|
|
g_object_unref (freed);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2008-11-21 06:45:19 +08:00
|
|
|
if (gimp_container_get_n_children (container) <= min_undo_levels)
|
2003-02-13 01:11:34 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-02-20 20:47:42 +08:00
|
|
|
static void
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_free_redo (GimpImage *image)
|
2003-02-20 20:47:42 +08:00
|
|
|
{
|
2010-02-04 03:31:25 +08:00
|
|
|
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
|
2010-02-05 03:06:49 +08:00
|
|
|
GimpContainer *container = private->redo_stack->undos;
|
2003-02-20 20:47:42 +08:00
|
|
|
|
2004-07-13 16:30:22 +08:00
|
|
|
#ifdef DEBUG_IMAGE_UNDO
|
|
|
|
g_printerr ("redo_steps: %d redo_bytes: %ld\n",
|
2008-11-21 06:45:19 +08:00
|
|
|
gimp_container_get_n_children (container),
|
2004-07-13 16:30:22 +08:00
|
|
|
(glong) gimp_object_get_memsize (GIMP_OBJECT (container), NULL));
|
2003-02-20 20:47:42 +08:00
|
|
|
#endif
|
|
|
|
|
2008-01-24 17:38:44 +08:00
|
|
|
if (gimp_container_is_empty (container))
|
|
|
|
return;
|
|
|
|
|
2008-11-21 06:45:19 +08:00
|
|
|
while (gimp_container_get_n_children (container) > 0)
|
2003-02-20 20:47:42 +08:00
|
|
|
{
|
2010-02-05 03:06:49 +08:00
|
|
|
GimpUndo *freed = gimp_undo_stack_free_bottom (private->redo_stack,
|
2004-07-13 16:30:22 +08:00
|
|
|
GIMP_UNDO_MODE_REDO);
|
|
|
|
|
|
|
|
#ifdef DEBUG_IMAGE_UNDO
|
|
|
|
g_printerr ("freed one step: redo_steps: %d redo_bytes: %ld\n",
|
2008-11-21 06:45:19 +08:00
|
|
|
gimp_container_get_n_children (container),
|
2004-07-13 16:30:22 +08:00
|
|
|
(glong )gimp_object_get_memsize (GIMP_OBJECT (container),
|
|
|
|
NULL));
|
2003-02-20 20:47:42 +08:00
|
|
|
#endif
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_event (image, GIMP_UNDO_EVENT_REDO_EXPIRED, freed);
|
2003-02-20 20:47:42 +08:00
|
|
|
|
|
|
|
g_object_unref (freed);
|
|
|
|
}
|
2008-01-24 17:38:44 +08:00
|
|
|
|
|
|
|
/* We need to use <= here because the undo counter has already been
|
|
|
|
* incremented at this point.
|
|
|
|
*/
|
2010-02-04 03:31:25 +08:00
|
|
|
if (private->dirty <= 0)
|
2008-01-24 17:38:44 +08:00
|
|
|
{
|
|
|
|
/* If the image was dirty, but could become clean by redo-ing
|
|
|
|
* some actions, then it should now become 'infinitely' dirty.
|
|
|
|
* This is because we've just nuked the actions that would allow
|
|
|
|
* the image to become clean again.
|
|
|
|
*/
|
2010-02-04 03:31:25 +08:00
|
|
|
private->dirty = 100000;
|
2008-01-24 17:38:44 +08:00
|
|
|
}
|
2003-02-20 20:47:42 +08:00
|
|
|
}
|
2004-07-29 22:16:21 +08:00
|
|
|
|
|
|
|
static GimpDirtyMask
|
2004-08-03 22:09:49 +08:00
|
|
|
gimp_image_undo_dirty_from_type (GimpUndoType undo_type)
|
2004-07-29 22:16:21 +08:00
|
|
|
{
|
2004-08-03 22:09:49 +08:00
|
|
|
switch (undo_type)
|
2004-07-29 22:16:21 +08:00
|
|
|
{
|
|
|
|
case GIMP_UNDO_GROUP_IMAGE_SCALE:
|
|
|
|
case GIMP_UNDO_GROUP_IMAGE_RESIZE:
|
|
|
|
case GIMP_UNDO_GROUP_IMAGE_FLIP:
|
|
|
|
case GIMP_UNDO_GROUP_IMAGE_ROTATE:
|
|
|
|
case GIMP_UNDO_GROUP_IMAGE_CROP:
|
|
|
|
return GIMP_DIRTY_IMAGE | GIMP_DIRTY_IMAGE_SIZE;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_IMAGE_CONVERT:
|
|
|
|
return GIMP_DIRTY_IMAGE | GIMP_DIRTY_DRAWABLE;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_IMAGE_LAYERS_MERGE:
|
|
|
|
return GIMP_DIRTY_IMAGE_STRUCTURE | GIMP_DIRTY_DRAWABLE;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_IMAGE_VECTORS_MERGE:
|
|
|
|
return GIMP_DIRTY_IMAGE_STRUCTURE | GIMP_DIRTY_VECTORS;
|
|
|
|
|
2005-09-19 20:44:06 +08:00
|
|
|
case GIMP_UNDO_GROUP_IMAGE_QUICK_MASK: /* FIXME */
|
2004-07-29 22:16:21 +08:00
|
|
|
return GIMP_DIRTY_IMAGE_STRUCTURE | GIMP_DIRTY_SELECTION;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_IMAGE_GRID:
|
2007-01-30 07:21:41 +08:00
|
|
|
case GIMP_UNDO_GROUP_GUIDE:
|
2004-07-29 22:16:21 +08:00
|
|
|
return GIMP_DIRTY_IMAGE_META;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_DRAWABLE:
|
|
|
|
case GIMP_UNDO_GROUP_DRAWABLE_MOD:
|
|
|
|
return GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_MASK: /* FIXME */
|
|
|
|
return GIMP_DIRTY_SELECTION;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_ITEM_VISIBILITY:
|
|
|
|
case GIMP_UNDO_GROUP_ITEM_LINKED:
|
|
|
|
case GIMP_UNDO_GROUP_ITEM_PROPERTIES:
|
|
|
|
return GIMP_DIRTY_ITEM_META;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_ITEM_DISPLACE: /* FIXME */
|
|
|
|
return GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE | GIMP_DIRTY_VECTORS;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_ITEM_SCALE: /* FIXME */
|
|
|
|
case GIMP_UNDO_GROUP_ITEM_RESIZE: /* FIXME */
|
|
|
|
return GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE | GIMP_DIRTY_VECTORS;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_LAYER_ADD_MASK:
|
|
|
|
case GIMP_UNDO_GROUP_LAYER_APPLY_MASK:
|
|
|
|
return GIMP_DIRTY_IMAGE_STRUCTURE;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_FS_TO_LAYER:
|
|
|
|
case GIMP_UNDO_GROUP_FS_FLOAT:
|
|
|
|
case GIMP_UNDO_GROUP_FS_ANCHOR:
|
|
|
|
return GIMP_DIRTY_IMAGE_STRUCTURE;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_EDIT_PASTE:
|
|
|
|
return GIMP_DIRTY_IMAGE_STRUCTURE;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_EDIT_CUT:
|
|
|
|
return GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_TEXT:
|
|
|
|
return GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_TRANSFORM: /* FIXME */
|
|
|
|
return GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE | GIMP_DIRTY_VECTORS;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_PAINT:
|
|
|
|
return GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_PARASITE_ATTACH:
|
|
|
|
case GIMP_UNDO_GROUP_PARASITE_REMOVE:
|
|
|
|
return GIMP_DIRTY_IMAGE_META | GIMP_DIRTY_ITEM_META;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_VECTORS_IMPORT:
|
|
|
|
return GIMP_DIRTY_IMAGE_STRUCTURE | GIMP_DIRTY_VECTORS;
|
|
|
|
|
|
|
|
case GIMP_UNDO_GROUP_MISC:
|
|
|
|
return GIMP_DIRTY_ALL;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GIMP_DIRTY_ALL;
|
|
|
|
}
|