1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* 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"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
#include <string.h>
|
2000-04-28 01:27:28 +08:00
|
|
|
|
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/pixel-region.h"
|
|
|
|
#include "base/tile-manager.h"
|
|
|
|
|
2001-04-07 23:58:26 +08:00
|
|
|
#include "paint-funcs/paint-funcs.h"
|
|
|
|
|
2003-02-14 22:14:29 +08:00
|
|
|
#include "gimp-parasites.h"
|
|
|
|
#include "gimp.h"
|
2003-06-24 03:34:48 +08:00
|
|
|
#include "gimpgrid.h"
|
2006-06-07 06:48:57 +08:00
|
|
|
#include "gimpguide.h"
|
2003-03-18 21:49:02 +08:00
|
|
|
#include "gimpimage-colormap.h"
|
2003-07-05 03:55:58 +08:00
|
|
|
#include "gimpimage-grid.h"
|
2003-02-14 22:14:29 +08:00
|
|
|
#include "gimpimage-guides.h"
|
2005-03-05 00:34:59 +08:00
|
|
|
#include "gimpimage-sample-points.h"
|
2003-02-14 22:14:29 +08:00
|
|
|
#include "gimpimage-undo.h"
|
|
|
|
#include "gimpimage.h"
|
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
|
|
|
#include "gimpitemundo.h"
|
2003-02-14 22:14:29 +08:00
|
|
|
#include "gimplayer-floating-sel.h"
|
|
|
|
#include "gimplayer.h"
|
|
|
|
#include "gimplayermask.h"
|
|
|
|
#include "gimplist.h"
|
|
|
|
#include "gimpparasitelist.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"
|
|
|
|
|
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
|
|
|
|
2002-02-24 02:29:07 +08:00
|
|
|
/*********************/
|
|
|
|
/* Image Type Undo */
|
2003-02-13 01:11:34 +08:00
|
|
|
/*********************/
|
2002-02-24 02:29:07 +08:00
|
|
|
|
|
|
|
typedef struct _ImageTypeUndo ImageTypeUndo;
|
|
|
|
|
|
|
|
struct _ImageTypeUndo
|
|
|
|
{
|
|
|
|
GimpImageBaseType base_type;
|
|
|
|
};
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
static gboolean undo_pop_image_type (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_image_type (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
2002-02-24 02:29:07 +08:00
|
|
|
|
|
|
|
gboolean
|
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
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
2002-02-24 02:29:07 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
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 (ImageTypeUndo),
|
|
|
|
sizeof (ImageTypeUndo),
|
2003-02-14 22:14:29 +08:00
|
|
|
GIMP_UNDO_IMAGE_TYPE, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_IMAGE,
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_image_type,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_free_image_type,
|
|
|
|
NULL)))
|
2002-02-24 02:29:07 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ImageTypeUndo *itu = new->data;
|
2002-02-24 02:29:07 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
itu->base_type = image->base_type;
|
2002-02-24 02:29:07 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_image_type (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
2002-02-24 02:29:07 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ImageTypeUndo *itu = undo->data;
|
2002-02-24 02:29:07 +08:00
|
|
|
GimpImageBaseType tmp;
|
|
|
|
|
|
|
|
tmp = itu->base_type;
|
2006-03-29 01:08:36 +08:00
|
|
|
itu->base_type = undo->image->base_type;
|
|
|
|
g_object_set (undo->image, "base-type", tmp, NULL);
|
2002-02-24 02:29:07 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_colormap_changed (undo->image, -1);
|
2002-02-24 02:29:07 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if (itu->base_type != undo->image->base_type)
|
2003-02-13 01:11:34 +08:00
|
|
|
accum->mode_changed = TRUE;
|
2002-02-24 02:29:07 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_free_image_type (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
2002-02-24 02:29:07 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
g_free (undo->data);
|
2002-02-24 02:29:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
/*********************/
|
|
|
|
/* Image Size Undo */
|
2003-02-13 01:11:34 +08:00
|
|
|
/*********************/
|
2002-02-24 01:29:19 +08:00
|
|
|
|
|
|
|
typedef struct _ImageSizeUndo ImageSizeUndo;
|
|
|
|
|
|
|
|
struct _ImageSizeUndo
|
|
|
|
{
|
2002-02-24 02:29:07 +08:00
|
|
|
gint width;
|
|
|
|
gint height;
|
2002-02-24 01:29:19 +08:00
|
|
|
};
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
static gboolean undo_pop_image_size (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_image_size (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-05-27 06:28:40 +08:00
|
|
|
gboolean
|
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
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
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 (ImageSizeUndo),
|
|
|
|
sizeof (ImageSizeUndo),
|
2003-02-14 22:14:29 +08:00
|
|
|
GIMP_UNDO_IMAGE_SIZE, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_IMAGE | GIMP_DIRTY_IMAGE_SIZE,
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_image_size,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_free_image_size,
|
|
|
|
NULL)))
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ImageSizeUndo *isu = new->data;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
isu->width = image->width;
|
|
|
|
isu->height = image->height;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_image_size (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ImageSizeUndo *isu = undo->data;
|
2003-02-13 01:11:34 +08:00
|
|
|
gint width;
|
|
|
|
gint height;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
width = isu->width;
|
|
|
|
height = isu->height;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
isu->width = undo->image->width;
|
|
|
|
isu->height = undo->image->height;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_object_set (undo->image,
|
2004-07-14 20:12:50 +08:00
|
|
|
"width", width,
|
|
|
|
"height", height,
|
|
|
|
NULL);
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (gimp_image_get_mask (undo->image)));
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if (undo->image->width != isu->width ||
|
|
|
|
undo->image->height != isu->height)
|
2003-02-13 01:11:34 +08:00
|
|
|
accum->size_changed = TRUE;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_free_image_size (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
g_free (undo->data);
|
2002-02-24 01:29:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***************************/
|
|
|
|
/* Image Resolution Undo */
|
2003-02-13 01:11:34 +08:00
|
|
|
/***************************/
|
2002-02-24 01:29:19 +08:00
|
|
|
|
|
|
|
typedef struct _ResolutionUndo ResolutionUndo;
|
|
|
|
|
|
|
|
struct _ResolutionUndo
|
|
|
|
{
|
2004-10-13 05:28:53 +08:00
|
|
|
gdouble xres;
|
|
|
|
gdouble yres;
|
|
|
|
GimpUnit unit;
|
2002-02-24 01:29:19 +08:00
|
|
|
};
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
static gboolean undo_pop_image_resolution (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_image_resolution (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
2002-02-24 01:29:19 +08:00
|
|
|
|
|
|
|
gboolean
|
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
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
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 (ResolutionUndo),
|
|
|
|
sizeof (ResolutionUndo),
|
2003-02-14 22:14:29 +08:00
|
|
|
GIMP_UNDO_IMAGE_RESOLUTION, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_IMAGE,
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_image_resolution,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_free_image_resolution,
|
|
|
|
NULL)))
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ResolutionUndo *ru = new->data;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
ru->xres = image->xresolution;
|
|
|
|
ru->yres = image->yresolution;
|
|
|
|
ru->unit = image->resolution_unit;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_image_resolution (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ResolutionUndo *ru = undo->data;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if (ABS (ru->xres - undo->image->xresolution) >= 1e-5 ||
|
|
|
|
ABS (ru->yres - undo->image->yresolution) >= 1e-5)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
gdouble xres;
|
|
|
|
gdouble yres;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
xres = undo->image->xresolution;
|
|
|
|
yres = undo->image->yresolution;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
undo->image->xresolution = ru->xres;
|
|
|
|
undo->image->yresolution = ru->yres;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
ru->xres = xres;
|
|
|
|
ru->yres = yres;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
accum->resolution_changed = TRUE;
|
2002-02-24 01:29:19 +08:00
|
|
|
}
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if (ru->unit != undo->image->resolution_unit)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUnit unit;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
unit = undo->image->resolution_unit;
|
|
|
|
undo->image->resolution_unit = ru->unit;
|
2003-02-13 01:11:34 +08:00
|
|
|
ru->unit = unit;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
accum->unit_changed = TRUE;
|
2002-02-24 01:29:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_free_image_resolution (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
g_free (undo->data);
|
2002-02-24 01:29:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/****************/
|
|
|
|
/* Guide Undo */
|
2003-02-13 01:11:34 +08:00
|
|
|
/****************/
|
1999-10-19 04:55:25 +08:00
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
typedef struct _GuideUndo GuideUndo;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
struct _GuideUndo
|
|
|
|
{
|
2003-05-20 19:24:54 +08:00
|
|
|
GimpGuide *guide;
|
|
|
|
GimpOrientationType orientation;
|
2006-06-07 23:49:59 +08:00
|
|
|
gint position;
|
2002-02-24 01:29:19 +08:00
|
|
|
};
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
static gboolean undo_pop_image_guide (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_image_guide (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-05-27 06:28:40 +08:00
|
|
|
gboolean
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_image_guide (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpGuide *guide)
|
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
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2006-06-07 23:49:59 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_GUIDE (guide), FALSE);
|
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 (GuideUndo),
|
|
|
|
sizeof (GuideUndo),
|
2003-02-14 22:14:29 +08:00
|
|
|
GIMP_UNDO_IMAGE_GUIDE, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_IMAGE_META,
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_image_guide,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_free_image_guide,
|
|
|
|
NULL)))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
GuideUndo *gu = new->data;
|
2001-02-14 12:55:21 +08:00
|
|
|
|
2006-06-07 06:48:57 +08:00
|
|
|
gu->guide = g_object_ref (guide);
|
2006-06-07 23:49:59 +08:00
|
|
|
gu->orientation = gimp_guide_get_orientation (guide);
|
|
|
|
gu->position = gimp_guide_get_position (guide);
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
static gboolean
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_image_guide (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2003-10-14 20:23:23 +08:00
|
|
|
GuideUndo *gu = undo->data;
|
2003-05-20 19:24:54 +08:00
|
|
|
GimpOrientationType old_orientation;
|
2006-06-07 23:49:59 +08:00
|
|
|
gint old_position;
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2006-06-07 23:49:59 +08:00
|
|
|
old_orientation = gimp_guide_get_orientation (gu->guide);
|
|
|
|
old_position = gimp_guide_get_position (gu->guide);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2005-04-03 23:48:03 +08:00
|
|
|
/* add and move guides manually (nor using the gimp_image_guide
|
|
|
|
* API), because we might be in the middle of an image resizing
|
|
|
|
* undo group and the guide's position might be temporarily out of
|
|
|
|
* image.
|
|
|
|
*/
|
|
|
|
|
2006-06-07 23:49:59 +08:00
|
|
|
if (old_position == -1)
|
2003-03-31 00:11:51 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
undo->image->guides = g_list_prepend (undo->image->guides, gu->guide);
|
2006-06-07 23:49:59 +08:00
|
|
|
gimp_guide_set_position (gu->guide, gu->position);
|
2006-06-07 06:48:57 +08:00
|
|
|
g_object_ref (gu->guide);
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_update_guide (undo->image, gu->guide);
|
2003-03-31 00:11:51 +08:00
|
|
|
}
|
2003-03-28 21:52:01 +08:00
|
|
|
else if (gu->position == -1)
|
2003-03-31 00:11:51 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_remove_guide (undo->image, gu->guide, FALSE);
|
2003-03-31 00:11:51 +08:00
|
|
|
}
|
2003-03-28 21:52:01 +08:00
|
|
|
else
|
2003-03-31 00:11:51 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_update_guide (undo->image, gu->guide);
|
2006-06-07 23:49:59 +08:00
|
|
|
gimp_guide_set_position (gu->guide, gu->position);
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_update_guide (undo->image, gu->guide);
|
2003-03-31 00:11:51 +08:00
|
|
|
}
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2006-06-07 23:49:59 +08:00
|
|
|
gimp_guide_set_orientation (gu->guide, gu->orientation);
|
2003-05-20 19:24:54 +08:00
|
|
|
|
|
|
|
gu->position = old_position;
|
|
|
|
gu->orientation = old_orientation;
|
2001-03-31 22:47:44 +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-20 20:47:42 +08:00
|
|
|
undo_free_image_guide (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-10-14 20:23:23 +08:00
|
|
|
GuideUndo *gu = undo->data;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-06-07 06:48:57 +08:00
|
|
|
g_object_unref (gu->guide);
|
2003-02-20 20:47:42 +08:00
|
|
|
g_free (gu);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2001-07-08 01:36:00 +08:00
|
|
|
|
2005-03-05 08:10:40 +08:00
|
|
|
/****************/
|
|
|
|
/* Grid Undo */
|
|
|
|
/****************/
|
|
|
|
|
|
|
|
typedef struct _GridUndo GridUndo;
|
|
|
|
|
|
|
|
struct _GridUndo
|
|
|
|
{
|
|
|
|
GimpGrid *grid;
|
|
|
|
};
|
|
|
|
|
|
|
|
static gboolean undo_pop_image_grid (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_image_grid (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
|
|
|
|
|
|
|
gboolean
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_image_grid (GimpImage *image,
|
2005-03-05 08:10:40 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpGrid *grid)
|
|
|
|
{
|
|
|
|
GimpUndo *new;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2005-03-05 08:10:40 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_GRID (grid), FALSE);
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_UNDO,
|
2005-03-05 08:10:40 +08:00
|
|
|
sizeof (GridUndo),
|
|
|
|
sizeof (GridUndo),
|
|
|
|
GIMP_UNDO_IMAGE_GRID, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_META,
|
|
|
|
undo_pop_image_grid,
|
|
|
|
undo_free_image_grid,
|
|
|
|
NULL)))
|
|
|
|
{
|
|
|
|
GridUndo *gu = new->data;
|
|
|
|
|
|
|
|
gu->grid = gimp_config_duplicate (GIMP_CONFIG (grid));
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
undo_pop_image_grid (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
|
|
|
{
|
|
|
|
GridUndo *gu = undo->data;
|
|
|
|
GimpGrid *grid;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
grid = gimp_config_duplicate (GIMP_CONFIG (undo->image->grid));
|
2005-03-05 08:10:40 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_set_grid (undo->image, gu->grid, FALSE);
|
2005-03-05 08:10:40 +08:00
|
|
|
|
|
|
|
g_object_unref (gu->grid);
|
|
|
|
gu->grid = grid;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
undo_free_image_grid (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
|
|
|
{
|
|
|
|
GridUndo *gu = undo->data;
|
|
|
|
|
|
|
|
if (gu->grid)
|
|
|
|
g_object_unref (gu->grid);
|
|
|
|
|
|
|
|
g_free (gu);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-05 00:34:59 +08:00
|
|
|
/**********************/
|
|
|
|
/* Sampe Point Undo */
|
|
|
|
/**********************/
|
|
|
|
|
|
|
|
typedef struct _SamplePointUndo SamplePointUndo;
|
|
|
|
|
|
|
|
struct _SamplePointUndo
|
|
|
|
{
|
2005-03-05 08:10:40 +08:00
|
|
|
GimpSamplePoint *sample_point;
|
|
|
|
gint x;
|
|
|
|
gint y;
|
2005-03-05 00:34:59 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static gboolean undo_pop_image_sample_point (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_image_sample_point (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
|
|
|
|
|
|
|
gboolean
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_image_sample_point (GimpImage *image,
|
2005-03-05 00:34:59 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpSamplePoint *sample_point)
|
|
|
|
{
|
|
|
|
GimpUndo *new;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2005-03-05 00:34:59 +08:00
|
|
|
g_return_val_if_fail (sample_point != NULL, FALSE);
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_UNDO,
|
2005-03-05 00:34:59 +08:00
|
|
|
sizeof (SamplePointUndo),
|
|
|
|
sizeof (SamplePointUndo),
|
|
|
|
GIMP_UNDO_IMAGE_SAMPLE_POINT, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_META,
|
|
|
|
undo_pop_image_sample_point,
|
|
|
|
undo_free_image_sample_point,
|
|
|
|
NULL)))
|
|
|
|
{
|
2005-04-03 23:48:03 +08:00
|
|
|
SamplePointUndo *spu = new->data;
|
2005-03-05 00:34:59 +08:00
|
|
|
|
2005-04-03 23:48:03 +08:00
|
|
|
spu->sample_point = gimp_image_sample_point_ref (sample_point);
|
|
|
|
spu->x = sample_point->x;
|
|
|
|
spu->y = sample_point->y;
|
2005-03-05 00:34:59 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
undo_pop_image_sample_point (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
|
|
|
{
|
2005-04-03 23:48:03 +08:00
|
|
|
SamplePointUndo *spu = undo->data;
|
2005-03-05 00:34:59 +08:00
|
|
|
gint old_x;
|
|
|
|
gint old_y;
|
|
|
|
|
2005-04-03 23:48:03 +08:00
|
|
|
old_x = spu->sample_point->x;
|
|
|
|
old_y = spu->sample_point->y;
|
|
|
|
|
|
|
|
/* add and move sample points manually (nor using the
|
|
|
|
* gimp_image_sample_point API), because we might be in the middle
|
|
|
|
* of an image resizing undo group and the sample point's position
|
|
|
|
* might be temporarily out of image.
|
|
|
|
*/
|
2005-03-05 00:34:59 +08:00
|
|
|
|
2005-04-03 23:48:03 +08:00
|
|
|
if (spu->sample_point->x == -1)
|
2005-03-05 00:34:59 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
undo->image->sample_points = g_list_append (undo->image->sample_points,
|
2005-04-03 23:48:03 +08:00
|
|
|
spu->sample_point);
|
|
|
|
|
|
|
|
spu->sample_point->x = spu->x;
|
|
|
|
spu->sample_point->y = spu->y;
|
|
|
|
gimp_image_sample_point_ref (spu->sample_point);
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_sample_point_added (undo->image, spu->sample_point);
|
|
|
|
gimp_image_update_sample_point (undo->image, spu->sample_point);
|
2005-03-05 00:34:59 +08:00
|
|
|
}
|
2005-04-03 23:48:03 +08:00
|
|
|
else if (spu->x == -1)
|
2005-03-05 00:34:59 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_remove_sample_point (undo->image, spu->sample_point, FALSE);
|
2005-03-05 00:34:59 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_update_sample_point (undo->image, spu->sample_point);
|
2005-04-03 23:48:03 +08:00
|
|
|
spu->sample_point->x = spu->x;
|
|
|
|
spu->sample_point->y = spu->y;
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_update_sample_point (undo->image, spu->sample_point);
|
2005-03-05 00:34:59 +08:00
|
|
|
}
|
|
|
|
|
2005-04-03 23:48:03 +08:00
|
|
|
spu->x = old_x;
|
|
|
|
spu->y = old_y;
|
2005-03-05 00:34:59 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
undo_free_image_sample_point (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
|
|
|
{
|
|
|
|
SamplePointUndo *gu = undo->data;
|
|
|
|
|
|
|
|
gimp_image_sample_point_unref (gu->sample_point);
|
|
|
|
g_free (gu);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-03-18 21:49:02 +08:00
|
|
|
/*******************/
|
|
|
|
/* Colormap Undo */
|
|
|
|
/*******************/
|
|
|
|
|
|
|
|
typedef struct _ColormapUndo ColormapUndo;
|
|
|
|
|
|
|
|
struct _ColormapUndo
|
|
|
|
{
|
2004-02-12 20:13:21 +08:00
|
|
|
gint num_colors;
|
|
|
|
guchar *cmap;
|
2003-03-18 21:49:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static gboolean undo_pop_image_colormap (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_image_colormap (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
|
|
|
|
|
|
|
gboolean
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_image_colormap (GimpImage *image,
|
2003-03-18 21:49:02 +08:00
|
|
|
const gchar *undo_desc)
|
|
|
|
{
|
|
|
|
GimpUndo *new;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2003-03-18 21:49:02 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_UNDO,
|
2003-03-18 21:49:02 +08:00
|
|
|
sizeof (ColormapUndo),
|
|
|
|
sizeof (ColormapUndo),
|
|
|
|
GIMP_UNDO_IMAGE_COLORMAP, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_IMAGE,
|
2003-03-18 21:49:02 +08:00
|
|
|
undo_pop_image_colormap,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_free_image_colormap,
|
|
|
|
NULL)))
|
2003-03-18 21:49:02 +08:00
|
|
|
{
|
2004-02-12 20:13:21 +08:00
|
|
|
ColormapUndo *cu = new->data;
|
2003-03-18 21:49:02 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
cu->num_colors = gimp_image_get_colormap_size (image);
|
|
|
|
cu->cmap = g_memdup (gimp_image_get_colormap (image),
|
2004-02-12 20:13:21 +08:00
|
|
|
cu->num_colors * 3);
|
2003-03-18 21:49:02 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
undo_pop_image_colormap (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
|
|
|
{
|
2004-02-12 20:13:21 +08:00
|
|
|
ColormapUndo *cu = undo->data;
|
|
|
|
guchar *cmap;
|
2003-03-18 21:49:02 +08:00
|
|
|
gint num_colors;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
num_colors = gimp_image_get_colormap_size (undo->image);
|
|
|
|
cmap = g_memdup (gimp_image_get_colormap (undo->image),
|
2004-02-12 20:13:21 +08:00
|
|
|
num_colors * 3);
|
2003-03-18 21:49:02 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_set_colormap (undo->image, cu->cmap, cu->num_colors, FALSE);
|
2003-03-18 21:49:02 +08:00
|
|
|
|
2004-02-12 20:13:21 +08:00
|
|
|
if (cu->cmap)
|
|
|
|
g_free (cu->cmap);
|
|
|
|
|
2003-03-18 21:49:02 +08:00
|
|
|
cu->num_colors = num_colors;
|
2004-02-12 20:13:21 +08:00
|
|
|
cu->cmap = cmap;
|
2003-03-18 21:49:02 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
undo_free_image_colormap (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
|
|
|
{
|
2004-02-12 20:13:21 +08:00
|
|
|
ColormapUndo *cu = undo->data;
|
|
|
|
|
|
|
|
if (cu->cmap)
|
|
|
|
g_free (cu->cmap);
|
|
|
|
|
|
|
|
g_free (cu);
|
2003-03-18 21:49:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-15 22:10:30 +08:00
|
|
|
/*******************/
|
|
|
|
/* Drawable Undo */
|
|
|
|
/*******************/
|
|
|
|
|
|
|
|
typedef struct _DrawableUndo DrawableUndo;
|
|
|
|
|
|
|
|
struct _DrawableUndo
|
|
|
|
{
|
|
|
|
TileManager *tiles;
|
|
|
|
gboolean sparse;
|
|
|
|
gint x, y, width, height;
|
|
|
|
};
|
|
|
|
|
|
|
|
static gboolean undo_pop_drawable (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_drawable (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
|
|
|
|
|
|
|
gboolean
|
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;
|
|
|
|
GimpUndo *new;
|
|
|
|
gint64 size;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2004-03-15 22:10:30 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
|
|
|
g_return_val_if_fail (tiles != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (sparse == TRUE ||
|
|
|
|
tile_manager_width (tiles) == width, FALSE);
|
|
|
|
g_return_val_if_fail (sparse == TRUE ||
|
|
|
|
tile_manager_height (tiles) == height, FALSE);
|
|
|
|
|
|
|
|
item = GIMP_ITEM (drawable);
|
|
|
|
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), FALSE);
|
2004-03-15 22:10:30 +08:00
|
|
|
g_return_val_if_fail (sparse == FALSE ||
|
|
|
|
tile_manager_width (tiles) == gimp_item_width (item),
|
|
|
|
FALSE);
|
|
|
|
g_return_val_if_fail (sparse == FALSE ||
|
|
|
|
tile_manager_height (tiles) == gimp_item_height (item),
|
|
|
|
FALSE);
|
|
|
|
|
2004-09-20 03:47:26 +08:00
|
|
|
size = sizeof (DrawableUndo) + tile_manager_get_memsize (tiles, sparse);
|
2004-03-15 22:10:30 +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 (DrawableUndo),
|
|
|
|
GIMP_UNDO_DRAWABLE, 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,
|
|
|
|
undo_free_drawable,
|
|
|
|
"item", item,
|
|
|
|
NULL)))
|
2004-03-15 22:10:30 +08:00
|
|
|
{
|
|
|
|
DrawableUndo *drawable_undo = new->data;
|
|
|
|
|
|
|
|
drawable_undo->tiles = tile_manager_ref (tiles);
|
|
|
|
drawable_undo->sparse = sparse;
|
|
|
|
drawable_undo->x = x;
|
|
|
|
drawable_undo->y = y;
|
|
|
|
drawable_undo->width = width;
|
|
|
|
drawable_undo->height = height;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
undo_pop_drawable (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
|
|
|
{
|
|
|
|
DrawableUndo *drawable_undo = undo->data;
|
|
|
|
|
2004-09-20 03:47:26 +08:00
|
|
|
undo->size -= tile_manager_get_memsize (drawable_undo->tiles,
|
|
|
|
drawable_undo->sparse);
|
2004-03-17 00:23:06 +08:00
|
|
|
|
2004-03-15 22:10:30 +08:00
|
|
|
gimp_drawable_swap_pixels (GIMP_DRAWABLE (GIMP_ITEM_UNDO (undo)->item),
|
|
|
|
drawable_undo->tiles,
|
|
|
|
drawable_undo->sparse,
|
|
|
|
drawable_undo->x,
|
|
|
|
drawable_undo->y,
|
|
|
|
drawable_undo->width,
|
|
|
|
drawable_undo->height);
|
|
|
|
|
2004-09-20 03:47:26 +08:00
|
|
|
undo->size += tile_manager_get_memsize (drawable_undo->tiles,
|
|
|
|
drawable_undo->sparse);
|
2004-03-17 00:23:06 +08:00
|
|
|
|
2004-03-15 22:10:30 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
undo_free_drawable (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
|
|
|
{
|
|
|
|
DrawableUndo *drawable_undo = undo->data;
|
|
|
|
|
|
|
|
tile_manager_unref (drawable_undo->tiles);
|
|
|
|
g_free (drawable_undo);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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-04-12 20:49:29 +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);
|
|
|
|
|
|
|
|
gboolean
|
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;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2004-03-16 04:58:07 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
|
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;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
typedef struct _MaskUndo MaskUndo;
|
|
|
|
|
|
|
|
struct _MaskUndo
|
|
|
|
{
|
2003-03-19 00:42:45 +08:00
|
|
|
TileManager *tiles; /* the actual mask */
|
|
|
|
gint x, y; /* offsets */
|
2002-08-20 18:22:23 +08:00
|
|
|
};
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
static gboolean undo_pop_mask (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_mask (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
2002-08-20 18:22:23 +08:00
|
|
|
|
|
|
|
gboolean
|
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
|
|
|
{
|
2004-03-17 00:23:06 +08:00
|
|
|
TileManager *undo_tiles = NULL;
|
2002-08-20 18:22:23 +08:00
|
|
|
gint x1, y1, x2, y2;
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
2003-11-17 01:51:36 +08:00
|
|
|
gint64 size;
|
2002-08-20 18:22:23 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2003-02-14 22:14:29 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_CHANNEL (mask), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (mask)), FALSE);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2004-03-17 00:23:06 +08:00
|
|
|
size = sizeof (MaskUndo);
|
|
|
|
|
2002-08-20 18:22:23 +08:00
|
|
|
if (gimp_channel_bounds (mask, &x1, &y1, &x2, &y2))
|
|
|
|
{
|
2004-03-17 00:23:06 +08:00
|
|
|
GimpDrawable *drawable = GIMP_DRAWABLE (mask);
|
|
|
|
PixelRegion srcPR, destPR;
|
2002-08-20 18:22:23 +08:00
|
|
|
|
2004-03-17 00:23:06 +08:00
|
|
|
undo_tiles = tile_manager_new (x2 - x1, y2 - y1,
|
|
|
|
gimp_drawable_bytes (drawable));
|
2002-08-20 18:22:23 +08:00
|
|
|
|
2006-04-07 17:21:18 +08:00
|
|
|
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
|
2004-03-17 00:23:06 +08:00
|
|
|
x1, y1, x2 - x1, y2 - y1, FALSE);
|
2002-08-20 18:22:23 +08:00
|
|
|
pixel_region_init (&destPR, undo_tiles,
|
2004-03-17 00:23:06 +08:00
|
|
|
0, 0, x2 - x1, y2 - y1, TRUE);
|
2002-08-20 18:22:23 +08:00
|
|
|
|
|
|
|
copy_region (&srcPR, &destPR);
|
|
|
|
|
2004-09-20 03:47:26 +08:00
|
|
|
size += tile_manager_get_memsize (undo_tiles, FALSE);
|
2004-03-17 00:23:06 +08:00
|
|
|
}
|
2002-08-20 18:22:23 +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 (MaskUndo),
|
|
|
|
GIMP_UNDO_MASK, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_IS_SELECTION (mask) ?
|
|
|
|
GIMP_DIRTY_SELECTION :
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_pop_mask,
|
|
|
|
undo_free_mask,
|
|
|
|
"item", mask,
|
|
|
|
NULL)))
|
2002-08-20 18:22:23 +08:00
|
|
|
{
|
2004-03-17 00:23:06 +08:00
|
|
|
MaskUndo *mask_undo = new->data;
|
2002-08-20 18:22:23 +08:00
|
|
|
|
2004-03-17 00:23:06 +08:00
|
|
|
mask_undo->tiles = undo_tiles;
|
|
|
|
mask_undo->x = x1;
|
|
|
|
mask_undo->y = y1;
|
2002-08-20 18:22:23 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (undo_tiles)
|
2003-05-27 01:02:06 +08:00
|
|
|
tile_manager_unref (undo_tiles);
|
2002-08-20 18:22:23 +08:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_mask (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
2002-08-20 18:22:23 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
MaskUndo *mu = undo->data;
|
|
|
|
GimpChannel *channel = GIMP_CHANNEL (GIMP_ITEM_UNDO (undo)->item);
|
2002-08-20 18:22:23 +08:00
|
|
|
TileManager *new_tiles;
|
|
|
|
PixelRegion srcPR, destPR;
|
|
|
|
gint x1, y1, x2, y2;
|
2003-03-19 00:42:45 +08:00
|
|
|
gint width = 0;
|
|
|
|
gint height = 0;
|
|
|
|
guchar empty = 0;
|
2002-08-20 18:22:23 +08:00
|
|
|
|
2004-03-17 00:23:06 +08:00
|
|
|
if (mu->tiles)
|
2004-09-20 03:47:26 +08:00
|
|
|
undo->size -= tile_manager_get_memsize (mu->tiles, FALSE);
|
2004-03-17 00:23:06 +08:00
|
|
|
|
2003-03-19 00:42:45 +08:00
|
|
|
if (gimp_channel_bounds (channel, &x1, &y1, &x2, &y2))
|
2002-08-20 18:22:23 +08:00
|
|
|
{
|
|
|
|
new_tiles = tile_manager_new ((x2 - x1), (y2 - y1), 1);
|
|
|
|
|
2003-03-19 00:42:45 +08:00
|
|
|
pixel_region_init (&srcPR, GIMP_DRAWABLE (channel)->tiles,
|
2002-08-20 18:22:23 +08:00
|
|
|
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
|
|
|
pixel_region_init (&destPR, new_tiles,
|
2006-04-12 20:49:29 +08:00
|
|
|
0, 0, (x2 - x1), (y2 - y1), TRUE);
|
2002-08-20 18:22:23 +08:00
|
|
|
|
|
|
|
copy_region (&srcPR, &destPR);
|
|
|
|
|
2003-03-19 00:42:45 +08:00
|
|
|
pixel_region_init (&srcPR, GIMP_DRAWABLE (channel)->tiles,
|
2006-04-12 20:49:29 +08:00
|
|
|
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
2002-08-20 18:22:23 +08:00
|
|
|
|
|
|
|
color_region (&srcPR, &empty);
|
|
|
|
}
|
|
|
|
else
|
2003-03-19 00:42:45 +08:00
|
|
|
{
|
|
|
|
new_tiles = NULL;
|
|
|
|
}
|
2002-08-20 18:22:23 +08:00
|
|
|
|
2003-02-20 20:47:42 +08:00
|
|
|
if (mu->tiles)
|
2002-08-20 18:22:23 +08:00
|
|
|
{
|
2003-02-20 20:47:42 +08:00
|
|
|
width = tile_manager_width (mu->tiles);
|
|
|
|
height = tile_manager_height (mu->tiles);
|
2002-08-20 18:22:23 +08:00
|
|
|
|
2003-02-20 20:47:42 +08:00
|
|
|
pixel_region_init (&srcPR, mu->tiles,
|
2006-04-12 20:49:29 +08:00
|
|
|
0, 0, width, height, FALSE);
|
2003-03-19 00:42:45 +08:00
|
|
|
pixel_region_init (&destPR, GIMP_DRAWABLE (channel)->tiles,
|
2006-04-12 20:49:29 +08:00
|
|
|
mu->x, mu->y, width, height, TRUE);
|
2002-08-20 18:22:23 +08:00
|
|
|
|
|
|
|
copy_region (&srcPR, &destPR);
|
|
|
|
|
2003-05-27 01:02:06 +08:00
|
|
|
tile_manager_unref (mu->tiles);
|
2002-08-20 18:22:23 +08:00
|
|
|
}
|
|
|
|
|
2003-10-06 22:40:12 +08:00
|
|
|
/* invalidate the current bounds and boundary of the mask */
|
|
|
|
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (channel));
|
2002-08-20 18:22:23 +08:00
|
|
|
|
2003-02-20 20:47:42 +08:00
|
|
|
if (mu->tiles)
|
2002-08-20 18:22:23 +08:00
|
|
|
{
|
2003-03-19 00:42:45 +08:00
|
|
|
channel->empty = FALSE;
|
|
|
|
channel->x1 = mu->x;
|
|
|
|
channel->y1 = mu->y;
|
|
|
|
channel->x2 = mu->x + width;
|
|
|
|
channel->y2 = mu->y + height;
|
2002-08-20 18:22:23 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-03-19 00:42:45 +08:00
|
|
|
channel->empty = TRUE;
|
|
|
|
channel->x1 = 0;
|
|
|
|
channel->y1 = 0;
|
2003-05-08 19:52:31 +08:00
|
|
|
channel->x2 = GIMP_ITEM (channel)->width;
|
|
|
|
channel->y2 = GIMP_ITEM (channel)->height;
|
2002-08-20 18:22:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* we know the bounds */
|
2003-03-19 00:42:45 +08:00
|
|
|
channel->bounds_known = TRUE;
|
2002-08-20 18:22:23 +08:00
|
|
|
|
|
|
|
/* set the new mask undo parameters */
|
2003-02-20 20:47:42 +08:00
|
|
|
mu->tiles = new_tiles;
|
|
|
|
mu->x = x1;
|
|
|
|
mu->y = y1;
|
2002-08-20 18:22:23 +08:00
|
|
|
|
2003-10-06 20:17:11 +08:00
|
|
|
gimp_drawable_update (GIMP_DRAWABLE (channel),
|
|
|
|
0, 0,
|
|
|
|
GIMP_ITEM (channel)->width,
|
|
|
|
GIMP_ITEM (channel)->height);
|
2002-08-20 18:22:23 +08:00
|
|
|
|
2004-03-17 00:23:06 +08:00
|
|
|
if (mu->tiles)
|
2004-09-20 03:47:26 +08:00
|
|
|
undo->size += tile_manager_get_memsize (mu->tiles, FALSE);
|
2004-03-17 00:23:06 +08:00
|
|
|
|
2002-08-20 18:22:23 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_free_mask (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
2002-08-20 18:22:23 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
MaskUndo *mu = undo->data;
|
2002-08-20 18:22:23 +08:00
|
|
|
|
2003-02-20 20:47:42 +08:00
|
|
|
if (mu->tiles)
|
2003-05-27 01:02:06 +08:00
|
|
|
tile_manager_unref (mu->tiles);
|
2003-02-13 01:11:34 +08:00
|
|
|
|
2003-02-20 20:47:42 +08:00
|
|
|
g_free (mu);
|
2002-08-20 18:22:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-26 08:04:55 +08:00
|
|
|
/**********************/
|
|
|
|
/* Item Rename Undo */
|
2003-02-13 01:11:34 +08:00
|
|
|
/**********************/
|
2002-02-26 08:04:55 +08:00
|
|
|
|
|
|
|
typedef struct _ItemRenameUndo ItemRenameUndo;
|
|
|
|
|
|
|
|
struct _ItemRenameUndo
|
|
|
|
{
|
2004-03-17 00:23:06 +08:00
|
|
|
gchar *name;
|
2002-02-26 08:04:55 +08:00
|
|
|
};
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
static gboolean undo_pop_item_rename (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_item_rename (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
2002-02-26 08:04:55 +08:00
|
|
|
|
|
|
|
gboolean
|
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
|
|
|
{
|
2003-05-07 19:09:00 +08:00
|
|
|
GimpUndo *new;
|
2003-11-17 01:51:36 +08:00
|
|
|
gint64 size;
|
2003-05-07 19:09:00 +08:00
|
|
|
const gchar *name;
|
2002-02-26 08:04:55 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2003-02-14 22:14:29 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), FALSE);
|
2003-02-14 22:14:29 +08:00
|
|
|
|
2003-05-07 19:09:00 +08:00
|
|
|
name = gimp_object_get_name (GIMP_OBJECT (item));
|
|
|
|
|
|
|
|
size = sizeof (ItemRenameUndo) + strlen (name) + 1;
|
|
|
|
|
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 (ItemRenameUndo),
|
|
|
|
GIMP_UNDO_ITEM_RENAME, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_ITEM_META,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_pop_item_rename,
|
|
|
|
undo_free_item_rename,
|
|
|
|
"item", item,
|
|
|
|
NULL)))
|
2002-02-26 08:04:55 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ItemRenameUndo *iru = new->data;
|
2002-02-26 08:04:55 +08:00
|
|
|
|
2004-03-17 00:23:06 +08:00
|
|
|
iru->name = g_strdup (name);
|
2002-02-26 08:04:55 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_item_rename (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
2002-02-26 08:04:55 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ItemRenameUndo *iru = undo->data;
|
|
|
|
GimpItem *item = GIMP_ITEM_UNDO (undo)->item;
|
2002-02-26 08:04:55 +08:00
|
|
|
gchar *tmp;
|
|
|
|
|
2004-03-17 00:23:06 +08:00
|
|
|
undo->size -= strlen (iru->name);
|
|
|
|
|
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
|
|
|
tmp = g_strdup (gimp_object_get_name (GIMP_OBJECT (item)));
|
2006-04-07 18:51:22 +08:00
|
|
|
gimp_object_take_name (GIMP_OBJECT (item), iru->name);
|
2004-03-17 00:23:06 +08:00
|
|
|
iru->name = tmp;
|
|
|
|
|
|
|
|
undo->size += strlen (iru->name);
|
2002-02-26 08:04:55 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_free_item_rename (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
2002-02-26 08:04:55 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ItemRenameUndo *iru = undo->data;
|
2002-02-26 08:04:55 +08:00
|
|
|
|
2004-03-17 00:23:06 +08:00
|
|
|
g_free (iru->name);
|
2002-02-26 08:04:55 +08:00
|
|
|
g_free (iru);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-05-09 03:11:17 +08:00
|
|
|
/****************************/
|
|
|
|
/* Item displacement Undo */
|
|
|
|
/****************************/
|
|
|
|
|
|
|
|
typedef struct _ItemDisplaceUndo ItemDisplaceUndo;
|
|
|
|
|
|
|
|
struct _ItemDisplaceUndo
|
|
|
|
{
|
|
|
|
gint old_offset_x;
|
|
|
|
gint old_offset_y;
|
|
|
|
};
|
|
|
|
|
|
|
|
static gboolean undo_pop_item_displace (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_item_displace (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
|
|
|
|
|
|
|
gboolean
|
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)
|
|
|
|
{
|
|
|
|
GimpUndo *new;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2003-05-09 03:11:17 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), FALSE);
|
2003-05-09 03:11:17 +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
|
|
|
sizeof (ItemDisplaceUndo),
|
|
|
|
sizeof (ItemDisplaceUndo),
|
|
|
|
GIMP_UNDO_ITEM_DISPLACE, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_IS_DRAWABLE (item) ?
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE :
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_VECTORS,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_pop_item_displace,
|
|
|
|
undo_free_item_displace,
|
|
|
|
"item", item,
|
|
|
|
NULL)))
|
2003-05-09 03:11:17 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ItemDisplaceUndo *idu = new->data;
|
2003-05-09 03:11:17 +08:00
|
|
|
|
|
|
|
gimp_item_offsets (item, &idu->old_offset_x, &idu->old_offset_y);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
undo_pop_item_displace (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ItemDisplaceUndo *idu = undo->data;
|
|
|
|
GimpItem *item = GIMP_ITEM_UNDO (undo)->item;
|
2003-05-09 03:11:17 +08:00
|
|
|
gint offset_x;
|
|
|
|
gint offset_y;
|
|
|
|
|
|
|
|
gimp_item_offsets (item, &offset_x, &offset_y);
|
|
|
|
|
|
|
|
gimp_item_translate (item,
|
|
|
|
idu->old_offset_x - offset_x,
|
|
|
|
idu->old_offset_y - offset_y,
|
2003-07-26 00:12:35 +08:00
|
|
|
FALSE);
|
2003-05-09 03:11:17 +08:00
|
|
|
|
|
|
|
idu->old_offset_x = offset_x;
|
|
|
|
idu->old_offset_y = offset_y;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
undo_free_item_displace (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
g_free (undo->data);
|
2003-05-09 03:11:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-09-12 03:52:29 +08:00
|
|
|
/******************************/
|
|
|
|
/* Item Visibility Undo */
|
|
|
|
/******************************/
|
2003-05-09 04:26:01 +08:00
|
|
|
|
2003-09-12 03:52:29 +08:00
|
|
|
typedef struct _ItemVisibilityUndo ItemVisibilityUndo;
|
2003-05-09 04:26:01 +08:00
|
|
|
|
2003-09-12 03:52:29 +08:00
|
|
|
struct _ItemVisibilityUndo
|
2003-05-09 04:26:01 +08:00
|
|
|
{
|
2003-09-12 03:52:29 +08:00
|
|
|
gboolean old_visible;
|
2003-05-09 04:26:01 +08:00
|
|
|
};
|
|
|
|
|
2003-09-12 03:52:29 +08:00
|
|
|
static gboolean undo_pop_item_visibility (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_item_visibility (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
2003-05-09 04:26:01 +08:00
|
|
|
|
|
|
|
gboolean
|
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
|
|
|
{
|
|
|
|
GimpUndo *new;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2003-05-09 04:26:01 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), FALSE);
|
2003-05-09 04:26:01 +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
|
|
|
sizeof (ItemVisibilityUndo),
|
|
|
|
sizeof (ItemVisibilityUndo),
|
|
|
|
GIMP_UNDO_ITEM_VISIBILITY, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_ITEM_META,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_pop_item_visibility,
|
|
|
|
undo_free_item_visibility,
|
|
|
|
"item", item,
|
|
|
|
NULL)))
|
2003-05-09 04:26:01 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ItemVisibilityUndo *ivu = new->data;
|
2003-05-09 04:26:01 +08:00
|
|
|
|
2003-09-12 03:52:29 +08:00
|
|
|
ivu->old_visible = gimp_item_get_visible (item);
|
2003-05-09 04:26:01 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2003-09-12 03:52:29 +08:00
|
|
|
undo_pop_item_visibility (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
2003-05-09 04:26:01 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ItemVisibilityUndo *ivu = undo->data;
|
|
|
|
GimpItem *item = GIMP_ITEM_UNDO (undo)->item;
|
2003-09-12 03:52:29 +08:00
|
|
|
gboolean visible;
|
2003-05-09 04:26:01 +08:00
|
|
|
|
2003-09-12 03:52:29 +08:00
|
|
|
visible = gimp_item_get_visible (item);
|
|
|
|
gimp_item_set_visible (item, ivu->old_visible, FALSE);
|
|
|
|
ivu->old_visible = visible;
|
2003-05-09 04:26:01 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-09-12 03:52:29 +08:00
|
|
|
undo_free_item_visibility (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
2003-05-09 04:26:01 +08:00
|
|
|
{
|
|
|
|
g_free (undo->data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-09-12 03:52:29 +08:00
|
|
|
/**********************/
|
|
|
|
/* Item linked Undo */
|
|
|
|
/**********************/
|
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
|
|
|
|
2003-09-12 03:52:29 +08:00
|
|
|
typedef struct _ItemLinkedUndo ItemLinkedUndo;
|
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
|
|
|
|
2003-09-12 03:52:29 +08:00
|
|
|
struct _ItemLinkedUndo
|
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
|
|
|
{
|
2003-09-12 03:52:29 +08:00
|
|
|
gboolean old_linked;
|
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
|
|
|
};
|
|
|
|
|
2003-09-12 03:52:29 +08:00
|
|
|
static gboolean undo_pop_item_linked (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_item_linked (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
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
|
|
|
|
|
|
|
gboolean
|
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
|
|
|
{
|
|
|
|
GimpUndo *new;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2003-09-12 03:52:29 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), FALSE);
|
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
|
|
|
|
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
|
|
|
sizeof (ItemLinkedUndo),
|
|
|
|
sizeof (ItemLinkedUndo),
|
|
|
|
GIMP_UNDO_ITEM_LINKED, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_ITEM_META,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_pop_item_linked,
|
|
|
|
undo_free_item_linked,
|
|
|
|
"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
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ItemLinkedUndo *ilu = new->data;
|
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
|
|
|
|
2003-09-12 03:52:29 +08:00
|
|
|
ilu->old_linked = gimp_item_get_linked (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
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2003-09-12 03:52:29 +08:00
|
|
|
undo_pop_item_linked (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
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
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ItemLinkedUndo *ilu = undo->data;
|
|
|
|
GimpItem *item = GIMP_ITEM_UNDO (undo)->item;
|
2003-09-12 03:52:29 +08:00
|
|
|
gboolean linked;
|
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
|
|
|
|
2003-09-12 03:52:29 +08:00
|
|
|
linked = gimp_item_get_linked (item);
|
|
|
|
gimp_item_set_linked (item, ilu->old_linked, FALSE);
|
|
|
|
ilu->old_linked = linked;
|
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
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-09-12 03:52:29 +08:00
|
|
|
undo_free_item_linked (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
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
|
|
|
{
|
2003-03-18 21:49:02 +08:00
|
|
|
g_free (undo->data);
|
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
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
typedef struct _LayerUndo LayerUndo;
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
struct _LayerUndo
|
|
|
|
{
|
|
|
|
gint prev_position; /* former position in list */
|
|
|
|
GimpLayer *prev_layer; /* previous active layer */
|
|
|
|
};
|
2002-02-15 03:31:16 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
static gboolean undo_push_layer (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndoType type,
|
|
|
|
GimpLayer *layer,
|
|
|
|
gint prev_position,
|
|
|
|
GimpLayer *prev_layer);
|
|
|
|
static gboolean undo_pop_layer (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_layer (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
1998-06-06 11:49:01 +08:00
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
gboolean
|
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,
|
|
|
|
gint prev_position,
|
|
|
|
GimpLayer *prev_layer)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
|
|
|
|
g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (layer)), FALSE);
|
|
|
|
g_return_val_if_fail (prev_layer == NULL || GIMP_IS_LAYER (prev_layer),
|
|
|
|
FALSE);
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
return undo_push_layer (image, undo_desc, GIMP_UNDO_LAYER_ADD,
|
2002-02-24 01:29:19 +08:00
|
|
|
layer, prev_position, prev_layer);
|
2001-03-11 21:15:41 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
gboolean
|
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
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), FALSE);
|
|
|
|
g_return_val_if_fail (prev_layer == NULL || GIMP_IS_LAYER (prev_layer),
|
|
|
|
FALSE);
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
return undo_push_layer (image, undo_desc, GIMP_UNDO_LAYER_REMOVE,
|
2002-02-24 01:29:19 +08:00
|
|
|
layer, prev_position, prev_layer);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
static gboolean
|
2006-03-29 01:08:36 +08:00
|
|
|
undo_push_layer (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
2006-04-12 20:49:29 +08:00
|
|
|
GimpUndoType type,
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpLayer *layer,
|
|
|
|
gint prev_position,
|
|
|
|
GimpLayer *prev_layer)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
2003-11-17 01:51:36 +08:00
|
|
|
gint64 size;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-08-25 18:49:33 +08:00
|
|
|
size = sizeof (LayerUndo);
|
|
|
|
|
|
|
|
if (type == GIMP_UNDO_LAYER_REMOVE)
|
|
|
|
size += gimp_object_get_memsize (GIMP_OBJECT (layer), NULL);
|
1997-11-25 06:05:25 +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 (LayerUndo),
|
|
|
|
type, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_pop_layer,
|
|
|
|
undo_free_layer,
|
|
|
|
"item", layer,
|
|
|
|
NULL)))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
LayerUndo *lu = new->data;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
|
|
|
lu->prev_position = prev_position;
|
|
|
|
lu->prev_layer = prev_layer;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
2001-01-29 08:46:04 +08:00
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
return FALSE;
|
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_layer (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
LayerUndo *lu = undo->data;
|
|
|
|
GimpLayer *layer = GIMP_LAYER (GIMP_ITEM_UNDO (undo)->item);
|
2004-01-18 08:36:02 +08:00
|
|
|
gboolean old_has_alpha;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
old_has_alpha = gimp_image_has_alpha (undo->image);
|
2004-01-18 08:36:02 +08:00
|
|
|
|
2003-02-13 19:23:50 +08:00
|
|
|
if ((undo_mode == GIMP_UNDO_MODE_UNDO &&
|
|
|
|
undo->undo_type == GIMP_UNDO_LAYER_ADD) ||
|
|
|
|
(undo_mode == GIMP_UNDO_MODE_REDO &&
|
|
|
|
undo->undo_type == GIMP_UNDO_LAYER_REMOVE))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-02-26 08:04:55 +08:00
|
|
|
/* remove layer */
|
|
|
|
|
2003-08-25 18:49:33 +08:00
|
|
|
undo->size += gimp_object_get_memsize (GIMP_OBJECT (layer), NULL);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* record the current position */
|
2006-03-29 01:08:36 +08:00
|
|
|
lu->prev_position = gimp_image_get_layer_index (undo->image, layer);
|
2002-02-26 08:04:55 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_container_remove (undo->image->layers, GIMP_OBJECT (layer));
|
|
|
|
undo->image->layer_stack = g_slist_remove (undo->image->layer_stack,
|
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
|
|
|
layer);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
|
|
|
if (gimp_layer_is_floating_sel (layer))
|
2006-04-12 20:49:29 +08:00
|
|
|
{
|
2004-12-03 21:39:50 +08:00
|
|
|
/* invalidate the boundary *before* setting the
|
|
|
|
* floating_sel pointer to NULL because the selection's
|
|
|
|
* outline is affected by the floating_sel and won't be
|
|
|
|
* completely cleared otherwise (bug #160247).
|
|
|
|
*/
|
|
|
|
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (layer));
|
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
undo->image->floating_sel = NULL;
|
2001-05-08 09:32:25 +08:00
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
/* activate the underlying drawable */
|
|
|
|
floating_sel_activate_drawable (layer);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_floating_selection_changed (undo->image);
|
2006-04-12 20:49:29 +08:00
|
|
|
}
|
2006-03-29 01:08:36 +08:00
|
|
|
else if (layer == gimp_image_get_active_layer (undo->image))
|
2003-11-13 19:23:01 +08:00
|
|
|
{
|
|
|
|
if (lu->prev_layer)
|
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_set_active_layer (undo->image, lu->prev_layer);
|
2003-11-13 19:23:01 +08:00
|
|
|
}
|
2006-03-29 01:08:36 +08:00
|
|
|
else if (undo->image->layer_stack)
|
2003-11-13 19:23:01 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_set_active_layer (undo->image,
|
|
|
|
undo->image->layer_stack->data);
|
2003-11-13 19:23:01 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_set_active_layer (undo->image, NULL);
|
2003-11-13 19:23:01 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_item_removed (GIMP_ITEM (layer));
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-02-26 08:04:55 +08:00
|
|
|
/* restore layer */
|
|
|
|
|
2003-08-25 18:49:33 +08:00
|
|
|
undo->size -= gimp_object_get_memsize (GIMP_OBJECT (layer), NULL);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* record the active layer */
|
2006-03-29 01:08:36 +08:00
|
|
|
lu->prev_layer = gimp_image_get_active_layer (undo->image);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* if this is a floating selection, set the fs pointer */
|
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
|
|
|
if (gimp_layer_is_floating_sel (layer))
|
2006-04-12 20:49:29 +08:00
|
|
|
undo->image->floating_sel = layer;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_container_insert (undo->image->layers,
|
2006-04-12 20:49:29 +08:00
|
|
|
GIMP_OBJECT (layer), lu->prev_position);
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_set_active_layer (undo->image, layer);
|
1998-09-27 04:07:46 +08:00
|
|
|
|
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
|
|
|
if (gimp_layer_is_floating_sel (layer))
|
2006-04-12 20:49:29 +08:00
|
|
|
gimp_image_floating_selection_changed (undo->image);
|
2004-03-28 22:20:57 +08:00
|
|
|
|
|
|
|
GIMP_ITEM (layer)->removed = FALSE;
|
2004-03-28 22:25:42 +08:00
|
|
|
|
|
|
|
if (layer->mask)
|
|
|
|
GIMP_ITEM (layer->mask)->removed = FALSE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if (old_has_alpha != gimp_image_has_alpha (undo->image))
|
2004-01-18 08:36:02 +08:00
|
|
|
accum->alpha_changed = TRUE;
|
|
|
|
|
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_layer (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-03-18 21:49:02 +08:00
|
|
|
g_free (undo->data);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
/***************************/
|
|
|
|
/* Layer re-position Undo */
|
2003-02-13 01:11:34 +08:00
|
|
|
/***************************/
|
2002-02-24 01:29:19 +08:00
|
|
|
|
|
|
|
typedef struct _LayerRepositionUndo LayerRepositionUndo;
|
|
|
|
|
|
|
|
struct _LayerRepositionUndo
|
|
|
|
{
|
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
|
|
|
gint old_position;
|
2002-02-24 01:29:19 +08:00
|
|
|
};
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
static gboolean undo_pop_layer_reposition (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_layer_reposition (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
2002-02-24 01:29:19 +08:00
|
|
|
|
|
|
|
gboolean
|
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
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2003-02-14 22:14:29 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), FALSE);
|
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
|
|
|
sizeof (LayerRepositionUndo),
|
|
|
|
sizeof (LayerRepositionUndo),
|
|
|
|
GIMP_UNDO_LAYER_REPOSITION, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_pop_layer_reposition,
|
|
|
|
undo_free_layer_reposition,
|
|
|
|
"item", layer,
|
|
|
|
NULL)))
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
LayerRepositionUndo *lru = new->data;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
lru->old_position = gimp_image_get_layer_index (image, layer);
|
2002-02-24 01:29:19 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_layer_reposition (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
LayerRepositionUndo *lru = undo->data;
|
|
|
|
GimpLayer *layer = GIMP_LAYER (GIMP_ITEM_UNDO (undo)->item);
|
2002-02-24 01:29:19 +08:00
|
|
|
gint pos;
|
|
|
|
|
|
|
|
/* what's the layer's current index? */
|
2006-03-29 01:08:36 +08:00
|
|
|
pos = gimp_image_get_layer_index (undo->image, layer);
|
|
|
|
gimp_image_position_layer (undo->image, layer, lru->old_position,
|
2003-02-17 21:33:29 +08:00
|
|
|
FALSE, NULL);
|
2003-02-13 01:11:34 +08:00
|
|
|
lru->old_position = pos;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_free_layer_reposition (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
g_free (undo->data);
|
2002-02-24 01:29:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
|
|
|
/***************************/
|
|
|
|
/* Layer properties Undo */
|
|
|
|
/***************************/
|
|
|
|
|
|
|
|
typedef struct _LayerPropertiesUndo LayerPropertiesUndo;
|
|
|
|
|
|
|
|
struct _LayerPropertiesUndo
|
|
|
|
{
|
|
|
|
GimpLayerModeEffects old_mode;
|
|
|
|
gdouble old_opacity;
|
2005-07-11 05:17:22 +08:00
|
|
|
gboolean old_lock_alpha;
|
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
|
|
|
};
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
static gboolean undo_push_layer_properties (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
|
|
|
GimpUndoType undo_type,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer);
|
|
|
|
static gboolean undo_pop_layer_properties (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_layer_properties (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
|
|
|
|
|
|
|
gboolean
|
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)
|
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
return undo_push_layer_properties (image, GIMP_UNDO_LAYER_MODE,
|
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
|
|
|
undo_desc, layer);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
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)
|
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
return undo_push_layer_properties (image, GIMP_UNDO_LAYER_OPACITY,
|
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
|
|
|
undo_desc, layer);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_undo_push_layer_lock_alpha (GimpImage *image,
|
2005-07-11 05:17:22 +08:00
|
|
|
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
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
return undo_push_layer_properties (image, GIMP_UNDO_LAYER_LOCK_ALPHA,
|
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
|
|
|
undo_desc, layer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2006-03-29 01:08:36 +08:00
|
|
|
undo_push_layer_properties (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
|
|
|
GimpUndoType undo_type,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer)
|
|
|
|
{
|
|
|
|
GimpUndo *new;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
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
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), FALSE);
|
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
|
|
|
|
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
|
|
|
sizeof (LayerPropertiesUndo),
|
|
|
|
sizeof (LayerPropertiesUndo),
|
|
|
|
undo_type, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_ITEM_META,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_pop_layer_properties,
|
|
|
|
undo_free_layer_properties,
|
|
|
|
"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
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
LayerPropertiesUndo *lpu = new->data;
|
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
|
|
|
|
2005-07-11 05:17:22 +08:00
|
|
|
lpu->old_mode = gimp_layer_get_mode (layer);
|
|
|
|
lpu->old_opacity = gimp_layer_get_opacity (layer);
|
|
|
|
lpu->old_lock_alpha = gimp_layer_get_lock_alpha (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
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
undo_pop_layer_properties (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
LayerPropertiesUndo *lpu = undo->data;
|
|
|
|
GimpLayer *layer = GIMP_LAYER (GIMP_ITEM_UNDO (undo)->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
|
|
|
|
2005-03-25 06:15:10 +08:00
|
|
|
switch (undo->undo_type)
|
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
|
|
|
{
|
2005-03-25 06:15:10 +08:00
|
|
|
case GIMP_UNDO_LAYER_MODE:
|
|
|
|
{
|
|
|
|
GimpLayerModeEffects mode;
|
|
|
|
|
|
|
|
mode = gimp_layer_get_mode (layer);
|
|
|
|
gimp_layer_set_mode (layer, lpu->old_mode, FALSE);
|
|
|
|
lpu->old_mode = mode;
|
|
|
|
}
|
|
|
|
break;
|
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
|
|
|
|
2005-03-25 06:15:10 +08:00
|
|
|
case GIMP_UNDO_LAYER_OPACITY:
|
|
|
|
{
|
|
|
|
gdouble opacity;
|
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
|
|
|
|
2005-03-25 06:15:10 +08:00
|
|
|
opacity = gimp_layer_get_opacity (layer);
|
|
|
|
gimp_layer_set_opacity (layer, lpu->old_opacity, FALSE);
|
|
|
|
lpu->old_opacity = opacity;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2005-07-11 05:17:22 +08:00
|
|
|
case GIMP_UNDO_LAYER_LOCK_ALPHA:
|
2005-03-25 06:15:10 +08:00
|
|
|
{
|
2005-07-11 05:17:22 +08:00
|
|
|
gboolean lock_alpha;
|
2005-03-25 06:15:10 +08:00
|
|
|
|
2005-07-11 05:17:22 +08:00
|
|
|
lock_alpha = gimp_layer_get_lock_alpha (layer);
|
|
|
|
gimp_layer_set_lock_alpha (layer, lpu->old_lock_alpha, FALSE);
|
|
|
|
lpu->old_lock_alpha = lock_alpha;
|
2005-03-25 06:15:10 +08:00
|
|
|
}
|
|
|
|
break;
|
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
|
|
|
|
2005-03-25 06:15:10 +08:00
|
|
|
default:
|
|
|
|
g_return_val_if_reached (FALSE);
|
|
|
|
break;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
undo_free_layer_properties (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
|
|
|
{
|
2003-03-18 21:49:02 +08:00
|
|
|
g_free (undo->data);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-01-05 08:28:12 +08:00
|
|
|
/*********************/
|
|
|
|
/* Text Layer Undo */
|
|
|
|
/*********************/
|
|
|
|
|
|
|
|
gboolean
|
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
|
|
|
{
|
2004-07-13 00:59:36 +08:00
|
|
|
GimpUndo *new;
|
2004-01-05 08:28:12 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2004-04-01 22:51:58 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_TEXT_LAYER (layer), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), FALSE);
|
2004-01-05 08:28:12 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_TEXT_UNDO,
|
2004-07-13 00:59:36 +08:00
|
|
|
0, 0,
|
|
|
|
GIMP_UNDO_TEXT_LAYER, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
2004-07-13 00:59:36 +08:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
"item", layer,
|
|
|
|
"param", pspec,
|
|
|
|
NULL)))
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
2004-03-21 01:21:48 +08:00
|
|
|
|
2004-07-13 00:59:36 +08:00
|
|
|
return FALSE;
|
2004-01-05 08:28:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-04-01 22:51:58 +08:00
|
|
|
/******************************/
|
|
|
|
/* Text Layer Modified Undo */
|
|
|
|
/******************************/
|
|
|
|
|
|
|
|
typedef struct _TextLayerModifiedUndo TextLayerModifiedUndo;
|
|
|
|
|
|
|
|
struct _TextLayerModifiedUndo
|
|
|
|
{
|
|
|
|
gboolean old_modified;
|
|
|
|
};
|
|
|
|
|
|
|
|
static gboolean undo_pop_text_layer_modified (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_text_layer_modified (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
|
|
|
|
|
|
|
gboolean
|
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)
|
|
|
|
{
|
|
|
|
GimpUndo *new;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2004-04-01 22:51:58 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_TEXT_LAYER (layer), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), FALSE);
|
2004-04-01 22:51: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
|
|
|
sizeof (TextLayerModifiedUndo),
|
|
|
|
sizeof (TextLayerModifiedUndo),
|
|
|
|
GIMP_UNDO_TEXT_LAYER_MODIFIED, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_ITEM_META,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_pop_text_layer_modified,
|
|
|
|
undo_free_text_layer_modified,
|
|
|
|
"item", layer,
|
|
|
|
NULL)))
|
2004-04-01 22:51:58 +08:00
|
|
|
{
|
|
|
|
TextLayerModifiedUndo *modified_undo = new->data;
|
|
|
|
|
|
|
|
modified_undo->old_modified = layer->modified;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
undo_pop_text_layer_modified (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
|
|
|
{
|
|
|
|
TextLayerModifiedUndo *modified_undo = undo->data;
|
|
|
|
GimpTextLayer *layer;
|
|
|
|
gboolean modified;
|
|
|
|
|
|
|
|
layer = GIMP_TEXT_LAYER (GIMP_ITEM_UNDO (undo)->item);
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
g_print ("setting layer->modified from %s to %s\n",
|
|
|
|
layer->modified ? "TRUE" : "FALSE",
|
|
|
|
modified_undo->old_modified ? "TRUE" : "FALSE");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
modified = layer->modified;
|
|
|
|
g_object_set (layer, "modified", modified_undo->old_modified, NULL);
|
|
|
|
modified_undo->old_modified = modified;
|
|
|
|
|
|
|
|
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (layer));
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
undo_free_text_layer_modified (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
|
|
|
{
|
|
|
|
g_free (undo->data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-03-25 06:15:10 +08:00
|
|
|
/********************************/
|
|
|
|
/* Layer Mask Add/Remove Undo */
|
|
|
|
/********************************/
|
|
|
|
|
|
|
|
typedef struct _LayerMaskUndo LayerMaskUndo;
|
|
|
|
|
|
|
|
struct _LayerMaskUndo
|
|
|
|
{
|
|
|
|
GimpLayerMask *mask;
|
|
|
|
};
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
static gboolean undo_push_layer_mask (GimpImage *image,
|
2005-03-25 06:15:10 +08:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpUndoType type,
|
|
|
|
GimpLayer *layer,
|
|
|
|
GimpLayerMask *mask);
|
|
|
|
static gboolean undo_pop_layer_mask (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_layer_mask (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
|
|
|
|
|
|
|
gboolean
|
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)
|
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2005-03-25 06:15:10 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), FALSE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER_MASK (mask), FALSE);
|
|
|
|
g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (mask)), FALSE);
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
return undo_push_layer_mask (image, undo_desc, GIMP_UNDO_LAYER_MASK_ADD,
|
2005-03-25 06:15:10 +08:00
|
|
|
layer, mask);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
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)
|
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2005-03-25 06:15:10 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), FALSE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER_MASK (mask), FALSE);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (mask)), FALSE);
|
|
|
|
g_return_val_if_fail (mask->layer == layer, FALSE);
|
|
|
|
g_return_val_if_fail (layer->mask == mask, FALSE);
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
return undo_push_layer_mask (image, undo_desc, GIMP_UNDO_LAYER_MASK_REMOVE,
|
2005-03-25 06:15:10 +08:00
|
|
|
layer, mask);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2006-03-29 01:08:36 +08:00
|
|
|
undo_push_layer_mask (GimpImage *image,
|
2005-03-25 06:15:10 +08:00
|
|
|
const gchar *undo_desc,
|
2006-04-12 20:49:29 +08:00
|
|
|
GimpUndoType type,
|
2005-03-25 06:15:10 +08:00
|
|
|
GimpLayer *layer,
|
|
|
|
GimpLayerMask *mask)
|
|
|
|
{
|
|
|
|
GimpUndo *new;
|
|
|
|
gint64 size;
|
|
|
|
|
|
|
|
size = sizeof (LayerMaskUndo);
|
|
|
|
|
|
|
|
if (type == GIMP_UNDO_LAYER_MASK_REMOVE)
|
|
|
|
size += gimp_object_get_memsize (GIMP_OBJECT (mask), NULL);
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_ITEM_UNDO,
|
2005-03-25 06:15:10 +08:00
|
|
|
size, sizeof (LayerMaskUndo),
|
|
|
|
type, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
undo_pop_layer_mask,
|
|
|
|
undo_free_layer_mask,
|
|
|
|
"item", layer,
|
|
|
|
NULL)))
|
|
|
|
{
|
|
|
|
LayerMaskUndo *lmu = new->data;
|
|
|
|
|
|
|
|
lmu->mask = g_object_ref (mask);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
undo_pop_layer_mask (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
|
|
|
{
|
|
|
|
LayerMaskUndo *lmu = undo->data;
|
|
|
|
GimpLayer *layer = GIMP_LAYER (GIMP_ITEM_UNDO (undo)->item);
|
|
|
|
|
|
|
|
if ((undo_mode == GIMP_UNDO_MODE_UNDO &&
|
|
|
|
undo->undo_type == GIMP_UNDO_LAYER_MASK_ADD) ||
|
|
|
|
(undo_mode == GIMP_UNDO_MODE_REDO &&
|
|
|
|
undo->undo_type == GIMP_UNDO_LAYER_MASK_REMOVE))
|
|
|
|
{
|
|
|
|
/* remove layer mask */
|
|
|
|
|
|
|
|
undo->size += gimp_object_get_memsize (GIMP_OBJECT (lmu->mask), NULL);
|
|
|
|
|
|
|
|
gimp_layer_apply_mask (layer, GIMP_MASK_DISCARD, FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* restore layer */
|
|
|
|
|
|
|
|
undo->size -= gimp_object_get_memsize (GIMP_OBJECT (lmu->mask), NULL);
|
|
|
|
|
|
|
|
gimp_layer_add_mask (layer, lmu->mask, FALSE);
|
|
|
|
|
|
|
|
GIMP_ITEM (lmu->mask)->removed = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
undo_free_layer_mask (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
|
|
|
{
|
|
|
|
LayerMaskUndo *lmu = undo->data;
|
|
|
|
|
|
|
|
g_object_unref (lmu->mask);
|
|
|
|
g_free (lmu);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************/
|
|
|
|
/* Layer Mask Property Undo */
|
|
|
|
/******************************/
|
|
|
|
|
|
|
|
typedef struct _LayerMaskPropertyUndo LayerMaskPropertyUndo;
|
|
|
|
|
|
|
|
struct _LayerMaskPropertyUndo
|
|
|
|
{
|
|
|
|
gboolean old_apply;
|
|
|
|
gboolean old_show;
|
|
|
|
};
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
static gboolean undo_push_layer_mask_properties (GimpImage *image,
|
2005-03-25 06:15:10 +08:00
|
|
|
GimpUndoType undo_type,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayerMask *mask);
|
|
|
|
static gboolean undo_pop_layer_mask_properties (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_layer_mask_properties (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
|
|
|
|
|
|
|
gboolean
|
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)
|
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
return undo_push_layer_mask_properties (image, GIMP_UNDO_LAYER_MASK_APPLY,
|
2005-03-25 06:15:10 +08:00
|
|
|
undo_desc, mask);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
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)
|
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
return undo_push_layer_mask_properties (image, GIMP_UNDO_LAYER_MASK_SHOW,
|
2005-03-25 06:15:10 +08:00
|
|
|
undo_desc, mask);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2006-03-29 01:08:36 +08:00
|
|
|
undo_push_layer_mask_properties (GimpImage *image,
|
2005-03-25 06:15:10 +08:00
|
|
|
GimpUndoType undo_type,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayerMask *mask)
|
|
|
|
{
|
|
|
|
GimpUndo *new;
|
|
|
|
gint64 size;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2005-03-25 06:15:10 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER_MASK (mask), FALSE);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (mask)), FALSE);
|
|
|
|
|
|
|
|
size = sizeof (LayerMaskPropertyUndo);
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_ITEM_UNDO,
|
2005-03-25 06:15:10 +08:00
|
|
|
size, sizeof (LayerMaskPropertyUndo),
|
|
|
|
undo_type, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
undo_pop_layer_mask_properties,
|
|
|
|
undo_free_layer_mask_properties,
|
|
|
|
"item", mask,
|
|
|
|
NULL)))
|
|
|
|
{
|
|
|
|
LayerMaskPropertyUndo *lmp_undo = new->data;
|
|
|
|
|
|
|
|
lmp_undo->old_apply = gimp_layer_mask_get_apply (mask);
|
|
|
|
lmp_undo->old_show = gimp_layer_mask_get_show (mask);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
undo_pop_layer_mask_properties (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
|
|
|
{
|
|
|
|
LayerMaskPropertyUndo *lmp_undo = undo->data;
|
|
|
|
GimpLayerMask *mask;
|
|
|
|
gboolean val;
|
|
|
|
|
|
|
|
mask = GIMP_LAYER_MASK (GIMP_ITEM_UNDO (undo)->item);
|
|
|
|
|
|
|
|
switch (undo->undo_type)
|
|
|
|
{
|
|
|
|
case GIMP_UNDO_LAYER_MASK_APPLY:
|
|
|
|
val = gimp_layer_mask_get_apply (mask);
|
|
|
|
gimp_layer_mask_set_apply (mask, lmp_undo->old_apply, FALSE);
|
|
|
|
lmp_undo->old_apply = val;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_UNDO_LAYER_MASK_SHOW:
|
|
|
|
val = gimp_layer_mask_get_show (mask);
|
|
|
|
gimp_layer_mask_set_show (mask, lmp_undo->old_show, FALSE);
|
|
|
|
lmp_undo->old_show = val;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_return_val_if_reached (FALSE);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
undo_free_layer_mask_properties (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
|
|
|
{
|
|
|
|
g_free (undo->data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
typedef struct _ChannelUndo ChannelUndo;
|
|
|
|
|
|
|
|
struct _ChannelUndo
|
|
|
|
{
|
|
|
|
gint prev_position; /* former position in list */
|
|
|
|
GimpChannel *prev_channel; /* previous active channel */
|
|
|
|
};
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
static gboolean undo_push_channel (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndoType type,
|
|
|
|
GimpChannel *channel,
|
|
|
|
gint prev_position,
|
|
|
|
GimpChannel *prev_channel);
|
|
|
|
static gboolean undo_pop_channel (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_channel (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
2002-02-24 01:29:19 +08:00
|
|
|
|
|
|
|
gboolean
|
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,
|
|
|
|
gint prev_position,
|
|
|
|
GimpChannel *prev_channel)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
|
|
|
|
g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (channel)), FALSE);
|
|
|
|
g_return_val_if_fail (prev_channel == NULL || GIMP_IS_CHANNEL (prev_channel),
|
|
|
|
FALSE);
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
return undo_push_channel (image, undo_desc, GIMP_UNDO_CHANNEL_ADD,
|
2002-02-24 01:29:19 +08:00
|
|
|
channel, prev_position, prev_channel);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
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
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)), FALSE);
|
|
|
|
g_return_val_if_fail (prev_channel == NULL || GIMP_IS_CHANNEL (prev_channel),
|
|
|
|
FALSE);
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
return undo_push_channel (image, undo_desc, GIMP_UNDO_CHANNEL_REMOVE,
|
2002-02-24 01:29:19 +08:00
|
|
|
channel, prev_position, prev_channel);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2006-03-29 01:08:36 +08:00
|
|
|
undo_push_channel (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
2006-04-12 20:49:29 +08:00
|
|
|
GimpUndoType type,
|
2003-02-14 22:14:29 +08:00
|
|
|
GimpChannel *channel,
|
|
|
|
gint prev_position,
|
|
|
|
GimpChannel *prev_channel)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
2003-11-17 01:51:36 +08:00
|
|
|
gint64 size;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-08-25 18:49:33 +08:00
|
|
|
size = sizeof (ChannelUndo);
|
|
|
|
|
|
|
|
if (type == GIMP_UNDO_CHANNEL_REMOVE)
|
|
|
|
size += gimp_object_get_memsize (GIMP_OBJECT (channel), NULL);
|
1997-11-25 06:05:25 +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 (ChannelUndo),
|
|
|
|
type, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_pop_channel,
|
|
|
|
undo_free_channel,
|
|
|
|
"item", channel,
|
|
|
|
NULL)))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ChannelUndo *cu = new->data;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
|
|
|
cu->prev_position = prev_position;
|
|
|
|
cu->prev_channel = prev_channel;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
2001-02-19 21:06:09 +08:00
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
return FALSE;
|
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_channel (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ChannelUndo *cu = undo->data;
|
|
|
|
GimpChannel *channel = GIMP_CHANNEL (GIMP_ITEM_UNDO (undo)->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
|
|
|
|
2003-02-13 19:23:50 +08:00
|
|
|
if ((undo_mode == GIMP_UNDO_MODE_UNDO &&
|
|
|
|
undo->undo_type == GIMP_UNDO_CHANNEL_ADD) ||
|
|
|
|
(undo_mode == GIMP_UNDO_MODE_REDO &&
|
|
|
|
undo->undo_type == GIMP_UNDO_CHANNEL_REMOVE))
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-02-26 08:04:55 +08:00
|
|
|
/* remove channel */
|
|
|
|
|
2003-08-25 18:49:33 +08:00
|
|
|
undo->size += gimp_object_get_memsize (GIMP_OBJECT (channel), NULL);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* record the current position */
|
2006-03-29 01:08:36 +08:00
|
|
|
cu->prev_position = gimp_image_get_channel_index (undo->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
|
|
|
channel);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_container_remove (undo->image->channels, GIMP_OBJECT (channel));
|
2003-03-25 11:29:11 +08:00
|
|
|
gimp_item_removed (GIMP_ITEM (channel));
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if (channel == gimp_image_get_active_channel (undo->image))
|
2003-03-25 11:29:11 +08:00
|
|
|
{
|
|
|
|
if (cu->prev_channel)
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_set_active_channel (undo->image, cu->prev_channel);
|
2003-03-25 11:29:11 +08:00
|
|
|
else
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_unset_active_channel (undo->image);
|
2003-03-25 11:29:11 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-02-26 08:04:55 +08:00
|
|
|
/* restore channel */
|
|
|
|
|
2003-08-25 18:49:33 +08:00
|
|
|
undo->size -= gimp_object_get_memsize (GIMP_OBJECT (channel), NULL);
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
/* record the active channel */
|
2006-03-29 01:08:36 +08:00
|
|
|
cu->prev_channel = gimp_image_get_active_channel (undo->image);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_container_insert (undo->image->channels,
|
2006-04-12 20:49:29 +08:00
|
|
|
GIMP_OBJECT (channel), cu->prev_position);
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_set_active_channel (undo->image, channel);
|
2004-03-28 22:20:57 +08:00
|
|
|
|
|
|
|
GIMP_ITEM (channel)->removed = FALSE;
|
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_channel (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2003-03-18 21:49:02 +08:00
|
|
|
g_free (undo->data);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
/******************************/
|
|
|
|
/* Channel re-position Undo */
|
2003-02-13 01:11:34 +08:00
|
|
|
/******************************/
|
2002-02-24 01:29:19 +08:00
|
|
|
|
|
|
|
typedef struct _ChannelRepositionUndo ChannelRepositionUndo;
|
|
|
|
|
|
|
|
struct _ChannelRepositionUndo
|
|
|
|
{
|
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
|
|
|
gint old_position;
|
2002-02-24 01:29:19 +08:00
|
|
|
};
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
static gboolean undo_pop_channel_reposition (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_channel_reposition (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
2002-02-24 01:29:19 +08:00
|
|
|
|
|
|
|
gboolean
|
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
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2003-02-14 22:14:29 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)), FALSE);
|
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
|
|
|
sizeof (ChannelRepositionUndo),
|
|
|
|
sizeof (ChannelRepositionUndo),
|
|
|
|
GIMP_UNDO_CHANNEL_REPOSITION, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_pop_channel_reposition,
|
|
|
|
undo_free_channel_reposition,
|
|
|
|
"item", channel,
|
|
|
|
NULL)))
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ChannelRepositionUndo *cru = new->data;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
cru->old_position = gimp_image_get_channel_index (image, channel);
|
2002-02-24 01:29:19 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_channel_reposition (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ChannelRepositionUndo *cru = undo->data;
|
|
|
|
GimpChannel *channel = GIMP_CHANNEL (GIMP_ITEM_UNDO (undo)->item);
|
2002-02-24 01:29:19 +08:00
|
|
|
gint pos;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
pos = gimp_image_get_channel_index (undo->image, channel);
|
|
|
|
gimp_image_position_channel (undo->image, channel, cru->old_position,
|
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
|
|
|
FALSE, NULL);
|
2002-02-25 05:00:58 +08:00
|
|
|
cru->old_position = pos;
|
2002-02-24 01:29:19 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_free_channel_reposition (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
2002-02-24 01:29:19 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
g_free (undo->data);
|
2002-02-25 05:00:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-03-17 10:25:39 +08:00
|
|
|
/************************/
|
|
|
|
/* Channel color Undo */
|
|
|
|
/************************/
|
|
|
|
|
|
|
|
typedef struct _ChannelColorUndo ChannelColorUndo;
|
|
|
|
|
|
|
|
struct _ChannelColorUndo
|
|
|
|
{
|
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
|
|
|
GimpRGB old_color;
|
2003-03-17 10:25:39 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static gboolean undo_pop_channel_color (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_channel_color (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
|
|
|
|
|
|
|
gboolean
|
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)
|
|
|
|
{
|
|
|
|
GimpUndo *new;
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2003-03-17 10:25:39 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)), FALSE);
|
2003-03-17 10:25:39 +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
|
|
|
sizeof (ChannelColorUndo),
|
|
|
|
sizeof (ChannelColorUndo),
|
|
|
|
GIMP_UNDO_CHANNEL_COLOR, 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_channel_color,
|
|
|
|
undo_free_channel_color,
|
|
|
|
"item", channel,
|
|
|
|
NULL)))
|
2003-03-17 10:25:39 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ChannelColorUndo *ccu = new->data;
|
2003-03-17 10:25:39 +08:00
|
|
|
|
|
|
|
gimp_channel_get_color (channel , &ccu->old_color);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
undo_pop_channel_color (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
ChannelColorUndo *ccu = undo->data;
|
|
|
|
GimpChannel *channel = GIMP_CHANNEL (GIMP_ITEM_UNDO (undo)->item);
|
2003-03-17 10:25:39 +08:00
|
|
|
GimpRGB color;
|
|
|
|
|
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_channel_get_color (channel, &color);
|
|
|
|
gimp_channel_set_color (channel, &ccu->old_color, FALSE);
|
2003-03-17 10:25:39 +08:00
|
|
|
ccu->old_color = color;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
undo_free_channel_color (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
|
|
|
{
|
|
|
|
g_free (undo->data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
typedef struct _VectorsUndo VectorsUndo;
|
|
|
|
|
|
|
|
struct _VectorsUndo
|
|
|
|
{
|
|
|
|
gint prev_position; /* former position in list */
|
|
|
|
GimpVectors *prev_vectors; /* previous active vectors */
|
|
|
|
};
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
static gboolean undo_push_vectors (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndoType type,
|
|
|
|
GimpVectors *vectors,
|
|
|
|
gint prev_position,
|
|
|
|
GimpVectors *prev_vectors);
|
|
|
|
static gboolean undo_pop_vectors (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_vectors (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
2002-02-25 05:00:58 +08:00
|
|
|
|
|
|
|
gboolean
|
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,
|
|
|
|
gint prev_position,
|
|
|
|
GimpVectors *prev_vectors)
|
2002-02-25 05:00:58 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
|
|
|
|
g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (vectors)), FALSE);
|
|
|
|
g_return_val_if_fail (prev_vectors == NULL || GIMP_IS_VECTORS (prev_vectors),
|
|
|
|
FALSE);
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
return undo_push_vectors (image, undo_desc, GIMP_UNDO_VECTORS_ADD,
|
2002-02-25 05:00:58 +08:00
|
|
|
vectors, prev_position, prev_vectors);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
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
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (vectors)), FALSE);
|
|
|
|
g_return_val_if_fail (prev_vectors == NULL || GIMP_IS_VECTORS (prev_vectors),
|
|
|
|
FALSE);
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
return undo_push_vectors (image, undo_desc, GIMP_UNDO_VECTORS_REMOVE,
|
2002-02-25 05:00:58 +08:00
|
|
|
vectors, prev_position, prev_vectors);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2006-03-29 01:08:36 +08:00
|
|
|
undo_push_vectors (GimpImage *image,
|
2003-02-14 22:14:29 +08:00
|
|
|
const gchar *undo_desc,
|
2006-04-12 20:49:29 +08:00
|
|
|
GimpUndoType type,
|
2003-02-14 22:14:29 +08:00
|
|
|
GimpVectors *vectors,
|
|
|
|
gint prev_position,
|
|
|
|
GimpVectors *prev_vectors)
|
2002-02-25 05:00:58 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
2003-11-17 01:51:36 +08:00
|
|
|
gint64 size;
|
2002-02-25 05:00:58 +08:00
|
|
|
|
2003-08-25 18:49:33 +08:00
|
|
|
size = sizeof (VectorsUndo);
|
|
|
|
|
|
|
|
if (type == GIMP_UNDO_VECTORS_REMOVE)
|
|
|
|
size += gimp_object_get_memsize (GIMP_OBJECT (vectors), 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 (VectorsUndo),
|
|
|
|
type, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_pop_vectors,
|
|
|
|
undo_free_vectors,
|
|
|
|
"item", vectors,
|
|
|
|
NULL)))
|
2002-02-25 05:00:58 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
VectorsUndo *vu = new->data;
|
2002-02-25 05:00:58 +08:00
|
|
|
|
|
|
|
vu->prev_position = prev_position;
|
|
|
|
vu->prev_vectors = prev_vectors;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_vectors (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
2002-02-25 05:00:58 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
VectorsUndo *vu = undo->data;
|
|
|
|
GimpVectors *vectors = GIMP_VECTORS (GIMP_ITEM_UNDO (undo)->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
|
|
|
|
2003-02-13 19:23:50 +08:00
|
|
|
if ((undo_mode == GIMP_UNDO_MODE_UNDO &&
|
|
|
|
undo->undo_type == GIMP_UNDO_VECTORS_ADD) ||
|
|
|
|
(undo_mode == GIMP_UNDO_MODE_REDO &&
|
|
|
|
undo->undo_type == GIMP_UNDO_VECTORS_REMOVE))
|
2002-02-25 05:00:58 +08:00
|
|
|
{
|
|
|
|
/* remove vectors */
|
|
|
|
|
2003-08-25 18:49:33 +08:00
|
|
|
undo->size += gimp_object_get_memsize (GIMP_OBJECT (vectors), NULL);
|
|
|
|
|
2002-02-25 05:00:58 +08:00
|
|
|
/* record the current position */
|
2006-03-29 01:08:36 +08:00
|
|
|
vu->prev_position = gimp_image_get_vectors_index (undo->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
|
|
|
vectors);
|
2002-02-25 05:00:58 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_container_remove (undo->image->vectors, GIMP_OBJECT (vectors));
|
2003-03-25 11:29:11 +08:00
|
|
|
gimp_item_removed (GIMP_ITEM (vectors));
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
if (vectors == gimp_image_get_active_vectors (undo->image))
|
|
|
|
gimp_image_set_active_vectors (undo->image, vu->prev_vectors);
|
2002-02-25 05:00:58 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* restore vectors */
|
|
|
|
|
2003-08-25 18:49:33 +08:00
|
|
|
undo->size -= gimp_object_get_memsize (GIMP_OBJECT (vectors), NULL);
|
|
|
|
|
2002-02-25 05:00:58 +08:00
|
|
|
/* record the active vectors */
|
2006-03-29 01:08:36 +08:00
|
|
|
vu->prev_vectors = gimp_image_get_active_vectors (undo->image);
|
2002-02-25 05:00:58 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_container_insert (undo->image->vectors,
|
2006-04-12 20:49:29 +08:00
|
|
|
GIMP_OBJECT (vectors), vu->prev_position);
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_set_active_vectors (undo->image, vectors);
|
2004-03-28 22:20:57 +08:00
|
|
|
|
|
|
|
GIMP_ITEM (vectors)->removed = FALSE;
|
2002-02-25 05:00:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_free_vectors (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
2002-02-25 05:00:58 +08:00
|
|
|
{
|
2003-03-18 21:49:02 +08:00
|
|
|
g_free (undo->data);
|
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
|
|
|
|
|
|
|
gboolean
|
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
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2003-02-14 22:14:29 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (vectors)), FALSE);
|
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
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-03-17 00:23:06 +08:00
|
|
|
if (copy)
|
|
|
|
g_object_unref (copy);
|
|
|
|
|
2002-02-25 05:00:58 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************/
|
|
|
|
/* Vectors re-position Undo */
|
2003-02-13 01:11:34 +08:00
|
|
|
/******************************/
|
2002-02-25 05:00:58 +08:00
|
|
|
|
|
|
|
typedef struct _VectorsRepositionUndo VectorsRepositionUndo;
|
|
|
|
|
|
|
|
struct _VectorsRepositionUndo
|
|
|
|
{
|
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
|
|
|
gint old_position;
|
2002-02-25 05:00:58 +08:00
|
|
|
};
|
|
|
|
|
2003-02-13 01:11:34 +08:00
|
|
|
static gboolean undo_pop_vectors_reposition (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum);
|
|
|
|
static void undo_free_vectors_reposition (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode);
|
2002-02-25 05:00:58 +08:00
|
|
|
|
|
|
|
gboolean
|
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
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
2002-02-25 05:00:58 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2003-02-14 22:14:29 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_VECTORS (vectors), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (vectors)), FALSE);
|
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
|
|
|
sizeof (VectorsRepositionUndo),
|
|
|
|
sizeof (VectorsRepositionUndo),
|
|
|
|
GIMP_UNDO_VECTORS_REPOSITION, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
2004-07-13 00:59:36 +08:00
|
|
|
undo_pop_vectors_reposition,
|
|
|
|
undo_free_vectors_reposition,
|
|
|
|
"item", vectors,
|
|
|
|
NULL)))
|
2002-02-25 05:00:58 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
VectorsRepositionUndo *vru = new->data;
|
2002-02-25 05:00:58 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
vru->old_position = gimp_image_get_vectors_index (image, vectors);
|
2002-02-25 05:00:58 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_vectors_reposition (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
2002-02-25 05:00:58 +08:00
|
|
|
{
|
2004-03-15 23:18:25 +08:00
|
|
|
VectorsRepositionUndo *vru = undo->data;
|
|
|
|
GimpVectors *vectors = GIMP_VECTORS (GIMP_ITEM_UNDO (undo)->item);
|
2002-02-25 05:00:58 +08:00
|
|
|
gint pos;
|
|
|
|
|
|
|
|
/* what's the vectors's current index? */
|
2006-03-29 01:08:36 +08:00
|
|
|
pos = gimp_image_get_vectors_index (undo->image, vectors);
|
|
|
|
gimp_image_position_vectors (undo->image, vectors, vru->old_position,
|
2003-02-17 21:33:29 +08:00
|
|
|
FALSE, NULL);
|
2002-02-25 05:00:58 +08:00
|
|
|
vru->old_position = pos;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_free_vectors_reposition (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode)
|
2002-02-25 05:00:58 +08:00
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
g_free (undo->data);
|
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
|
|
|
|
2002-02-24 01:29:19 +08:00
|
|
|
gboolean
|
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
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2003-02-14 22:14:29 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (floating_layer), FALSE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
|
|
|
|
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;
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
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
|
|
|
|
2000-05-27 06:28:40 +08:00
|
|
|
gboolean
|
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
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2003-02-14 22:14:29 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (floating_layer), FALSE);
|
|
|
|
|
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
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
2003-02-03 21:45:40 +08:00
|
|
|
|
|
|
|
return FALSE;
|
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
|
|
|
|
2000-05-27 06:28:40 +08:00
|
|
|
gboolean
|
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
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2003-02-14 22:14:29 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (floating_layer), FALSE);
|
|
|
|
|
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
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
2003-02-03 21:45:40 +08:00
|
|
|
|
|
|
|
return FALSE;
|
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
|
|
|
|
2000-05-27 06:28:40 +08:00
|
|
|
gboolean
|
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
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
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
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2000-05-27 06:28:40 +08:00
|
|
|
gboolean
|
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
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
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
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2000-05-27 06:28:40 +08:00
|
|
|
gboolean
|
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
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), FALSE);
|
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));
|
1999-04-23 14:07:09 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2000-05-27 06:28:40 +08:00
|
|
|
gboolean
|
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
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
2004-11-12 18:56:23 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), FALSE);
|
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));
|
1999-04-23 14:07:09 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2000-05-27 06:28:40 +08:00
|
|
|
gboolean
|
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
|
|
|
{
|
2003-02-13 01:11:34 +08:00
|
|
|
GimpUndo *new;
|
1999-08-23 22:34:58 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
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
|
|
|
|
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
|
|
|
0, 0,
|
2003-02-14 22:14:29 +08:00
|
|
|
GIMP_UNDO_CANT, undo_desc,
|
2004-07-29 22:16:21 +08:00
|
|
|
GIMP_DIRTY_ALL,
|
2003-02-13 01:11:34 +08:00
|
|
|
undo_pop_cantundo,
|
2004-07-13 00:59:36 +08:00
|
|
|
NULL,
|
2003-02-13 01:11:34 +08:00
|
|
|
NULL)))
|
2002-02-26 08:04:55 +08:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
1999-08-23 22:34:58 +08:00
|
|
|
|
2002-02-26 08:04:55 +08:00
|
|
|
return FALSE;
|
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:
|
2003-02-14 22:14:29 +08:00
|
|
|
g_message (_("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
|
|
|
}
|