1
/* Gimp - The GNU Image Manipulation Program
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
#include <glib-object.h>
23
#include "vectors-types.h"
25
#include "core/gimpimage.h"
27
#include "gimpvectors.h"
28
#include "gimpvectorspropundo.h"
31
static GObject * gimp_vectors_prop_undo_constructor (GType type,
33
GObjectConstructParam *params);
35
static void gimp_vectors_prop_undo_pop (GimpUndo *undo,
36
GimpUndoMode undo_mode,
37
GimpUndoAccumulator *accum);
40
G_DEFINE_TYPE (GimpVectorsPropUndo, gimp_vectors_prop_undo, GIMP_TYPE_ITEM_UNDO)
42
#define parent_class gimp_vectors_prop_undo_parent_class
46
gimp_vectors_prop_undo_class_init (GimpVectorsPropUndoClass *klass)
48
GObjectClass *object_class = G_OBJECT_CLASS (klass);
49
GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass);
51
object_class->constructor = gimp_vectors_prop_undo_constructor;
53
undo_class->pop = gimp_vectors_prop_undo_pop;
57
gimp_vectors_prop_undo_init (GimpVectorsPropUndo *undo)
62
gimp_vectors_prop_undo_constructor (GType type,
64
GObjectConstructParam *params)
67
GimpVectorsPropUndo *vectors_prop_undo;
71
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
73
vectors_prop_undo = GIMP_VECTORS_PROP_UNDO (object);
75
g_assert (GIMP_IS_VECTORS (GIMP_ITEM_UNDO (object)->item));
77
image = GIMP_UNDO (object)->image;
78
vectors = GIMP_VECTORS (GIMP_ITEM_UNDO (object)->item);
80
switch (GIMP_UNDO (object)->undo_type)
82
case GIMP_UNDO_VECTORS_REPOSITION:
83
vectors_prop_undo->position = gimp_image_get_vectors_index (image, vectors);
87
g_assert_not_reached ();
94
gimp_vectors_prop_undo_pop (GimpUndo *undo,
95
GimpUndoMode undo_mode,
96
GimpUndoAccumulator *accum)
98
GimpVectorsPropUndo *vectors_prop_undo = GIMP_VECTORS_PROP_UNDO (undo);
99
GimpVectors *vectors = GIMP_VECTORS (GIMP_ITEM_UNDO (undo)->item);
101
GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
103
switch (undo->undo_type)
105
case GIMP_UNDO_VECTORS_REPOSITION:
109
position = gimp_image_get_vectors_index (undo->image, vectors);
110
gimp_image_position_vectors (undo->image, vectors,
111
vectors_prop_undo->position,
113
vectors_prop_undo->position = position;
118
g_assert_not_reached ();