gimp r27000 - in trunk: . plug-ins/common
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r27000 - in trunk: . plug-ins/common
- Date: Thu, 18 Sep 2008 19:31:26 +0000 (UTC)
Author: neo
Date: Thu Sep 18 19:31:26 2008
New Revision: 27000
URL: http://svn.gnome.org/viewvc/gimp?rev=27000&view=rev
Log:
2008-09-18 Sven Neumann <sven gimp org>
* plug-ins/common/edge-dog.c: the plug-in can only run on
layers,
not masks and channels. Added a check for this and bail out with
an error message. Fixes bug #552625.
* plug-ins/common/curve-bend.c: return error messages via the
procedure's return values.
Modified:
trunk/ChangeLog
trunk/plug-ins/common/curve-bend.c
trunk/plug-ins/common/edge-dog.c
Modified: trunk/plug-ins/common/curve-bend.c
==============================================================================
--- trunk/plug-ins/common/curve-bend.c (original)
+++ trunk/plug-ins/common/curve-bend.c Thu Sep 18 19:31:26 2008
@@ -573,13 +573,12 @@
{
const gchar *l_env;
BenderDialog *cd;
-
GimpDrawable *l_active_drawable = NULL;
gint32 l_active_drawable_id = -1;
gint32 l_image_id = -1;
gint32 l_layer_id = -1;
gint32 l_layer_mask_id = -1;
- gint32 l_bent_layer_id = -1;
+ GError *error = NULL;
/* Get the runmode from the in-parameters */
GimpRunMode run_mode = param[0].data.d_int32;
@@ -641,10 +640,12 @@
p_delta_gdouble (&bval.rotation, bval_from.rotation,
bval_to.rotation, total_steps, current_step);
- /* note: iteration of curve and points arrays would not give useful results.
- * (there might be different number of points in the from/to bender values )
- * the iteration is done later, (see p_bender_calculate_iter_curve)
- * when the curve is calculated.
+ /* note: iteration of curve and points arrays would not
+ * give useful results. (there might be different
+ * number of points in the from/to bender values )
+ * the iteration is done later, (see
+ * p_bender_calculate_iter_curve) when the curve
+ * is calculated.
*/
bval.total_steps = total_steps;
@@ -672,7 +673,9 @@
if (! gimp_drawable_is_layer (l_layer_id))
{
- g_message (_("Can operate on layers only (but was called on channel or mask)."));
+ g_set_error (&error, 0, 0, "%s",
+ _("Can operate on layers only "
+ "(but was called on channel or mask)."));
status = GIMP_PDB_EXECUTION_ERROR;
}
@@ -680,7 +683,8 @@
l_layer_mask_id = gimp_layer_get_mask (l_layer_id);
if (l_layer_mask_id >= 0)
{
- g_message (_("Cannot operate on layers with masks."));
+ g_set_error (&error, 0, 0, "%s",
+ _("Cannot operate on layers with masks."));
status = GIMP_PDB_EXECUTION_ERROR;
}
@@ -691,7 +695,8 @@
/* could not float the selection because selection rectangle
* is completely empty return GIMP_PDB_EXECUTION_ERROR
*/
- g_message (_("Cannot operate on empty selections."));
+ g_set_error (&error, 0, 0, "%s",
+ _("Cannot operate on empty selections."));
status = GIMP_PDB_EXECUTION_ERROR;
}
else
@@ -779,6 +784,8 @@
if (cd->run)
{
+ gint32 l_bent_layer_id;
+
gimp_image_undo_group_start (l_image_id);
l_bent_layer_id = p_main_bend (cd, cd->drawable, cd->work_on_copy);
@@ -790,6 +797,9 @@
{
p_store_values (cd);
}
+
+ /* return the id of handled layer */
+ values[1].data.d_int32 = l_bent_layer_id;
}
else
{
@@ -800,8 +810,14 @@
gimp_displays_flush ();
}
+ if (status != GIMP_PDB_SUCCESS && error)
+ {
+ *nreturn_vals = 2;
+ values[1].type = GIMP_PDB_STRING;
+ values[1].data.d_string = error->message;
+ }
+
values[0].data.d_status = status;
- values[1].data.d_int32 = l_bent_layer_id; /* return the id of handled layer */
}
static int
Modified: trunk/plug-ins/common/edge-dog.c
==============================================================================
--- trunk/plug-ins/common/edge-dog.c (original)
+++ trunk/plug-ins/common/edge-dog.c Thu Sep 18 19:31:26 2008
@@ -158,6 +158,7 @@
GimpDrawable *drawable;
GimpRunMode run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
+ GError *error = NULL;
run_mode = param[0].data.d_int32;
@@ -169,57 +170,68 @@
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status;
- /* Get the specified image and drawable */
- image_ID = param[1].data.d_image;
- drawable = gimp_drawable_get (param[2].data.d_drawable);
-
- /* set the tile cache size so that the gaussian blur works well */
- gimp_tile_cache_ntiles (2 *
- (MAX (drawable->width, drawable->height) /
- gimp_tile_width () + 1));
-
- if (strcmp (name, PLUG_IN_PROC) == 0)
- {
- switch (run_mode)
- {
- case GIMP_RUN_INTERACTIVE:
- /* Possibly retrieve data */
- gimp_get_data (PLUG_IN_PROC, &dogvals);
-
- /* First acquire information with a dialog */
- if (! dog_dialog (image_ID, drawable))
- return;
- break;
-
- case GIMP_RUN_NONINTERACTIVE:
- /* Make sure all the arguments are there! */
- if (nparams != 7)
- status = GIMP_PDB_CALLING_ERROR;
+ if (! gimp_drawable_is_layer (param[2].data.d_drawable))
+ {
+ g_set_error (&error, 0, 0, "%s",
+ _("Can operate on layers only "
+ "(but was called on channel or mask)."));
+ status = GIMP_PDB_EXECUTION_ERROR;
+ }
+
+ if (status == GIMP_PDB_SUCCESS)
+ {
+ /* Get the specified image and drawable */
+ image_ID = param[1].data.d_image;
+ drawable = gimp_drawable_get (param[2].data.d_drawable);
+
+ /* set the tile cache size so that the gaussian blur works well */
+ gimp_tile_cache_ntiles (2 *
+ (MAX (drawable->width, drawable->height) /
+ gimp_tile_width () + 1));
- if (status == GIMP_PDB_SUCCESS)
+ if (strcmp (name, PLUG_IN_PROC) == 0)
+ {
+ switch (run_mode)
{
- dogvals.inner = param[3].data.d_float;
- dogvals.outer = param[4].data.d_float;
- dogvals.normalize = param[5].data.d_int32;
- dogvals.invert = param[6].data.d_int32;
- }
- if (status == GIMP_PDB_SUCCESS &&
- (dogvals.inner <= 0.0 && dogvals.outer <= 0.0))
- status = GIMP_PDB_CALLING_ERROR;
- break;
-
- case GIMP_RUN_WITH_LAST_VALS:
- /* Possibly retrieve data */
- gimp_get_data (PLUG_IN_PROC, &dogvals);
- break;
+ case GIMP_RUN_INTERACTIVE:
+ /* Possibly retrieve data */
+ gimp_get_data (PLUG_IN_PROC, &dogvals);
+
+ /* First acquire information with a dialog */
+ if (! dog_dialog (image_ID, drawable))
+ return;
+ break;
+
+ case GIMP_RUN_NONINTERACTIVE:
+ /* Make sure all the arguments are there! */
+ if (nparams != 7)
+ status = GIMP_PDB_CALLING_ERROR;
+
+ if (status == GIMP_PDB_SUCCESS)
+ {
+ dogvals.inner = param[3].data.d_float;
+ dogvals.outer = param[4].data.d_float;
+ dogvals.normalize = param[5].data.d_int32;
+ dogvals.invert = param[6].data.d_int32;
+
+ if (dogvals.inner <= 0.0 || dogvals.outer <= 0.0)
+ status = GIMP_PDB_CALLING_ERROR;
+ }
+ break;
+
+ case GIMP_RUN_WITH_LAST_VALS:
+ /* Possibly retrieve data */
+ gimp_get_data (PLUG_IN_PROC, &dogvals);
+ break;
- default:
- break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ status = GIMP_PDB_CALLING_ERROR;
}
- }
- else
- {
- status = GIMP_PDB_CALLING_ERROR;
}
if (status == GIMP_PDB_SUCCESS)
@@ -250,6 +262,7 @@
{
status = GIMP_PDB_EXECUTION_ERROR;
*nreturn_vals = 2;
+
values[1].type = GIMP_PDB_STRING;
values[1].data.d_string = _("Cannot operate on indexed color images.");
}
@@ -257,6 +270,13 @@
gimp_drawable_detach (drawable);
}
+ if (status != GIMP_PDB_SUCCESS && error)
+ {
+ *nreturn_vals = 2;
+ values[1].type = GIMP_PDB_STRING;
+ values[1].data.d_string = error->message;
+ }
+
values[0].data.d_status = status;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]