2006-12-09 21:33:38 +00:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1997-11-24 22:05:25 +00:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-17 22:28:01 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1997-11-24 22:05:25 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-17 22:28:01 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1997-11-24 22:05:25 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-11 23:27:07 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1997-11-24 22:05:25 +00:00
|
|
|
*/
|
2000-06-07 22:51:23 +00:00
|
|
|
|
1999-09-06 00:07:03 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2013-10-15 01:58:39 +02:00
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
2008-10-09 20:24:04 +00:00
|
|
|
#include <gegl.h>
|
2000-12-16 21:37:03 +00:00
|
|
|
|
2001-05-21 13:58:46 +00:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
|
|
|
2003-05-07 11:09:00 +00:00
|
|
|
#include "core-types.h"
|
2000-12-16 21:37:03 +00:00
|
|
|
|
2003-02-14 14:14:29 +00:00
|
|
|
#include "gimp.h"
|
2007-01-29 08:40:40 +00:00
|
|
|
#include "gimpchannelpropundo.h"
|
2007-01-31 12:33:03 +00:00
|
|
|
#include "gimpchannelundo.h"
|
2023-06-19 14:54:21 +00:00
|
|
|
#include "gimpdrawablefilter.h"
|
|
|
|
#include "gimpdrawablefilterundo.h"
|
2007-01-31 19:13:12 +00:00
|
|
|
#include "gimpdrawablemodundo.h"
|
2018-07-24 12:20:17 +02:00
|
|
|
#include "gimpdrawablepropundo.h"
|
2006-10-20 08:56:58 +00:00
|
|
|
#include "gimpdrawableundo.h"
|
2016-05-20 16:46:26 +02:00
|
|
|
#include "gimpfloatingselectionundo.h"
|
2003-06-23 19:34:48 +00:00
|
|
|
#include "gimpgrid.h"
|
2009-09-07 13:04:55 +02:00
|
|
|
#include "gimpgrouplayer.h"
|
|
|
|
#include "gimpgrouplayerundo.h"
|
2006-06-06 22:48:57 +00:00
|
|
|
#include "gimpguide.h"
|
2007-01-30 12:32:14 +00:00
|
|
|
#include "gimpguideundo.h"
|
2006-10-14 16:20:46 +00:00
|
|
|
#include "gimpimage.h"
|
2003-02-14 14:14:29 +00:00
|
|
|
#include "gimpimage-undo.h"
|
2006-10-30 10:13:06 +00:00
|
|
|
#include "gimpimage-undo-push.h"
|
2007-01-28 18:21:39 +00:00
|
|
|
#include "gimpimageundo.h"
|
2007-01-28 19:00:13 +00:00
|
|
|
#include "gimpitempropundo.h"
|
2003-02-14 14:14:29 +00:00
|
|
|
#include "gimplayermask.h"
|
2007-01-31 18:50:39 +00:00
|
|
|
#include "gimplayermaskpropundo.h"
|
2007-01-31 12:33:03 +00:00
|
|
|
#include "gimplayermaskundo.h"
|
2007-01-28 20:10:45 +00:00
|
|
|
#include "gimplayerpropundo.h"
|
2007-01-31 12:33:03 +00:00
|
|
|
#include "gimplayerundo.h"
|
2007-01-30 22:53:18 +00:00
|
|
|
#include "gimpmaskundo.h"
|
2007-01-30 10:34:59 +00:00
|
|
|
#include "gimpsamplepoint.h"
|
2007-01-30 12:32:14 +00:00
|
|
|
#include "gimpsamplepointundo.h"
|
2004-07-29 14:16:21 +00:00
|
|
|
#include "gimpselection.h"
|
2002-02-14 19:31:16 +00:00
|
|
|
|
2004-04-01 14:51:58 +00:00
|
|
|
#include "text/gimptextlayer.h"
|
2004-03-21 23:14:21 +00:00
|
|
|
#include "text/gimptextundo.h"
|
2004-01-05 00:28:12 +00:00
|
|
|
|
2024-07-12 06:16:25 +00:00
|
|
|
#include "vectors/gimppath.h"
|
2024-07-13 05:07:57 +00:00
|
|
|
#include "vectors/gimppathmodundo.h"
|
|
|
|
#include "vectors/gimppathpropundo.h"
|
|
|
|
#include "vectors/gimppathundo.h"
|
2003-01-31 18:08:32 +00:00
|
|
|
|
2003-03-25 16:38:19 +00:00
|
|
|
#include "gimp-intl.h"
|
1999-04-23 06:07:09 +00: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-01 18:43:24 +00:00
|
|
|
|
2007-01-30 12:32:14 +00:00
|
|
|
/**************************/
|
|
|
|
/* Image Property Undos */
|
|
|
|
/**************************/
|
2002-02-23 18:29:07 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_image_type (GimpImage *image,
|
2003-02-14 14:14:29 +00:00
|
|
|
const gchar *undo_desc)
|
2002-02-23 18:29:07 +00:00
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2003-02-14 14:14:29 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
|
|
|
GIMP_UNDO_IMAGE_TYPE, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE,
|
|
|
|
NULL);
|
2002-02-23 18:29:07 +00:00
|
|
|
}
|
|
|
|
|
2012-04-25 16:46:58 +02:00
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_image_precision (GimpImage *image,
|
|
|
|
const gchar *undo_desc)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
|
|
|
GIMP_UNDO_IMAGE_PRECISION, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_image_size (GimpImage *image,
|
2008-08-03 11:35:53 +00:00
|
|
|
const gchar *undo_desc,
|
2008-08-04 20:11:35 +00:00
|
|
|
gint previous_origin_x,
|
2008-08-28 19:12:03 +00:00
|
|
|
gint previous_origin_y,
|
|
|
|
gint previous_width,
|
|
|
|
gint previous_height)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2002-02-23 17:29:19 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
|
|
|
GIMP_UNDO_IMAGE_SIZE, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE | GIMP_DIRTY_IMAGE_SIZE,
|
2008-08-03 11:35:53 +00:00
|
|
|
"previous-origin-x", previous_origin_x,
|
|
|
|
"previous-origin-y", previous_origin_y,
|
2008-08-28 19:12:03 +00:00
|
|
|
"previous-width", previous_width,
|
|
|
|
"previous-height", previous_height,
|
2007-01-29 18:49:06 +00:00
|
|
|
NULL);
|
2002-02-23 17:29:19 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_image_resolution (GimpImage *image,
|
2003-02-14 14:14:29 +00:00
|
|
|
const gchar *undo_desc)
|
2002-02-23 17:29:19 +00:00
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2002-02-23 17:29:19 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
|
|
|
GIMP_UNDO_IMAGE_RESOLUTION, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE,
|
|
|
|
NULL);
|
2002-02-23 17:29:19 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 22:37:18 +00:00
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_image_grid (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpGrid *grid)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_GRID (grid), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
|
|
|
GIMP_UNDO_IMAGE_GRID, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_META,
|
|
|
|
"grid", grid,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_image_colormap (GimpImage *image,
|
|
|
|
const gchar *undo_desc)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
|
|
|
GIMP_UNDO_IMAGE_COLORMAP, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2016-05-08 18:02:57 +02:00
|
|
|
GimpUndo *
|
2018-10-07 16:16:21 +02:00
|
|
|
gimp_image_undo_push_image_hidden_profile (GimpImage *image,
|
|
|
|
const gchar *undo_desc)
|
2016-05-08 18:02:57 +02:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
2018-10-07 16:16:21 +02:00
|
|
|
GIMP_UNDO_IMAGE_HIDDEN_PROFILE, undo_desc,
|
2016-05-08 18:02:57 +02:00
|
|
|
GIMP_DIRTY_IMAGE,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2013-10-19 18:38:01 +02:00
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_image_metadata (GimpImage *image,
|
|
|
|
const gchar *undo_desc)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
|
|
|
GIMP_UNDO_IMAGE_METADATA, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_META,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2007-02-02 10:55:38 +00:00
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_image_parasite (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
const GimpParasite *parasite)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (parasite != NULL, NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
|
|
|
GIMP_UNDO_PARASITE_ATTACH, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_META,
|
2021-04-05 18:36:44 +02:00
|
|
|
"parasite-name", gimp_parasite_get_name (parasite),
|
2007-02-02 10:55:38 +00:00
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_image_parasite_remove (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
const gchar *name)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
|
|
|
GIMP_UNDO_PARASITE_REMOVE, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_META,
|
|
|
|
"parasite-name", name,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2007-01-29 22:37:18 +00:00
|
|
|
|
2007-01-30 12:32:14 +00:00
|
|
|
/********************************/
|
|
|
|
/* Guide & Sample Point Undos */
|
|
|
|
/********************************/
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2007-01-29 23:21:41 +00:00
|
|
|
gimp_image_undo_push_guide (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpGuide *guide)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_GUIDE (guide), NULL);
|
2003-02-14 14:14:29 +00:00
|
|
|
|
2007-01-30 12:32:14 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_GUIDE_UNDO,
|
|
|
|
GIMP_UNDO_GUIDE, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_META,
|
2018-07-15 17:02:56 +02:00
|
|
|
"aux-item", guide,
|
2007-01-30 12:32:14 +00:00
|
|
|
NULL);
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2007-01-29 23:21:41 +00:00
|
|
|
gimp_image_undo_push_sample_point (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpSamplePoint *sample_point)
|
2005-03-04 16:34:59 +00:00
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2018-07-15 15:58:24 +02:00
|
|
|
g_return_val_if_fail (GIMP_IS_SAMPLE_POINT (sample_point), NULL);
|
2005-03-04 16:34:59 +00:00
|
|
|
|
2007-01-30 12:32:14 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_SAMPLE_POINT_UNDO,
|
|
|
|
GIMP_UNDO_SAMPLE_POINT, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_META,
|
2018-07-15 17:02:56 +02:00
|
|
|
"aux-item", sample_point,
|
2007-01-30 12:32:14 +00:00
|
|
|
NULL);
|
2005-03-04 16:34:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-31 19:13:12 +00:00
|
|
|
/********************/
|
|
|
|
/* Drawable Undos */
|
|
|
|
/********************/
|
2004-03-15 14:10:30 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_drawable (GimpImage *image,
|
2004-03-15 14:10:30 +00:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpDrawable *drawable,
|
2012-03-22 14:13:17 +01:00
|
|
|
GeglBuffer *buffer,
|
2004-03-15 14:10:30 +00:00
|
|
|
gint x,
|
2012-03-22 14:25:45 +01:00
|
|
|
gint y)
|
2004-03-15 14:10:30 +00:00
|
|
|
{
|
|
|
|
GimpItem *item;
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
2012-03-22 14:13:17 +01:00
|
|
|
g_return_val_if_fail (GEGL_IS_BUFFER (buffer), NULL);
|
2004-03-15 14:10:30 +00:00
|
|
|
|
|
|
|
item = GIMP_ITEM (drawable);
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
2004-03-15 14:10:30 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_DRAWABLE_UNDO,
|
|
|
|
GIMP_UNDO_DRAWABLE, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
|
|
|
"item", item,
|
2012-03-22 14:13:17 +01:00
|
|
|
"buffer", buffer,
|
2007-01-29 18:49:06 +00:00
|
|
|
"x", x,
|
|
|
|
"y", y,
|
|
|
|
NULL);
|
2004-03-15 14:10:30 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_drawable_mod (GimpImage *image,
|
2004-03-16 16:23:06 +00:00
|
|
|
const gchar *undo_desc,
|
2010-03-18 10:25:18 +01:00
|
|
|
GimpDrawable *drawable,
|
2012-03-21 21:36:50 +01:00
|
|
|
gboolean copy_buffer)
|
2004-03-15 20:58:07 +00:00
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
|
2004-03-15 20:58:07 +00:00
|
|
|
|
2007-01-31 19:13:12 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_DRAWABLE_MOD_UNDO,
|
|
|
|
GIMP_UNDO_DRAWABLE_MOD, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
2012-03-21 21:36:50 +01:00
|
|
|
"item", drawable,
|
|
|
|
"copy-buffer", copy_buffer,
|
2007-01-31 19:13:12 +00:00
|
|
|
NULL);
|
2004-03-15 20:58:07 +00:00
|
|
|
}
|
|
|
|
|
2018-07-24 12:20:17 +02:00
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_drawable_format (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpDrawable *drawable)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_DRAWABLE_PROP_UNDO,
|
|
|
|
GIMP_UNDO_DRAWABLE_FORMAT, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
|
|
|
"item", drawable,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2004-03-15 20:58:07 +00:00
|
|
|
|
2023-06-19 14:54:21 +00:00
|
|
|
/***************************/
|
|
|
|
/* Drawable Filter Undos */
|
|
|
|
/***************************/
|
2025-05-29 00:45:01 +02:00
|
|
|
|
2023-06-19 14:54:21 +00:00
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_filter_add (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpDrawableFilter *filter)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DRAWABLE_FILTER (filter), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_DRAWABLE_FILTER_UNDO,
|
|
|
|
GIMP_UNDO_FILTER_ADD, undo_desc,
|
|
|
|
GIMP_DIRTY_DRAWABLE,
|
|
|
|
"filter", filter,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_filter_remove (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpDrawableFilter *filter)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DRAWABLE_FILTER (filter), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_DRAWABLE_FILTER_UNDO,
|
|
|
|
GIMP_UNDO_FILTER_REMOVE, undo_desc,
|
|
|
|
GIMP_DIRTY_DRAWABLE,
|
|
|
|
"filter", filter,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_filter_reorder (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpDrawableFilter *filter)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DRAWABLE_FILTER (filter), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_DRAWABLE_FILTER_UNDO,
|
|
|
|
GIMP_UNDO_FILTER_REORDER, undo_desc,
|
|
|
|
GIMP_DIRTY_DRAWABLE,
|
|
|
|
"filter", filter,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2025-05-13 18:59:46 +00:00
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_filter_modified (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpDrawable *drawable,
|
2025-05-17 21:31:47 +02:00
|
|
|
GimpDrawableFilter *filter)
|
2025-05-13 18:59:46 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DRAWABLE_FILTER (filter), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_DRAWABLE_FILTER_UNDO,
|
|
|
|
GIMP_UNDO_FILTER_MODIFIED, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
2025-05-17 21:31:47 +02:00
|
|
|
"filter", filter,
|
2025-05-13 18:59:46 +00:00
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2023-06-19 14:54:21 +00:00
|
|
|
|
2012-04-28 16:14:52 +02:00
|
|
|
/****************/
|
|
|
|
/* Mask Undos */
|
|
|
|
/****************/
|
2002-08-20 10:22:23 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_mask (GimpImage *image,
|
2003-02-14 14:14:29 +00:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpChannel *mask)
|
2002-08-20 10:22:23 +00:00
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CHANNEL (mask), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (mask)), NULL);
|
2002-08-20 10:22:23 +00:00
|
|
|
|
2007-01-30 22:53:18 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_MASK_UNDO,
|
2007-01-29 18:49:06 +00:00
|
|
|
GIMP_UNDO_MASK, undo_desc,
|
|
|
|
GIMP_IS_SELECTION (mask) ?
|
|
|
|
GIMP_DIRTY_SELECTION :
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
|
|
|
"item", mask,
|
|
|
|
NULL);
|
2002-08-20 10:22:23 +00:00
|
|
|
}
|
|
|
|
|
2012-04-28 16:14:52 +02:00
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_mask_precision (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpChannel *mask)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CHANNEL (mask), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (mask)), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_MASK_UNDO,
|
|
|
|
GIMP_UNDO_MASK, undo_desc,
|
|
|
|
GIMP_IS_SELECTION (mask) ?
|
|
|
|
GIMP_DIRTY_SELECTION :
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
2012-04-28 19:15:47 +02:00
|
|
|
"item", mask,
|
|
|
|
"convert-format", TRUE,
|
2012-04-28 16:14:52 +02:00
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2002-08-20 10:22:23 +00:00
|
|
|
|
2007-02-03 22:25:32 +00:00
|
|
|
/****************/
|
|
|
|
/* Item Undos */
|
|
|
|
/****************/
|
2002-02-26 00:04:55 +00:00
|
|
|
|
2010-02-06 16:41:54 +01:00
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_item_reorder (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpItem *item)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_ITEM_PROP_UNDO,
|
|
|
|
GIMP_UNDO_ITEM_REORDER, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
"item", item,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_item_rename (GimpImage *image,
|
2003-02-14 14:14:29 +00:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpItem *item)
|
2002-02-26 00:04:55 +00:00
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
2003-02-14 14:14:29 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_ITEM_PROP_UNDO,
|
|
|
|
GIMP_UNDO_ITEM_RENAME, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
"item", item,
|
|
|
|
NULL);
|
2002-02-26 00:04:55 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_item_displace (GimpImage *image,
|
2003-05-08 19:11:17 +00:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpItem *item)
|
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
2003-05-08 19:11:17 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_ITEM_PROP_UNDO,
|
|
|
|
GIMP_UNDO_ITEM_DISPLACE, undo_desc,
|
|
|
|
GIMP_IS_DRAWABLE (item) ?
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE :
|
2024-07-13 05:07:57 +00:00
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_PATH,
|
2007-01-29 18:49:06 +00:00
|
|
|
"item", item,
|
|
|
|
NULL);
|
2003-05-08 19:11:17 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_item_visibility (GimpImage *image,
|
2003-09-11 19:52:29 +00:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpItem *item)
|
2003-05-08 20:26:01 +00:00
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
2003-05-08 20:26:01 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_ITEM_PROP_UNDO,
|
|
|
|
GIMP_UNDO_ITEM_VISIBILITY, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
"item", item,
|
|
|
|
NULL);
|
2003-05-08 20:26:01 +00:00
|
|
|
}
|
|
|
|
|
2016-10-29 16:50:13 +02:00
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_item_color_tag (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpItem *item)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_ITEM_PROP_UNDO,
|
|
|
|
GIMP_UNDO_ITEM_COLOR_TAG, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
"item", item,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2012-11-09 11:17:25 +01:00
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_item_lock_content (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpItem *item)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_ITEM_PROP_UNDO,
|
|
|
|
GIMP_UNDO_ITEM_LOCK_CONTENT, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
"item", item,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_item_lock_position (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpItem *item)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_ITEM_PROP_UNDO,
|
|
|
|
GIMP_UNDO_ITEM_LOCK_POSITION, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
"item", item,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2017-12-23 23:57:12 +01:00
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_item_lock_visibility (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpItem *item)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_ITEM_PROP_UNDO,
|
|
|
|
GIMP_UNDO_ITEM_LOCK_VISIBILITY, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
"item", item,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2007-02-02 10:55:38 +00:00
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_item_parasite (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpItem *item,
|
|
|
|
const GimpParasite *parasite)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
|
|
|
g_return_val_if_fail (parasite != NULL, NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_ITEM_PROP_UNDO,
|
|
|
|
GIMP_UNDO_PARASITE_ATTACH, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
"item", item,
|
2021-04-05 18:36:44 +02:00
|
|
|
"parasite-name", gimp_parasite_get_name (parasite),
|
2007-02-02 10:55:38 +00:00
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_item_parasite_remove (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpItem *item,
|
|
|
|
const gchar *name)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_ITEM (item), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (item), NULL);
|
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_ITEM_PROP_UNDO,
|
|
|
|
GIMP_UNDO_PARASITE_REMOVE, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
"item", item,
|
|
|
|
"parasite-name", name,
|
|
|
|
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-17 18:02:41 +00:00
|
|
|
|
2007-02-03 22:25:32 +00:00
|
|
|
/*****************/
|
|
|
|
/* Layer Undos */
|
|
|
|
/*****************/
|
2002-02-14 19:31:16 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_layer_add (GimpImage *image,
|
2003-02-14 14:14:29 +00:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer,
|
2020-04-04 02:49:51 +02:00
|
|
|
GList *prev_layers)
|
2002-02-23 17:29:19 +00:00
|
|
|
{
|
2020-04-04 02:49:51 +02:00
|
|
|
GList *iter;
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
2020-04-04 02:49:51 +02:00
|
|
|
|
|
|
|
for (iter = prev_layers; iter; iter = iter->next)
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (iter->data), NULL);
|
2004-11-12 10:56:23 +00:00
|
|
|
|
2007-01-31 12:33:03 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_UNDO,
|
|
|
|
GIMP_UNDO_LAYER_ADD, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
2020-04-04 02:49:51 +02:00
|
|
|
"item", layer,
|
|
|
|
"prev-layers", prev_layers,
|
2007-01-31 12:33:03 +00:00
|
|
|
NULL);
|
2001-03-11 13:15:41 +00:00
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_layer_remove (GimpImage *image,
|
2003-02-14 14:14:29 +00:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer,
|
2009-08-03 19:21:51 +02:00
|
|
|
GimpLayer *prev_parent,
|
2003-02-14 14:14:29 +00:00
|
|
|
gint prev_position,
|
2020-04-04 02:49:51 +02:00
|
|
|
GList *prev_layers)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2020-04-04 02:49:51 +02:00
|
|
|
GList *iter;
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
2009-08-03 19:21:51 +02:00
|
|
|
g_return_val_if_fail (prev_parent == NULL || GIMP_IS_LAYER (prev_parent),
|
|
|
|
NULL);
|
2020-04-04 02:49:51 +02:00
|
|
|
|
|
|
|
for (iter = prev_layers; iter; iter = iter->next)
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (iter->data), NULL);
|
2004-11-12 10:56:23 +00:00
|
|
|
|
2007-01-31 12:33:03 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_UNDO,
|
|
|
|
GIMP_UNDO_LAYER_REMOVE, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
"item", layer,
|
2009-08-03 19:21:51 +02:00
|
|
|
"prev-parent", prev_parent,
|
2007-01-31 12:33:03 +00:00
|
|
|
"prev-position", prev_position,
|
2020-04-04 02:49:51 +02:00
|
|
|
"prev-layers", prev_layers,
|
2007-01-31 12:33:03 +00:00
|
|
|
NULL);
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00: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-17 18:02:41 +00:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer)
|
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
2007-01-28 20:10:45 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_PROP_UNDO,
|
|
|
|
GIMP_UNDO_LAYER_MODE, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
"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-17 18:02:41 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00: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-17 18:02:41 +00:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer)
|
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-17 18:02:41 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_PROP_UNDO,
|
|
|
|
GIMP_UNDO_LAYER_OPACITY, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
"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-17 18:02:41 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2007-01-28 20:10:45 +00:00
|
|
|
gimp_image_undo_push_layer_lock_alpha (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer)
|
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-17 18:02:41 +00:00
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-17 18:02:41 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_PROP_UNDO,
|
|
|
|
GIMP_UNDO_LAYER_LOCK_ALPHA, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
"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-17 18:02:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-07 13:04:55 +02:00
|
|
|
/***********************/
|
|
|
|
/* Group Layer Undos */
|
|
|
|
/***********************/
|
|
|
|
|
|
|
|
GimpUndo *
|
Bug 51112 - Support layer masks on layer groups
Add layer-mask support for group layers. Group-layer masks work
similarly to ordinary-layer masks, with the following
considerations:
The group's mask size is the same as group's size (i.e., the
bounding box of its children) at all times. When the group's size
changes, the mask is cropped to the new size -- areas of the mask
that fall outside of the new bounds are discarded and their data is
lost (sans undo), and newly added areas are filled with black (and
hence are transparent by default).
The new gimp_group_layer_{suspend,resume}_mask() functions can be
used to modify this behavior. Between the outermost pair of
suspend/resume calls, the old mask data is remembered, and is used
to fill the newly added areas while cropping the mask when the
group is resized. We override GimpItem::{start,end}_move() for
GimpLayer, to call these functions (suspend() in start_move(), and
resume() in end_move()) for each of the layer's ancestors.
As a result, while moving a layer, or a set of layers, atomically,
such as while dragging with the move tool, or moving linked layers,
the ancestors' mask data is not lost, and is only discarded at the
end of the operation.
This commit also takes care of properly handling undo for group-
layer mask crops, properly invalidating the image when the group
layer's mask is shown, and enabling the mask actions for group
layers (obviously :).
2018-02-05 11:19:18 -05:00
|
|
|
gimp_image_undo_push_group_layer_suspend_resize (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpGroupLayer *group)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_GROUP_LAYER (group), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (group)), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_GROUP_LAYER_UNDO,
|
|
|
|
GIMP_UNDO_GROUP_LAYER_SUSPEND_RESIZE, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
|
|
|
"item", group,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_group_layer_resume_resize (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpGroupLayer *group)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_GROUP_LAYER (group), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (group)), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_GROUP_LAYER_UNDO,
|
|
|
|
GIMP_UNDO_GROUP_LAYER_RESUME_RESIZE, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
|
|
|
"item", group,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_group_layer_suspend_mask (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpGroupLayer *group)
|
2009-09-07 13:04:55 +02:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_GROUP_LAYER (group), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (group)), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_GROUP_LAYER_UNDO,
|
Bug 51112 - Support layer masks on layer groups
Add layer-mask support for group layers. Group-layer masks work
similarly to ordinary-layer masks, with the following
considerations:
The group's mask size is the same as group's size (i.e., the
bounding box of its children) at all times. When the group's size
changes, the mask is cropped to the new size -- areas of the mask
that fall outside of the new bounds are discarded and their data is
lost (sans undo), and newly added areas are filled with black (and
hence are transparent by default).
The new gimp_group_layer_{suspend,resume}_mask() functions can be
used to modify this behavior. Between the outermost pair of
suspend/resume calls, the old mask data is remembered, and is used
to fill the newly added areas while cropping the mask when the
group is resized. We override GimpItem::{start,end}_move() for
GimpLayer, to call these functions (suspend() in start_move(), and
resume() in end_move()) for each of the layer's ancestors.
As a result, while moving a layer, or a set of layers, atomically,
such as while dragging with the move tool, or moving linked layers,
the ancestors' mask data is not lost, and is only discarded at the
end of the operation.
This commit also takes care of properly handling undo for group-
layer mask crops, properly invalidating the image when the group
layer's mask is shown, and enabling the mask actions for group
layers (obviously :).
2018-02-05 11:19:18 -05:00
|
|
|
GIMP_UNDO_GROUP_LAYER_SUSPEND_MASK, undo_desc,
|
2009-09-07 13:04:55 +02:00
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
|
|
|
"item", group,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpUndo *
|
Bug 51112 - Support layer masks on layer groups
Add layer-mask support for group layers. Group-layer masks work
similarly to ordinary-layer masks, with the following
considerations:
The group's mask size is the same as group's size (i.e., the
bounding box of its children) at all times. When the group's size
changes, the mask is cropped to the new size -- areas of the mask
that fall outside of the new bounds are discarded and their data is
lost (sans undo), and newly added areas are filled with black (and
hence are transparent by default).
The new gimp_group_layer_{suspend,resume}_mask() functions can be
used to modify this behavior. Between the outermost pair of
suspend/resume calls, the old mask data is remembered, and is used
to fill the newly added areas while cropping the mask when the
group is resized. We override GimpItem::{start,end}_move() for
GimpLayer, to call these functions (suspend() in start_move(), and
resume() in end_move()) for each of the layer's ancestors.
As a result, while moving a layer, or a set of layers, atomically,
such as while dragging with the move tool, or moving linked layers,
the ancestors' mask data is not lost, and is only discarded at the
end of the operation.
This commit also takes care of properly handling undo for group-
layer mask crops, properly invalidating the image when the group
layer's mask is shown, and enabling the mask actions for group
layers (obviously :).
2018-02-05 11:19:18 -05:00
|
|
|
gimp_image_undo_push_group_layer_resume_mask (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpGroupLayer *group)
|
2009-09-07 13:04:55 +02:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_GROUP_LAYER (group), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (group)), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_GROUP_LAYER_UNDO,
|
Bug 51112 - Support layer masks on layer groups
Add layer-mask support for group layers. Group-layer masks work
similarly to ordinary-layer masks, with the following
considerations:
The group's mask size is the same as group's size (i.e., the
bounding box of its children) at all times. When the group's size
changes, the mask is cropped to the new size -- areas of the mask
that fall outside of the new bounds are discarded and their data is
lost (sans undo), and newly added areas are filled with black (and
hence are transparent by default).
The new gimp_group_layer_{suspend,resume}_mask() functions can be
used to modify this behavior. Between the outermost pair of
suspend/resume calls, the old mask data is remembered, and is used
to fill the newly added areas while cropping the mask when the
group is resized. We override GimpItem::{start,end}_move() for
GimpLayer, to call these functions (suspend() in start_move(), and
resume() in end_move()) for each of the layer's ancestors.
As a result, while moving a layer, or a set of layers, atomically,
such as while dragging with the move tool, or moving linked layers,
the ancestors' mask data is not lost, and is only discarded at the
end of the operation.
This commit also takes care of properly handling undo for group-
layer mask crops, properly invalidating the image when the group
layer's mask is shown, and enabling the mask actions for group
layers (obviously :).
2018-02-05 11:19:18 -05:00
|
|
|
GIMP_UNDO_GROUP_LAYER_RESUME_MASK, undo_desc,
|
2009-09-07 13:04:55 +02:00
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
|
|
|
"item", group,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2018-03-25 09:54:13 -04:00
|
|
|
GimpUndo *
|
Bug 795410 - Deleting a layer group and then undoing the deletion ...
... raises a CRITICAL
gimp_item_{start,end}_move() currently serves two different
purposes: It is used by GimpLayer to suspend/resume mask resizing
of the layer's ancestors; this is necessary whenever an operation
on a layer might affect the size of its ancestors. It is also used
by GimpGroupLayer to suspend/resume its own mask resizing; this, on
the other hand, is only necessary before applying one of the
transformation functions to the group, so that mask modification is
handled by GimpLayer. In other words, the effects of
gimp_item_{start,end}_move() on group layers are only necessary in
a subset of the cases in which these functions are used.
While in itself this isn't a problem, it does cause issues when
removing a group layer: gimp_image_remove_layer() calls
gimp_item_start_move() before removing the layer, and
gimp_item_end_move() afterwards. While the former function is
called while the layer is still attached to the image, the latter
function is called after the layer is no longer attached. Since
GimpGroupLayer pushes an undo step in response to these calls, only
the call to start_move() results in an undo step, while the call to
end_move() doesn't, resulting in an unbalanced
GIMP_UNDO_GROUP_LAYER_START_MOVE undo step on the stack. This
causes problems when undoing the operation.
Add gimp_item_{start,end}_transform() functions, and corresponding
GimpItem::{start,end}_transform() virtual functions, which are more
specialized versions of gimp_item_{start,end}_move(), which should
be used instead of the former before/after transforming an item; in
other cases, such as when removing ot reordering an item,
gimp_item_{start,end}_move() should still be used. The default
implementation of GimpItem::{start,end}_transform() calls
gimp_item_{start,end}_move(), respectively, so subclasses that
override these functions don't have to do that themselves.
In GimpGroupLayer, override GimpItem::{start,end}_transform(),
instead of GimpItem::{start,end}_move(), for the same purpose of
suspending mask resize. This avoids these functions from being
called when removing a layer group, fixing the bug.
2018-04-22 03:39:40 -04:00
|
|
|
gimp_image_undo_push_group_layer_start_transform (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpGroupLayer *group)
|
2018-03-25 09:54:13 -04:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_GROUP_LAYER (group), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (group)), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_GROUP_LAYER_UNDO,
|
Bug 795410 - Deleting a layer group and then undoing the deletion ...
... raises a CRITICAL
gimp_item_{start,end}_move() currently serves two different
purposes: It is used by GimpLayer to suspend/resume mask resizing
of the layer's ancestors; this is necessary whenever an operation
on a layer might affect the size of its ancestors. It is also used
by GimpGroupLayer to suspend/resume its own mask resizing; this, on
the other hand, is only necessary before applying one of the
transformation functions to the group, so that mask modification is
handled by GimpLayer. In other words, the effects of
gimp_item_{start,end}_move() on group layers are only necessary in
a subset of the cases in which these functions are used.
While in itself this isn't a problem, it does cause issues when
removing a group layer: gimp_image_remove_layer() calls
gimp_item_start_move() before removing the layer, and
gimp_item_end_move() afterwards. While the former function is
called while the layer is still attached to the image, the latter
function is called after the layer is no longer attached. Since
GimpGroupLayer pushes an undo step in response to these calls, only
the call to start_move() results in an undo step, while the call to
end_move() doesn't, resulting in an unbalanced
GIMP_UNDO_GROUP_LAYER_START_MOVE undo step on the stack. This
causes problems when undoing the operation.
Add gimp_item_{start,end}_transform() functions, and corresponding
GimpItem::{start,end}_transform() virtual functions, which are more
specialized versions of gimp_item_{start,end}_move(), which should
be used instead of the former before/after transforming an item; in
other cases, such as when removing ot reordering an item,
gimp_item_{start,end}_move() should still be used. The default
implementation of GimpItem::{start,end}_transform() calls
gimp_item_{start,end}_move(), respectively, so subclasses that
override these functions don't have to do that themselves.
In GimpGroupLayer, override GimpItem::{start,end}_transform(),
instead of GimpItem::{start,end}_move(), for the same purpose of
suspending mask resize. This avoids these functions from being
called when removing a layer group, fixing the bug.
2018-04-22 03:39:40 -04:00
|
|
|
GIMP_UNDO_GROUP_LAYER_START_TRANSFORM, undo_desc,
|
2018-03-25 09:54:13 -04:00
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
|
|
|
"item", group,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpUndo *
|
Bug 795410 - Deleting a layer group and then undoing the deletion ...
... raises a CRITICAL
gimp_item_{start,end}_move() currently serves two different
purposes: It is used by GimpLayer to suspend/resume mask resizing
of the layer's ancestors; this is necessary whenever an operation
on a layer might affect the size of its ancestors. It is also used
by GimpGroupLayer to suspend/resume its own mask resizing; this, on
the other hand, is only necessary before applying one of the
transformation functions to the group, so that mask modification is
handled by GimpLayer. In other words, the effects of
gimp_item_{start,end}_move() on group layers are only necessary in
a subset of the cases in which these functions are used.
While in itself this isn't a problem, it does cause issues when
removing a group layer: gimp_image_remove_layer() calls
gimp_item_start_move() before removing the layer, and
gimp_item_end_move() afterwards. While the former function is
called while the layer is still attached to the image, the latter
function is called after the layer is no longer attached. Since
GimpGroupLayer pushes an undo step in response to these calls, only
the call to start_move() results in an undo step, while the call to
end_move() doesn't, resulting in an unbalanced
GIMP_UNDO_GROUP_LAYER_START_MOVE undo step on the stack. This
causes problems when undoing the operation.
Add gimp_item_{start,end}_transform() functions, and corresponding
GimpItem::{start,end}_transform() virtual functions, which are more
specialized versions of gimp_item_{start,end}_move(), which should
be used instead of the former before/after transforming an item; in
other cases, such as when removing ot reordering an item,
gimp_item_{start,end}_move() should still be used. The default
implementation of GimpItem::{start,end}_transform() calls
gimp_item_{start,end}_move(), respectively, so subclasses that
override these functions don't have to do that themselves.
In GimpGroupLayer, override GimpItem::{start,end}_transform(),
instead of GimpItem::{start,end}_move(), for the same purpose of
suspending mask resize. This avoids these functions from being
called when removing a layer group, fixing the bug.
2018-04-22 03:39:40 -04:00
|
|
|
gimp_image_undo_push_group_layer_end_transform (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpGroupLayer *group)
|
2018-03-25 09:54:13 -04:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_GROUP_LAYER (group), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (group)), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_GROUP_LAYER_UNDO,
|
Bug 795410 - Deleting a layer group and then undoing the deletion ...
... raises a CRITICAL
gimp_item_{start,end}_move() currently serves two different
purposes: It is used by GimpLayer to suspend/resume mask resizing
of the layer's ancestors; this is necessary whenever an operation
on a layer might affect the size of its ancestors. It is also used
by GimpGroupLayer to suspend/resume its own mask resizing; this, on
the other hand, is only necessary before applying one of the
transformation functions to the group, so that mask modification is
handled by GimpLayer. In other words, the effects of
gimp_item_{start,end}_move() on group layers are only necessary in
a subset of the cases in which these functions are used.
While in itself this isn't a problem, it does cause issues when
removing a group layer: gimp_image_remove_layer() calls
gimp_item_start_move() before removing the layer, and
gimp_item_end_move() afterwards. While the former function is
called while the layer is still attached to the image, the latter
function is called after the layer is no longer attached. Since
GimpGroupLayer pushes an undo step in response to these calls, only
the call to start_move() results in an undo step, while the call to
end_move() doesn't, resulting in an unbalanced
GIMP_UNDO_GROUP_LAYER_START_MOVE undo step on the stack. This
causes problems when undoing the operation.
Add gimp_item_{start,end}_transform() functions, and corresponding
GimpItem::{start,end}_transform() virtual functions, which are more
specialized versions of gimp_item_{start,end}_move(), which should
be used instead of the former before/after transforming an item; in
other cases, such as when removing ot reordering an item,
gimp_item_{start,end}_move() should still be used. The default
implementation of GimpItem::{start,end}_transform() calls
gimp_item_{start,end}_move(), respectively, so subclasses that
override these functions don't have to do that themselves.
In GimpGroupLayer, override GimpItem::{start,end}_transform(),
instead of GimpItem::{start,end}_move(), for the same purpose of
suspending mask resize. This avoids these functions from being
called when removing a layer group, fixing the bug.
2018-04-22 03:39:40 -04:00
|
|
|
GIMP_UNDO_GROUP_LAYER_END_TRANSFORM, undo_desc,
|
2018-03-25 09:54:13 -04:00
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
|
|
|
"item", group,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2009-09-13 19:24:19 +02:00
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_group_layer_convert (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpGroupLayer *group)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_GROUP_LAYER (group), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (group)), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_GROUP_LAYER_UNDO,
|
|
|
|
GIMP_UNDO_GROUP_LAYER_CONVERT, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
|
|
|
"item", group,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2009-09-07 13:04:55 +02:00
|
|
|
|
2007-01-30 15:08:59 +00:00
|
|
|
/**********************/
|
|
|
|
/* Text Layer Undos */
|
|
|
|
/**********************/
|
2004-01-05 00:28:12 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_text_layer (GimpImage *image,
|
2004-03-20 17:21:48 +00:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpTextLayer *layer,
|
|
|
|
const GParamSpec *pspec)
|
2004-01-05 00:28:12 +00:00
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_TEXT_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
2004-03-20 17:21:48 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_TEXT_UNDO,
|
|
|
|
GIMP_UNDO_TEXT_LAYER, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
|
|
|
"item", layer,
|
|
|
|
"param", pspec,
|
|
|
|
NULL);
|
2004-01-05 00:28:12 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_text_layer_modified (GimpImage *image,
|
2004-04-01 14:51:58 +00:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpTextLayer *layer)
|
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_TEXT_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
2004-04-01 14:51:58 +00:00
|
|
|
|
2007-01-30 15:08:59 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_TEXT_UNDO,
|
|
|
|
GIMP_UNDO_TEXT_LAYER_MODIFIED, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
|
|
|
"item", layer,
|
|
|
|
NULL);
|
2012-11-10 18:56:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
GimpUndo *
|
|
|
|
gimp_image_undo_push_text_layer_convert (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpTextLayer *layer)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_TEXT_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_TEXT_UNDO,
|
|
|
|
GIMP_UNDO_TEXT_LAYER_CONVERT, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM,
|
|
|
|
"item", layer,
|
|
|
|
NULL);
|
2004-04-01 14:51:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-03 22:25:32 +00:00
|
|
|
/**********************/
|
|
|
|
/* Layer Mask Undos */
|
|
|
|
/**********************/
|
2005-03-24 22:15:10 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_layer_mask_add (GimpImage *image,
|
2005-03-24 22:15:10 +00:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer,
|
|
|
|
GimpLayerMask *mask)
|
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER_MASK (mask), NULL);
|
|
|
|
g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (mask)), NULL);
|
2005-03-24 22:15:10 +00:00
|
|
|
|
2007-01-31 12:33:03 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_MASK_UNDO,
|
|
|
|
GIMP_UNDO_LAYER_MASK_ADD, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
"item", layer,
|
|
|
|
"layer-mask", mask,
|
|
|
|
NULL);
|
2005-03-24 22:15:10 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_layer_mask_remove (GimpImage *image,
|
2005-03-24 22:15:10 +00:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer,
|
|
|
|
GimpLayerMask *mask)
|
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER_MASK (mask), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (mask)), NULL);
|
2007-01-31 12:33:03 +00:00
|
|
|
g_return_val_if_fail (gimp_layer_mask_get_layer (mask) == layer, NULL);
|
|
|
|
g_return_val_if_fail (gimp_layer_get_mask (layer) == mask, NULL);
|
2005-03-24 22:15:10 +00:00
|
|
|
|
2007-01-31 12:33:03 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_MASK_UNDO,
|
|
|
|
GIMP_UNDO_LAYER_MASK_REMOVE, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
"item", layer,
|
|
|
|
"layer-mask", mask,
|
|
|
|
NULL);
|
2005-03-24 22:15:10 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2012-03-17 18:30:13 +01:00
|
|
|
gimp_image_undo_push_layer_mask_apply (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer)
|
2005-03-24 22:15:10 +00:00
|
|
|
{
|
2007-01-31 18:50:39 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2012-03-17 18:30:13 +01:00
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
2007-01-31 18:50:39 +00:00
|
|
|
|
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_MASK_PROP_UNDO,
|
|
|
|
GIMP_UNDO_LAYER_MASK_APPLY, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
2012-03-17 18:30:13 +01:00
|
|
|
"item", layer,
|
2007-01-31 18:50:39 +00:00
|
|
|
NULL);
|
2005-03-24 22:15:10 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2012-03-17 18:30:13 +01:00
|
|
|
gimp_image_undo_push_layer_mask_show (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpLayer *layer)
|
2005-03-24 22:15:10 +00:00
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2012-03-17 18:30:13 +01:00
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
|
2005-03-24 22:15:10 +00:00
|
|
|
|
2007-01-31 18:50:39 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_MASK_PROP_UNDO,
|
|
|
|
GIMP_UNDO_LAYER_MASK_SHOW, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM_META,
|
2012-03-17 18:30:13 +01:00
|
|
|
"item", layer,
|
2007-01-31 18:50:39 +00:00
|
|
|
NULL);
|
2005-03-24 22:15:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-03 22:25:32 +00:00
|
|
|
/*******************/
|
|
|
|
/* Channel Undos */
|
|
|
|
/*******************/
|
2002-02-23 17:29:19 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_channel_add (GimpImage *image,
|
2003-02-14 14:14:29 +00:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpChannel *channel,
|
2020-04-04 02:49:51 +02:00
|
|
|
GList *prev_channels)
|
2002-02-23 17:29:19 +00:00
|
|
|
{
|
2020-04-04 02:49:51 +02:00
|
|
|
GList *iter;
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), NULL);
|
|
|
|
g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (channel)), NULL);
|
2020-04-04 02:49:51 +02:00
|
|
|
|
|
|
|
for (iter = prev_channels; iter; iter = iter->next)
|
|
|
|
g_return_val_if_fail (GIMP_IS_CHANNEL (iter->data), NULL);
|
2004-11-12 10:56:23 +00:00
|
|
|
|
2007-01-31 12:33:03 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_CHANNEL_UNDO,
|
|
|
|
GIMP_UNDO_CHANNEL_ADD, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
2020-04-04 02:49:51 +02:00
|
|
|
"item", channel,
|
|
|
|
"prev-channels", prev_channels,
|
2007-01-31 12:33:03 +00:00
|
|
|
NULL);
|
2002-02-23 17:29:19 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_channel_remove (GimpImage *image,
|
2003-02-14 14:14:29 +00:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpChannel *channel,
|
2009-08-03 19:21:51 +02:00
|
|
|
GimpChannel *prev_parent,
|
2003-02-14 14:14:29 +00:00
|
|
|
gint prev_position,
|
2020-04-04 02:49:51 +02:00
|
|
|
GList *prev_channels)
|
2002-02-23 17:29:19 +00:00
|
|
|
{
|
2020-04-04 02:49:51 +02:00
|
|
|
GList *iter;
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)), NULL);
|
2009-08-03 19:21:51 +02:00
|
|
|
g_return_val_if_fail (prev_parent == NULL || GIMP_IS_CHANNEL (prev_parent),
|
|
|
|
NULL);
|
2020-04-04 02:49:51 +02:00
|
|
|
|
|
|
|
for (iter = prev_channels; iter; iter = iter->next)
|
|
|
|
g_return_val_if_fail (GIMP_IS_CHANNEL (iter->data), NULL);
|
2004-11-12 10:56:23 +00:00
|
|
|
|
2007-01-31 12:33:03 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_CHANNEL_UNDO,
|
|
|
|
GIMP_UNDO_CHANNEL_REMOVE, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
"item", channel,
|
2009-08-03 19:21:51 +02:00
|
|
|
"prev-parent", prev_parent,
|
2007-01-31 12:33:03 +00:00
|
|
|
"prev-position", prev_position,
|
2020-04-04 02:49:51 +02:00
|
|
|
"prev-channels", prev_channels,
|
2007-01-31 12:33:03 +00:00
|
|
|
NULL);
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_channel_color (GimpImage *image,
|
2003-03-17 02:25:39 +00:00
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpChannel *channel)
|
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), NULL);
|
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)), NULL);
|
2003-03-17 02:25:39 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_CHANNEL_PROP_UNDO,
|
|
|
|
GIMP_UNDO_CHANNEL_COLOR, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_DRAWABLE,
|
|
|
|
"item", channel,
|
|
|
|
NULL);
|
2003-03-17 02:25:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-03 22:25:32 +00:00
|
|
|
/*******************/
|
2024-07-11 00:07:44 +00:00
|
|
|
/* Path Undos */
|
2007-02-03 22:25:32 +00:00
|
|
|
/*******************/
|
2002-02-24 21:00:58 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2024-07-11 00:07:44 +00:00
|
|
|
gimp_image_undo_push_path_add (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
2024-07-12 06:16:25 +00:00
|
|
|
GimpPath *path,
|
2024-07-11 00:07:44 +00:00
|
|
|
GList *prev_paths)
|
2002-02-24 21:00:58 +00:00
|
|
|
{
|
2020-04-04 02:49:51 +02:00
|
|
|
GList *iter;
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2024-07-12 06:16:25 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_PATH (path), NULL);
|
2024-07-11 00:07:44 +00:00
|
|
|
g_return_val_if_fail (! gimp_item_is_attached (GIMP_ITEM (path)), NULL);
|
2020-04-04 02:49:51 +02:00
|
|
|
|
2024-07-11 00:07:44 +00:00
|
|
|
for (iter = prev_paths; iter; iter = iter->next)
|
2024-07-12 06:16:25 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_PATH (iter->data), NULL);
|
2004-11-12 10:56:23 +00:00
|
|
|
|
2024-07-13 05:07:57 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_PATH_UNDO,
|
|
|
|
GIMP_UNDO_PATH_ADD, undo_desc,
|
2007-01-31 12:33:03 +00:00
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
2024-07-11 00:07:44 +00:00
|
|
|
"item", path,
|
2024-07-13 05:07:57 +00:00
|
|
|
"prev-paths", prev_paths,
|
2007-01-31 12:33:03 +00:00
|
|
|
NULL);
|
2002-02-24 21:00:58 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2024-07-11 00:07:44 +00:00
|
|
|
gimp_image_undo_push_path_remove (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
2024-07-12 06:16:25 +00:00
|
|
|
GimpPath *path,
|
|
|
|
GimpPath *prev_parent,
|
2024-07-11 00:07:44 +00:00
|
|
|
gint prev_position,
|
|
|
|
GList *prev_paths)
|
2002-02-24 21:00:58 +00:00
|
|
|
{
|
2020-04-04 02:49:51 +02:00
|
|
|
GList *iter;
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2024-07-12 06:16:25 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_PATH (path), NULL);
|
2024-07-11 00:07:44 +00:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (path)), NULL);
|
2024-07-12 06:16:25 +00:00
|
|
|
g_return_val_if_fail (prev_parent == NULL || GIMP_IS_PATH (prev_parent),
|
2009-08-03 19:21:51 +02:00
|
|
|
NULL);
|
2020-04-04 02:49:51 +02:00
|
|
|
|
2024-07-11 00:07:44 +00:00
|
|
|
for (iter = prev_paths; iter; iter = iter->next)
|
2024-07-12 06:16:25 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_PATH (iter->data), NULL);
|
2004-11-12 10:56:23 +00:00
|
|
|
|
2024-07-13 05:07:57 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_PATH_UNDO,
|
|
|
|
GIMP_UNDO_PATH_REMOVE, undo_desc,
|
2007-01-31 12:33:03 +00:00
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
2024-07-11 00:07:44 +00:00
|
|
|
"item", path,
|
2009-08-03 19:21:51 +02:00
|
|
|
"prev-parent", prev_parent,
|
2007-01-31 12:33:03 +00:00
|
|
|
"prev-position", prev_position,
|
2024-07-13 05:07:57 +00:00
|
|
|
"prev-paths", prev_paths,
|
2007-01-31 12:33:03 +00:00
|
|
|
NULL);
|
2002-02-24 21:00:58 +00:00
|
|
|
}
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2024-07-11 00:07:44 +00:00
|
|
|
gimp_image_undo_push_path_mod (GimpImage *image,
|
|
|
|
const gchar *undo_desc,
|
2024-07-12 06:16:25 +00:00
|
|
|
GimpPath *path)
|
2002-02-24 21:00:58 +00:00
|
|
|
{
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2024-07-12 06:16:25 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_PATH (path), NULL);
|
2024-07-11 00:07:44 +00:00
|
|
|
g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (path)), NULL);
|
2003-02-14 14:14:29 +00:00
|
|
|
|
2024-07-13 05:07:57 +00:00
|
|
|
return gimp_image_undo_push (image, GIMP_TYPE_PATH_MOD_UNDO,
|
|
|
|
GIMP_UNDO_PATH_MOD, undo_desc,
|
|
|
|
GIMP_DIRTY_ITEM | GIMP_DIRTY_PATH,
|
2024-07-11 00:07:44 +00:00
|
|
|
"item", path,
|
2007-01-31 19:56:41 +00:00
|
|
|
NULL);
|
2002-02-24 21:00:58 +00:00
|
|
|
}
|
|
|
|
|
2002-02-23 17:29:19 +00:00
|
|
|
|
2007-02-03 22:25:32 +00:00
|
|
|
/******************************/
|
|
|
|
/* Floating Selection Undos */
|
|
|
|
/******************************/
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_fs_to_layer (GimpImage *image,
|
2003-02-14 14:14:29 +00:00
|
|
|
const gchar *undo_desc,
|
2007-01-31 21:54:17 +00:00
|
|
|
GimpLayer *floating_layer)
|
2002-02-23 17:29:19 +00:00
|
|
|
{
|
2007-02-03 21:58:12 +00:00
|
|
|
GimpUndo *undo;
|
2002-02-23 17:29:19 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_LAYER (floating_layer), NULL);
|
2003-02-14 14:14:29 +00:00
|
|
|
|
2016-05-20 16:46:26 +02:00
|
|
|
undo = gimp_image_undo_push (image, GIMP_TYPE_FLOATING_SELECTION_UNDO,
|
2007-02-03 21:58:12 +00:00
|
|
|
GIMP_UNDO_FS_TO_LAYER, undo_desc,
|
|
|
|
GIMP_DIRTY_IMAGE_STRUCTURE,
|
|
|
|
"item", floating_layer,
|
|
|
|
NULL);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2007-02-03 21:58:12 +00:00
|
|
|
return undo;
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
|
1999-04-23 06:07:09 +00:00
|
|
|
|
2002-02-23 17:29:19 +00:00
|
|
|
/******************************************************************************/
|
|
|
|
/* Something for which programmer is too lazy to write an undo function for */
|
2003-02-12 17:11:34 +00:00
|
|
|
/******************************************************************************/
|
1999-08-23 14:34:58 +00:00
|
|
|
|
2007-02-03 21:58:12 +00:00
|
|
|
static void
|
|
|
|
undo_pop_cantundo (GimpUndo *undo,
|
|
|
|
GimpUndoMode undo_mode,
|
|
|
|
GimpUndoAccumulator *accum)
|
|
|
|
{
|
|
|
|
switch (undo_mode)
|
|
|
|
{
|
|
|
|
case GIMP_UNDO_MODE_UNDO:
|
|
|
|
gimp_message (undo->image->gimp, NULL, GIMP_MESSAGE_WARNING,
|
2009-08-29 12:40:40 +02:00
|
|
|
_("Can't undo %s"), gimp_object_get_name (undo));
|
2007-02-03 21:58:12 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_UNDO_MODE_REDO:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1999-08-23 14:34:58 +00:00
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
GimpUndo *
|
2006-03-28 17:08:36 +00:00
|
|
|
gimp_image_undo_push_cantundo (GimpImage *image,
|
2003-02-14 14:14:29 +00:00
|
|
|
const gchar *undo_desc)
|
1999-08-23 14:34:58 +00:00
|
|
|
{
|
2007-02-03 21:58:12 +00:00
|
|
|
GimpUndo *undo;
|
|
|
|
|
2007-01-29 18:49:06 +00:00
|
|
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
2003-02-14 14:14:29 +00:00
|
|
|
|
2000-01-25 23:06:12 +00: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-23 17:29:19 +00:00
|
|
|
* any adequate undo facility.
|
|
|
|
*/
|
1999-08-23 14:34:58 +00:00
|
|
|
|
2007-02-03 21:58:12 +00:00
|
|
|
undo = gimp_image_undo_push (image, GIMP_TYPE_UNDO,
|
2007-01-29 18:49:06 +00:00
|
|
|
GIMP_UNDO_CANT, undo_desc,
|
|
|
|
GIMP_DIRTY_ALL,
|
|
|
|
NULL);
|
1999-08-23 14:34:58 +00:00
|
|
|
|
2007-02-03 21:58:12 +00:00
|
|
|
if (undo)
|
|
|
|
g_signal_connect (undo, "pop",
|
|
|
|
G_CALLBACK (undo_pop_cantundo),
|
|
|
|
NULL);
|
1999-08-23 14:34:58 +00:00
|
|
|
|
2007-02-03 21:58:12 +00:00
|
|
|
return undo;
|
1999-08-23 14:34:58 +00:00
|
|
|
}
|