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 "core-types.h"
25
#include "gimplayermask.h"
26
#include "gimplayermaskpropundo.h"
29
static GObject * gimp_layer_mask_prop_undo_constructor (GType type,
31
GObjectConstructParam *params);
33
static void gimp_layer_mask_prop_undo_pop (GimpUndo *undo,
34
GimpUndoMode undo_mode,
35
GimpUndoAccumulator *accum);
38
G_DEFINE_TYPE (GimpLayerMaskPropUndo, gimp_layer_mask_prop_undo,
41
#define parent_class gimp_layer_mask_prop_undo_parent_class
45
gimp_layer_mask_prop_undo_class_init (GimpLayerMaskPropUndoClass *klass)
47
GObjectClass *object_class = G_OBJECT_CLASS (klass);
48
GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass);
50
object_class->constructor = gimp_layer_mask_prop_undo_constructor;
52
undo_class->pop = gimp_layer_mask_prop_undo_pop;
56
gimp_layer_mask_prop_undo_init (GimpLayerMaskPropUndo *undo)
61
gimp_layer_mask_prop_undo_constructor (GType type,
63
GObjectConstructParam *params)
66
GimpLayerMaskPropUndo *layer_mask_prop_undo;
67
GimpLayerMask *layer_mask;
69
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
71
layer_mask_prop_undo = GIMP_LAYER_MASK_PROP_UNDO (object);
73
g_assert (GIMP_IS_LAYER_MASK (GIMP_ITEM_UNDO (object)->item));
75
layer_mask = GIMP_LAYER_MASK (GIMP_ITEM_UNDO (object)->item);
77
switch (GIMP_UNDO (object)->undo_type)
79
case GIMP_UNDO_LAYER_MASK_APPLY:
80
layer_mask_prop_undo->apply = gimp_layer_mask_get_apply (layer_mask);
83
case GIMP_UNDO_LAYER_MASK_SHOW:
84
layer_mask_prop_undo->show = gimp_layer_mask_get_show (layer_mask);
88
g_assert_not_reached ();
95
gimp_layer_mask_prop_undo_pop (GimpUndo *undo,
96
GimpUndoMode undo_mode,
97
GimpUndoAccumulator *accum)
99
GimpLayerMaskPropUndo *layer_mask_prop_undo = GIMP_LAYER_MASK_PROP_UNDO (undo);
100
GimpLayerMask *layer_mask = GIMP_LAYER_MASK (GIMP_ITEM_UNDO (undo)->item);
102
GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
104
switch (undo->undo_type)
106
case GIMP_UNDO_LAYER_MASK_APPLY:
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;
116
case GIMP_UNDO_LAYER_MASK_SHOW:
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;
127
g_assert_not_reached ();