2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1997-11-25 06:05:25 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (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
|
|
|
|
* along with this program; if not, write to the Free Software
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-06-08 06:51:23 +08:00
|
|
|
|
1999-09-06 08:07:03 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2003-05-07 19:09:00 +08:00
|
|
|
#include <glib-object.h>
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-05-21 21:58:46 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2005-01-26 03:11:26 +08:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
2001-05-21 21:58:46 +08:00
|
|
|
|
2003-05-07 19:09:00 +08:00
|
|
|
#include "core-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-05-15 19:25:25 +08:00
|
|
|
#include "base/tile-manager.h"
|
|
|
|
|
2003-02-14 22:14:29 +08:00
|
|
|
#include "gimp.h"
|
2006-10-15 00:20:46 +08:00
|
|
|
#include "gimp-parasites.h"
|
2007-01-29 16:40:40 +08:00
|
|
|
#include "gimpchannelpropundo.h"
|
2007-01-31 20:33:03 +08:00
|
|
|
#include "gimpchannelundo.h"
|
2006-10-20 16:56:58 +08:00
|
|
|
#include "gimpdrawableundo.h"
|
2003-06-24 03:34:48 +08:00
|
|
|
#include "gimpgrid.h"
|
2006-06-07 06:48:57 +08:00
|
|
|
#include "gimpguide.h"
|
2007-01-30 20:32:14 +08:00
|
|
|
#include "gimpguideundo.h"
|
2006-10-15 00:20:46 +08:00
|
|
|
#include "gimpimage.h"
|
2003-02-14 22:14:29 +08:00
|
|
|
#include "gimpimage-undo.h"
|
2006-10-30 18:13:06 +08:00
|
|
|
#include "gimpimage-undo-push.h"
|
2007-01-29 02:21:39 +08:00
|
|
|
#include "gimpimageundo.h"
|
2007-01-29 03:00:13 +08:00
|
|
|
#include "gimpitempropundo.h"
|
2003-02-14 22:14:29 +08:00
|
|
|
#include "gimplayer.h"
|
2006-10-15 00:20:46 +08:00
|
|
|
#include "gimplayer-floating-sel.h"
|
2003-02-14 22:14:29 +08:00
|
|
|
#include "gimplayermask.h"
|
2007-02-01 02:50:39 +08:00
|
|
|
#include "gimplayermaskpropundo.h"
|
2007-01-31 20:33:03 +08:00
|
|
|
#include "gimplayermaskundo.h"
|
2007-01-29 04:10:45 +08:00
|
|
|
#include "gimplayerpropundo.h"
|
2007-01-31 20:33:03 +08:00
|
|
|
#include "gimplayerundo.h"
|
2007-01-31 06:53:18 +08:00
|
|
|
#include "gimpmaskundo.h"
|
2003-02-14 22:14:29 +08:00
|
|
|
#include "gimpparasitelist.h"
|
2007-01-30 18:34:59 +08:00
|
|
|
#include "gimpsamplepoint.h"
|
2007-01-30 20:32:14 +08:00
|
|
|
#include "gimpsamplepointundo.h"
|
2004-07-29 22:16:21 +08:00
|
|
|
#include "gimpselection.h"
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2004-04-01 22:51:58 +08:00
|
|
|
#include "text/gimptextlayer.h"
|
2004-03-22 07:14:21 +08:00
|
|
|
#include "text/gimptextundo.h"
|
2004-01-05 08:28:12 +08:00
|
|
|
|
2003-02-01 02:08:32 +08:00
|
|
|
#include "vectors/gimpvectors.h"
|
2007-01-31 06:06:55 +08:00
|
|
|
#include "vectors/gimpvectorspropundo.h"
|
2007-01-31 20:33:03 +08:00
|
|
|
#include "vectors/gimpvectorsundo.h"
|
2003-02-01 02:08:32 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
1999-04-23 14:07:09 +08:00
|
|
|
|
comment typo fix, plus add %D* to default image-title-format string, so
Fri Oct 1 12:46:12 1999 Austin Donnelly <austin@gimp.org>
* gimprc.in: comment typo fix, plus add %D* to default
image-title-format string, so people get a '*' in the titlebar
if their image is dirty.
* app/fileops.c: initialise filename before using it.
* app/gdisplay.c: empty parameter list () is K&R - should be
stronger (void) in ANSI C.
* app/gimpdrawable.c: gimp_drawable_{dirty,clean} functions
removed - no one uses them anyway. Parasite undo type is
proper parasite undo type, not MISC_UNDO.
* app/gimpdrawableP.h: drawable dirty bit removed.
* app/gimpimage.c: don't change the resolution if there's no
difference from the old one. Call gdisplay_shrink_wrap() to
re-calculate scale factors and refresh the display on
resolution change. Layer undo doesn't have sub-types
anymore, uses main UndoType instead.
* app/layer.h: Remove LayerUndoType
* app/qmask.c: fix qmask undo so it actually works.
* app/undo.h: new types for undo_push_layer{,_mask} and
undo_push_qmask.
* app/undo.c: change way group boundaries are represented:
each Undo has a group_boundary boolean set to TRUE if this is
the start or the end of a group, and the type of the Undo is
the group's type. Within a group, each Undo keeps its own
type. This allows pop funcs and free funcs to do
type-specific things (eg needed by layer and channel stuff).
Don't maintain per-drawable dirty flags anymore. Floating
sel to layer and layer rename now uses meaningful undo types.
* app/undo_types.h: more specific undo types:
LAYER_{ADD,REMOVE}_UNDO, LAYER_MASK_{ADD,REMOVE}_UNDO,
LAYER_RENAME_UNDO, and PARASITE_{ATTACH,DETACH}_UNDO.
* app/undo_history.c: oops - undo stack was being placed into gtk
list in wrong order.
* app/edit_selection.c: push more descriptive LAYER_DISPLACE_UNDO
rather than MISC_UNDO.
* app/layers_dialog.c: better tagging of undo types
1999-10-02 02:43:24 +08:00
|
|
|
|
2007-01-30 20:32:14 +08:00
|
|
|
/**************************/
|
|
|
|
/* Image Property Undos */
|
|
|
|
/**************************/
|
2002-02-24 02:29:07 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_image_type (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc)
|
2002-02-24 02:29:07 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_IMAGE_TYPE, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE,
|
|
|
|
NULL, NULL,
|
|
|
|
NULL);
|
2002-02-24 02:29:07 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_image_size (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_IMAGE_SIZE, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE | GIMP_DIRTY_IMAGE_SIZE,
|
|
|
|
NULL, NULL,
|
|
|
|
NULL);
|
2002-02-24 01:29:19 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_image_resolution (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_IMAGE_RESOLUTION, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE,
|
|
|
|
NULL, NULL,
|
|
|
|
NULL);
|
2002-02-24 01:29:19 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 06:37:18 +08:00
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_image_grid (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpGrid *grid)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_GRID (grid), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_IMAGE_GRID, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_META,
|
|
|
|
NULL, NULL,
|
|
|
|
"grid", grid,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_image_colormap (GimpImage *image,
|
|
|
|
const gchar *undo_desc)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_IMAGE_COLORMAP, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE,
|
|
|
|
NULL, NULL,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-30 20:32:14 +08:00
|
|
|
/********************************/
|
|
|
|
/* Guide & Sample Point Undos */
|
|
|
|
/********************************/
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2007-01-30 07:21:41 +08:00
|
|
|
gimp_image_undo_push_guide (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpGuide *guide)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_GUIDE (guide), NULL);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2007-01-30 20:32:14 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_GUIDE_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_GUIDE, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_META,
|
|
|
|
NULL, NULL,
|
|
|
|
"guide", guide,
|
|
|
|
NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2007-01-30 07:21:41 +08:00
|
|
|
gimp_image_undo_push_sample_point (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpSamplePoint *sample_point)
|
2005-03-05 00:34:59 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (sample_point != NULL, NULL);
|
2005-03-05 00:34:59 +08:00
|
|
|
|
2007-01-30 20:32:14 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_SAMPLE_POINT_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_SAMPLE_POINT, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_META,
|
|
|
|
NULL, NULL,
|
|
|
|
"sample-point", sample_point,
|
|
|
|
NULL);
|
2005-03-05 00:34:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-15 22:10:30 +08:00
|
|
|
/*******************/
|
|
|
|
/* Drawable Undo */
|
|
|
|
/*******************/
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_drawable (GimpImage *image,
|
2004-03-15 22:10:30 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
TileManager *tiles,
|
|
|
|
gboolean sparse,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height)
|
|
|
|
{
|
|
|
|
GimpItem *item;
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
|
|
|
g_return_val_if_fail (tiles != NULL, NULL);
|
2004-03-15 22:10:30 +08:00
|
|
|
g_return_val_if_fail (sparse == TRUE ||
|
2007-01-30 02:49:06 +08:00
|
|
|
tile_manager_width (tiles) == width, NULL);
|
2004-03-15 22:10:30 +08:00
|
|
|
g_return_val_if_fail (sparse == TRUE ||
|
2007-01-30 02:49:06 +08:00
|
|
|
tile_manager_height (tiles) == height, NULL);
|
2004-03-15 22:10:30 +08:00
|
|
|
|
|
|
|
item = GIMP_ITEM (drawable);
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
2004-03-15 22:10:30 +08:00
|
|
|
g_return_val_if_fail (sparse == FALSE ||
|
|
|
|
tile_manager_width (tiles) == gimp_item_width (item),
|
2007-01-30 02:49:06 +08:00
|
|
|
NULL);
|
2004-03-15 22:10:30 +08:00
|
|
|
g_return_val_if_fail (sparse == FALSE ||
|
|
|
|
tile_manager_height (tiles) == gimp_item_height (item),
|
2007-01-30 02:49:06 +08:00
|
|
|
NULL);
|
2004-03-15 22:10:30 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_DRAWABLE_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_DRAWABLE, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", item,
|
|
|
|
"tiles", tiles,
|
|
|
|
"sparse", sparse,
|
|
|
|
"x", x,
|
|
|
|
"y", y,
|
|
|
|
"width", width,
|
|
|
|
"height", height,
|
|
|
|
NULL);
|
2004-03-15 22:10:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-16 04:58:07 +08:00
|
|
|
/***********************/
|
|
|
|
/* Drawable Mod Undo */
|
|
|
|
/***********************/
|
|
|
|
|
|
|
|
typedef struct _DrawableModUndo DrawableModUndo;
|
|
|
|
|
|
|
|
struct _DrawableModUndo
|
|
|
|
{
|
|
|
|
TileManager *tiles;
|
|
|
|
GimpImageType type;
|
|
|
|
gint offset_x;
|
2006-10-30 18:13:06 +08:00
|
|
|
gint offset_y;
|
2004-03-16 04:58:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static gboolean undo_pop_drawable_mod (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_drawable_mod (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_drawable_mod (GimpImage *image,
|
2004-03-17 00:23:06 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpDrawable *drawable)
|
2004-03-16 04:58:07 +08:00
|
|
|
{
|
|
|
|
GimpUndo *new;
|
|
|
|
gint64 size;
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
|
2004-03-16 04:58:07 +08:00
|
|
|
|
2004-09-20 03:47:26 +08:00
|
|
|
size = sizeof (DrawableModUndo) + tile_manager_get_memsize (drawable->tiles,
|
|
|
|
FALSE);
|
2004-03-16 04:58:07 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_ITEM_UNDO,
|
2004-07-13 00:59:36 +08:00
|
|
|
size, sizeof (DrawableModUndo),
|
|
|
|
GIMP_UNDO_DRAWABLE_MOD, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_pop_drawable_mod,
|
|
|
|
undo_free_drawable_mod,
|
|
|
|
"item", drawable,
|
|
|
|
NULL)))
|
2004-03-16 04:58:07 +08:00
|
|
|
{
|
|
|
|
DrawableModUndo *drawable_undo = new->data;
|
|
|
|
|
|
|
|
drawable_undo->tiles = tile_manager_ref (drawable->tiles);
|
|
|
|
drawable_undo->type = drawable->type;
|
|
|
|
drawable_undo->offset_x = GIMP_ITEM (drawable)->offset_x;
|
|
|
|
drawable_undo->offset_y = GIMP_ITEM (drawable)->offset_y;
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return new;
|
2004-03-16 04:58:07 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return NULL;
|
2004-03-16 04:58:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
undo_pop_drawable_mod (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
|
|
|
{
|
|
|
|
DrawableModUndo *drawable_undo = undo->data;
|
|
|
|
GimpDrawable *drawable = GIMP_DRAWABLE (GIMP_ITEM_UNDO (undo)->item);
|
|
|
|
TileManager *tiles;
|
|
|
|
GimpImageType drawable_type;
|
|
|
|
gint offset_x, offset_y;
|
|
|
|
|
2004-09-20 03:47:26 +08:00
|
|
|
undo->size -= tile_manager_get_memsize (drawable_undo->tiles, FALSE);
|
2004-03-17 00:23:06 +08:00
|
|
|
|
2004-03-16 04:58:07 +08:00
|
|
|
tiles = drawable_undo->tiles;
|
|
|
|
drawable_type = drawable_undo->type;
|
|
|
|
offset_x = drawable_undo->offset_x;
|
|
|
|
offset_y = drawable_undo->offset_y;
|
|
|
|
|
|
|
|
drawable_undo->tiles = tile_manager_ref (drawable->tiles);
|
|
|
|
drawable_undo->type = drawable->type;
|
|
|
|
drawable_undo->offset_x = GIMP_ITEM (drawable)->offset_x;
|
|
|
|
drawable_undo->offset_y = GIMP_ITEM (drawable)->offset_y;
|
|
|
|
|
|
|
|
gimp_drawable_set_tiles_full (drawable, FALSE, NULL,
|
|
|
|
tiles, drawable_type, offset_x, offset_y);
|
|
|
|
tile_manager_unref (tiles);
|
|
|
|
|
2004-09-20 03:47:26 +08:00
|
|
|
undo->size += tile_manager_get_memsize (drawable_undo->tiles, FALSE);
|
2004-03-17 00:23:06 +08:00
|
|
|
|
2004-03-16 04:58:07 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
undo_free_drawable_mod (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
|
|
|
{
|
|
|
|
DrawableModUndo *drawable_undo = undo->data;
|
|
|
|
|
|
|
|
tile_manager_unref (drawable_undo->tiles);
|
|
|
|
g_free (drawable_undo);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-08-20 18:22:23 +08:00
|
|
|
/***************/
|
|
|
|
/* Mask Undo */
|
2003-02-13 01:11:34 +08:00
|
|
|
/***************/
|
2002-08-20 18:22:23 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_mask (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpChannel *mask)
|
2002-08-20 18:22:23 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CHANNEL (mask), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (mask)), NULL);
|
2002-08-20 18:22:23 +08:00
|
|
|
|
2007-01-31 06:53:18 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_MASK_UNDO,
|
2007-01-30 02:49:06 +08:00
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_MASK, undo_desc,
|
|
|
|
GIMP_IS_SELECTION (mask) ?
|
|
|
|
GIMP_DIRTY_SELECTION :
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", mask,
|
|
|
|
NULL);
|
2002-08-20 18:22:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-30 20:32:14 +08:00
|
|
|
/*************************/
|
|
|
|
/* Item Property Undos */
|
|
|
|
/*************************/
|
2002-02-26 08:04:55 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_item_rename (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpItem *item)
|
2002-02-26 08:04:55 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_ITEM_PROP_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_ITEM_RENAME, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", item,
|
|
|
|
NULL);
|
2002-02-26 08:04:55 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_item_displace (GimpImage *image,
|
2003-05-09 03:11:17 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpItem *item)
|
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
2003-05-09 03:11:17 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_ITEM_PROP_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_ITEM_DISPLACE, undo_desc,
|
|
|
|
GIMP_IS_DRAWABLE (item) ?
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE :
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_VECTORS,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", item,
|
|
|
|
NULL);
|
2003-05-09 03:11:17 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_item_visibility (GimpImage *image,
|
2003-09-12 03:52:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpItem *item)
|
2003-05-09 04:26:01 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
2003-05-09 04:26:01 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_ITEM_PROP_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_ITEM_VISIBILITY, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", item,
|
|
|
|
NULL);
|
2003-05-09 04:26:01 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_item_linked (GimpImage *image,
|
2003-09-12 03:52:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpItem *item)
|
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
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
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
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_ITEM_PROP_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_ITEM_LINKED, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", item,
|
|
|
|
NULL);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
/***************************/
|
|
|
|
/* Layer Add/Remove Undo */
|
2003-02-13 01:11:34 +08:00
|
|
|
/***************************/
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_layer_add (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer,
|
|
|
|
GimpLayer *prev_layer)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (prev_layer == NULL || GIMP_IS_LAYER (prev_layer),
|
2007-01-30 02:49:06 +08:00
|
|
|
NULL);
|
2004-11-12 18:56:23 +08:00
|
|
|
|
2007-01-31 20:33:03 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_LAYER_ADD, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", layer,
|
|
|
|
"prev-layer", prev_layer,
|
|
|
|
NULL);
|
2001-03-11 21:15:41 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_layer_remove (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer,
|
|
|
|
gint prev_position,
|
|
|
|
GimpLayer *prev_layer)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (prev_layer == NULL || GIMP_IS_LAYER (prev_layer),
|
2007-01-30 02:49:06 +08:00
|
|
|
NULL);
|
2004-11-12 18:56:23 +08:00
|
|
|
|
2007-01-31 20:33:03 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_LAYER_REMOVE, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", layer,
|
|
|
|
"prev-position", prev_position,
|
|
|
|
"prev-layer", prev_layer,
|
|
|
|
NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-30 20:32:14 +08:00
|
|
|
/**************************/
|
|
|
|
/* Layer Property Undos */
|
|
|
|
/**************************/
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_layer_reposition (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_PROP_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_LAYER_REPOSITION, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", layer,
|
|
|
|
NULL);
|
2002-02-24 01:29:19 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_layer_mode (GimpImage *image,
|
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
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer)
|
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
2007-01-29 04:10:45 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_PROP_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_LAYER_MODE, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", layer,
|
|
|
|
NULL);
|
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
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_layer_opacity (GimpImage *image,
|
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
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer)
|
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
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
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_PROP_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_LAYER_OPACITY, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", layer,
|
|
|
|
NULL);
|
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
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2007-01-29 04:10:45 +08:00
|
|
|
gimp_image_undo_push_layer_lock_alpha (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer)
|
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
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
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
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_PROP_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_LAYER_LOCK_ALPHA, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", layer,
|
|
|
|
NULL);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-30 23:08:59 +08:00
|
|
|
/**********************/
|
|
|
|
/* Text Layer Undos */
|
|
|
|
/**********************/
|
2004-01-05 08:28:12 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_text_layer (GimpImage *image,
|
2004-03-21 01:21:48 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpTextLayer *layer,
|
|
|
|
const GParamSpec *pspec)
|
2004-01-05 08:28:12 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_TEXT_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
2004-03-21 01:21:48 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_TEXT_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_TEXT_LAYER, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", layer,
|
|
|
|
"param", pspec,
|
|
|
|
NULL);
|
2004-01-05 08:28:12 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_text_layer_modified (GimpImage *image,
|
2004-04-01 22:51:58 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpTextLayer *layer)
|
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_TEXT_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
2004-04-01 22:51:58 +08:00
|
|
|
|
2007-01-30 23:08:59 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_TEXT_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_TEXT_LAYER_MODIFIED, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", layer,
|
|
|
|
NULL);
|
2004-04-01 22:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-25 06:15:10 +08:00
|
|
|
/********************************/
|
|
|
|
/* Layer Mask Add/Remove Undo */
|
|
|
|
/********************************/
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_layer_mask_add (GimpImage *image,
|
2005-03-25 06:15:10 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer,
|
|
|
|
GimpLayerMask *mask)
|
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER_MASK (mask), NULL);
|
|
|
|
g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (mask)), NULL);
|
2005-03-25 06:15:10 +08:00
|
|
|
|
2007-01-31 20:33:03 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_MASK_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_LAYER_MASK_ADD, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", layer,
|
|
|
|
"layer-mask", mask,
|
|
|
|
NULL);
|
2005-03-25 06:15:10 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_layer_mask_remove (GimpImage *image,
|
2005-03-25 06:15:10 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer,
|
|
|
|
GimpLayerMask *mask)
|
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER_MASK (mask), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (mask)), NULL);
|
2007-01-31 20:33:03 +08:00
|
|
|
g_return_val_if_fail (gimp_layer_mask_get_layer (mask) == layer, NULL);
|
|
|
|
g_return_val_if_fail (gimp_layer_get_mask (layer) == mask, NULL);
|
2005-03-25 06:15:10 +08:00
|
|
|
|
2007-01-31 20:33:03 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_MASK_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_LAYER_MASK_REMOVE, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", layer,
|
|
|
|
"layer-mask", mask,
|
|
|
|
NULL);
|
2005-03-25 06:15:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-01 02:50:39 +08:00
|
|
|
/*******************************/
|
|
|
|
/* Layer Mask Property Undos */
|
|
|
|
/*******************************/
|
2007-01-30 02:49:06 +08:00
|
|
|
|
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_layer_mask_apply (GimpImage *image,
|
2005-03-25 06:15:10 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayerMask *mask)
|
|
|
|
{
|
2007-02-01 02:50:39 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER_MASK (mask), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (mask)), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_MASK_PROP_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_LAYER_MASK_APPLY, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", mask,
|
|
|
|
NULL);
|
2005-03-25 06:15:10 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_layer_mask_show (GimpImage *image,
|
2005-03-25 06:15:10 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayerMask *mask)
|
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER_MASK (mask), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (mask)), NULL);
|
2005-03-25 06:15:10 +08:00
|
|
|
|
2007-02-01 02:50:39 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_MASK_PROP_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_LAYER_MASK_SHOW, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", mask,
|
|
|
|
NULL);
|
2005-03-25 06:15:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
/*****************************/
|
|
|
|
/* Add/Remove Channel Undo */
|
2003-02-13 01:11:34 +08:00
|
|
|
/*****************************/
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_channel_add (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpChannel *channel,
|
|
|
|
GimpChannel *prev_channel)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), NULL);
|
|
|
|
g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (channel)), NULL);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (prev_channel == NULL || GIMP_IS_CHANNEL (prev_channel),
|
2007-01-30 02:49:06 +08:00
|
|
|
NULL);
|
2004-11-12 18:56:23 +08:00
|
|
|
|
2007-01-31 20:33:03 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_CHANNEL_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_CHANNEL_ADD, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", channel,
|
|
|
|
"prev-channel", prev_channel,
|
|
|
|
NULL);
|
2002-02-24 01:29:19 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_channel_remove (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpChannel *channel,
|
|
|
|
gint prev_position,
|
|
|
|
GimpChannel *prev_channel)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)), NULL);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (prev_channel == NULL || GIMP_IS_CHANNEL (prev_channel),
|
2007-01-30 02:49:06 +08:00
|
|
|
NULL);
|
2004-11-12 18:56:23 +08:00
|
|
|
|
2007-01-31 20:33:03 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_CHANNEL_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_CHANNEL_REMOVE, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", channel,
|
|
|
|
"prev-position", prev_position,
|
|
|
|
"prev-channel", prev_channel,
|
|
|
|
NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-30 20:32:14 +08:00
|
|
|
/****************************/
|
|
|
|
/* Channel Property Undos */
|
|
|
|
/****************************/
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_channel_reposition (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpChannel *channel)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)), NULL);
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_CHANNEL_PROP_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_CHANNEL_REPOSITION, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", channel,
|
|
|
|
NULL);
|
2002-02-24 01:29:19 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_channel_color (GimpImage *image,
|
2003-03-17 10:25:39 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpChannel *channel)
|
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)), NULL);
|
2003-03-17 10:25:39 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_CHANNEL_PROP_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_CHANNEL_COLOR, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", channel,
|
|
|
|
NULL);
|
2003-03-17 10:25:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-25 05:00:58 +08:00
|
|
|
/*****************************/
|
|
|
|
/* Add/Remove Vectors Undo */
|
2003-02-13 01:11:34 +08:00
|
|
|
/*****************************/
|
2002-02-25 05:00:58 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_vectors_add (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpVectors *vectors,
|
|
|
|
GimpVectors *prev_vectors)
|
2002-02-25 05:00:58 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), NULL);
|
|
|
|
g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (vectors)), NULL);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (prev_vectors == NULL || GIMP_IS_VECTORS (prev_vectors),
|
2007-01-30 02:49:06 +08:00
|
|
|
NULL);
|
2004-11-12 18:56:23 +08:00
|
|
|
|
2007-01-31 20:33:03 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_VECTORS_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_VECTORS_ADD, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", vectors,
|
|
|
|
"prev-vectors", prev_vectors,
|
|
|
|
NULL);
|
2002-02-25 05:00:58 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_vectors_remove (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpVectors *vectors,
|
|
|
|
gint prev_position,
|
|
|
|
GimpVectors *prev_vectors)
|
2002-02-25 05:00:58 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (vectors)), NULL);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (prev_vectors == NULL || GIMP_IS_VECTORS (prev_vectors),
|
2007-01-30 02:49:06 +08:00
|
|
|
NULL);
|
2004-11-12 18:56:23 +08:00
|
|
|
|
2007-01-31 20:33:03 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_VECTORS_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_VECTORS_REMOVE, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", vectors,
|
|
|
|
"prev-position", prev_position,
|
|
|
|
"prev-vectors", prev_vectors,
|
|
|
|
NULL);
|
2002-02-25 05:00:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************/
|
|
|
|
/* Vectors Mod Undo */
|
2003-02-13 01:11:34 +08:00
|
|
|
/**********************/
|
2002-02-25 05:00:58 +08:00
|
|
|
|
|
|
|
typedef struct _VectorsModUndo VectorsModUndo;
|
|
|
|
|
|
|
|
struct _VectorsModUndo
|
|
|
|
{
|
2004-03-17 00:23:06 +08:00
|
|
|
GimpVectors *vectors;
|
2002-02-25 05:00:58 +08:00
|
|
|
};
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
static gboolean undo_pop_vectors_mod (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_vectors_mod (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
2002-02-25 05:00:58 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_vectors_mod (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpVectors *vectors)
|
2002-02-25 05:00:58 +08:00
|
|
|
{
|
2004-03-17 00:23:06 +08:00
|
|
|
GimpVectors *copy;
|
|
|
|
GimpUndo *new;
|
|
|
|
gint64 size;
|
2002-02-25 05:00:58 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (vectors)), NULL);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2004-03-17 00:23:06 +08:00
|
|
|
copy = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
|
|
|
|
G_TYPE_FROM_INSTANCE (vectors),
|
|
|
|
FALSE));
|
|
|
|
|
2002-02-25 05:00:58 +08:00
|
|
|
size = (sizeof (VectorsModUndo) +
|
2004-03-17 00:23:06 +08:00
|
|
|
gimp_object_get_memsize (GIMP_OBJECT (copy), NULL));
|
2002-02-25 05:00:58 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_ITEM_UNDO,
|
2004-07-13 00:59:36 +08:00
|
|
|
size, sizeof (VectorsModUndo),
|
|
|
|
GIMP_UNDO_VECTORS_MOD, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_VECTORS,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_pop_vectors_mod,
|
|
|
|
undo_free_vectors_mod,
|
|
|
|
"item", vectors,
|
|
|
|
NULL)))
|
2002-02-25 05:00:58 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
VectorsModUndo *vmu = new->data;
|
2002-02-25 05:00:58 +08:00
|
|
|
|
2004-03-17 00:23:06 +08:00
|
|
|
vmu->vectors = copy;
|
2002-02-25 05:00:58 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return new;
|
2002-02-25 05:00:58 +08:00
|
|
|
}
|
|
|
|
|
2004-03-17 00:23:06 +08:00
|
|
|
if (copy)
|
|
|
|
g_object_unref (copy);
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return NULL;
|
2002-02-25 05:00:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_vectors_mod (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
2002-02-25 05:00:58 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
VectorsModUndo *vmu = undo->data;
|
|
|
|
GimpVectors *vectors = GIMP_VECTORS (GIMP_ITEM_UNDO (undo)->item);
|
2002-02-25 05:00:58 +08:00
|
|
|
GimpVectors *temp;
|
|
|
|
|
2004-03-17 00:23:06 +08:00
|
|
|
undo->size -= gimp_object_get_memsize (GIMP_OBJECT (vmu->vectors), NULL);
|
2002-02-25 05:00:58 +08:00
|
|
|
|
2004-03-17 00:23:06 +08:00
|
|
|
temp = vmu->vectors;
|
|
|
|
|
|
|
|
vmu->vectors =
|
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
|
|
|
GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
|
|
|
|
G_TYPE_FROM_INSTANCE (vectors),
|
2003-02-13 01:11:34 +08:00
|
|
|
FALSE));
|
2002-02-25 05:00:58 +08:00
|
|
|
|
2003-05-09 08:38:51 +08:00
|
|
|
gimp_vectors_freeze (vectors);
|
|
|
|
|
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
|
|
|
gimp_vectors_copy_strokes (temp, vectors);
|
2002-02-25 05:00:58 +08:00
|
|
|
|
2003-05-09 08:38:51 +08:00
|
|
|
GIMP_ITEM (vectors)->width = GIMP_ITEM (temp)->width;
|
|
|
|
GIMP_ITEM (vectors)->height = GIMP_ITEM (temp)->height;
|
|
|
|
GIMP_ITEM (vectors)->offset_x = GIMP_ITEM (temp)->offset_x;
|
|
|
|
GIMP_ITEM (vectors)->offset_y = GIMP_ITEM (temp)->offset_y;
|
|
|
|
|
2003-02-01 02:08:32 +08:00
|
|
|
g_object_unref (temp);
|
2002-02-25 05:00:58 +08:00
|
|
|
|
2003-05-09 08:38:51 +08:00
|
|
|
gimp_vectors_thaw (vectors);
|
|
|
|
|
2004-03-17 00:23:06 +08:00
|
|
|
undo->size += gimp_object_get_memsize (GIMP_OBJECT (vmu->vectors), NULL);
|
|
|
|
|
2002-02-25 05:00:58 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_free_vectors_mod (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
2002-02-25 05:00:58 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
VectorsModUndo *vmu = undo->data;
|
2002-02-25 05:00:58 +08:00
|
|
|
|
2004-03-17 00:23:06 +08:00
|
|
|
g_object_unref (vmu->vectors);
|
2002-02-25 05:00:58 +08:00
|
|
|
g_free (vmu);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************/
|
2007-01-31 06:06:55 +08:00
|
|
|
/* Vectors Properties Undos */
|
2003-02-13 01:11:34 +08:00
|
|
|
/******************************/
|
2002-02-25 05:00:58 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_vectors_reposition (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpVectors *vectors)
|
2002-02-25 05:00:58 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (vectors)), NULL);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2007-01-31 06:06:55 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_VECTORS_PROP_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_VECTORS_REPOSITION, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
NULL, NULL,
|
|
|
|
"item", vectors,
|
|
|
|
NULL);
|
2002-02-24 01:29:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/**************************************/
|
|
|
|
/* Floating Selection to Layer Undo */
|
2003-02-13 01:11:34 +08:00
|
|
|
/**************************************/
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
typedef struct _FStoLayerUndo FStoLayerUndo;
|
|
|
|
|
|
|
|
struct _FStoLayerUndo
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-02-24 01:29:19 +08:00
|
|
|
GimpLayer *floating_layer; /* the floating layer */
|
|
|
|
GimpDrawable *drawable; /* drawable of floating sel */
|
|
|
|
};
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
static gboolean undo_pop_fs_to_layer (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_fs_to_layer (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_fs_to_layer (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *floating_layer,
|
|
|
|
GimpDrawable *drawable)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (floating_layer), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_UNDO,
|
2003-02-13 01:11:34 +08:00
|
|
|
sizeof (FStoLayerUndo),
|
|
|
|
sizeof (FStoLayerUndo),
|
2003-02-14 22:14:29 +08:00
|
|
|
GIMP_UNDO_FS_TO_LAYER, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_fs_to_layer,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_free_fs_to_layer,
|
|
|
|
NULL)))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
FStoLayerUndo *fsu = new->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
fsu->floating_layer = floating_layer;
|
|
|
|
fsu->drawable = drawable;
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return new;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2003-05-27 01:02:06 +08:00
|
|
|
tile_manager_unref (floating_layer->fs.backing_store);
|
2002-02-24 01:29:19 +08:00
|
|
|
floating_layer->fs.backing_store = NULL;
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return NULL;
|
2002-02-24 01:29:19 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-05-27 06:28:40 +08:00
|
|
|
static gboolean
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_fs_to_layer (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
FStoLayerUndo *fsu = undo->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
switch (undo_mode)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
case GIMP_UNDO_MODE_UNDO:
|
1997-11-25 06:05:25 +08:00
|
|
|
/* Update the preview for the floating sel */
|
2002-02-24 01:29:19 +08:00
|
|
|
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (fsu->floating_layer));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
fsu->floating_layer->fs.drawable = fsu->drawable;
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_set_active_layer (undo->image, fsu->floating_layer);
|
|
|
|
undo->image->floating_sel = fsu->floating_layer;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-09-25 02:06:49 +08:00
|
|
|
/* store the contents of the drawable */
|
2003-08-25 18:49:33 +08:00
|
|
|
floating_sel_store (fsu->floating_layer,
|
2004-09-25 02:06:49 +08:00
|
|
|
GIMP_ITEM (fsu->floating_layer)->offset_x,
|
|
|
|
GIMP_ITEM (fsu->floating_layer)->offset_y,
|
|
|
|
GIMP_ITEM (fsu->floating_layer)->width,
|
|
|
|
GIMP_ITEM (fsu->floating_layer)->height);
|
2002-02-24 01:29:19 +08:00
|
|
|
fsu->floating_layer->fs.initial = TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* clear the selection */
|
2003-09-04 19:33:06 +08:00
|
|
|
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (fsu->floating_layer));
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
case GIMP_UNDO_MODE_REDO:
|
1997-11-25 06:05:25 +08:00
|
|
|
/* restore the contents of the drawable */
|
2003-08-25 18:49:33 +08:00
|
|
|
floating_sel_restore (fsu->floating_layer,
|
2004-09-25 02:06:49 +08:00
|
|
|
GIMP_ITEM (fsu->floating_layer)->offset_x,
|
|
|
|
GIMP_ITEM (fsu->floating_layer)->offset_y,
|
|
|
|
GIMP_ITEM (fsu->floating_layer)->width,
|
|
|
|
GIMP_ITEM (fsu->floating_layer)->height);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2004-09-25 02:06:49 +08:00
|
|
|
/* Update the preview for the underlying drawable */
|
2002-02-24 01:29:19 +08:00
|
|
|
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (fsu->floating_layer));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* clear the selection */
|
2003-09-04 19:33:06 +08:00
|
|
|
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (fsu->floating_layer));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* update the pointers */
|
2002-02-24 01:29:19 +08:00
|
|
|
fsu->floating_layer->fs.drawable = NULL;
|
2006-03-29 01:08:36 +08:00
|
|
|
undo->image->floating_sel = NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-09-25 02:06:49 +08:00
|
|
|
gimp_object_name_changed (GIMP_OBJECT (fsu->floating_layer));
|
|
|
|
|
|
|
|
gimp_drawable_update (GIMP_DRAWABLE (fsu->floating_layer),
|
2006-04-12 20:49:29 +08:00
|
|
|
0, 0,
|
|
|
|
GIMP_ITEM (fsu->floating_layer)->width,
|
|
|
|
GIMP_ITEM (fsu->floating_layer)->height);
|
2004-09-25 02:06:49 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_floating_selection_changed (undo->image);
|
2001-05-08 09:32:25 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Honest, guv, it's not a feature - it's a tightly integrated package of
Mon Sep 20 12:51:30 EDT 1999 Austin Donnelly <austin@gimp.org>
Honest, guv, it's not a feature - it's a tightly integrated
package of undo system cleanups and fixes.
NEW FILES:
* app/undo_history.c: window showing recent undo (and redo) steps
available.
* app/undo_types.h: broken out of undo.h to fix circular includes.
MODIFIED FILES:
* app/Makefile.am: compile undo_history.c
* app/channel.h: use enum for channel undo type, not just magic
numbers.
* app/layer.h: same for layer undos.
* app/commands.c: edit_show_undo_history_cmd_callback() function to
pull up undo history window.
* app/commands.h: prototype for above.
* app/gdisplay.c: make undo / redo menu items sensitive according
to whether they would do anything. Would be easy to change
the text to say what would be undone/redone, but I don't know
the GTK.
* app/gimpimage.c: new signal emitted by gimage:
UNDO_EVENT. gimp_image_undo_event() function to emit it.
* app/gimpimage.h: prototype for above.
* app/gimpimageP.h: pushing_undo_group member is now an undo_type,
not an int. Keep undo history widget here too (if created).
* app/menus.c: add "Edit/Undo history..." to image menu.
* app/undo.c: new types: enums undo_type and undo_state rather than
ints and magic numbers. All undo_pop_* and undo_free_*
functions made static. New static function
undo_type_to_name(). Issue undo event signals on various
important events (eg undo pushed, undo popped etc).
undo_push() now takes a "dirties_image" arg to say whether
image should be dirtied. Layer moves now dirty the image. A
couple of g_return_if_fails () on undo_pop and undo_redo to
assert we're not in the middle of an undo group.
undo_get_{undo,redo}_name() to peek at names of top items on
undo and redo stacks resp. undo_map_over_{undo,redo}_stack()
to run a function for each item or group on stack. Layer and
channel undos use symbolic names rather than 0 or 1. Array
mapping undo types to names.
* app/undo.h: split out undo types to undo_types.h. Prototypes
for functions described above. undo_event_t enum.
undo_history_new() prototype lives here too.
Random other fixes:
* app/gimpdrawable.c
* app/image_render.c: default labels in switches to keep egcs happy.
* app/nav_window.c: some fixes to (sort of) cope with image res !=
screen res. Still needs work to handle non-square pixels
properly.
* app/paths_dialog.c: bad idea to call gimp_image_dirty()
directly. Even though it's currently commented out.
1999-09-21 01:15:20 +08:00
|
|
|
static void
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_free_fs_to_layer (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
FStoLayerUndo *fsu = undo->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
if (undo_mode == GIMP_UNDO_MODE_UNDO)
|
2001-11-10 00:54:56 +08:00
|
|
|
{
|
2003-05-27 01:02:06 +08:00
|
|
|
tile_manager_unref (fsu->floating_layer->fs.backing_store);
|
2002-02-24 01:29:19 +08:00
|
|
|
fsu->floating_layer->fs.backing_store = NULL;
|
2001-11-10 00:54:56 +08:00
|
|
|
}
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
g_free (fsu);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************/
|
|
|
|
/* Floating Selection Rigor Undo */
|
2003-02-13 01:11:34 +08:00
|
|
|
/***********************************/
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-03-18 21:49:02 +08:00
|
|
|
static gboolean undo_pop_fs_rigor (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_fs_rigor (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *floating_layer)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (floating_layer), NULL);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_ITEM_UNDO,
|
2004-07-13 00:59:36 +08:00
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_FS_RIGOR, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_NONE,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_pop_fs_rigor,
|
|
|
|
NULL,
|
|
|
|
"item", floating_layer,
|
|
|
|
NULL)))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
return new;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2003-02-03 21:45:40 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-05-27 06:28:40 +08:00
|
|
|
static gboolean
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_fs_rigor (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-03-18 21:49:02 +08:00
|
|
|
GimpLayer *floating_layer;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-03-18 21:49:02 +08:00
|
|
|
floating_layer = GIMP_LAYER (GIMP_ITEM_UNDO (undo)->item);
|
2000-06-08 06:51:23 +08:00
|
|
|
|
2003-03-18 21:49:02 +08:00
|
|
|
if (! gimp_layer_is_floating_sel (floating_layer))
|
1997-11-25 06:05:25 +08:00
|
|
|
return FALSE;
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
switch (undo_mode)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
case GIMP_UNDO_MODE_UNDO:
|
2003-03-18 21:49:02 +08:00
|
|
|
floating_sel_relax (floating_layer, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
case GIMP_UNDO_MODE_REDO:
|
2003-03-18 21:49:02 +08:00
|
|
|
floating_sel_rigor (floating_layer, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************/
|
|
|
|
/* Floating Selection Relax Undo */
|
2003-02-13 01:11:34 +08:00
|
|
|
/***********************************/
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-03-18 21:49:02 +08:00
|
|
|
static gboolean undo_pop_fs_relax (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_fs_relax (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *floating_layer)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (floating_layer), NULL);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_ITEM_UNDO,
|
2004-07-13 00:59:36 +08:00
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_FS_RELAX, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_NONE,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_pop_fs_relax,
|
|
|
|
NULL,
|
|
|
|
"item", floating_layer,
|
|
|
|
NULL)))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
return new;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2003-02-03 21:45:40 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return NULL;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-05-27 06:28:40 +08:00
|
|
|
static gboolean
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_fs_relax (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-03-18 21:49:02 +08:00
|
|
|
GimpLayer *floating_layer;
|
2000-06-08 06:51:23 +08:00
|
|
|
|
2003-03-18 21:49:02 +08:00
|
|
|
floating_layer = GIMP_LAYER (GIMP_ITEM_UNDO (undo)->item);
|
2000-06-08 06:51:23 +08:00
|
|
|
|
2003-03-18 21:49:02 +08:00
|
|
|
if (! gimp_layer_is_floating_sel (floating_layer))
|
1997-11-25 06:05:25 +08:00
|
|
|
return FALSE;
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
switch (undo_mode)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
case GIMP_UNDO_MODE_UNDO:
|
2003-03-18 21:49:02 +08:00
|
|
|
floating_sel_rigor (floating_layer, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
case GIMP_UNDO_MODE_REDO:
|
2003-03-18 21:49:02 +08:00
|
|
|
floating_sel_relax (floating_layer, FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-04-23 14:07:09 +08:00
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
/*******************/
|
|
|
|
/* Parasite Undo */
|
2003-02-13 01:11:34 +08:00
|
|
|
/*******************/
|
1999-04-23 14:07:09 +08:00
|
|
|
|
|
|
|
typedef struct _ParasiteUndo ParasiteUndo;
|
|
|
|
|
|
|
|
struct _ParasiteUndo
|
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image;
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpItem *item;
|
2000-05-27 06:28:40 +08:00
|
|
|
GimpParasite *parasite;
|
|
|
|
gchar *name;
|
1999-04-23 14:07:09 +08:00
|
|
|
};
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
static gboolean undo_pop_parasite (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_parasite (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-04-02 22:44:32 +08:00
|
|
|
gimp_image_undo_push_image_parasite (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
const GimpParasite *parasite)
|
1999-04-23 14:07:09 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
1999-04-23 14:07:09 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_UNDO,
|
2003-02-13 01:11:34 +08:00
|
|
|
sizeof (ParasiteUndo),
|
|
|
|
sizeof (ParasiteUndo),
|
2003-02-14 22:14:29 +08:00
|
|
|
GIMP_UNDO_PARASITE_ATTACH, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_IMAGE_META,
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_parasite,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_free_parasite,
|
|
|
|
NULL)))
|
1999-04-23 14:07:09 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ParasiteUndo *pu = new->data;
|
1999-04-23 14:07:09 +08:00
|
|
|
|
2006-04-02 22:44:32 +08:00
|
|
|
pu->image = image;
|
2002-02-26 01:58:50 +08:00
|
|
|
pu->item = NULL;
|
2002-02-24 01:29:19 +08:00
|
|
|
pu->name = g_strdup (gimp_parasite_name (parasite));
|
2006-03-29 01:08:36 +08:00
|
|
|
pu->parasite = gimp_parasite_copy (gimp_image_parasite_find (image,
|
2002-02-24 01:29:19 +08:00
|
|
|
pu->name));
|
1999-04-23 14:07:09 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return new;
|
1999-04-23 14:07:09 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return NULL;
|
1999-04-23 14:07:09 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_image_parasite_remove (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
const gchar *name)
|
1999-04-23 14:07:09 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
1999-04-23 14:07:09 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_UNDO,
|
2003-02-13 01:11:34 +08:00
|
|
|
sizeof (ParasiteUndo),
|
|
|
|
sizeof (ParasiteUndo),
|
2003-02-14 22:14:29 +08:00
|
|
|
GIMP_UNDO_PARASITE_REMOVE, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_IMAGE_META,
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_parasite,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_free_parasite,
|
|
|
|
NULL)))
|
1999-04-23 14:07:09 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ParasiteUndo *pu = new->data;
|
1999-04-23 14:07:09 +08:00
|
|
|
|
2006-04-02 22:44:32 +08:00
|
|
|
pu->image = image;
|
2002-02-26 01:58:50 +08:00
|
|
|
pu->item = NULL;
|
2002-02-24 01:29:19 +08:00
|
|
|
pu->name = g_strdup (name);
|
2006-03-29 01:08:36 +08:00
|
|
|
pu->parasite = gimp_parasite_copy (gimp_image_parasite_find (image,
|
2002-02-24 01:29:19 +08:00
|
|
|
pu->name));
|
1999-04-23 14:07:09 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return new;
|
1999-04-23 14:07:09 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return NULL;
|
1999-04-23 14:07:09 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-04-02 22:44:32 +08:00
|
|
|
gimp_image_undo_push_item_parasite (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpItem *item,
|
|
|
|
const GimpParasite *parasite)
|
1999-04-23 14:07:09 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
1999-04-23 14:07:09 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_UNDO,
|
2003-02-13 01:11:34 +08:00
|
|
|
sizeof (ParasiteUndo),
|
|
|
|
sizeof (ParasiteUndo),
|
2003-02-14 22:14:29 +08:00
|
|
|
GIMP_UNDO_PARASITE_ATTACH, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_ITEM_META,
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_parasite,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_free_parasite,
|
|
|
|
NULL)))
|
1999-04-23 14:07:09 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ParasiteUndo *pu = new->data;
|
1999-04-23 14:07:09 +08:00
|
|
|
|
2006-04-02 22:44:32 +08:00
|
|
|
pu->image = NULL;
|
2002-02-26 01:58:50 +08:00
|
|
|
pu->item = item;
|
2002-02-24 01:29:19 +08:00
|
|
|
pu->name = g_strdup (gimp_parasite_name (parasite));
|
2002-02-26 01:58:50 +08:00
|
|
|
pu->parasite = gimp_parasite_copy (gimp_item_parasite_find (item,
|
|
|
|
pu->name));
|
2007-01-30 02:49:06 +08:00
|
|
|
return new;
|
1999-04-23 14:07:09 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return NULL;
|
1999-04-23 14:07:09 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_item_parasite_remove (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpItem *item,
|
|
|
|
const gchar *name)
|
1999-04-23 14:07:09 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
1999-04-23 14:07:09 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_UNDO,
|
2003-02-13 01:11:34 +08:00
|
|
|
sizeof (ParasiteUndo),
|
|
|
|
sizeof (ParasiteUndo),
|
2003-02-14 22:14:29 +08:00
|
|
|
GIMP_UNDO_PARASITE_REMOVE, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_ITEM_META,
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_parasite,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_free_parasite,
|
|
|
|
NULL)))
|
1999-04-23 14:07:09 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ParasiteUndo *pu = new->data;
|
1999-04-23 14:07:09 +08:00
|
|
|
|
2006-04-02 22:44:32 +08:00
|
|
|
pu->image = NULL;
|
2002-02-26 01:58:50 +08:00
|
|
|
pu->item = item;
|
2002-02-24 01:29:19 +08:00
|
|
|
pu->name = g_strdup (name);
|
2002-02-26 01:58:50 +08:00
|
|
|
pu->parasite = gimp_parasite_copy (gimp_item_parasite_find (item,
|
|
|
|
pu->name));
|
2007-01-30 02:49:06 +08:00
|
|
|
return new;
|
1999-04-23 14:07:09 +08:00
|
|
|
}
|
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return NULL;
|
1999-04-23 14:07:09 +08:00
|
|
|
}
|
|
|
|
|
2000-05-27 06:28:40 +08:00
|
|
|
static gboolean
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_parasite (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
1999-04-23 14:07:09 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ParasiteUndo *pu = undo->data;
|
2000-05-27 06:28:40 +08:00
|
|
|
GimpParasite *tmp;
|
1999-04-23 14:07:09 +08:00
|
|
|
|
2003-02-14 22:14:29 +08:00
|
|
|
tmp = pu->parasite;
|
2000-05-27 06:28:40 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if (pu->image)
|
2003-02-14 22:14:29 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
pu->parasite = gimp_parasite_copy (gimp_image_parasite_find (undo->image,
|
2003-02-14 22:14:29 +08:00
|
|
|
pu->name));
|
2000-01-26 07:06:12 +08:00
|
|
|
if (tmp)
|
2006-04-12 20:49:29 +08:00
|
|
|
gimp_parasite_list_add (pu->image->parasites, tmp);
|
2000-01-26 07:06:12 +08:00
|
|
|
else
|
2006-04-12 20:49:29 +08:00
|
|
|
gimp_parasite_list_remove (pu->image->parasites, pu->name);
|
2000-01-26 07:06:12 +08:00
|
|
|
}
|
2003-02-14 22:14:29 +08:00
|
|
|
else if (pu->item)
|
2000-01-26 07:06:12 +08:00
|
|
|
{
|
2003-02-14 22:14:29 +08:00
|
|
|
pu->parasite = gimp_parasite_copy (gimp_item_parasite_find (pu->item,
|
|
|
|
pu->name));
|
2000-01-26 07:06:12 +08:00
|
|
|
if (tmp)
|
2006-04-12 20:49:29 +08:00
|
|
|
gimp_parasite_list_add (pu->item->parasites, tmp);
|
2000-01-26 07:06:12 +08:00
|
|
|
else
|
2006-04-12 20:49:29 +08:00
|
|
|
gimp_parasite_list_remove (pu->item->parasites, pu->name);
|
2000-01-26 07:06:12 +08:00
|
|
|
}
|
1999-04-23 14:07:09 +08:00
|
|
|
else
|
2000-01-26 07:06:12 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
pu->parasite = gimp_parasite_copy (gimp_parasite_find (undo->image->gimp,
|
2003-02-14 22:14:29 +08:00
|
|
|
pu->name));
|
2000-01-26 07:06:12 +08:00
|
|
|
if (tmp)
|
2006-04-12 20:49:29 +08:00
|
|
|
gimp_parasite_attach (undo->image->gimp, tmp);
|
2000-01-26 07:06:12 +08:00
|
|
|
else
|
2006-04-12 20:49:29 +08:00
|
|
|
gimp_parasite_detach (undo->image->gimp, pu->name);
|
2000-01-26 07:06:12 +08:00
|
|
|
}
|
2003-02-03 21:45:40 +08:00
|
|
|
|
1999-04-23 14:07:09 +08:00
|
|
|
if (tmp)
|
2000-05-27 06:28:40 +08:00
|
|
|
gimp_parasite_free (tmp);
|
1999-04-23 14:07:09 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Honest, guv, it's not a feature - it's a tightly integrated package of
Mon Sep 20 12:51:30 EDT 1999 Austin Donnelly <austin@gimp.org>
Honest, guv, it's not a feature - it's a tightly integrated
package of undo system cleanups and fixes.
NEW FILES:
* app/undo_history.c: window showing recent undo (and redo) steps
available.
* app/undo_types.h: broken out of undo.h to fix circular includes.
MODIFIED FILES:
* app/Makefile.am: compile undo_history.c
* app/channel.h: use enum for channel undo type, not just magic
numbers.
* app/layer.h: same for layer undos.
* app/commands.c: edit_show_undo_history_cmd_callback() function to
pull up undo history window.
* app/commands.h: prototype for above.
* app/gdisplay.c: make undo / redo menu items sensitive according
to whether they would do anything. Would be easy to change
the text to say what would be undone/redone, but I don't know
the GTK.
* app/gimpimage.c: new signal emitted by gimage:
UNDO_EVENT. gimp_image_undo_event() function to emit it.
* app/gimpimage.h: prototype for above.
* app/gimpimageP.h: pushing_undo_group member is now an undo_type,
not an int. Keep undo history widget here too (if created).
* app/menus.c: add "Edit/Undo history..." to image menu.
* app/undo.c: new types: enums undo_type and undo_state rather than
ints and magic numbers. All undo_pop_* and undo_free_*
functions made static. New static function
undo_type_to_name(). Issue undo event signals on various
important events (eg undo pushed, undo popped etc).
undo_push() now takes a "dirties_image" arg to say whether
image should be dirtied. Layer moves now dirty the image. A
couple of g_return_if_fails () on undo_pop and undo_redo to
assert we're not in the middle of an undo group.
undo_get_{undo,redo}_name() to peek at names of top items on
undo and redo stacks resp. undo_map_over_{undo,redo}_stack()
to run a function for each item or group on stack. Layer and
channel undos use symbolic names rather than 0 or 1. Array
mapping undo types to names.
* app/undo.h: split out undo types to undo_types.h. Prototypes
for functions described above. undo_event_t enum.
undo_history_new() prototype lives here too.
Random other fixes:
* app/gimpdrawable.c
* app/image_render.c: default labels in switches to keep egcs happy.
* app/nav_window.c: some fixes to (sort of) cope with image res !=
screen res. Still needs work to handle non-square pixels
properly.
* app/paths_dialog.c: bad idea to call gimp_image_dirty()
directly. Even though it's currently commented out.
1999-09-21 01:15:20 +08:00
|
|
|
static void
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_free_parasite (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
1999-04-23 14:07:09 +08:00
|
|
|
{
|
2004-03-17 00:23:06 +08:00
|
|
|
ParasiteUndo *pu = undo->data;
|
1999-04-23 14:07:09 +08:00
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
if (pu->parasite)
|
|
|
|
gimp_parasite_free (pu->parasite);
|
|
|
|
if (pu->name)
|
|
|
|
g_free (pu->name);
|
1999-04-23 14:07:09 +08:00
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
g_free (pu);
|
1999-04-23 14:07:09 +08:00
|
|
|
}
|
|
|
|
|
1999-08-23 22:34:58 +08:00
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
/******************************************************************************/
|
|
|
|
/* Something for which programmer is too lazy to write an undo function for */
|
2003-02-13 01:11:34 +08:00
|
|
|
/******************************************************************************/
|
1999-08-23 22:34:58 +08:00
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
static gboolean undo_pop_cantundo (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
1999-08-23 22:34:58 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
GimpUndo *
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_cantundo (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc)
|
1999-08-23 22:34:58 +08:00
|
|
|
{
|
2007-01-30 02:49:06 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2000-01-26 07:06:12 +08:00
|
|
|
/* This is the sole purpose of this type of undo: the ability to
|
|
|
|
* mark an image as having been mutated, without really providing
|
2002-02-24 01:29:19 +08:00
|
|
|
* any adequate undo facility.
|
|
|
|
*/
|
1999-08-23 22:34:58 +08:00
|
|
|
|
2007-01-30 02:49:06 +08:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_UNDO,
|
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_CANT, undo_desc,
|
|
|
|
GIMP_DIRTY_ALL,
|
|
|
|
undo_pop_cantundo,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
1999-08-23 22:34:58 +08:00
|
|
|
}
|
|
|
|
|
2000-05-27 06:28:40 +08:00
|
|
|
static gboolean
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_cantundo (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
1999-08-23 22:34:58 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
switch (undo_mode)
|
2000-01-26 07:06:12 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
case GIMP_UNDO_MODE_UNDO:
|
2006-10-15 00:20:46 +08:00
|
|
|
gimp_message (undo->image->gimp, NULL, GIMP_MESSAGE_WARNING,
|
|
|
|
_("Can't undo %s"), GIMP_OBJECT (undo)->name);
|
2000-01-26 07:06:12 +08:00
|
|
|
break;
|
1999-08-23 22:34:58 +08:00
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
case GIMP_UNDO_MODE_REDO:
|
2000-01-26 07:06:12 +08:00
|
|
|
break;
|
1999-08-23 22:34:58 +08:00
|
|
|
}
|
|
|
|
|
2000-01-26 07:06:12 +08:00
|
|
|
return TRUE;
|
1999-08-23 22:34:58 +08:00
|
|
|
}
|