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

« back to all changes in this revision

Viewing changes to app/core/gimplayermaskpropundo.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 "core-types.h"
 
24
 
 
25
#include "gimplayermask.h"
 
26
#include "gimplayermaskpropundo.h"
 
27
 
 
28
 
 
29
static GObject * gimp_layer_mask_prop_undo_constructor (GType                  type,
 
30
                                                        guint                  n_params,
 
31
                                                        GObjectConstructParam *params);
 
32
 
 
33
static void      gimp_layer_mask_prop_undo_pop         (GimpUndo              *undo,
 
34
                                                        GimpUndoMode           undo_mode,
 
35
                                                        GimpUndoAccumulator   *accum);
 
36
 
 
37
 
 
38
G_DEFINE_TYPE (GimpLayerMaskPropUndo, gimp_layer_mask_prop_undo,
 
39
               GIMP_TYPE_ITEM_UNDO)
 
40
 
 
41
#define parent_class gimp_layer_mask_prop_undo_parent_class
 
42
 
 
43
 
 
44
static void
 
45
gimp_layer_mask_prop_undo_class_init (GimpLayerMaskPropUndoClass *klass)
 
46
{
 
47
  GObjectClass  *object_class = G_OBJECT_CLASS (klass);
 
48
  GimpUndoClass *undo_class   = GIMP_UNDO_CLASS (klass);
 
49
 
 
50
  object_class->constructor = gimp_layer_mask_prop_undo_constructor;
 
51
 
 
52
  undo_class->pop           = gimp_layer_mask_prop_undo_pop;
 
53
}
 
54
 
 
55
static void
 
56
gimp_layer_mask_prop_undo_init (GimpLayerMaskPropUndo *undo)
 
57
{
 
58
}
 
59
 
 
60
static GObject *
 
61
gimp_layer_mask_prop_undo_constructor (GType                  type,
 
62
                                       guint                  n_params,
 
63
                                       GObjectConstructParam *params)
 
64
{
 
65
  GObject               *object;
 
66
  GimpLayerMaskPropUndo *layer_mask_prop_undo;
 
67
  GimpLayerMask         *layer_mask;
 
68
 
 
69
  object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
 
70
 
 
71
  layer_mask_prop_undo = GIMP_LAYER_MASK_PROP_UNDO (object);
 
72
 
 
73
  g_assert (GIMP_IS_LAYER_MASK (GIMP_ITEM_UNDO (object)->item));
 
74
 
 
75
  layer_mask = GIMP_LAYER_MASK (GIMP_ITEM_UNDO (object)->item);
 
76
 
 
77
  switch (GIMP_UNDO (object)->undo_type)
 
78
    {
 
79
    case GIMP_UNDO_LAYER_MASK_APPLY:
 
80
      layer_mask_prop_undo->apply = gimp_layer_mask_get_apply (layer_mask);
 
81
      break;
 
82
 
 
83
    case GIMP_UNDO_LAYER_MASK_SHOW:
 
84
      layer_mask_prop_undo->show = gimp_layer_mask_get_show (layer_mask);
 
85
      break;
 
86
 
 
87
    default:
 
88
      g_assert_not_reached ();
 
89
    }
 
90
 
 
91
  return object;
 
92
}
 
93
 
 
94
static void
 
95
gimp_layer_mask_prop_undo_pop (GimpUndo            *undo,
 
96
                               GimpUndoMode         undo_mode,
 
97
                               GimpUndoAccumulator *accum)
 
98
{
 
99
  GimpLayerMaskPropUndo *layer_mask_prop_undo = GIMP_LAYER_MASK_PROP_UNDO (undo);
 
100
  GimpLayerMask         *layer_mask           = GIMP_LAYER_MASK (GIMP_ITEM_UNDO (undo)->item);
 
101
 
 
102
  GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
 
103
 
 
104
  switch (undo->undo_type)
 
105
    {
 
106
    case GIMP_UNDO_LAYER_MASK_APPLY:
 
107
      {
 
108
        gboolean apply;
 
109
 
 
110
        apply = gimp_layer_mask_get_apply (layer_mask);
 
111
        gimp_layer_mask_set_apply (layer_mask, layer_mask_prop_undo->apply, FALSE);
 
112
        layer_mask_prop_undo->apply = apply;
 
113
      }
 
114
      break;
 
115
 
 
116
    case GIMP_UNDO_LAYER_MASK_SHOW:
 
117
      {
 
118
        gboolean show;
 
119
 
 
120
        show = gimp_layer_mask_get_show (layer_mask);
 
121
        gimp_layer_mask_set_show (layer_mask, layer_mask_prop_undo->show, FALSE);
 
122
        layer_mask_prop_undo->show = show;
 
123
      }
 
124
      break;
 
125
 
 
126
    default:
 
127
      g_assert_not_reached ();
 
128
    }
 
129
}