mirror of https://github.com/GNOME/gimp.git
app/core/Makefile.am app/core/core-types.h new undo class which handles
2007-01-28 Michael Natterer <mitch@gimp.org> * app/core/Makefile.am * app/core/core-types.h * app/core/gimpimageundo.[ch]: new undo class which handles GIMP_UNDO_IMAGE_TYPE, GIMP_UNDO_IMAGE_SIZE and GIMP_UNDO_IMAGE_RESOLUTION. * app/core/gimpimage-undo-push.c: use the new undo class and remove the resp. code here. * app/core/gimpimage-undo.h: changed include guards to not conflict with gimpimageundo.h svn path=/trunk/; revision=21789
This commit is contained in:
parent
50bbab0ec7
commit
11a43d6a50
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
2007-01-28 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* app/core/Makefile.am
|
||||||
|
* app/core/core-types.h
|
||||||
|
* app/core/gimpimageundo.[ch]: new undo class which handles
|
||||||
|
GIMP_UNDO_IMAGE_TYPE, GIMP_UNDO_IMAGE_SIZE and
|
||||||
|
GIMP_UNDO_IMAGE_RESOLUTION.
|
||||||
|
|
||||||
|
* app/core/gimpimage-undo-push.c: use the new undo class and
|
||||||
|
remove the resp. code here.
|
||||||
|
|
||||||
|
* app/core/gimpimage-undo.h: changed include guards to not
|
||||||
|
conflict with gimpimageundo.h
|
||||||
|
|
||||||
2007-01-28 Sven Neumann <sven@gimp.org>
|
2007-01-28 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/dialogs/authors.xsl: fixed spelling of "auto-generated".
|
* app/dialogs/authors.xsl: fixed spelling of "auto-generated".
|
||||||
|
|
|
@ -186,6 +186,8 @@ libappcore_a_sources = \
|
||||||
gimpimage-undo.h \
|
gimpimage-undo.h \
|
||||||
gimpimage-undo-push.c \
|
gimpimage-undo-push.c \
|
||||||
gimpimage-undo-push.h \
|
gimpimage-undo-push.h \
|
||||||
|
gimpimageundo.c \
|
||||||
|
gimpimageundo.h \
|
||||||
gimpimagefile.c \
|
gimpimagefile.c \
|
||||||
gimpimagefile.h \
|
gimpimagefile.h \
|
||||||
gimpimagemap.c \
|
gimpimagemap.c \
|
||||||
|
|
|
@ -110,6 +110,7 @@ typedef struct _GimpLayerMask GimpLayerMask;
|
||||||
/* undo objects */
|
/* undo objects */
|
||||||
|
|
||||||
typedef struct _GimpUndo GimpUndo;
|
typedef struct _GimpUndo GimpUndo;
|
||||||
|
typedef struct _GimpImageUndo GimpImageUndo;
|
||||||
typedef struct _GimpItemUndo GimpItemUndo;
|
typedef struct _GimpItemUndo GimpItemUndo;
|
||||||
typedef struct _GimpChannelUndo GimpChannelUndo;
|
typedef struct _GimpChannelUndo GimpChannelUndo;
|
||||||
typedef struct _GimpDrawableUndo GimpDrawableUndo;
|
typedef struct _GimpDrawableUndo GimpDrawableUndo;
|
||||||
|
|
|
@ -27,11 +27,8 @@
|
||||||
|
|
||||||
#include "core-types.h"
|
#include "core-types.h"
|
||||||
|
|
||||||
#include "base/pixel-region.h"
|
|
||||||
#include "base/tile-manager.h"
|
#include "base/tile-manager.h"
|
||||||
|
|
||||||
#include "paint-funcs/paint-funcs.h"
|
|
||||||
|
|
||||||
#include "gimp.h"
|
#include "gimp.h"
|
||||||
#include "gimp-parasites.h"
|
#include "gimp-parasites.h"
|
||||||
#include "gimpchannelundo.h"
|
#include "gimpchannelundo.h"
|
||||||
|
@ -45,6 +42,7 @@
|
||||||
#include "gimpimage-sample-points.h"
|
#include "gimpimage-sample-points.h"
|
||||||
#include "gimpimage-undo.h"
|
#include "gimpimage-undo.h"
|
||||||
#include "gimpimage-undo-push.h"
|
#include "gimpimage-undo-push.h"
|
||||||
|
#include "gimpimageundo.h"
|
||||||
#include "gimplayer.h"
|
#include "gimplayer.h"
|
||||||
#include "gimplayer-floating-sel.h"
|
#include "gimplayer-floating-sel.h"
|
||||||
#include "gimplayermask.h"
|
#include "gimplayermask.h"
|
||||||
|
@ -64,19 +62,6 @@
|
||||||
/* Image Type Undo */
|
/* Image Type Undo */
|
||||||
/*********************/
|
/*********************/
|
||||||
|
|
||||||
typedef struct _ImageTypeUndo ImageTypeUndo;
|
|
||||||
|
|
||||||
struct _ImageTypeUndo
|
|
||||||
{
|
|
||||||
GimpImageBaseType base_type;
|
|
||||||
};
|
|
||||||
|
|
||||||
static gboolean undo_pop_image_type (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode,
|
|
||||||
GimpUndoAccumulator *accum);
|
|
||||||
static void undo_free_image_type (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode);
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gimp_image_undo_push_image_type (GimpImage *image,
|
gimp_image_undo_push_image_type (GimpImage *image,
|
||||||
const gchar *undo_desc)
|
const gchar *undo_desc)
|
||||||
|
@ -85,71 +70,25 @@ gimp_image_undo_push_image_type (GimpImage *image,
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||||
|
|
||||||
if ((new = gimp_image_undo_push (image, GIMP_TYPE_UNDO,
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
||||||
sizeof (ImageTypeUndo),
|
0, 0,
|
||||||
sizeof (ImageTypeUndo),
|
|
||||||
GIMP_UNDO_IMAGE_TYPE, undo_desc,
|
GIMP_UNDO_IMAGE_TYPE, undo_desc,
|
||||||
GIMP_DIRTY_IMAGE,
|
GIMP_DIRTY_IMAGE,
|
||||||
undo_pop_image_type,
|
NULL,
|
||||||
undo_free_image_type,
|
NULL,
|
||||||
NULL)))
|
NULL)))
|
||||||
{
|
{
|
||||||
ImageTypeUndo *itu = new->data;
|
|
||||||
|
|
||||||
itu->base_type = image->base_type;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
undo_pop_image_type (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode,
|
|
||||||
GimpUndoAccumulator *accum)
|
|
||||||
{
|
|
||||||
ImageTypeUndo *itu = undo->data;
|
|
||||||
GimpImageBaseType tmp;
|
|
||||||
|
|
||||||
tmp = itu->base_type;
|
|
||||||
itu->base_type = undo->image->base_type;
|
|
||||||
g_object_set (undo->image, "base-type", tmp, NULL);
|
|
||||||
|
|
||||||
gimp_image_colormap_changed (undo->image, -1);
|
|
||||||
|
|
||||||
if (itu->base_type != undo->image->base_type)
|
|
||||||
accum->mode_changed = TRUE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
undo_free_image_type (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode)
|
|
||||||
{
|
|
||||||
g_free (undo->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*********************/
|
/*********************/
|
||||||
/* Image Size Undo */
|
/* Image Size Undo */
|
||||||
/*********************/
|
/*********************/
|
||||||
|
|
||||||
typedef struct _ImageSizeUndo ImageSizeUndo;
|
|
||||||
|
|
||||||
struct _ImageSizeUndo
|
|
||||||
{
|
|
||||||
gint width;
|
|
||||||
gint height;
|
|
||||||
};
|
|
||||||
|
|
||||||
static gboolean undo_pop_image_size (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode,
|
|
||||||
GimpUndoAccumulator *accum);
|
|
||||||
static void undo_free_image_size (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode);
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gimp_image_undo_push_image_size (GimpImage *image,
|
gimp_image_undo_push_image_size (GimpImage *image,
|
||||||
const gchar *undo_desc)
|
const gchar *undo_desc)
|
||||||
|
@ -158,82 +97,25 @@ gimp_image_undo_push_image_size (GimpImage *image,
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||||
|
|
||||||
if ((new = gimp_image_undo_push (image, GIMP_TYPE_UNDO,
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
||||||
sizeof (ImageSizeUndo),
|
0, 0,
|
||||||
sizeof (ImageSizeUndo),
|
|
||||||
GIMP_UNDO_IMAGE_SIZE, undo_desc,
|
GIMP_UNDO_IMAGE_SIZE, undo_desc,
|
||||||
GIMP_DIRTY_IMAGE | GIMP_DIRTY_IMAGE_SIZE,
|
GIMP_DIRTY_IMAGE | GIMP_DIRTY_IMAGE_SIZE,
|
||||||
undo_pop_image_size,
|
NULL,
|
||||||
undo_free_image_size,
|
NULL,
|
||||||
NULL)))
|
NULL)))
|
||||||
{
|
{
|
||||||
ImageSizeUndo *isu = new->data;
|
|
||||||
|
|
||||||
isu->width = image->width;
|
|
||||||
isu->height = image->height;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
undo_pop_image_size (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode,
|
|
||||||
GimpUndoAccumulator *accum)
|
|
||||||
{
|
|
||||||
ImageSizeUndo *isu = undo->data;
|
|
||||||
gint width;
|
|
||||||
gint height;
|
|
||||||
|
|
||||||
width = isu->width;
|
|
||||||
height = isu->height;
|
|
||||||
|
|
||||||
isu->width = undo->image->width;
|
|
||||||
isu->height = undo->image->height;
|
|
||||||
|
|
||||||
g_object_set (undo->image,
|
|
||||||
"width", width,
|
|
||||||
"height", height,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (gimp_image_get_mask (undo->image)));
|
|
||||||
|
|
||||||
if (undo->image->width != isu->width ||
|
|
||||||
undo->image->height != isu->height)
|
|
||||||
accum->size_changed = TRUE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
undo_free_image_size (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode)
|
|
||||||
{
|
|
||||||
g_free (undo->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************/
|
/***************************/
|
||||||
/* Image Resolution Undo */
|
/* Image Resolution Undo */
|
||||||
/***************************/
|
/***************************/
|
||||||
|
|
||||||
typedef struct _ResolutionUndo ResolutionUndo;
|
|
||||||
|
|
||||||
struct _ResolutionUndo
|
|
||||||
{
|
|
||||||
gdouble xres;
|
|
||||||
gdouble yres;
|
|
||||||
GimpUnit unit;
|
|
||||||
};
|
|
||||||
|
|
||||||
static gboolean undo_pop_image_resolution (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode,
|
|
||||||
GimpUndoAccumulator *accum);
|
|
||||||
static void undo_free_image_resolution (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode);
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gimp_image_undo_push_image_resolution (GimpImage *image,
|
gimp_image_undo_push_image_resolution (GimpImage *image,
|
||||||
const gchar *undo_desc)
|
const gchar *undo_desc)
|
||||||
|
@ -242,73 +124,20 @@ gimp_image_undo_push_image_resolution (GimpImage *image,
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||||
|
|
||||||
if ((new = gimp_image_undo_push (image, GIMP_TYPE_UNDO,
|
if ((new = gimp_image_undo_push (image, GIMP_TYPE_IMAGE_UNDO,
|
||||||
sizeof (ResolutionUndo),
|
0, 0,
|
||||||
sizeof (ResolutionUndo),
|
|
||||||
GIMP_UNDO_IMAGE_RESOLUTION, undo_desc,
|
GIMP_UNDO_IMAGE_RESOLUTION, undo_desc,
|
||||||
GIMP_DIRTY_IMAGE,
|
GIMP_DIRTY_IMAGE,
|
||||||
undo_pop_image_resolution,
|
NULL,
|
||||||
undo_free_image_resolution,
|
NULL,
|
||||||
NULL)))
|
NULL)))
|
||||||
{
|
{
|
||||||
ResolutionUndo *ru = new->data;
|
|
||||||
|
|
||||||
ru->xres = image->xresolution;
|
|
||||||
ru->yres = image->yresolution;
|
|
||||||
ru->unit = image->resolution_unit;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
undo_pop_image_resolution (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode,
|
|
||||||
GimpUndoAccumulator *accum)
|
|
||||||
{
|
|
||||||
ResolutionUndo *ru = undo->data;
|
|
||||||
|
|
||||||
if (ABS (ru->xres - undo->image->xresolution) >= 1e-5 ||
|
|
||||||
ABS (ru->yres - undo->image->yresolution) >= 1e-5)
|
|
||||||
{
|
|
||||||
gdouble xres;
|
|
||||||
gdouble yres;
|
|
||||||
|
|
||||||
xres = undo->image->xresolution;
|
|
||||||
yres = undo->image->yresolution;
|
|
||||||
|
|
||||||
undo->image->xresolution = ru->xres;
|
|
||||||
undo->image->yresolution = ru->yres;
|
|
||||||
|
|
||||||
ru->xres = xres;
|
|
||||||
ru->yres = yres;
|
|
||||||
|
|
||||||
accum->resolution_changed = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ru->unit != undo->image->resolution_unit)
|
|
||||||
{
|
|
||||||
GimpUnit unit;
|
|
||||||
|
|
||||||
unit = undo->image->resolution_unit;
|
|
||||||
undo->image->resolution_unit = ru->unit;
|
|
||||||
ru->unit = unit;
|
|
||||||
|
|
||||||
accum->unit_changed = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
undo_free_image_resolution (GimpUndo *undo,
|
|
||||||
GimpUndoMode undo_mode)
|
|
||||||
{
|
|
||||||
g_free (undo->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/****************/
|
/****************/
|
||||||
/* Guide Undo */
|
/* Guide Undo */
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __GIMP_IMAGE_UNDO_H__
|
#ifndef __GIMP_IMAGE__UNDO_H__
|
||||||
#define __GIMP_IMAGE_UNDO_H__
|
#define __GIMP_IMAGE__UNDO_H__
|
||||||
|
|
||||||
|
|
||||||
gboolean gimp_image_undo (GimpImage *image);
|
gboolean gimp_image_undo (GimpImage *image);
|
||||||
|
@ -51,4 +51,4 @@ GimpUndo * gimp_image_undo_can_compress (GimpImage *image,
|
||||||
GimpUndo * gimp_image_undo_get_fadeable (GimpImage *image);
|
GimpUndo * gimp_image_undo_get_fadeable (GimpImage *image);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_IMAGE_UNDO_H__ */
|
#endif /* __GIMP_IMAGE__UNDO_H__ */
|
||||||
|
|
|
@ -0,0 +1,166 @@
|
||||||
|
/* GIMP - The GNU 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
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <glib-object.h>
|
||||||
|
|
||||||
|
#include "libgimpbase/gimpbase.h"
|
||||||
|
|
||||||
|
#include "core-types.h"
|
||||||
|
|
||||||
|
#include "gimpdrawable.h"
|
||||||
|
#include "gimpimage.h"
|
||||||
|
#include "gimpimageundo.h"
|
||||||
|
|
||||||
|
|
||||||
|
static GObject * gimp_image_undo_constructor (GType type,
|
||||||
|
guint n_params,
|
||||||
|
GObjectConstructParam *params);
|
||||||
|
|
||||||
|
static void gimp_image_undo_pop (GimpUndo *undo,
|
||||||
|
GimpUndoMode undo_mode,
|
||||||
|
GimpUndoAccumulator *accum);
|
||||||
|
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (GimpImageUndo, gimp_image_undo, GIMP_TYPE_UNDO)
|
||||||
|
|
||||||
|
#define parent_class gimp_image_undo_parent_class
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_image_undo_class_init (GimpImageUndoClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass);
|
||||||
|
|
||||||
|
object_class->constructor = gimp_image_undo_constructor;
|
||||||
|
|
||||||
|
undo_class->pop = gimp_image_undo_pop;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_image_undo_init (GimpImageUndo *undo)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static GObject *
|
||||||
|
gimp_image_undo_constructor (GType type,
|
||||||
|
guint n_params,
|
||||||
|
GObjectConstructParam *params)
|
||||||
|
{
|
||||||
|
GObject *object;
|
||||||
|
GimpImageUndo *image_undo;
|
||||||
|
GimpImage *image;
|
||||||
|
|
||||||
|
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
|
||||||
|
|
||||||
|
image_undo = GIMP_IMAGE_UNDO (object);
|
||||||
|
|
||||||
|
image = GIMP_UNDO (object)->image;
|
||||||
|
|
||||||
|
image_undo->base_type = image->base_type;
|
||||||
|
image_undo->width = image->width;
|
||||||
|
image_undo->height = image->height;
|
||||||
|
image_undo->xresolution = image->xresolution;
|
||||||
|
image_undo->yresolution = image->yresolution;
|
||||||
|
image_undo->resolution_unit = image->resolution_unit;
|
||||||
|
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_image_undo_pop (GimpUndo *undo,
|
||||||
|
GimpUndoMode undo_mode,
|
||||||
|
GimpUndoAccumulator *accum)
|
||||||
|
{
|
||||||
|
GimpImageUndo *image_undo = GIMP_IMAGE_UNDO (undo);
|
||||||
|
|
||||||
|
GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
|
||||||
|
|
||||||
|
if (undo->undo_type == GIMP_UNDO_IMAGE_TYPE)
|
||||||
|
{
|
||||||
|
GimpImageBaseType base_type;
|
||||||
|
|
||||||
|
base_type = image_undo->base_type;
|
||||||
|
image_undo->base_type = undo->image->base_type;
|
||||||
|
g_object_set (undo->image, "base-type", base_type, NULL);
|
||||||
|
|
||||||
|
gimp_image_colormap_changed (undo->image, -1);
|
||||||
|
|
||||||
|
if (image_undo->base_type != undo->image->base_type)
|
||||||
|
accum->mode_changed = TRUE;
|
||||||
|
}
|
||||||
|
else if (undo->undo_type == GIMP_UNDO_IMAGE_SIZE)
|
||||||
|
{
|
||||||
|
gint width;
|
||||||
|
gint height;
|
||||||
|
|
||||||
|
width = image_undo->width;
|
||||||
|
height = image_undo->height;
|
||||||
|
|
||||||
|
image_undo->width = undo->image->width;
|
||||||
|
image_undo->height = undo->image->height;
|
||||||
|
|
||||||
|
g_object_set (undo->image,
|
||||||
|
"width", width,
|
||||||
|
"height", height,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (gimp_image_get_mask (undo->image)));
|
||||||
|
|
||||||
|
if (undo->image->width != image_undo->width ||
|
||||||
|
undo->image->height != image_undo->height)
|
||||||
|
accum->size_changed = TRUE;
|
||||||
|
}
|
||||||
|
else if (undo->undo_type == GIMP_UNDO_IMAGE_RESOLUTION)
|
||||||
|
{
|
||||||
|
if (ABS (image_undo->xresolution - undo->image->xresolution) >= 1e-5 ||
|
||||||
|
ABS (image_undo->yresolution - undo->image->yresolution) >= 1e-5)
|
||||||
|
{
|
||||||
|
gdouble xres;
|
||||||
|
gdouble yres;
|
||||||
|
|
||||||
|
xres = undo->image->xresolution;
|
||||||
|
yres = undo->image->yresolution;
|
||||||
|
|
||||||
|
undo->image->xresolution = image_undo->xresolution;
|
||||||
|
undo->image->yresolution = image_undo->yresolution;
|
||||||
|
|
||||||
|
image_undo->xresolution = xres;
|
||||||
|
image_undo->yresolution = yres;
|
||||||
|
|
||||||
|
accum->resolution_changed = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (image_undo->resolution_unit != undo->image->resolution_unit)
|
||||||
|
{
|
||||||
|
GimpUnit unit;
|
||||||
|
|
||||||
|
unit = undo->image->resolution_unit;
|
||||||
|
undo->image->resolution_unit = image_undo->resolution_unit;
|
||||||
|
image_undo->resolution_unit = unit;
|
||||||
|
|
||||||
|
accum->unit_changed = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_assert_not_reached ();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
/* GIMP - The GNU 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
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GIMP_IMAGE_UNDO_H__
|
||||||
|
#define __GIMP_IMAGE_UNDO_H__
|
||||||
|
|
||||||
|
|
||||||
|
#include "gimpundo.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define GIMP_TYPE_IMAGE_UNDO (gimp_image_undo_get_type ())
|
||||||
|
#define GIMP_IMAGE_UNDO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_IMAGE_UNDO, GimpImageUndo))
|
||||||
|
#define GIMP_IMAGE_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_IMAGE_UNDO, GimpImageUndoClass))
|
||||||
|
#define GIMP_IS_IMAGE_UNDO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_IMAGE_UNDO))
|
||||||
|
#define GIMP_IS_IMAGE_UNDO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_IMAGE_UNDO))
|
||||||
|
#define GIMP_IMAGE_UNDO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_IMAGE_UNDO, GimpImageUndoClass))
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _GimpImageUndoClass GimpImageUndoClass;
|
||||||
|
|
||||||
|
struct _GimpImageUndo
|
||||||
|
{
|
||||||
|
GimpUndo parent_instance;
|
||||||
|
|
||||||
|
GimpImageBaseType base_type;
|
||||||
|
gint width;
|
||||||
|
gint height;
|
||||||
|
gdouble xresolution;
|
||||||
|
gdouble yresolution;
|
||||||
|
GimpUnit resolution_unit;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GimpImageUndoClass
|
||||||
|
{
|
||||||
|
GimpUndoClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
GType gimp_image_undo_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __GIMP_IMAGE_UNDO_H__ */
|
Loading…
Reference in New Issue