~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/vectors/gimpvectorspropundo.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Gimp - The GNU Image Manipulation Program
 
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 
3
 *
 
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.
 
8
 *
 
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.
 
13
 *
 
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.
 
17
 */
 
18
 
 
19
#include "config.h"
 
20
 
 
21
#include <glib-object.h>
 
22
 
 
23
#include "vectors-types.h"
 
24
 
 
25
#include "core/gimpimage.h"
 
26
 
 
27
#include "gimpvectors.h"
 
28
#include "gimpvectorspropundo.h"
 
29
 
 
30
 
 
31
static GObject * gimp_vectors_prop_undo_constructor (GType                  type,
 
32
                                                     guint                  n_params,
 
33
                                                     GObjectConstructParam *params);
 
34
 
 
35
static void      gimp_vectors_prop_undo_pop         (GimpUndo              *undo,
 
36
                                                     GimpUndoMode           undo_mode,
 
37
                                                     GimpUndoAccumulator   *accum);
 
38
 
 
39
 
 
40
G_DEFINE_TYPE (GimpVectorsPropUndo, gimp_vectors_prop_undo, GIMP_TYPE_ITEM_UNDO)
 
41
 
 
42
#define parent_class gimp_vectors_prop_undo_parent_class
 
43
 
 
44
 
 
45
static void
 
46
gimp_vectors_prop_undo_class_init (GimpVectorsPropUndoClass *klass)
 
47
{
 
48
  GObjectClass  *object_class = G_OBJECT_CLASS (klass);
 
49
  GimpUndoClass *undo_class   = GIMP_UNDO_CLASS (klass);
 
50
 
 
51
  object_class->constructor = gimp_vectors_prop_undo_constructor;
 
52
 
 
53
  undo_class->pop           = gimp_vectors_prop_undo_pop;
 
54
}
 
55
 
 
56
static void
 
57
gimp_vectors_prop_undo_init (GimpVectorsPropUndo *undo)
 
58
{
 
59
}
 
60
 
 
61
static GObject *
 
62
gimp_vectors_prop_undo_constructor (GType                  type,
 
63
                                    guint                  n_params,
 
64
                                    GObjectConstructParam *params)
 
65
{
 
66
  GObject             *object;
 
67
  GimpVectorsPropUndo *vectors_prop_undo;
 
68
  GimpImage           *image;
 
69
  GimpVectors         *vectors;
 
70
 
 
71
  object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
 
72
 
 
73
  vectors_prop_undo = GIMP_VECTORS_PROP_UNDO (object);
 
74
 
 
75
  g_assert (GIMP_IS_VECTORS (GIMP_ITEM_UNDO (object)->item));
 
76
 
 
77
  image   = GIMP_UNDO (object)->image;
 
78
  vectors = GIMP_VECTORS (GIMP_ITEM_UNDO (object)->item);
 
79
 
 
80
  switch (GIMP_UNDO (object)->undo_type)
 
81
    {
 
82
    case GIMP_UNDO_VECTORS_REPOSITION:
 
83
      vectors_prop_undo->position = gimp_image_get_vectors_index (image, vectors);
 
84
      break;
 
85
 
 
86
    default:
 
87
      g_assert_not_reached ();
 
88
    }
 
89
 
 
90
  return object;
 
91
}
 
92
 
 
93
static void
 
94
gimp_vectors_prop_undo_pop (GimpUndo            *undo,
 
95
                            GimpUndoMode         undo_mode,
 
96
                            GimpUndoAccumulator *accum)
 
97
{
 
98
  GimpVectorsPropUndo *vectors_prop_undo = GIMP_VECTORS_PROP_UNDO (undo);
 
99
  GimpVectors         *vectors           = GIMP_VECTORS (GIMP_ITEM_UNDO (undo)->item);
 
100
 
 
101
  GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
 
102
 
 
103
  switch (undo->undo_type)
 
104
    {
 
105
    case GIMP_UNDO_VECTORS_REPOSITION:
 
106
      {
 
107
        gint position;
 
108
 
 
109
        position = gimp_image_get_vectors_index (undo->image, vectors);
 
110
        gimp_image_position_vectors (undo->image, vectors,
 
111
                                     vectors_prop_undo->position,
 
112
                                     FALSE, NULL);
 
113
        vectors_prop_undo->position = position;
 
114
      }
 
115
      break;
 
116
 
 
117
    default:
 
118
      g_assert_not_reached ();
 
119
    }
 
120
}