plug-ins: fix all remaining GimpImageProcedure to new run() API.

This commit is contained in:
Jehan 2021-04-03 22:32:47 +02:00
parent 79e608694e
commit 931b9fb539
15 changed files with 360 additions and 41 deletions

View File

@ -137,7 +137,8 @@ static GimpProcedure * compose_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray * compose_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data);
@ -390,6 +391,10 @@ compose_create_procedure (GimpPlugIn *plug_in,
compose_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "GRAY*");
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_("C_ompose..."));
gimp_procedure_add_menu_path (procedure, "<Image>/Colors/Components");
@ -442,6 +447,8 @@ compose_create_procedure (GimpPlugIn *plug_in,
compose_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "GRAY*");
gimp_procedure_set_sensitivity_mask (procedure,
GIMP_PROCEDURE_SENSITIVE_DRAWABLE);
gimp_procedure_set_documentation (procedure,
"Compose an image from multiple "
@ -491,6 +498,10 @@ compose_create_procedure (GimpPlugIn *plug_in,
compose_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "GRAY*");
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_ecompose"));
gimp_procedure_add_menu_path (procedure, "<Image>/Colors/Components");
@ -519,12 +530,14 @@ static GimpValueArray *
compose_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data)
{
GimpValueArray *return_vals;
const gchar *name = gimp_procedure_get_name (procedure);
GimpDrawable *drawable = NULL;
const gchar *name = gimp_procedure_get_name (procedure);
gint compose_by_drawable;
gint i;
@ -533,6 +546,26 @@ compose_run (GimpProcedure *procedure,
compose_by_drawable = ! strcmp (name, DRAWABLE_COMPOSE_PROC);
if (compose_by_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_CALLING_ERROR,
error);
}
else
{
drawable = drawables[0];
}
}
if (! strcmp (name, RECOMPOSE_PROC))
{
GimpParasite *parasite = gimp_image_get_parasite (image,

View File

@ -163,7 +163,8 @@ static GimpProcedure * hot_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray * hot_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data);
@ -246,6 +247,8 @@ hot_create_procedure (GimpPlugIn *plug_in,
hot_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_("_Hot..."));
gimp_procedure_add_menu_path (procedure, "<Image>/Colors/Modify");
@ -294,15 +297,34 @@ static GimpValueArray *
hot_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data)
{
piArgs pi_args;
GimpDrawable *drawable;
piArgs pi_args;
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];
}
pi_args.mode = GIMP_VALUES_GET_INT (args, 0);
pi_args.action = GIMP_VALUES_GET_INT (args, 1);
pi_args.new_layerp = GIMP_VALUES_GET_BOOLEAN (args, 2);

View File

@ -84,7 +84,8 @@ static GimpProcedure * nlfilter_create_procedure (GimpPlugIn *plug_in
static GimpValueArray * nlfilter_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data);
@ -157,6 +158,8 @@ nlfilter_create_procedure (GimpPlugIn *plug_in,
nlfilter_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_("_NL Filter..."));
gimp_procedure_add_menu_path (procedure,"<Image>/Filters/Enhance");
@ -202,13 +205,33 @@ static GimpValueArray *
nlfilter_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."),
gimp_procedure_get_name (procedure));
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CALLING_ERROR,
error);
}
else
{
drawable = drawables[0];
}
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:

View File

@ -68,7 +68,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);
@ -135,6 +136,8 @@ tile_create_procedure (GimpPlugIn *plug_in,
tile_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_("_Tile..."));
gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Map");
@ -195,17 +198,36 @@ static GimpValueArray *
tile_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data)
{
GimpValueArray *return_vals;
GimpLayer *new_layer;
GimpImage *new_image;
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];
}
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:

View File

@ -64,7 +64,8 @@ static GimpProcedure * wavelet_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray * wavelet_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data);
@ -122,6 +123,8 @@ wavelet_create_procedure (GimpPlugIn *plug_in,
wavelet_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_("_Wavelet-decompose..."));
gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Enhance");
@ -162,13 +165,15 @@ static GimpValueArray *
wavelet_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data)
{
GimpLayer **scale_layers;
GimpLayer *new_scale;
GimpLayer *parent = NULL;
GimpDrawable *drawable;
GimpLayerMode grain_extract_mode = GIMP_LAYER_MODE_GRAIN_EXTRACT;
GimpLayerMode grain_merge_mode = GIMP_LAYER_MODE_GRAIN_MERGE;
gint id;
@ -176,6 +181,23 @@ wavelet_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."),
gimp_procedure_get_name (procedure));
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CALLING_ERROR,
error);
}
else
{
drawable = drawables[0];
}
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:

View File

@ -96,7 +96,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);
@ -232,6 +233,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_("_Fractal Explorer..."));
gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Render/Fractals");
@ -372,10 +375,12 @@ static GimpValueArray *
explorer_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data)
{
GimpDrawable *drawable;
gint pwidth;
gint pheight;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
@ -385,6 +390,23 @@ explorer_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."),
gimp_procedure_get_name (procedure));
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CALLING_ERROR,
error);
}
else
{
drawable = drawables[0];
}
if (! gimp_drawable_mask_intersect (drawable,
&sel_x, &sel_y,
&sel_width, &sel_height))

View File

@ -83,7 +83,8 @@ static GimpProcedure * gfig_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray * gfig_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data);
@ -159,6 +160,8 @@ gfig_create_procedure (GimpPlugIn *plug_in,
gfig_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_("_Gfig..."));
gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Render");
@ -190,15 +193,34 @@ static GimpValueArray *
gfig_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data)
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint pwidth, pheight;
GimpDrawable *drawable;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint pwidth, pheight;
INIT_I18N ();
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];
}
gfig_context = g_new0 (GFigContext, 1);
gfig_context->show_background = TRUE;

View File

@ -62,7 +62,8 @@ static GimpProcedure * gimpressionist_create_procedure (GimpPlugIn *p
static GimpValueArray * gimpressionist_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data);
@ -112,6 +113,8 @@ gimpressionist_create_procedure (GimpPlugIn *plug_in,
gimpressionist_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_("_GIMPressionist..."));
gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Artistic");
@ -156,7 +159,8 @@ static GimpValueArray *
gimpressionist_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *_drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data)
{
@ -165,7 +169,22 @@ gimpressionist_run (GimpProcedure *procedure,
INIT_I18N ();
gegl_init (NULL, NULL);
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."),
gimp_procedure_get_name (procedure));
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CALLING_ERROR,
error);
}
else
{
drawable = drawables[0];
}
img_has_alpha = gimp_drawable_has_alpha (drawable);

View File

@ -393,7 +393,8 @@ static GimpProcedure * gflare_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray * gflare_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data);
@ -810,6 +811,8 @@ gflare_create_procedure (GimpPlugIn *plug_in,
gflare_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_("_Gradient Flare..."));
gimp_procedure_add_menu_path (procedure,
@ -911,7 +914,8 @@ static GimpValueArray *
gflare_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *_image,
GimpDrawable *_drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data)
{
@ -920,8 +924,24 @@ gflare_run (GimpProcedure *procedure,
INIT_I18N ();
gegl_init (NULL, NULL);
image = _image;
drawable = _drawable;
image = _image;
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];
}
dinfo.is_color = gimp_drawable_is_rgb (drawable);
dinfo.has_alpha = gimp_drawable_has_alpha (drawable);

View File

@ -202,7 +202,8 @@ static GimpProcedure * ifs_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray * ifs_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data);
@ -363,6 +364,8 @@ ifs_create_procedure (GimpPlugIn *plug_in,
ifs_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_("_IFS Fractal..."));
gimp_procedure_add_menu_path (procedure,
@ -393,16 +396,35 @@ static GimpValueArray *
ifs_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data)
{
GimpDrawable *drawable;
GimpParasite *parasite = NULL;
gboolean found_parasite = FALSE;
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];
}
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:

View File

@ -87,7 +87,8 @@ static GimpProcedure * imap_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray * imap_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data);
@ -159,6 +160,8 @@ imap_create_procedure (GimpPlugIn *plug_in,
imap_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_("_Image Map..."));
gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Web");
@ -180,27 +183,43 @@ static GimpValueArray *
imap_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data)
{
INIT_I18N ();
gegl_init (NULL, NULL);
_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."),
gimp_procedure_get_name (procedure));
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CALLING_ERROR,
error);
}
else
{
_drawable = drawables[0];
}
_image_name = gimp_image_get_name (image);
_image_width = gimp_image_width (image);
_image_height = gimp_image_height (image);
_map_info.color = gimp_drawable_is_rgb (drawable);
_map_info.color = gimp_drawable_is_rgb (_drawable);
if (run_mode != GIMP_RUN_INTERACTIVE)
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CALLING_ERROR,
NULL);
if (! dialog (drawable))
if (! dialog (_drawable))
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
NULL);

View File

@ -64,7 +64,8 @@ static GimpProcedure * lighting_create_procedure (GimpPlugIn *plug_in
static GimpValueArray * lighting_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data);
@ -112,6 +113,8 @@ lighting_create_procedure (GimpPlugIn *plug_in,
lighting_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_("_Lighting Effects..."));
gimp_procedure_add_menu_path (procedure,
@ -382,13 +385,33 @@ static GimpValueArray *
lighting_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."),
gimp_procedure_get_name (procedure));
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CALLING_ERROR,
error);
}
else
{
drawable = drawables[0];
}
set_default_settings ();
gimp_get_data (PLUG_IN_PROC, &mapvals);

View File

@ -64,7 +64,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);
@ -112,6 +113,8 @@ map_create_procedure (GimpPlugIn *plug_in,
map_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_("Map _Object..."));
gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Map");
@ -471,17 +474,36 @@ static GimpValueArray *
map_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *_image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data)
{
gint i;
GimpDrawable *drawable;
gint i;
INIT_I18N ();
gegl_init (NULL, NULL);
image = _image;
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];
}
set_default_settings ();
switch (run_mode)

View File

@ -129,7 +129,8 @@ static GimpProcedure * pagecurl_create_procedure (GimpPlugIn *plug_in
static GimpValueArray * pagecurl_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data);
@ -222,6 +223,8 @@ pagecurl_create_procedure (GimpPlugIn *plug_in,
pagecurl_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_("_Pagecurl..."));
gimp_procedure_add_menu_path (procedure, "<Image>/Filters/Distorts");
@ -277,10 +280,12 @@ static GimpValueArray *
pagecurl_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;
INIT_I18N ();
@ -288,6 +293,23 @@ pagecurl_run (GimpProcedure *procedure,
image = _image;
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];
}
curl.colors = GIMP_VALUES_GET_INT (args, 0);
curl.edge = GIMP_VALUES_GET_INT (args, 1);
curl.orientation = GIMP_VALUES_GET_INT (args, 2);

View File

@ -79,7 +79,8 @@ static GimpProcedure * sel2path_create_procedure (GimpPlugIn *plug_in
static GimpValueArray * sel2path_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data);
@ -136,6 +137,10 @@ sel2path_create_procedure (GimpPlugIn *plug_in,
sel2path_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_documentation (procedure,
"Converts a selection to a path",
@ -274,7 +279,8 @@ static GimpValueArray *
sel2path_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GimpDrawable *drawable,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
gpointer run_data)
{