diff --git a/plug-ins/common/align-layers.c b/plug-ins/common/align-layers.c index b5dc126b0f..837f04f379 100644 --- a/plug-ins/common/align-layers.c +++ b/plug-ins/common/align-layers.c @@ -96,7 +96,8 @@ static GimpProcedure * align_layers_create_procedure (GimpPlugIn static GimpValueArray * align_layers_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -187,6 +188,10 @@ align_layers_create_procedure (GimpPlugIn *plug_in, align_layers_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE | + GIMP_PROCEDURE_SENSITIVE_DRAWABLES | + GIMP_PROCEDURE_SENSITIVE_NO_DRAWABLES); gimp_procedure_set_menu_label (procedure, N_("Align Visi_ble Layers...")); gimp_procedure_add_menu_path (procedure, "/Image/Arrange"); @@ -226,7 +231,8 @@ static GimpValueArray * align_layers_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { diff --git a/plug-ins/common/animation-optimize.c b/plug-ins/common/animation-optimize.c index 97e7134b1c..e0371c9368 100644 --- a/plug-ins/common/animation-optimize.c +++ b/plug-ins/common/animation-optimize.c @@ -86,7 +86,8 @@ static GimpProcedure * optimize_create_procedure (GimpPlugIn *plug_in static GimpValueArray * optimize_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -168,6 +169,11 @@ optimize_create_procedure (GimpPlugIn *plug_in, GIMP_PDB_PROC_TYPE_PLUGIN, optimize_run, NULL, NULL); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE | + GIMP_PROCEDURE_SENSITIVE_DRAWABLES | + GIMP_PROCEDURE_SENSITIVE_NO_DRAWABLES); + gimp_procedure_set_menu_label (procedure, N_("Optimize (for _GIF)")); gimp_procedure_set_documentation (procedure, @@ -191,6 +197,11 @@ optimize_create_procedure (GimpPlugIn *plug_in, GIMP_PDB_PROC_TYPE_PLUGIN, optimize_run, NULL, NULL); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE | + GIMP_PROCEDURE_SENSITIVE_DRAWABLES | + GIMP_PROCEDURE_SENSITIVE_NO_DRAWABLES); + gimp_procedure_set_menu_label (procedure, N_("_Optimize (Difference)")); gimp_procedure_set_documentation (procedure, @@ -211,6 +222,11 @@ optimize_create_procedure (GimpPlugIn *plug_in, GIMP_PDB_PROC_TYPE_PLUGIN, optimize_run, NULL, NULL); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE | + GIMP_PROCEDURE_SENSITIVE_DRAWABLES | + GIMP_PROCEDURE_SENSITIVE_NO_DRAWABLES); + gimp_procedure_set_menu_label (procedure, N_("_Unoptimize")); gimp_procedure_set_documentation (procedure, @@ -228,6 +244,11 @@ optimize_create_procedure (GimpPlugIn *plug_in, GIMP_PDB_PROC_TYPE_PLUGIN, optimize_run, NULL, NULL); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE | + GIMP_PROCEDURE_SENSITIVE_DRAWABLES | + GIMP_PROCEDURE_SENSITIVE_NO_DRAWABLES); + gimp_procedure_set_menu_label (procedure, N_("_Remove Backdrop")); gimp_procedure_set_documentation (procedure, @@ -244,6 +265,11 @@ optimize_create_procedure (GimpPlugIn *plug_in, GIMP_PDB_PROC_TYPE_PLUGIN, optimize_run, NULL, NULL); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE | + GIMP_PROCEDURE_SENSITIVE_DRAWABLES | + GIMP_PROCEDURE_SENSITIVE_NO_DRAWABLES); + gimp_procedure_set_menu_label (procedure, N_("_Find Backdrop")); gimp_procedure_set_documentation (procedure, @@ -281,7 +307,8 @@ static GimpValueArray * optimize_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { diff --git a/plug-ins/common/animation-play.c b/plug-ins/common/animation-play.c index 2b852785d6..4335eb7b98 100644 --- a/plug-ins/common/animation-play.c +++ b/plug-ins/common/animation-play.c @@ -93,7 +93,8 @@ static GimpProcedure * play_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * play_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -242,6 +243,10 @@ play_create_procedure (GimpPlugIn *plug_in, play_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE | + GIMP_PROCEDURE_SENSITIVE_DRAWABLES | + GIMP_PROCEDURE_SENSITIVE_NO_DRAWABLES); gimp_procedure_set_menu_label (procedure, N_("_Playback...")); gimp_procedure_set_icon_name (procedure, "media-playback-start"); @@ -265,7 +270,8 @@ static GimpValueArray * play_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *_image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { diff --git a/plug-ins/common/blinds.c b/plug-ins/common/blinds.c index 8dfbcfb772..f86410372d 100644 --- a/plug-ins/common/blinds.c +++ b/plug-ins/common/blinds.c @@ -82,7 +82,8 @@ static GimpProcedure * blinds_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * blinds_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -149,6 +150,8 @@ blinds_create_procedure (GimpPlugIn *plug_in, blinds_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*, GRAY*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Blinds...")); gimp_procedure_add_menu_path (procedure, "/Filters/Distorts"); @@ -196,13 +199,33 @@ static GimpValueArray * blinds_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { + GimpDrawable *drawable; + INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + switch (run_mode) { case GIMP_RUN_INTERACTIVE: diff --git a/plug-ins/common/border-average.c b/plug-ins/common/border-average.c index ce0a82dc58..95871d6542 100644 --- a/plug-ins/common/border-average.c +++ b/plug-ins/common/border-average.c @@ -57,7 +57,8 @@ static GimpProcedure * border_average_create_procedure (GimpPlugIn static GimpValueArray * border_average_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -130,6 +131,8 @@ border_average_create_procedure (GimpPlugIn *plug_in, border_average_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Border Average...")); gimp_procedure_add_menu_path (procedure, "/Colors/Info"); @@ -169,10 +172,12 @@ static GimpValueArray * border_average_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { + GimpDrawable *drawable; GimpValueArray *return_vals = NULL; GimpPDBStatusType status = GIMP_PDB_SUCCESS; GimpRGB result_color = { 0.0, }; @@ -181,6 +186,23 @@ border_average_run (GimpProcedure *procedure, INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + buffer = gimp_drawable_get_buffer (drawable); switch (run_mode) diff --git a/plug-ins/common/checkerboard.c b/plug-ins/common/checkerboard.c index 96995b6187..93f8ca1e67 100644 --- a/plug-ins/common/checkerboard.c +++ b/plug-ins/common/checkerboard.c @@ -66,7 +66,8 @@ static GimpProcedure * checkerboard_create_procedure (GimpPlugIn *plu static GimpValueArray * checkerboard_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -127,6 +128,8 @@ checkerboard_create_procedure (GimpPlugIn *plug_in, checkerboard_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*, GRAY*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Checkerboard (legacy)...")); @@ -162,13 +165,33 @@ static GimpValueArray * checkerboard_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { + GimpDrawable *drawable; + INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + switch (run_mode) { case GIMP_RUN_INTERACTIVE: diff --git a/plug-ins/common/cml-explorer.c b/plug-ins/common/cml-explorer.c index 63274628a2..03ba7ef21b 100644 --- a/plug-ins/common/cml-explorer.c +++ b/plug-ins/common/cml-explorer.c @@ -338,7 +338,8 @@ static GimpProcedure * explorer_create_procedure (GimpPlugIn *plug_in static GimpValueArray * explorer_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -499,6 +500,8 @@ explorer_create_procedure (GimpPlugIn *plug_in, explorer_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*, GRAY*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("CML _Explorer...")); gimp_procedure_add_menu_path (procedure, @@ -540,13 +543,29 @@ static GimpValueArray * explorer_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *_drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { INIT_I18N (); - drawable = _drawable; + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } switch (run_mode) { diff --git a/plug-ins/common/colormap-remap.c b/plug-ins/common/colormap-remap.c index cfd85fa21d..7ae5b636ec 100644 --- a/plug-ins/common/colormap-remap.c +++ b/plug-ins/common/colormap-remap.c @@ -69,7 +69,8 @@ static GimpProcedure * remap_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * remap_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -124,6 +125,10 @@ remap_create_procedure (GimpPlugIn *plug_in, remap_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "INDEXED*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE | + GIMP_PROCEDURE_SENSITIVE_DRAWABLES | + GIMP_PROCEDURE_SENSITIVE_NO_DRAWABLES); gimp_procedure_set_menu_label (procedure, N_("R_earrange Colormap...")); gimp_procedure_set_icon_name (procedure, GIMP_ICON_COLORMAP); @@ -160,6 +165,10 @@ remap_create_procedure (GimpPlugIn *plug_in, remap_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "INDEXED*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE | + GIMP_PROCEDURE_SENSITIVE_DRAWABLES | + GIMP_PROCEDURE_SENSITIVE_NO_DRAWABLES); gimp_procedure_set_menu_label (procedure, N_("_Swap Colors")); gimp_procedure_set_icon_name (procedure, GIMP_ICON_COLORMAP); @@ -197,7 +206,8 @@ static GimpValueArray * remap_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { diff --git a/plug-ins/common/contrast-retinex.c b/plug-ins/common/contrast-retinex.c index d66bd84b3e..7081796a7a 100644 --- a/plug-ins/common/contrast-retinex.c +++ b/plug-ins/common/contrast-retinex.c @@ -94,7 +94,8 @@ static GimpProcedure * retinex_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * retinex_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -186,6 +187,8 @@ retinex_create_procedure (GimpPlugIn *plug_in, retinex_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("Retine_x...")); gimp_procedure_add_menu_path (procedure, "/Colors/Tone Mapping"); @@ -239,15 +242,34 @@ static GimpValueArray * retinex_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { - gint x, y, width, height; + GimpDrawable *drawable; + gint x, y, width, height; INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + if (! gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height) || width < MIN_GAUSSIAN_SCALE || height < MIN_GAUSSIAN_SCALE) diff --git a/plug-ins/common/crop-zealous.c b/plug-ins/common/crop-zealous.c index e244d2c777..0cdeb37681 100644 --- a/plug-ins/common/crop-zealous.c +++ b/plug-ins/common/crop-zealous.c @@ -55,7 +55,8 @@ static GimpProcedure * crop_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * crop_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -105,6 +106,8 @@ crop_create_procedure (GimpPlugIn *plug_in, crop_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Zealous Crop")); gimp_procedure_add_menu_path (procedure, "/Image/Crop"); @@ -127,15 +130,35 @@ static GimpValueArray * crop_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { + GimpDrawable *drawable; + INIT_I18N (); gegl_init (NULL, NULL); gimp_progress_init (_("Zealous cropping")); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + do_zcrop (drawable, image); if (run_mode != GIMP_RUN_NONINTERACTIVE) diff --git a/plug-ins/common/curve-bend.c b/plug-ins/common/curve-bend.c index 9f8d0f3537..87b9de06e3 100644 --- a/plug-ins/common/curve-bend.c +++ b/plug-ins/common/curve-bend.c @@ -255,7 +255,8 @@ static GimpProcedure * bender_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * bender_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -422,6 +423,8 @@ bender_create_procedure (GimpPlugIn *plug_in, bender_run, NULL, NULL); gimp_procedure_set_image_types (procedure, PLUG_IN_IMAGE_TYPES); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Curve Bend...")); gimp_procedure_add_menu_path (procedure, "/Filters/Distorts"); @@ -640,7 +643,8 @@ static GimpValueArray * bender_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { @@ -648,6 +652,7 @@ bender_run (GimpProcedure *procedure, GimpValueArray *return_vals; BenderDialog *cd = NULL; GimpDrawable *active_drawable = NULL; + GimpDrawable *drawable; GimpLayer *layer = NULL; GimpLayer *bent_layer = NULL; GError *error = NULL; @@ -655,6 +660,23 @@ bender_run (GimpProcedure *procedure, INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_EXECUTION_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + env = g_getenv ("BEND_DEBUG"); if (env != NULL) if ((*env != 'n') && (*env != 'N')) gb_debug = 1; diff --git a/plug-ins/common/decompose.c b/plug-ins/common/decompose.c index 5901d03b05..27882d31c2 100644 --- a/plug-ins/common/decompose.c +++ b/plug-ins/common/decompose.c @@ -98,7 +98,8 @@ static GimpProcedure * decompose_create_procedure (GimpPlugIn *plug_i static GimpValueArray * decompose_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -273,6 +274,8 @@ decompose_create_procedure (GimpPlugIn *plug_in, decompose_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Decompose...")); gimp_procedure_add_menu_path (procedure, "/Colors/Components"); @@ -344,12 +347,14 @@ static GimpValueArray * decompose_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { GimpProcedureConfig *config; GimpValueArray *return_vals; + GimpDrawable *drawable; gint num_images; GimpImage *image_extract[MAX_EXTRACT_IMAGES]; GimpLayer *layer_extract[MAX_EXTRACT_IMAGES]; @@ -362,6 +367,23 @@ decompose_run (GimpProcedure *procedure, INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + config = gimp_procedure_create_config (procedure); gimp_procedure_config_begin_run (config, NULL, run_mode, args); diff --git a/plug-ins/common/depth-merge.c b/plug-ins/common/depth-merge.c index 62394657de..2e4e7dc666 100644 --- a/plug-ins/common/depth-merge.c +++ b/plug-ins/common/depth-merge.c @@ -124,7 +124,8 @@ static GimpProcedure * merge_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * merge_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -209,6 +210,8 @@ merge_create_procedure (GimpPlugIn *plug_in, merge_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*, GRAY*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Depth Merge...")); gimp_procedure_add_menu_path (procedure, "/Filters/Combine"); @@ -284,15 +287,34 @@ static GimpValueArray * merge_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { - DepthMerge dm; + GimpDrawable *drawable; + DepthMerge dm; INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + DepthMerge_initParams (&dm); switch (run_mode) diff --git a/plug-ins/common/despeckle.c b/plug-ins/common/despeckle.c index 9034e5f352..f0554cf7fd 100644 --- a/plug-ins/common/despeckle.c +++ b/plug-ins/common/despeckle.c @@ -92,7 +92,8 @@ static GimpProcedure * despeckle_create_procedure (GimpPlugIn *plug_i static GimpValueArray * despeckle_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -171,6 +172,8 @@ despeckle_create_procedure (GimpPlugIn *plug_in, despeckle_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*, GRAY*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("Des_peckle...")); gimp_procedure_add_menu_path (procedure, "/Filters/Enhance"); @@ -220,15 +223,34 @@ static GimpValueArray * despeckle_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { GimpProcedureConfig *config; + GimpDrawable *drawable; INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + if (! gimp_drawable_is_rgb (drawable) && ! gimp_drawable_is_gray (drawable)) { diff --git a/plug-ins/common/destripe.c b/plug-ins/common/destripe.c index c5c369392a..3a0217e445 100644 --- a/plug-ins/common/destripe.c +++ b/plug-ins/common/destripe.c @@ -72,7 +72,8 @@ static GimpProcedure * destripe_create_procedure (GimpPlugIn *plug_in static GimpValueArray * destripe_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -132,6 +133,8 @@ destripe_create_procedure (GimpPlugIn *plug_in, destripe_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*, GRAY*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("Des_tripe...")); gimp_procedure_add_menu_path (procedure, "/Colors/Tone Mapping"); @@ -161,13 +164,33 @@ static GimpValueArray * destripe_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { + GimpDrawable *drawable; + INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + switch (run_mode) { case GIMP_RUN_INTERACTIVE: diff --git a/plug-ins/common/film.c b/plug-ins/common/film.c index ae8f2c5180..09e7b7d134 100644 --- a/plug-ins/common/film.c +++ b/plug-ins/common/film.c @@ -99,7 +99,8 @@ static GimpProcedure * film_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * film_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -224,6 +225,10 @@ film_create_procedure (GimpPlugIn *plug_in, film_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE | + GIMP_PROCEDURE_SENSITIVE_DRAWABLES | + GIMP_PROCEDURE_SENSITIVE_NO_DRAWABLES); gimp_procedure_set_menu_label (procedure, N_("_Filmstrip...")); gimp_procedure_add_menu_path (procedure, "/Filters/Combine"); @@ -306,7 +311,8 @@ static GimpValueArray * film_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { diff --git a/plug-ins/common/gradient-map.c b/plug-ins/common/gradient-map.c index 97f500587e..5a927bdd67 100644 --- a/plug-ins/common/gradient-map.c +++ b/plug-ins/common/gradient-map.c @@ -66,7 +66,8 @@ static GimpProcedure * map_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * map_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -123,6 +124,8 @@ map_create_procedure (GimpPlugIn *plug_in, NULL); gimp_procedure_set_image_types (procedure, "RGB*, GRAY*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Gradient Map")); gimp_procedure_add_menu_path (procedure, "/Colors/Map"); @@ -157,6 +160,8 @@ map_create_procedure (GimpPlugIn *plug_in, NULL); gimp_procedure_set_image_types (procedure, "RGB*, GRAY*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Palette Map")); gimp_procedure_add_menu_path (procedure, "/Colors/Map"); @@ -186,20 +191,39 @@ map_create_procedure (GimpPlugIn *plug_in, } static GimpValueArray * -map_run (GimpProcedure *procedure, - GimpRunMode run_mode, - GimpImage *image, - GimpDrawable *drawable, - const GimpValueArray *args, - gpointer run_data) +map_run (GimpProcedure *procedure, + GimpRunMode run_mode, + GimpImage *image, + gint n_drawables, + GimpDrawable **drawables, + const GimpValueArray *args, + gpointer run_data) { - MapMode mode = GPOINTER_TO_INT (run_data); - GeglBuffer *shadow_buffer; - GeglBuffer *buffer; + MapMode mode = GPOINTER_TO_INT (run_data); + GeglBuffer *shadow_buffer; + GeglBuffer *buffer; + GimpDrawable *drawable; INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + gimp_procedure_get_name (procedure)); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + shadow_buffer = gimp_drawable_get_shadow_buffer (drawable); buffer = gimp_drawable_get_buffer (drawable); diff --git a/plug-ins/common/grid.c b/plug-ins/common/grid.c index fe2a957fd5..92a51efd84 100644 --- a/plug-ins/common/grid.c +++ b/plug-ins/common/grid.c @@ -96,7 +96,8 @@ static GimpProcedure * grid_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * grid_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -164,6 +165,8 @@ grid_create_procedure (GimpPlugIn *plug_in, grid_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Grid (legacy)...")); gimp_procedure_add_menu_path (procedure, @@ -261,13 +264,33 @@ static GimpValueArray * grid_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { + GimpDrawable *drawable; + INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + if (run_mode == GIMP_RUN_NONINTERACTIVE) { grid_cfg.hwidth = GIMP_VALUES_GET_INT (args, 0); diff --git a/plug-ins/common/guillotine.c b/plug-ins/common/guillotine.c index c3adab81b5..6de8df5af8 100644 --- a/plug-ins/common/guillotine.c +++ b/plug-ins/common/guillotine.c @@ -57,7 +57,8 @@ static GimpProcedure * guillotine_create_procedure (GimpPlugIn *plug_ static GimpValueArray * guillotine_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); static GList * guillotine (GimpImage *image, @@ -101,6 +102,10 @@ guillotine_create_procedure (GimpPlugIn *plug_in, guillotine_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE | + GIMP_PROCEDURE_SENSITIVE_DRAWABLES | + GIMP_PROCEDURE_SENSITIVE_NO_DRAWABLES); gimp_procedure_set_menu_label (procedure, N_("Slice Using G_uides")); gimp_procedure_add_menu_path (procedure, "/Image/Crop"); @@ -138,7 +143,8 @@ static GimpValueArray * guillotine_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { diff --git a/plug-ins/common/jigsaw.c b/plug-ins/common/jigsaw.c index f221e04140..0a3d62bdab 100644 --- a/plug-ins/common/jigsaw.c +++ b/plug-ins/common/jigsaw.c @@ -210,7 +210,8 @@ static GimpProcedure * jigsaw_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * jigsaw_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -392,6 +393,8 @@ jigsaw_create_procedure (GimpPlugIn *plug_in, jigsaw_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Jigsaw...")); gimp_procedure_add_menu_path (procedure, @@ -445,13 +448,33 @@ static GimpValueArray * jigsaw_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { + GimpDrawable *drawable; + INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + switch (run_mode) { case GIMP_RUN_INTERACTIVE: diff --git a/plug-ins/common/mail.c b/plug-ins/common/mail.c index 952037b953..7278f97c4f 100644 --- a/plug-ins/common/mail.c +++ b/plug-ins/common/mail.c @@ -88,14 +88,16 @@ static GimpProcedure * mail_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * mail_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); -static GimpPDBStatusType send_image (const gchar *filename, - GimpImage *image, - GimpDrawable *drawable, - gint32 run_mode); +static GimpPDBStatusType send_image (const gchar *filename, + GimpImage *image, + gint n_drawables, + GimpDrawable **drawables, + gint32 run_mode); static gboolean send_dialog (void); static void mail_entry_callback (GtkWidget *widget, @@ -192,6 +194,10 @@ mail_create_procedure (GimpPlugIn *plug_in, mail_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE | + GIMP_PROCEDURE_SENSITIVE_DRAWABLES | + GIMP_PROCEDURE_SENSITIVE_NO_DRAWABLES); gimp_procedure_set_menu_label (procedure, N_("Send by E_mail...")); gimp_procedure_set_icon_name (procedure, GIMP_ICON_EDIT); @@ -253,7 +259,8 @@ static GimpValueArray * mail_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { @@ -306,7 +313,7 @@ mail_run (GimpProcedure *procedure, status = send_image (mail_info.filename, image, - drawable, + n_drawables, drawables, run_mode); if (status == GIMP_PDB_SUCCESS) @@ -321,13 +328,13 @@ mail_run (GimpProcedure *procedure, } static GimpPDBStatusType -send_image (const gchar *filename, - GimpImage *image, - GimpDrawable *drawable, - gint32 run_mode) +send_image (const gchar *filename, + GimpImage *image, + gint n_drawables, + GimpDrawable **drawables, + gint32 run_mode) { GimpPDBStatusType status = GIMP_PDB_SUCCESS; - GimpItem **drawables; gchar *ext; GFile *tmpfile; gchar *tmpname; @@ -353,18 +360,13 @@ send_image (const gchar *filename, tmpfile = gimp_temp_file (ext + 1); tmpname = g_file_get_path (tmpfile); - drawables = g_new (GimpItem *, 1); - drawables[0] = (GimpItem *) drawable; - if (! (gimp_file_save (run_mode, - image, 1, + if (! (gimp_file_save (run_mode, image, n_drawables, (const GimpItem **) drawables, tmpfile) && valid_file (tmpfile))) { - g_free (drawables); goto error; } - g_free (drawables); #ifndef SENDMAIL /* xdg-email */ /* From xdg-email doc: diff --git a/plug-ins/common/qbist.c b/plug-ins/common/qbist.c index 8b8551ded4..364c4c6178 100644 --- a/plug-ins/common/qbist.c +++ b/plug-ins/common/qbist.c @@ -110,7 +110,8 @@ static GimpProcedure * qbist_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * qbist_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -176,6 +177,8 @@ qbist_create_procedure (GimpPlugIn *plug_in, qbist_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Qbist...")); gimp_procedure_add_menu_path (procedure, @@ -203,7 +206,8 @@ static GimpValueArray * qbist_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { @@ -211,13 +215,30 @@ qbist_run (GimpProcedure *procedure, gint img_height, img_width; GeglBuffer *buffer; GeglBufferIterator *iter; + GimpDrawable *drawable; gint total_pixels; gint done_pixels; - INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + img_width = gimp_drawable_width (drawable); img_height = gimp_drawable_height (drawable); diff --git a/plug-ins/common/sample-colorize.c b/plug-ins/common/sample-colorize.c index b044fb5d97..d1d46982f6 100644 --- a/plug-ins/common/sample-colorize.c +++ b/plug-ins/common/sample-colorize.c @@ -195,7 +195,8 @@ static GimpProcedure * colorize_create_procedure (GimpPlugIn *plug_in static GimpValueArray * colorize_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -321,6 +322,8 @@ colorize_create_procedure (GimpPlugIn *plug_in, colorize_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*, GRAY*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Sample Colorize...")); gimp_procedure_add_menu_path (procedure, "/Colors/Map"); @@ -408,15 +411,34 @@ static GimpValueArray * colorize_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { - const gchar *env; + const gchar *env; + GimpDrawable *drawable; INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + env = g_getenv ("SAMPLE_COLORIZE_DEBUG"); if (env != NULL && (*env != 'n') && (*env != 'N')) g_Sdebug = TRUE; diff --git a/plug-ins/common/smooth-palette.c b/plug-ins/common/smooth-palette.c index 0146585cdc..79d711484f 100644 --- a/plug-ins/common/smooth-palette.c +++ b/plug-ins/common/smooth-palette.c @@ -60,7 +60,8 @@ static GimpProcedure * palette_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * palette_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -125,6 +126,8 @@ palette_create_procedure (GimpPlugIn *plug_in, palette_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("Smoo_th Palette...")); gimp_procedure_add_menu_path (procedure, "/Colors/Info"); @@ -183,17 +186,36 @@ static GimpValueArray * palette_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { GimpValueArray *return_vals; GimpImage *new_image; GimpLayer *new_layer; + GimpDrawable *drawable; INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + switch (run_mode) { case GIMP_RUN_INTERACTIVE: diff --git a/plug-ins/common/sparkle.c b/plug-ins/common/sparkle.c index 424a23e5fb..d0f9578fb9 100644 --- a/plug-ins/common/sparkle.c +++ b/plug-ins/common/sparkle.c @@ -94,7 +94,8 @@ static GimpProcedure * sparkle_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * sparkle_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -199,6 +200,8 @@ sparkle_create_procedure (GimpPlugIn *plug_in, sparkle_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*, GRAY*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Sparkle...")); gimp_procedure_add_menu_path (procedure, @@ -305,15 +308,34 @@ static GimpValueArray * sparkle_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { - gint x, y, w, h; + GimpDrawable *drawable; + gint x, y, w, h; INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + if (! gimp_drawable_mask_intersect (drawable, &x, &y, &w, &h)) { g_message (_("Region selected for filter is empty")); diff --git a/plug-ins/common/sphere-designer.c b/plug-ins/common/sphere-designer.c index 278eef3cee..530bb96795 100644 --- a/plug-ins/common/sphere-designer.c +++ b/plug-ins/common/sphere-designer.c @@ -283,7 +283,8 @@ static GimpProcedure * designer_create_procedure (GimpPlugIn *plug_in static GimpValueArray * designer_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -401,6 +402,8 @@ designer_create_procedure (GimpPlugIn *plug_in, designer_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*, GRAY*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("Sphere _Designer...")); gimp_procedure_add_menu_path (procedure, "/Filters/Render"); @@ -3156,15 +3159,34 @@ static GimpValueArray * designer_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { - gint x, y, w, h; + GimpDrawable *drawable; + gint x, y, w, h; INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + if (! gimp_drawable_mask_intersect (drawable, &x, &y, &w, &h)) { g_message (_("Region selected for plug-in is empty")); diff --git a/plug-ins/common/tile-small.c b/plug-ins/common/tile-small.c index 4939756b78..d09cf24b25 100644 --- a/plug-ins/common/tile-small.c +++ b/plug-ins/common/tile-small.c @@ -109,7 +109,8 @@ static GimpProcedure * tile_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * tile_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -256,6 +257,8 @@ tile_create_procedure (GimpPlugIn *plug_in, tile_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*, GRAY*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Small Tiles...")); gimp_procedure_add_menu_path (procedure, "/Filters/Map"); @@ -284,16 +287,35 @@ static GimpValueArray * tile_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { - gint pwidth; - gint pheight; + GimpDrawable *drawable; + gint pwidth; + gint pheight; INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + has_alpha = gimp_drawable_has_alpha (drawable); if (! gimp_drawable_mask_intersect (drawable, diff --git a/plug-ins/common/van-gogh-lic.c b/plug-ins/common/van-gogh-lic.c index d6d108e54c..4f7d9eddc2 100644 --- a/plug-ins/common/van-gogh-lic.c +++ b/plug-ins/common/van-gogh-lic.c @@ -88,7 +88,8 @@ static GimpProcedure * lic_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * lic_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); static void lic_scale_entry_update (GimpLabelSpin *entry, @@ -869,6 +870,8 @@ lic_create_procedure (GimpPlugIn *plug_in, lic_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Van Gogh (LIC)...")); gimp_procedure_add_menu_path (procedure, "/Filters/Artistic"); @@ -891,13 +894,33 @@ static GimpValueArray * lic_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { + GimpDrawable *drawable; + INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + /* Set default values */ /* ================== */ diff --git a/plug-ins/common/warp.c b/plug-ins/common/warp.c index 465caef59a..9bab711bff 100644 --- a/plug-ins/common/warp.c +++ b/plug-ins/common/warp.c @@ -132,7 +132,8 @@ static GimpProcedure * warp_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * warp_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -241,6 +242,8 @@ warp_create_procedure (GimpPlugIn *plug_in, warp_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*, GRAY*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Warp...")); gimp_procedure_add_menu_path (procedure, "/Filters/Map"); @@ -352,15 +355,34 @@ static GimpValueArray * warp_run (GimpProcedure *procedure, GimpRunMode _run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { - GimpRGB color; + GimpDrawable *drawable; + GimpRGB color; INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + /* get currently selected foreground pixel color */ gimp_context_get_foreground (&color); gimp_rgb_get_uchar (&color, diff --git a/plug-ins/file-dds/dds.c b/plug-ins/file-dds/dds.c index f05782233b..fcaaa9a878 100644 --- a/plug-ins/file-dds/dds.c +++ b/plug-ins/file-dds/dds.c @@ -87,7 +87,8 @@ static GimpValueArray * dds_save (GimpProcedure *procedure, static GimpValueArray * dds_decode (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); #endif @@ -307,6 +308,8 @@ dds_create_procedure (GimpPlugIn *plug_in, dds_decode, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGBA"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("Decode YCoCg")); /* gimp_procedure_add_menu_path (procedure, "/Filters/Colors"); */ @@ -327,6 +330,8 @@ dds_create_procedure (GimpPlugIn *plug_in, dds_decode, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGBA"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("Decode YCoCg (scaled)")); /* gimp_procedure_add_menu_path (procedure, "/Filters/Colors"); */ @@ -349,6 +354,8 @@ dds_create_procedure (GimpPlugIn *plug_in, dds_decode, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGBA"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("Decode Alpha exponent")); /* gimp_procedure_add_menu_path (procedure, "/Filters/Colors"); */ @@ -488,11 +495,30 @@ static GimpValueArray * dds_decode (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { - const gchar *name = gimp_procedure_get_name (procedure); + const gchar *name = gimp_procedure_get_name (procedure); + GimpDrawable *drawable, + + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + name); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_EXECUTION_ERROR, + error); + } + else + { + drawable = drawables[0]; + } if (! strcmp (name, DECODE_YCOCG_PROC)) { diff --git a/plug-ins/flame/flame.c b/plug-ins/flame/flame.c index 66d882e33a..c271b7fc76 100644 --- a/plug-ins/flame/flame.c +++ b/plug-ins/flame/flame.c @@ -86,7 +86,8 @@ static GimpProcedure * flame_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * flame_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -166,6 +167,8 @@ flame_create_procedure (GimpPlugIn *plug_in, flame_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "RGB*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE); gimp_procedure_set_menu_label (procedure, N_("_Flame...")); gimp_procedure_add_menu_path (procedure, @@ -219,13 +222,33 @@ static GimpValueArray * flame_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { + GimpDrawable *drawable; + INIT_I18N (); gegl_init (NULL, NULL); + if (n_drawables != 1) + { + GError *error = NULL; + + g_set_error (&error, GIMP_PLUG_IN_ERROR, 0, + _("Procedure '%s' only works with one drawable."), + PLUG_IN_PROC); + + return gimp_procedure_new_return_values (procedure, + GIMP_PDB_CALLING_ERROR, + error); + } + else + { + drawable = drawables[0]; + } + if (run_mode == GIMP_RUN_NONINTERACTIVE) { return gimp_procedure_new_return_values (procedure, diff --git a/plug-ins/print/print.c b/plug-ins/print/print.c index 4f62f1849d..ef0ab133b8 100644 --- a/plug-ins/print/print.c +++ b/plug-ins/print/print.c @@ -70,7 +70,8 @@ static GimpProcedure * print_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * print_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -156,6 +157,10 @@ print_create_procedure (GimpPlugIn *plug_in, print_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE | + GIMP_PROCEDURE_SENSITIVE_DRAWABLES | + GIMP_PROCEDURE_SENSITIVE_NO_DRAWABLES); gimp_procedure_set_menu_label (procedure, N_("_Print...")); gimp_procedure_set_icon_name (procedure, GIMP_ICON_DOCUMENT_PRINT); @@ -206,7 +211,8 @@ static GimpValueArray * print_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) { diff --git a/plug-ins/twain/twain.c b/plug-ins/twain/twain.c index f42854928d..9dd51e5047 100644 --- a/plug-ins/twain/twain.c +++ b/plug-ins/twain/twain.c @@ -153,7 +153,8 @@ static GimpProcedure * twain_create_procedure (GimpPlugIn *plug_in, static GimpValueArray * twain_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data); @@ -194,6 +195,11 @@ twain_create_procedure (GimpPlugIn *plug_in, twain_run, NULL, NULL); gimp_procedure_set_image_types (procedure, "*"); + gimp_procedure_set_sensitivity_mask (procedure, + GIMP_PROCEDURE_SENSITIVE_DRAWABLE | + GIMP_PROCEDURE_SENSITIVE_DRAWABLES | + GIMP_PROCEDURE_SENSITIVE_NO_DRAWABLES | + GIMP_PROCEDURE_SENSITIVE_NO_IMAGE); gimp_procedure_set_menu_label (procedure, N_("_Scanner/Camera...")); gimp_procedure_add_menu_path (procedure, "/File/Create/Acquire"); @@ -380,7 +386,8 @@ static GimpValueArray * twain_run (GimpProcedure *procedure, GimpRunMode run_mode, GimpImage *image, - GimpDrawable *drawable, + gint n_drawables, + GimpDrawable **drawables, const GimpValueArray *args, gpointer run_data) {