~ubuntu-branches/ubuntu/vivid/gimp/vivid

« back to all changes in this revision

Viewing changes to app/vectors/gimpvectorspropundo.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach
  • Date: 2012-05-08 18:50:03 UTC
  • mto: (1.1.26) (0.5.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 71.
  • Revision ID: package-import@ubuntu.com-20120508185003-tltkvbaysf8d2426
ImportĀ upstreamĀ versionĀ 2.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Gimp - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
4
 
 * This program is free software; you can redistribute it and/or modify
 
4
 * This program is free software: you can redistribute it and/or modify
5
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
 
6
 * the Free Software Foundation; either version 3 of the License, or
7
7
 * (at your option) any later version.
8
8
 *
9
9
 * This program is distributed in the hope that it will be useful,
12
12
 * GNU General Public License for more details.
13
13
 *
14
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.
 
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
16
 */
18
17
 
19
18
#include "config.h"
20
19
 
21
 
#include <glib-object.h>
 
20
#include <gegl.h>
22
21
 
23
22
#include "vectors-types.h"
24
23
 
28
27
#include "gimpvectorspropundo.h"
29
28
 
30
29
 
31
 
static GObject * gimp_vectors_prop_undo_constructor (GType                  type,
32
 
                                                     guint                  n_params,
33
 
                                                     GObjectConstructParam *params);
 
30
static void   gimp_vectors_prop_undo_constructed (GObject             *object);
34
31
 
35
 
static void      gimp_vectors_prop_undo_pop         (GimpUndo              *undo,
36
 
                                                     GimpUndoMode           undo_mode,
37
 
                                                     GimpUndoAccumulator   *accum);
 
32
static void   gimp_vectors_prop_undo_pop         (GimpUndo            *undo,
 
33
                                                  GimpUndoMode         undo_mode,
 
34
                                                  GimpUndoAccumulator *accum);
38
35
 
39
36
 
40
37
G_DEFINE_TYPE (GimpVectorsPropUndo, gimp_vectors_prop_undo, GIMP_TYPE_ITEM_UNDO)
48
45
  GObjectClass  *object_class = G_OBJECT_CLASS (klass);
49
46
  GimpUndoClass *undo_class   = GIMP_UNDO_CLASS (klass);
50
47
 
51
 
  object_class->constructor = gimp_vectors_prop_undo_constructor;
 
48
  object_class->constructed = gimp_vectors_prop_undo_constructed;
52
49
 
53
50
  undo_class->pop           = gimp_vectors_prop_undo_pop;
54
51
}
58
55
{
59
56
}
60
57
 
61
 
static GObject *
62
 
gimp_vectors_prop_undo_constructor (GType                  type,
63
 
                                    guint                  n_params,
64
 
                                    GObjectConstructParam *params)
 
58
static void
 
59
gimp_vectors_prop_undo_constructed (GObject *object)
65
60
{
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);
 
61
  /* GimpVectors *vectors; */
 
62
 
 
63
  if (G_OBJECT_CLASS (parent_class)->constructed)
 
64
    G_OBJECT_CLASS (parent_class)->constructed (object);
74
65
 
75
66
  g_assert (GIMP_IS_VECTORS (GIMP_ITEM_UNDO (object)->item));
76
67
 
77
 
  image   = GIMP_UNDO (object)->image;
78
 
  vectors = GIMP_VECTORS (GIMP_ITEM_UNDO (object)->item);
 
68
  /* vectors = GIMP_VECTORS (GIMP_ITEM_UNDO (object)->item); */
79
69
 
80
70
  switch (GIMP_UNDO (object)->undo_type)
81
71
    {
82
 
    case GIMP_UNDO_VECTORS_REPOSITION:
83
 
      vectors_prop_undo->position = gimp_image_get_vectors_index (image, vectors);
84
 
      break;
85
 
 
86
72
    default:
87
73
      g_assert_not_reached ();
88
74
    }
89
 
 
90
 
  return object;
91
75
}
92
76
 
93
77
static void
95
79
                            GimpUndoMode         undo_mode,
96
80
                            GimpUndoAccumulator *accum)
97
81
{
 
82
#if 0
98
83
  GimpVectorsPropUndo *vectors_prop_undo = GIMP_VECTORS_PROP_UNDO (undo);
99
84
  GimpVectors         *vectors           = GIMP_VECTORS (GIMP_ITEM_UNDO (undo)->item);
 
85
#endif
100
86
 
101
87
  GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
102
88
 
103
89
  switch (undo->undo_type)
104
90
    {
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
91
    default:
118
92
      g_assert_not_reached ();
119
93
    }