[gimp/metadata-browser] app: move the layer mask show, edit, apply API from GimpLayerMask to GimpLayer
- From: Roman Joost <romanofski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/metadata-browser] app: move the layer mask show, edit, apply API from GimpLayerMask to GimpLayer
- Date: Wed, 12 Sep 2012 23:14:52 +0000 (UTC)
commit a1c3f4875eabe339d597aa93913f4a71bdba6791
Author: Michael Natterer <mitch gimp org>
Date: Sat Mar 17 18:30:13 2012 +0100
app: move the layer mask show, edit, apply API from GimpLayerMask to GimpLayer
because it would require really evil hacks to honor these properties
in the gegl projection if they were on the mask, and because they
actually belong to the layer.
app/actions/layers-actions.c | 8 +-
app/actions/layers-commands.c | 8 +-
app/core/gimpimage-merge.c | 2 +-
app/core/gimpimage-undo-push.c | 24 +++---
app/core/gimpimage-undo-push.h | 4 +-
app/core/gimpimage.c | 2 +-
app/core/gimplayer-project.c | 4 +-
app/core/gimplayer.c | 161 +++++++++++++++++++++++++++++++--
app/core/gimplayer.h | 20 ++++
app/core/gimplayermask.c | 160 +--------------------------------
app/core/gimplayermask.h | 40 ++-------
app/core/gimplayermaskpropundo.c | 22 +++---
app/display/gimpcanvaslayerboundary.c | 21 ++---
app/display/gimpdisplayshell-style.c | 3 +-
app/pdb/layer-cmds.c | 12 ++--
app/widgets/gimplayertreeview.c | 48 +++++-----
app/xcf/xcf-load.c | 30 +++++-
app/xcf/xcf-save.c | 8 +-
tools/pdbgen/pdb/layer.pdb | 12 ++--
19 files changed, 294 insertions(+), 295 deletions(-)
---
diff --git a/app/actions/layers-actions.c b/app/actions/layers-actions.c
index 0a68fdc..6400f6c 100644
--- a/app/actions/layers-actions.c
+++ b/app/actions/layers-actions.c
@@ -24,10 +24,10 @@
#include "actions-types.h"
+#include "core/gimpchannel.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h"
-#include "core/gimplayermask.h"
#include "text/gimptextlayer.h"
@@ -659,9 +659,9 @@ layers_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("layers-mask-show", layer && !fs && !ac && mask);
SET_SENSITIVE ("layers-mask-disable", layer && !fs && !ac && mask);
- SET_ACTIVE ("layers-mask-edit", mask && gimp_layer_mask_get_edit (mask));
- SET_ACTIVE ("layers-mask-show", mask && gimp_layer_mask_get_show (mask));
- SET_ACTIVE ("layers-mask-disable", mask && !gimp_layer_mask_get_apply (mask));
+ SET_ACTIVE ("layers-mask-edit", mask && gimp_layer_get_edit_mask (layer));
+ SET_ACTIVE ("layers-mask-show", mask && gimp_layer_get_show_mask (layer));
+ SET_ACTIVE ("layers-mask-disable", mask && !gimp_layer_get_apply_mask (layer));
SET_SENSITIVE ("layers-mask-selection-replace", layer && !fs && !ac && mask);
SET_SENSITIVE ("layers-mask-selection-add", layer && !fs && !ac && mask);
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index 0a19989..55fd134 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -31,6 +31,7 @@
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
+#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpgrouplayer.h"
#include "core/gimpimage.h"
@@ -39,7 +40,6 @@
#include "core/gimpimage-undo-push.h"
#include "core/gimpitemundo.h"
#include "core/gimplayer-floating-sel.h"
-#include "core/gimplayermask.h"
#include "core/gimppickable.h"
#include "core/gimptoolinfo.h"
#include "core/gimpundostack.h"
@@ -766,7 +766,7 @@ layers_mask_edit_cmd_callback (GtkAction *action,
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- gimp_layer_mask_set_edit (mask, active);
+ gimp_layer_set_edit_mask (layer, active);
gimp_image_flush (image);
}
}
@@ -788,7 +788,7 @@ layers_mask_show_cmd_callback (GtkAction *action,
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- gimp_layer_mask_set_show (mask, active, TRUE);
+ gimp_layer_set_show_mask (layer, active, TRUE);
gimp_image_flush (image);
}
}
@@ -810,7 +810,7 @@ layers_mask_disable_cmd_callback (GtkAction *action,
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- gimp_layer_mask_set_apply (mask, ! active, TRUE);
+ gimp_layer_set_apply_mask (layer, ! active, TRUE);
gimp_image_flush (image);
}
}
diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c
index 23453fc..542cf12 100644
--- a/app/core/gimpimage-merge.c
+++ b/app/core/gimpimage-merge.c
@@ -651,7 +651,7 @@ gimp_image_merge_layers (GimpImage *image,
FALSE);
if (gimp_layer_get_mask (layer) &&
- gimp_layer_mask_get_apply (layer->mask))
+ gimp_layer_get_apply_mask (layer))
{
TileManager *tiles;
diff --git a/app/core/gimpimage-undo-push.c b/app/core/gimpimage-undo-push.c
index ec071f1..33b70e5 100644
--- a/app/core/gimpimage-undo-push.c
+++ b/app/core/gimpimage-undo-push.c
@@ -656,34 +656,34 @@ gimp_image_undo_push_layer_mask_remove (GimpImage *image,
}
GimpUndo *
-gimp_image_undo_push_layer_mask_apply (GimpImage *image,
- const gchar *undo_desc,
- GimpLayerMask *mask)
+gimp_image_undo_push_layer_mask_apply (GimpImage *image,
+ const gchar *undo_desc,
+ GimpLayer *layer)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
- g_return_val_if_fail (GIMP_IS_LAYER_MASK (mask), NULL);
- g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (mask)), NULL);
+ g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
+ g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_MASK_PROP_UNDO,
GIMP_UNDO_LAYER_MASK_APPLY, undo_desc,
GIMP_DIRTY_ITEM_META,
- "item", mask,
+ "item", layer,
NULL);
}
GimpUndo *
-gimp_image_undo_push_layer_mask_show (GimpImage *image,
- const gchar *undo_desc,
- GimpLayerMask *mask)
+gimp_image_undo_push_layer_mask_show (GimpImage *image,
+ const gchar *undo_desc,
+ GimpLayer *layer)
{
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
- g_return_val_if_fail (GIMP_IS_LAYER_MASK (mask), NULL);
- g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (mask)), NULL);
+ g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
+ g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (layer)), NULL);
return gimp_image_undo_push (image, GIMP_TYPE_LAYER_MASK_PROP_UNDO,
GIMP_UNDO_LAYER_MASK_SHOW, undo_desc,
GIMP_DIRTY_ITEM_META,
- "item", mask,
+ "item", layer,
NULL);
}
diff --git a/app/core/gimpimage-undo-push.h b/app/core/gimpimage-undo-push.h
index 8baea0c..82b1ee3 100644
--- a/app/core/gimpimage-undo-push.h
+++ b/app/core/gimpimage-undo-push.h
@@ -164,10 +164,10 @@ GimpUndo * gimp_image_undo_push_layer_mask_remove (GimpImage *image,
GimpLayerMask *mask);
GimpUndo * gimp_image_undo_push_layer_mask_apply (GimpImage *image,
const gchar *undo_desc,
- GimpLayerMask *mask);
+ GimpLayer *layer);
GimpUndo * gimp_image_undo_push_layer_mask_show (GimpImage *image,
const gchar *undo_desc,
- GimpLayerMask *mask);
+ GimpLayer *layer);
/* channel undos */
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 6105bdc..2dd6408 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -3214,7 +3214,7 @@ gimp_image_get_active_drawable (const GimpImage *image)
GimpLayer *layer = GIMP_LAYER (active_layer);
GimpLayerMask *mask = gimp_layer_get_mask (layer);
- if (mask && gimp_layer_mask_get_edit (mask))
+ if (mask && gimp_layer_get_edit_mask (layer))
return GIMP_DRAWABLE (mask);
else
return GIMP_DRAWABLE (layer);
diff --git a/app/core/gimplayer-project.c b/app/core/gimplayer-project.c
index e091450..7b96a60 100644
--- a/app/core/gimplayer-project.c
+++ b/app/core/gimplayer-project.c
@@ -46,7 +46,7 @@ gimp_layer_project_region (GimpDrawable *drawable,
GimpLayer *layer = GIMP_LAYER (drawable);
GimpLayerMask *mask = gimp_layer_get_mask (layer);
- if (mask && gimp_layer_mask_get_show (mask))
+ if (mask && gimp_layer_get_show_mask (layer))
{
/* If we're showing the layer mask instead of the layer... */
@@ -81,7 +81,7 @@ gimp_layer_project_region (GimpDrawable *drawable,
x, y, width, height,
&temp_layer_tiles);
- if (mask && gimp_layer_mask_get_apply (mask))
+ if (mask && gimp_layer_get_apply_mask (layer))
{
gimp_drawable_init_src_region (GIMP_DRAWABLE (mask), &maskPR,
x, y, width, height,
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 74a7c5c..64f54e8 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -65,6 +65,9 @@ enum
MODE_CHANGED,
LOCK_ALPHA_CHANGED,
MASK_CHANGED,
+ APPLY_MASK_CHANGED,
+ EDIT_MASK_CHANGED,
+ SHOW_MASK_CHANGED,
LAST_SIGNAL
};
@@ -241,6 +244,33 @@ gimp_layer_class_init (GimpLayerClass *klass)
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ layer_signals[APPLY_MASK_CHANGED] =
+ g_signal_new ("apply-mask-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpLayerClass, apply_mask_changed),
+ NULL, NULL,
+ gimp_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ layer_signals[EDIT_MASK_CHANGED] =
+ g_signal_new ("edit-mask-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpLayerClass, edit_mask_changed),
+ NULL, NULL,
+ gimp_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ layer_signals[SHOW_MASK_CHANGED] =
+ g_signal_new ("show-mask-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpLayerClass, show_mask_changed),
+ NULL, NULL,
+ gimp_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
object_class->set_property = gimp_layer_set_property;
object_class->get_property = gimp_layer_get_property;
object_class->dispose = gimp_layer_dispose;
@@ -295,6 +325,9 @@ gimp_layer_class_init (GimpLayerClass *klass)
klass->mode_changed = NULL;
klass->lock_alpha_changed = NULL;
klass->mask_changed = NULL;
+ klass->apply_mask_changed = NULL;
+ klass->edit_mask_changed = NULL;
+ klass->show_mask_changed = NULL;
g_object_class_install_property (object_class, PROP_OPACITY,
g_param_spec_double ("opacity", NULL, NULL,
@@ -336,6 +369,9 @@ gimp_layer_init (GimpLayer *layer)
layer->lock_alpha = FALSE;
layer->mask = NULL;
+ layer->apply_mask = TRUE;
+ layer->edit_mask = TRUE;
+ layer->show_mask = FALSE;
/* floating selection */
layer->fs.drawable = NULL;
@@ -575,6 +611,10 @@ gimp_layer_duplicate (GimpItem *item,
mask = gimp_item_duplicate (GIMP_ITEM (layer->mask),
G_TYPE_FROM_INSTANCE (layer->mask));
gimp_layer_add_mask (new_layer, GIMP_LAYER_MASK (mask), FALSE, NULL);
+
+ new_layer->apply_mask = layer->apply_mask;
+ new_layer->edit_mask = layer->edit_mask;
+ new_layer->show_mask = layer->show_mask;
}
}
@@ -1077,10 +1117,8 @@ gimp_layer_layer_mask_update (GimpDrawable *drawable,
gint height,
GimpLayer *layer)
{
- GimpLayerMask *layer_mask = GIMP_LAYER_MASK (drawable);
-
- if (gimp_layer_mask_get_apply (layer_mask) ||
- gimp_layer_mask_get_show (layer_mask))
+ if (gimp_layer_get_apply_mask (layer) ||
+ gimp_layer_get_show_mask (layer))
{
gimp_drawable_update (GIMP_DRAWABLE (layer),
x, y, width, height);
@@ -1511,6 +1549,9 @@ gimp_layer_add_mask (GimpLayer *layer,
layer, mask);
layer->mask = g_object_ref_sink (mask);
+ layer->apply_mask = TRUE;
+ layer->edit_mask = TRUE;
+ layer->show_mask = FALSE;
gimp_layer_mask_set_layer (mask, layer);
@@ -1524,8 +1565,8 @@ gimp_layer_add_mask (GimpLayer *layer,
layer->opacity_node, "aux");
}
- if (gimp_layer_mask_get_apply (mask) ||
- gimp_layer_mask_get_show (mask))
+ if (gimp_layer_get_apply_mask (layer) ||
+ gimp_layer_get_show_mask (layer))
{
gimp_drawable_update (GIMP_DRAWABLE (layer),
0, 0,
@@ -1792,6 +1833,8 @@ gimp_layer_apply_mask (GimpLayer *layer,
C_("undo-type", "Apply Layer Mask") :
C_("undo-type", "Delete Layer Mask"));
+ gimp_image_undo_push_layer_mask_show (image, NULL, layer);
+ gimp_image_undo_push_layer_mask_apply (image, NULL, layer);
gimp_image_undo_push_layer_mask_remove (image, NULL, layer, mask);
if (mode == GIMP_MASK_APPLY &&
@@ -1802,9 +1845,9 @@ gimp_layer_apply_mask (GimpLayer *layer,
}
/* check if applying the mask changes the projection */
- if (gimp_layer_mask_get_show (mask) ||
- (mode == GIMP_MASK_APPLY && ! gimp_layer_mask_get_apply (mask)) ||
- (mode == GIMP_MASK_DISCARD && gimp_layer_mask_get_apply (mask)))
+ if (gimp_layer_get_show_mask (layer) ||
+ (mode == GIMP_MASK_APPLY && ! gimp_layer_get_apply_mask (layer)) ||
+ (mode == GIMP_MASK_DISCARD && gimp_layer_get_apply_mask (layer)))
{
view_changed = TRUE;
}
@@ -1867,6 +1910,106 @@ gimp_layer_apply_mask (GimpLayer *layer,
}
void
+gimp_layer_set_apply_mask (GimpLayer *layer,
+ gboolean apply,
+ gboolean push_undo)
+{
+ g_return_if_fail (GIMP_IS_LAYER (layer));
+ g_return_if_fail (layer->mask != NULL);
+
+ if (layer->apply_mask != apply)
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
+
+ if (push_undo)
+ gimp_image_undo_push_layer_mask_apply (image,
+ apply ?
+ C_("undo-type", "Enable Layer Mask") :
+ C_("undo-type", "Disable Layer Mask"),
+ layer);
+
+ layer->apply_mask = apply ? TRUE : FALSE;
+
+ gimp_drawable_update (GIMP_DRAWABLE (layer),
+ 0, 0,
+ gimp_item_get_width (GIMP_ITEM (layer)),
+ gimp_item_get_height (GIMP_ITEM (layer)));
+
+ g_signal_emit (layer, layer_signals[APPLY_MASK_CHANGED], 0);
+ }
+}
+
+gboolean
+gimp_layer_get_apply_mask (const GimpLayer *layer)
+{
+ g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
+ g_return_val_if_fail (layer->mask, FALSE);
+
+ return layer->apply_mask;
+}
+
+void
+gimp_layer_set_edit_mask (GimpLayer *layer,
+ gboolean edit)
+{
+ g_return_if_fail (GIMP_IS_LAYER (layer));
+ g_return_if_fail (layer->mask != NULL);
+
+ if (layer->edit_mask != edit)
+ {
+ layer->edit_mask = edit ? TRUE : FALSE;
+
+ g_signal_emit (layer, layer_signals[EDIT_MASK_CHANGED], 0);
+ }
+}
+
+gboolean
+gimp_layer_get_edit_mask (const GimpLayer *layer)
+{
+ g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
+ g_return_val_if_fail (layer->mask, FALSE);
+
+ return layer->edit_mask;
+}
+
+void
+gimp_layer_set_show_mask (GimpLayer *layer,
+ gboolean show,
+ gboolean push_undo)
+{
+ g_return_if_fail (GIMP_IS_LAYER (layer));
+ g_return_if_fail (layer->mask != NULL);
+
+ if (layer->show_mask != show)
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
+
+ if (push_undo)
+ gimp_image_undo_push_layer_mask_show (image,
+ C_("undo-type", "Show Layer Mask"),
+ layer);
+
+ layer->show_mask = show ? TRUE : FALSE;
+
+ gimp_drawable_update (GIMP_DRAWABLE (layer),
+ 0, 0,
+ gimp_item_get_width (GIMP_ITEM (layer)),
+ gimp_item_get_height (GIMP_ITEM (layer)));
+
+ g_signal_emit (layer, layer_signals[SHOW_MASK_CHANGED], 0);
+ }
+}
+
+gboolean
+gimp_layer_get_show_mask (const GimpLayer *layer)
+{
+ g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
+ g_return_val_if_fail (layer->mask, FALSE);
+
+ return layer->show_mask;
+}
+
+void
gimp_layer_add_alpha (GimpLayer *layer)
{
GimpItem *item;
diff --git a/app/core/gimplayer.h b/app/core/gimplayer.h
index a491719..1f4c0f7 100644
--- a/app/core/gimplayer.h
+++ b/app/core/gimplayer.h
@@ -41,6 +41,9 @@ struct _GimpLayer
gboolean lock_alpha; /* lock the alpha channel */
GimpLayerMask *mask; /* possible layer mask */
+ gboolean apply_mask; /* controls mask application */
+ gboolean edit_mask; /* edit mask or layer? */
+ gboolean show_mask; /* show mask or layer? */
GeglNode *opacity_node;
@@ -62,6 +65,9 @@ struct _GimpLayerClass
void (* mode_changed) (GimpLayer *layer);
void (* lock_alpha_changed) (GimpLayer *layer);
void (* mask_changed) (GimpLayer *layer);
+ void (* apply_mask_changed) (GimpLayer *layer);
+ void (* edit_mask_changed) (GimpLayer *layer);
+ void (* show_mask_changed) (GimpLayer *layer);
};
@@ -116,6 +122,20 @@ void gimp_layer_apply_mask (GimpLayer *layer,
GimpMaskApplyMode mode,
gboolean push_undo);
+void gimp_layer_set_apply_mask (GimpLayer *layer,
+ gboolean apply,
+ gboolean push_undo);
+gboolean gimp_layer_get_apply_mask (const GimpLayer *layer);
+
+void gimp_layer_set_edit_mask (GimpLayer *layer,
+ gboolean edit);
+gboolean gimp_layer_get_edit_mask (const GimpLayer *layer);
+
+void gimp_layer_set_show_mask (GimpLayer *layer,
+ gboolean show,
+ gboolean push_undo);
+gboolean gimp_layer_get_show_mask (const GimpLayer *layer);
+
void gimp_layer_add_alpha (GimpLayer *layer);
void gimp_layer_flatten (GimpLayer *layer,
GimpContext *context);
diff --git a/app/core/gimplayermask.c b/app/core/gimplayermask.c
index 59bd341..50d6943 100644
--- a/app/core/gimplayermask.c
+++ b/app/core/gimplayermask.c
@@ -31,20 +31,10 @@
#include "gimpimage-undo-push.h"
#include "gimplayer.h"
#include "gimplayermask.h"
-#include "gimpmarshal.h"
#include "gimp-intl.h"
-enum
-{
- APPLY_CHANGED,
- EDIT_CHANGED,
- SHOW_CHANGED,
- LAST_SIGNAL
-};
-
-
static gboolean gimp_layer_mask_is_attached (const GimpItem *item);
static gboolean gimp_layer_mask_is_content_locked (const GimpItem *item);
static GimpItemTree * gimp_layer_mask_get_tree (GimpItem *item);
@@ -60,8 +50,6 @@ G_DEFINE_TYPE (GimpLayerMask, gimp_layer_mask, GIMP_TYPE_CHANNEL)
#define parent_class gimp_layer_mask_parent_class
-static guint layer_mask_signals[LAST_SIGNAL] = { 0 };
-
static void
gimp_layer_mask_class_init (GimpLayerMaskClass *klass)
@@ -69,37 +57,8 @@ gimp_layer_mask_class_init (GimpLayerMaskClass *klass)
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
GimpItemClass *item_class = GIMP_ITEM_CLASS (klass);
- layer_mask_signals[APPLY_CHANGED] =
- g_signal_new ("apply-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GimpLayerMaskClass, apply_changed),
- NULL, NULL,
- gimp_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- layer_mask_signals[EDIT_CHANGED] =
- g_signal_new ("edit-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GimpLayerMaskClass, edit_changed),
- NULL, NULL,
- gimp_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- layer_mask_signals[SHOW_CHANGED] =
- g_signal_new ("show-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GimpLayerMaskClass, show_changed),
- NULL, NULL,
- gimp_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
viewable_class->default_stock_id = "gimp-layer-mask";
- klass->edit_changed = NULL;
-
item_class->is_attached = gimp_layer_mask_is_attached;
item_class->is_content_locked = gimp_layer_mask_is_content_locked;
item_class->get_tree = gimp_layer_mask_get_tree;
@@ -112,10 +71,7 @@ gimp_layer_mask_class_init (GimpLayerMaskClass *klass)
static void
gimp_layer_mask_init (GimpLayerMask *layer_mask)
{
- layer_mask->layer = NULL;
- layer_mask->apply_mask = TRUE;
- layer_mask->edit_mask = TRUE;
- layer_mask->show_mask = FALSE;
+ layer_mask->layer = NULL;
}
static gboolean
@@ -158,16 +114,6 @@ gimp_layer_mask_duplicate (GimpItem *item,
new_item = GIMP_ITEM_CLASS (parent_class)->duplicate (item, new_type);
- if (GIMP_IS_LAYER_MASK (new_item))
- {
- GimpLayerMask *layer_mask = GIMP_LAYER_MASK (item);
- GimpLayerMask *new_layer_mask = GIMP_LAYER_MASK (new_item);
-
- new_layer_mask->apply_mask = layer_mask->apply_mask;
- new_layer_mask->edit_mask = layer_mask->edit_mask;
- new_layer_mask->show_mask = layer_mask->show_mask;
- }
-
return new_item;
}
@@ -246,107 +192,3 @@ gimp_layer_mask_get_layer (const GimpLayerMask *layer_mask)
return layer_mask->layer;
}
-
-void
-gimp_layer_mask_set_apply (GimpLayerMask *layer_mask,
- gboolean apply,
- gboolean push_undo)
-{
- g_return_if_fail (GIMP_IS_LAYER_MASK (layer_mask));
-
- if (layer_mask->apply_mask != apply)
- {
- GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer_mask));
-
- if (push_undo)
- gimp_image_undo_push_layer_mask_apply (image,
- apply ?
- C_("undo-type", "Enable Layer Mask") :
- C_("undo-type", "Disable Layer Mask"),
- layer_mask);
-
- layer_mask->apply_mask = apply ? TRUE : FALSE;
-
- if (layer_mask->layer)
- {
- GimpDrawable *drawable = GIMP_DRAWABLE (layer_mask->layer);
-
- gimp_drawable_update (drawable,
- 0, 0,
- gimp_item_get_width (GIMP_ITEM (drawable)),
- gimp_item_get_height (GIMP_ITEM (drawable)));
- }
-
- g_signal_emit (layer_mask, layer_mask_signals[APPLY_CHANGED], 0);
- }
-}
-
-gboolean
-gimp_layer_mask_get_apply (const GimpLayerMask *layer_mask)
-{
- g_return_val_if_fail (GIMP_IS_LAYER_MASK (layer_mask), FALSE);
-
- return layer_mask->apply_mask;
-}
-
-void
-gimp_layer_mask_set_edit (GimpLayerMask *layer_mask,
- gboolean edit)
-{
- g_return_if_fail (GIMP_IS_LAYER_MASK (layer_mask));
-
- if (layer_mask->edit_mask != edit)
- {
- layer_mask->edit_mask = edit ? TRUE : FALSE;
-
- g_signal_emit (layer_mask, layer_mask_signals[EDIT_CHANGED], 0);
- }
-}
-
-gboolean
-gimp_layer_mask_get_edit (const GimpLayerMask *layer_mask)
-{
- g_return_val_if_fail (GIMP_IS_LAYER_MASK (layer_mask), FALSE);
-
- return layer_mask->edit_mask;
-}
-
-void
-gimp_layer_mask_set_show (GimpLayerMask *layer_mask,
- gboolean show,
- gboolean push_undo)
-{
- g_return_if_fail (GIMP_IS_LAYER_MASK (layer_mask));
-
- if (layer_mask->show_mask != show)
- {
- GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer_mask));
-
- if (push_undo)
- gimp_image_undo_push_layer_mask_show (image,
- C_("undo-type", "Show Layer Mask"),
- layer_mask);
-
- layer_mask->show_mask = show ? TRUE : FALSE;
-
- if (layer_mask->layer)
- {
- GimpDrawable *drawable = GIMP_DRAWABLE (layer_mask->layer);
-
- gimp_drawable_update (drawable,
- 0, 0,
- gimp_item_get_width (GIMP_ITEM (drawable)),
- gimp_item_get_height (GIMP_ITEM (drawable)));
- }
-
- g_signal_emit (layer_mask, layer_mask_signals[SHOW_CHANGED], 0);
- }
-}
-
-gboolean
-gimp_layer_mask_get_show (const GimpLayerMask *layer_mask)
-{
- g_return_val_if_fail (GIMP_IS_LAYER_MASK (layer_mask), FALSE);
-
- return layer_mask->show_mask;
-}
diff --git a/app/core/gimplayermask.h b/app/core/gimplayermask.h
index 45b3ebb..29d4ac6 100644
--- a/app/core/gimplayermask.h
+++ b/app/core/gimplayermask.h
@@ -37,49 +37,27 @@ struct _GimpLayerMask
GimpChannel parent_instance;
GimpLayer *layer;
-
- gboolean apply_mask; /* controls mask application */
- gboolean edit_mask; /* edit mask or layer? */
- gboolean show_mask; /* show mask or layer? */
};
struct _GimpLayerMaskClass
{
GimpChannelClass parent_class;
-
- void (* apply_changed) (GimpLayerMask *layer_mask);
- void (* edit_changed) (GimpLayerMask *layer_mask);
- void (* show_changed) (GimpLayerMask *layer_mask);
};
/* function declarations */
-GType gimp_layer_mask_get_type (void) G_GNUC_CONST;
-
-GimpLayerMask * gimp_layer_mask_new (GimpImage *image,
- gint width,
- gint height,
- const gchar *name,
- const GimpRGB *color);
-
-void gimp_layer_mask_set_layer (GimpLayerMask *layer_mask,
- GimpLayer *layer);
-GimpLayer * gimp_layer_mask_get_layer (const GimpLayerMask *layer_mask);
-
-void gimp_layer_mask_set_apply (GimpLayerMask *layer_mask,
- gboolean apply,
- gboolean push_undo);
-gboolean gimp_layer_mask_get_apply (const GimpLayerMask *layer_mask);
+GType gimp_layer_mask_get_type (void) G_GNUC_CONST;
-void gimp_layer_mask_set_edit (GimpLayerMask *layer_mask,
- gboolean edit);
-gboolean gimp_layer_mask_get_edit (const GimpLayerMask *layer_mask);
+GimpLayerMask * gimp_layer_mask_new (GimpImage *image,
+ gint width,
+ gint height,
+ const gchar *name,
+ const GimpRGB *color);
-void gimp_layer_mask_set_show (GimpLayerMask *layer_mask,
- gboolean show,
- gboolean push_undo);
-gboolean gimp_layer_mask_get_show (const GimpLayerMask *layer_mask);
+void gimp_layer_mask_set_layer (GimpLayerMask *layer_mask,
+ GimpLayer *layer);
+GimpLayer * gimp_layer_mask_get_layer (const GimpLayerMask *layer_mask);
#endif /* __GIMP_LAYER_MASK_H__ */
diff --git a/app/core/gimplayermaskpropundo.c b/app/core/gimplayermaskpropundo.c
index 87bdd1d..85baf25 100644
--- a/app/core/gimplayermaskpropundo.c
+++ b/app/core/gimplayermaskpropundo.c
@@ -21,7 +21,7 @@
#include "core-types.h"
-#include "gimplayermask.h"
+#include "gimplayer.h"
#include "gimplayermaskpropundo.h"
@@ -58,25 +58,25 @@ static void
gimp_layer_mask_prop_undo_constructed (GObject *object)
{
GimpLayerMaskPropUndo *layer_mask_prop_undo;
- GimpLayerMask *layer_mask;
+ GimpLayer *layer;
layer_mask_prop_undo = GIMP_LAYER_MASK_PROP_UNDO (object);
if (G_OBJECT_CLASS (parent_class)->constructed)
G_OBJECT_CLASS (parent_class)->constructed (object);
- g_assert (GIMP_IS_LAYER_MASK (GIMP_ITEM_UNDO (object)->item));
+ g_assert (GIMP_IS_LAYER (GIMP_ITEM_UNDO (object)->item));
- layer_mask = GIMP_LAYER_MASK (GIMP_ITEM_UNDO (object)->item);
+ layer = GIMP_LAYER (GIMP_ITEM_UNDO (object)->item);
switch (GIMP_UNDO (object)->undo_type)
{
case GIMP_UNDO_LAYER_MASK_APPLY:
- layer_mask_prop_undo->apply = gimp_layer_mask_get_apply (layer_mask);
+ layer_mask_prop_undo->apply = gimp_layer_get_apply_mask (layer);
break;
case GIMP_UNDO_LAYER_MASK_SHOW:
- layer_mask_prop_undo->show = gimp_layer_mask_get_show (layer_mask);
+ layer_mask_prop_undo->show = gimp_layer_get_show_mask (layer);
break;
default:
@@ -90,7 +90,7 @@ gimp_layer_mask_prop_undo_pop (GimpUndo *undo,
GimpUndoAccumulator *accum)
{
GimpLayerMaskPropUndo *layer_mask_prop_undo = GIMP_LAYER_MASK_PROP_UNDO (undo);
- GimpLayerMask *layer_mask = GIMP_LAYER_MASK (GIMP_ITEM_UNDO (undo)->item);
+ GimpLayer *layer = GIMP_LAYER (GIMP_ITEM_UNDO (undo)->item);
GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum);
@@ -100,8 +100,8 @@ gimp_layer_mask_prop_undo_pop (GimpUndo *undo,
{
gboolean apply;
- apply = gimp_layer_mask_get_apply (layer_mask);
- gimp_layer_mask_set_apply (layer_mask, layer_mask_prop_undo->apply, FALSE);
+ apply = gimp_layer_get_apply_mask (layer);
+ gimp_layer_set_apply_mask (layer, layer_mask_prop_undo->apply, FALSE);
layer_mask_prop_undo->apply = apply;
}
break;
@@ -110,8 +110,8 @@ gimp_layer_mask_prop_undo_pop (GimpUndo *undo,
{
gboolean show;
- show = gimp_layer_mask_get_show (layer_mask);
- gimp_layer_mask_set_show (layer_mask, layer_mask_prop_undo->show, FALSE);
+ show = gimp_layer_get_show_mask (layer);
+ gimp_layer_set_show_mask (layer, layer_mask_prop_undo->show, FALSE);
layer_mask_prop_undo->show = show;
}
break;
diff --git a/app/display/gimpcanvaslayerboundary.c b/app/display/gimpcanvaslayerboundary.c
index 54a7e35..78918bb 100644
--- a/app/display/gimpcanvaslayerboundary.c
+++ b/app/display/gimpcanvaslayerboundary.c
@@ -31,7 +31,6 @@
#include "core/gimpchannel.h"
#include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h"
-#include "core/gimplayermask.h"
#include "gimpcanvas.h"
#include "gimpcanvaslayerboundary.h"
@@ -249,11 +248,10 @@ gimp_canvas_layer_boundary_set_layer (GimpCanvasLayerBoundary *boundary,
if (layer)
{
- GimpItem *item = GIMP_ITEM (layer);
- GimpLayerMask *mask;
+ GimpItem *item = GIMP_ITEM (layer);
- mask = gimp_layer_get_mask (layer);
- edit_mask = (mask && gimp_layer_mask_get_edit (mask));
+ edit_mask = (gimp_layer_get_mask (layer) &&
+ gimp_layer_get_edit_mask (layer));
g_object_set (boundary,
"x", (gdouble) gimp_item_get_offset_x (item),
@@ -272,19 +270,18 @@ gimp_canvas_layer_boundary_set_layer (GimpCanvasLayerBoundary *boundary,
}
else if (layer && layer == private->layer)
{
- GimpItem *item = GIMP_ITEM (layer);
- GimpLayerMask *mask;
- gint lx, ly, lw, lh;
- gdouble x, y, w ,h;
- gboolean edit_mask;
+ GimpItem *item = GIMP_ITEM (layer);
+ gint lx, ly, lw, lh;
+ gdouble x, y, w ,h;
+ gboolean edit_mask;
lx = gimp_item_get_offset_x (item);
ly = gimp_item_get_offset_y (item);
lw = gimp_item_get_width (item);
lh = gimp_item_get_height (item);
- mask = gimp_layer_get_mask (layer);
- edit_mask = (mask && gimp_layer_mask_get_edit (mask));
+ edit_mask = (gimp_layer_get_mask (layer) &&
+ gimp_layer_get_edit_mask (layer));
g_object_get (boundary,
"x", &x,
diff --git a/app/display/gimpdisplayshell-style.c b/app/display/gimpdisplayshell-style.c
index e2d0c4c..c17004c 100644
--- a/app/display/gimpdisplayshell-style.c
+++ b/app/display/gimpdisplayshell-style.c
@@ -30,7 +30,6 @@
#include "core/gimpgrid.h"
#include "core/gimplayer.h"
-#include "core/gimplayermask.h"
#include "widgets/gimpcairo.h"
@@ -197,7 +196,7 @@ gimp_display_shell_set_layer_style (GimpDisplayShell *shell,
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
if (gimp_layer_get_mask (layer) &&
- gimp_layer_mask_get_edit (gimp_layer_get_mask (layer)))
+ gimp_layer_get_edit_mask (layer))
{
pattern = gimp_cairo_stipple_pattern_create (&layer_mask_fg,
&layer_mask_bg,
diff --git a/app/pdb/layer-cmds.c b/app/pdb/layer-cmds.c
index fe8511a..f4c2fc5 100644
--- a/app/pdb/layer-cmds.c
+++ b/app/pdb/layer-cmds.c
@@ -797,7 +797,7 @@ layer_get_apply_mask_invoker (GimpProcedure *procedure,
if (success)
{
if (layer->mask)
- apply_mask = gimp_layer_mask_get_apply (layer->mask);
+ apply_mask = gimp_layer_get_apply_mask (layer);
else
apply_mask = FALSE;
}
@@ -829,7 +829,7 @@ layer_set_apply_mask_invoker (GimpProcedure *procedure,
if (success)
{
if (layer->mask)
- gimp_layer_mask_set_apply (layer->mask, apply_mask, TRUE);
+ gimp_layer_set_apply_mask (layer, apply_mask, TRUE);
else
success = FALSE;
}
@@ -856,7 +856,7 @@ layer_get_show_mask_invoker (GimpProcedure *procedure,
if (success)
{
if (layer->mask)
- show_mask = gimp_layer_mask_get_show (layer->mask);
+ show_mask = gimp_layer_get_show_mask (layer);
else
show_mask = FALSE;
}
@@ -888,7 +888,7 @@ layer_set_show_mask_invoker (GimpProcedure *procedure,
if (success)
{
if (layer->mask)
- gimp_layer_mask_set_show (layer->mask, show_mask, TRUE);
+ gimp_layer_set_show_mask (layer, show_mask, TRUE);
else
success = FALSE;
}
@@ -915,7 +915,7 @@ layer_get_edit_mask_invoker (GimpProcedure *procedure,
if (success)
{
if (layer->mask)
- edit_mask = gimp_layer_mask_get_edit (layer->mask);
+ edit_mask = gimp_layer_get_edit_mask (layer);
else
edit_mask = FALSE;
}
@@ -947,7 +947,7 @@ layer_set_edit_mask_invoker (GimpProcedure *procedure,
if (success)
{
if (layer->mask)
- gimp_layer_mask_set_edit (layer->mask, edit_mask);
+ gimp_layer_set_edit_mask (layer, edit_mask);
else
success = FALSE;
}
diff --git a/app/widgets/gimplayertreeview.c b/app/widgets/gimplayertreeview.c
index e76809a..5734f61 100644
--- a/app/widgets/gimplayertreeview.c
+++ b/app/widgets/gimplayertreeview.c
@@ -151,7 +151,7 @@ static void gimp_layer_tree_view_renderer_update (GimpViewRende
GimpLayerTreeView *view);
static void gimp_layer_tree_view_update_borders (GimpLayerTreeView *view,
GtkTreeIter *iter);
-static void gimp_layer_tree_view_mask_callback (GimpLayerMask *mask,
+static void gimp_layer_tree_view_mask_callback (GimpLayer *mask,
GimpLayerTreeView *view);
static void gimp_layer_tree_view_layer_clicked (GimpCellRendererViewable *cell,
const gchar *path,
@@ -1119,13 +1119,13 @@ gimp_layer_tree_view_update_menu (GimpLayerTreeView *layer_view,
gimp_action_group_set_action_active (group, "layers-mask-show",
mask &&
- gimp_layer_mask_get_show (mask));
+ gimp_layer_get_show_mask (layer));
gimp_action_group_set_action_active (group, "layers-mask-disable",
mask &&
- ! gimp_layer_mask_get_apply (mask));
+ ! gimp_layer_get_apply_mask (layer));
gimp_action_group_set_action_active (group, "layers-mask-edit",
mask &&
- gimp_layer_mask_get_edit (mask));
+ gimp_layer_get_edit_mask (layer));
}
@@ -1167,9 +1167,9 @@ gimp_layer_tree_view_mask_update (GimpLayerTreeView *layer_view,
closure = g_cclosure_new (G_CALLBACK (gimp_layer_tree_view_mask_callback),
layer_view, NULL);
g_object_watch_closure (G_OBJECT (renderer), closure);
- g_signal_connect_closure (mask, "apply-changed", closure, FALSE);
- g_signal_connect_closure (mask, "edit-changed", closure, FALSE);
- g_signal_connect_closure (mask, "show-changed", closure, FALSE);
+ g_signal_connect_closure (layer, "apply-mask-changed", closure, FALSE);
+ g_signal_connect_closure (layer, "edit-mask-changed", closure, FALSE);
+ g_signal_connect_closure (layer, "show-mask-changed", closure, FALSE);
}
gtk_tree_store_set (GTK_TREE_STORE (tree_view->model), iter,
@@ -1232,18 +1232,21 @@ gimp_layer_tree_view_update_borders (GimpLayerTreeView *layer_view,
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (layer_view);
GimpViewRenderer *layer_renderer;
GimpViewRenderer *mask_renderer;
+ GimpLayer *layer;
GimpLayerMask *mask = NULL;
GimpViewBorderType layer_type = GIMP_VIEW_BORDER_BLACK;
gtk_tree_model_get (tree_view->model, iter,
GIMP_CONTAINER_TREE_STORE_COLUMN_RENDERER, &layer_renderer,
- layer_view->priv->model_column_mask, &mask_renderer,
+ layer_view->priv->model_column_mask, &mask_renderer,
-1);
+ layer = GIMP_LAYER (layer_renderer->viewable);
+
if (mask_renderer)
mask = GIMP_LAYER_MASK (mask_renderer->viewable);
- if (! mask || (mask && ! gimp_layer_mask_get_edit (mask)))
+ if (! mask || (mask && ! gimp_layer_get_edit_mask (layer)))
layer_type = GIMP_VIEW_BORDER_WHITE;
gimp_view_renderer_set_border_type (layer_renderer, layer_type);
@@ -1252,15 +1255,15 @@ gimp_layer_tree_view_update_borders (GimpLayerTreeView *layer_view,
{
GimpViewBorderType mask_color = GIMP_VIEW_BORDER_BLACK;
- if (gimp_layer_mask_get_show (mask))
+ if (gimp_layer_get_show_mask (layer))
{
mask_color = GIMP_VIEW_BORDER_GREEN;
}
- else if (! gimp_layer_mask_get_apply (mask))
+ else if (! gimp_layer_get_apply_mask (layer))
{
mask_color = GIMP_VIEW_BORDER_RED;
}
- else if (gimp_layer_mask_get_edit (mask))
+ else if (gimp_layer_get_edit_mask (layer))
{
mask_color = GIMP_VIEW_BORDER_WHITE;
}
@@ -1276,14 +1279,13 @@ gimp_layer_tree_view_update_borders (GimpLayerTreeView *layer_view,
}
static void
-gimp_layer_tree_view_mask_callback (GimpLayerMask *mask,
+gimp_layer_tree_view_mask_callback (GimpLayer *layer,
GimpLayerTreeView *layer_view)
{
GimpContainerView *view = GIMP_CONTAINER_VIEW (layer_view);
GtkTreeIter *iter;
- iter = gimp_container_view_lookup (view, (GimpViewable *)
- gimp_layer_mask_get_layer (mask));
+ iter = gimp_container_view_lookup (view, (GimpViewable *) layer);
gimp_layer_tree_view_update_borders (layer_view, iter);
}
@@ -1309,14 +1311,14 @@ gimp_layer_tree_view_layer_clicked (GimpCellRendererViewable *cell,
group = gimp_ui_manager_get_action_group (ui_manager, "layers");
gtk_tree_model_get (tree_view->model, &iter,
- layer_view->priv->model_column_mask, &renderer,
+ GIMP_CONTAINER_TREE_STORE_COLUMN_RENDERER, &renderer,
-1);
if (renderer)
{
- GimpLayerMask *mask = GIMP_LAYER_MASK (renderer->viewable);
+ GimpLayer *layer = GIMP_LAYER (renderer->viewable);
- if (gimp_layer_mask_get_edit (mask))
+ if (gimp_layer_get_edit_mask (layer))
gimp_action_group_set_action_active (group,
"layers-mask-edit", FALSE);
@@ -1349,20 +1351,20 @@ gimp_layer_tree_view_mask_clicked (GimpCellRendererViewable *cell,
group = gimp_ui_manager_get_action_group (ui_manager, "layers");
gtk_tree_model_get (tree_view->model, &iter,
- layer_view->priv->model_column_mask, &renderer,
+ GIMP_CONTAINER_TREE_STORE_COLUMN_RENDERER, &renderer,
-1);
if (renderer)
{
- GimpLayerMask *mask = GIMP_LAYER_MASK (renderer->viewable);
+ GimpLayer *layer = GIMP_LAYER (renderer->viewable);
if (state & GDK_MOD1_MASK)
gimp_action_group_set_action_active (group, "layers-mask-show",
- ! gimp_layer_mask_get_show (mask));
+ ! gimp_layer_get_show_mask (layer));
else if (state & gimp_get_toggle_behavior_mask ())
gimp_action_group_set_action_active (group, "layers-mask-disable",
- gimp_layer_mask_get_apply (mask));
- else if (! gimp_layer_mask_get_edit (mask))
+ gimp_layer_get_apply_mask (layer));
+ else if (! gimp_layer_get_edit_mask (layer))
gimp_action_group_set_action_active (group,
"layers-mask-edit", TRUE);
diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
index 23593c6..19aeb8d 100644
--- a/app/xcf/xcf-load.c
+++ b/app/xcf/xcf-load.c
@@ -369,9 +369,27 @@ xcf_load_add_masks (GimpImage *image)
if (mask)
{
+ gboolean apply_mask;
+ gboolean edit_mask;
+ gboolean show_mask;
+
+ apply_mask = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (layer),
+ "gimp-layer-mask-apply"));
+ edit_mask = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (layer),
+ "gimp-layer-mask-edit"));
+ show_mask = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (layer),
+ "gimp-layer-mask-show"));
+
gimp_layer_add_mask (layer, mask, FALSE, NULL);
- g_object_set_data (G_OBJECT (layer), "gimp-layer-mask", NULL);
+ gimp_layer_set_apply_mask (layer, apply_mask, FALSE);
+ gimp_layer_set_edit_mask (layer, edit_mask);
+ gimp_layer_set_show_mask (layer, show_mask, FALSE);
+
+ g_object_set_data (G_OBJECT (layer), "gimp-layer-mask", NULL);
+ g_object_set_data (G_OBJECT (layer), "gimp-layer-mask-apply", NULL);
+ g_object_set_data (G_OBJECT (layer), "gimp-layer-mask-edit", NULL);
+ g_object_set_data (G_OBJECT (layer), "gimp-layer-mask-show", NULL);
}
}
@@ -1156,10 +1174,6 @@ xcf_load_layer (XcfInfo *info,
xcf_progress_update (info);
- gimp_layer_mask_set_apply (layer_mask, apply_mask, FALSE);
- gimp_layer_mask_set_edit (layer_mask, edit_mask);
- gimp_layer_mask_set_show (layer_mask, show_mask, FALSE);
-
/* don't add the layer mask yet, that won't work for group
* layers which update their size automatically; instead
* attach it so it can be added when all layers are loaded
@@ -1167,6 +1181,12 @@ xcf_load_layer (XcfInfo *info,
g_object_set_data_full (G_OBJECT (layer), "gimp-layer-mask",
g_object_ref_sink (layer_mask),
(GDestroyNotify) g_object_unref);
+ g_object_set_data (G_OBJECT (layer), "gimp-layer-mask-apply",
+ GINT_TO_POINTER (apply_mask));
+ g_object_set_data (G_OBJECT (layer), "gimp-layer-mask-edit",
+ GINT_TO_POINTER (edit_mask));
+ g_object_set_data (G_OBJECT (layer), "gimp-layer-mask-show",
+ GINT_TO_POINTER (show_mask));
}
/* attach the floating selection... */
diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c
index 44e4785..f75b1ae 100644
--- a/app/xcf/xcf-save.c
+++ b/app/xcf/xcf-save.c
@@ -496,14 +496,12 @@ xcf_save_layer_props (XcfInfo *info,
if (gimp_layer_get_mask (layer))
{
- GimpLayerMask *mask = gimp_layer_get_mask (layer);
-
xcf_check_error (xcf_save_prop (info, image, PROP_APPLY_MASK, error,
- gimp_layer_mask_get_apply (mask)));
+ gimp_layer_get_apply_mask (layer)));
xcf_check_error (xcf_save_prop (info, image, PROP_EDIT_MASK, error,
- gimp_layer_mask_get_edit (mask)));
+ gimp_layer_get_edit_mask (layer)));
xcf_check_error (xcf_save_prop (info, image, PROP_SHOW_MASK, error,
- gimp_layer_mask_get_show (mask)));
+ gimp_layer_get_show_mask (layer)));
}
else
{
diff --git a/tools/pdbgen/pdb/layer.pdb b/tools/pdbgen/pdb/layer.pdb
index b655b13..0e85104 100644
--- a/tools/pdbgen/pdb/layer.pdb
+++ b/tools/pdbgen/pdb/layer.pdb
@@ -835,7 +835,7 @@ HELP
code => <<'CODE'
{
if (layer->mask)
- apply_mask = gimp_layer_mask_get_apply (layer->mask);
+ apply_mask = gimp_layer_get_apply_mask (layer);
else
apply_mask = FALSE;
}
@@ -866,7 +866,7 @@ HELP
code => <<'CODE'
{
if (layer->mask)
- gimp_layer_mask_set_apply (layer->mask, apply_mask, TRUE);
+ gimp_layer_set_apply_mask (layer, apply_mask, TRUE);
else
success = FALSE;
}
@@ -900,7 +900,7 @@ HELP
code => <<'CODE'
{
if (layer->mask)
- show_mask = gimp_layer_mask_get_show (layer->mask);
+ show_mask = gimp_layer_get_show_mask (layer);
else
show_mask = FALSE;
}
@@ -931,7 +931,7 @@ HELP
code => <<'CODE'
{
if (layer->mask)
- gimp_layer_mask_set_show (layer->mask, show_mask, TRUE);
+ gimp_layer_set_show_mask (layer, show_mask, TRUE);
else
success = FALSE;
}
@@ -964,7 +964,7 @@ HELP
code => <<'CODE'
{
if (layer->mask)
- edit_mask = gimp_layer_mask_get_edit (layer->mask);
+ edit_mask = gimp_layer_get_edit_mask (layer);
else
edit_mask = FALSE;
}
@@ -995,7 +995,7 @@ HELP
code => <<'CODE'
{
if (layer->mask)
- gimp_layer_mask_set_edit (layer->mask, edit_mask);
+ gimp_layer_set_edit_mask (layer, edit_mask);
else
success = FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]