gimp r26948 - in trunk: . app/actions app/core app/pdb app/xcf tools/pdbgen/pdb
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26948 - in trunk: . app/actions app/core app/pdb app/xcf tools/pdbgen/pdb
- Date: Mon, 15 Sep 2008 21:05:01 +0000 (UTC)
Author: mitch
Date: Mon Sep 15 21:05:01 2008
New Revision: 26948
URL: http://svn.gnome.org/viewvc/gimp?rev=26948&view=rev
Log:
2008-09-15 Michael Natterer <mitch gimp org>
* app/core/gimplayer.[ch] (gimp_layer_add_mask): add GError
parameter and replace g_message() by g_set_error().
* app/core/gimplayermaskundo.c
* app/xcf/xcf-load.c
* app/actions/layers-commands.c: pass NULL errors since these
places know what they are doing. Ha ha...
* tools/pdbgen/pdb/layer.pdb
* tools/pdbgen/pdb/image.pdb: pass the error so we get more real
error messages for failed PDB calls.
* app/pdb/image-cmds.c
* app/pdb/layer-cmds.c: regenerated.
Modified:
trunk/ChangeLog
trunk/app/actions/layers-commands.c
trunk/app/core/gimplayer.c
trunk/app/core/gimplayer.h
trunk/app/core/gimplayermaskundo.c
trunk/app/pdb/image-cmds.c
trunk/app/pdb/layer-cmds.c
trunk/app/xcf/xcf-load.c
trunk/tools/pdbgen/pdb/image.pdb
trunk/tools/pdbgen/pdb/layer.pdb
Modified: trunk/app/actions/layers-commands.c
==============================================================================
--- trunk/app/actions/layers-commands.c (original)
+++ trunk/app/actions/layers-commands.c Mon Sep 15 21:05:01 2008
@@ -1049,7 +1049,7 @@
if (layer_mask_invert)
gimp_channel_invert (GIMP_CHANNEL (mask), FALSE);
- gimp_layer_add_mask (layer, mask, TRUE);
+ gimp_layer_add_mask (layer, mask, TRUE, NULL);
gimp_image_undo_group_end (image);
Modified: trunk/app/core/gimplayer.c
==============================================================================
--- trunk/app/core/gimplayer.c (original)
+++ trunk/app/core/gimplayer.c Mon Sep 15 21:05:01 2008
@@ -538,7 +538,7 @@
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);
+ gimp_layer_add_mask (new_layer, GIMP_LAYER_MASK (mask), FALSE, NULL);
}
}
@@ -1241,31 +1241,27 @@
}
GimpLayerMask *
-gimp_layer_add_mask (GimpLayer *layer,
- GimpLayerMask *mask,
- gboolean push_undo)
+gimp_layer_add_mask (GimpLayer *layer,
+ GimpLayerMask *mask,
+ gboolean push_undo,
+ GError **error)
{
GimpImage *image;
g_return_val_if_fail (GIMP_IS_LAYER (layer), NULL);
g_return_val_if_fail (GIMP_IS_LAYER_MASK (mask), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (! gimp_item_is_attached (GIMP_ITEM (layer)))
push_undo = FALSE;
image = gimp_item_get_image (GIMP_ITEM (layer));
- if (! image)
- {
- g_message (_("Cannot add layer mask to layer "
- "which is not part of an image."));
- return NULL;
- }
-
if (layer->mask)
{
- g_message (_("Unable to add a layer mask since "
- "the layer already has one."));
+ g_set_error (error, 0, 0,
+ _("Unable to add a layer mask since "
+ "the layer already has one."));
return NULL;
}
@@ -1274,8 +1270,9 @@
(gimp_item_height (GIMP_ITEM (layer)) !=
gimp_item_height (GIMP_ITEM (mask))))
{
- g_message (_("Cannot add layer mask of different "
- "dimensions than specified layer."));
+ g_set_error (error, 0, 0,
+ _("Cannot add layer mask of different "
+ "dimensions than specified layer."));
return NULL;
}
Modified: trunk/app/core/gimplayer.h
==============================================================================
--- trunk/app/core/gimplayer.h (original)
+++ trunk/app/core/gimplayer.h Mon Sep 15 21:05:01 2008
@@ -103,7 +103,8 @@
GimpChannel *channel);
GimpLayerMask * gimp_layer_add_mask (GimpLayer *layer,
GimpLayerMask *mask,
- gboolean push_undo);
+ gboolean push_undo,
+ GError **error);
void gimp_layer_apply_mask (GimpLayer *layer,
GimpMaskApplyMode mode,
gboolean push_undo);
Modified: trunk/app/core/gimplayermaskundo.c
==============================================================================
--- trunk/app/core/gimplayermaskundo.c (original)
+++ trunk/app/core/gimplayermaskundo.c Mon Sep 15 21:05:01 2008
@@ -188,7 +188,7 @@
{
/* restore layer mask */
- gimp_layer_add_mask (layer, layer_mask_undo->layer_mask, FALSE);
+ gimp_layer_add_mask (layer, layer_mask_undo->layer_mask, FALSE, NULL);
GIMP_ITEM (layer_mask_undo->layer_mask)->removed = FALSE;
}
Modified: trunk/app/pdb/image-cmds.c
==============================================================================
--- trunk/app/pdb/image-cmds.c (original)
+++ trunk/app/pdb/image-cmds.c Mon Sep 15 21:05:01 2008
@@ -1490,9 +1490,8 @@
if (success)
{
- if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error) &&
- ! gimp_layer_get_mask (layer))
- success = (gimp_layer_add_mask (layer, mask, TRUE) == mask);
+ if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error))
+ success = (gimp_layer_add_mask (layer, mask, TRUE, error) == mask);
else
success = FALSE;
}
Modified: trunk/app/pdb/layer-cmds.c
==============================================================================
--- trunk/app/pdb/layer-cmds.c (original)
+++ trunk/app/pdb/layer-cmds.c Mon Sep 15 21:05:01 2008
@@ -550,9 +550,8 @@
if (success)
{
- if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error) &&
- ! gimp_layer_get_mask (layer))
- success = (gimp_layer_add_mask (layer, mask, TRUE) == mask);
+ if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error))
+ success = (gimp_layer_add_mask (layer, mask, TRUE, error) == mask);
else
success = FALSE;
}
Modified: trunk/app/xcf/xcf-load.c
==============================================================================
--- trunk/app/xcf/xcf-load.c (original)
+++ trunk/app/xcf/xcf-load.c Mon Sep 15 21:05:01 2008
@@ -1019,7 +1019,7 @@
gimp_layer_mask_set_edit (layer_mask, edit_mask);
gimp_layer_mask_set_show (layer_mask, show_mask, FALSE);
- gimp_layer_add_mask (layer, layer_mask, FALSE);
+ gimp_layer_add_mask (layer, layer_mask, FALSE, NULL);
}
/* attach the floating selection... */
Modified: trunk/tools/pdbgen/pdb/image.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/image.pdb (original)
+++ trunk/tools/pdbgen/pdb/image.pdb Mon Sep 15 21:05:01 2008
@@ -1015,9 +1015,8 @@
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error) &&
- ! gimp_layer_get_mask (layer))
- success = (gimp_layer_add_mask (layer, mask, TRUE) == mask);
+ if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error))
+ success = (gimp_layer_add_mask (layer, mask, TRUE, error) == mask);
else
success = FALSE;
}
Modified: trunk/tools/pdbgen/pdb/layer.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/layer.pdb (original)
+++ trunk/tools/pdbgen/pdb/layer.pdb Mon Sep 15 21:05:01 2008
@@ -276,9 +276,8 @@
%invoke = (
code => <<'CODE'
{
- if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error) &&
- ! gimp_layer_get_mask (layer))
- success = (gimp_layer_add_mask (layer, mask, TRUE) == mask);
+ if (gimp_pdb_item_is_floating (GIMP_ITEM (mask), error))
+ success = (gimp_layer_add_mask (layer, mask, TRUE, error) == mask);
else
success = FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]