plug-ins: port to gimp_image_procedure_new2() all plug-ins which were already…

… working with a GimpProcedureConfig.

These are the easiest ones to port as most of the work was already done (mostly
just some now useless calls to remove).
This commit is contained in:
Jehan 2023-06-21 01:09:41 +02:00
parent 96b3302e65
commit 4f14f620c4
14 changed files with 182 additions and 456 deletions

View File

@ -98,7 +98,7 @@ static GimpValueArray * align_layers_run (GimpProcedure
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
@ -166,9 +166,9 @@ align_layers_create_procedure (GimpPlugIn *plug_in,
if (! strcmp (name, PLUG_IN_PROC))
{
procedure = gimp_image_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
align_layers_run, NULL, NULL);
procedure = gimp_image_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
align_layers_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "*");
gimp_procedure_set_sensitivity_mask (procedure,
@ -266,18 +266,14 @@ align_layers_run (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpProcedureConfig *config;
GimpValueArray *return_vals = NULL;
GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR;
GError *error = NULL;
GList *layers;
gint layer_num;
config = gimp_procedure_create_config (procedure);
gimp_procedure_config_begin_run (config, NULL, run_mode, args);
GimpValueArray *return_vals = NULL;
GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR;
GError *error = NULL;
GList *layers;
gint layer_num;
switch ( run_mode )
{
@ -312,11 +308,7 @@ align_layers_run (GimpProcedure *procedure,
gimp_displays_flush ();
}
gimp_procedure_config_end_run (config, status);
g_object_unref (config);
return_vals = gimp_procedure_new_return_values (procedure, status,
error);
return_vals = gimp_procedure_new_return_values (procedure, status, error);
return return_vals;
}

View File

@ -75,7 +75,7 @@ static GimpValueArray * blinds_run (GimpProcedure *procedure
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
static gboolean blinds_dialog (GimpProcedure *procedure,
@ -129,9 +129,9 @@ blinds_create_procedure (GimpPlugIn *plug_in,
if (! strcmp (name, PLUG_IN_PROC))
{
procedure = gimp_image_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
blinds_run, NULL, NULL);
procedure = gimp_image_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
blinds_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
gimp_procedure_set_sensitivity_mask (procedure,
@ -186,11 +186,10 @@ blinds_run (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpProcedureConfig *config;
GimpDrawable *drawable;
GimpDrawable *drawable;
gegl_init (NULL, NULL);
@ -211,26 +210,10 @@ blinds_run (GimpProcedure *procedure,
drawable = drawables[0];
}
config = gimp_procedure_create_config (procedure);
gimp_procedure_config_begin_run (config, NULL, run_mode, args);
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
if (! blinds_dialog (procedure, G_OBJECT (config), drawable))
{
gimp_procedure_config_end_run (config, GIMP_PDB_CANCEL);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
}
break;
default:
break;
}
if (run_mode == GIMP_RUN_INTERACTIVE && ! blinds_dialog (procedure, G_OBJECT (config), drawable))
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
if (gimp_drawable_is_rgb (drawable) ||
gimp_drawable_is_gray (drawable))
@ -244,17 +227,11 @@ blinds_run (GimpProcedure *procedure,
}
else
{
gimp_procedure_config_end_run (config, GIMP_PDB_EXECUTION_ERROR);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
NULL);
}
gimp_procedure_config_end_run (config, GIMP_PDB_SUCCESS);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL);
}

View File

@ -88,7 +88,7 @@ static GimpValueArray * retinex_run (GimpProcedure *procedur
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
static gboolean retinex_dialog (GimpProcedure *procedure,
@ -167,9 +167,9 @@ retinex_create_procedure (GimpPlugIn *plug_in,
if (! strcmp (name, PLUG_IN_PROC))
{
procedure = gimp_image_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
retinex_run, NULL, NULL);
procedure = gimp_image_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
retinex_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "RGB*");
gimp_procedure_set_sensitivity_mask (procedure,
@ -230,25 +230,18 @@ retinex_run (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpProcedureConfig *config;
GimpDrawable *drawable;
gint x, y, width, height;
GimpDrawable *drawable;
gint x, y, width, height;
gegl_init (NULL, NULL);
config = gimp_procedure_create_config (procedure);
gimp_procedure_config_begin_run (config, NULL, run_mode, args);
if (n_drawables != 1)
{
GError *error = NULL;
gimp_procedure_config_end_run (config, GIMP_PDB_EXECUTION_ERROR);
g_object_unref (config);
g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
_("Procedure '%s' only works with one drawable."),
PLUG_IN_PROC);
@ -265,32 +258,14 @@ retinex_run (GimpProcedure *procedure,
if (! gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height) ||
width < MIN_GAUSSIAN_SCALE ||
height < MIN_GAUSSIAN_SCALE)
{
gimp_procedure_config_end_run (config, GIMP_PDB_EXECUTION_ERROR);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
NULL);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
NULL);
}
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
if (! retinex_dialog (procedure, G_OBJECT (config), drawable))
{
gimp_procedure_config_end_run (config, GIMP_PDB_CANCEL);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
}
break;
default:
break;
}
if (run_mode == GIMP_RUN_INTERACTIVE && ! retinex_dialog (procedure, G_OBJECT (config), drawable))
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
if (gimp_drawable_is_rgb (drawable))
{
@ -303,17 +278,11 @@ retinex_run (GimpProcedure *procedure,
}
else
{
gimp_procedure_config_end_run (config, GIMP_PDB_EXECUTION_ERROR);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
NULL);
}
gimp_procedure_config_end_run (config, GIMP_PDB_SUCCESS);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL);
}

View File

@ -57,7 +57,7 @@ static GimpValueArray * crop_run (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
static inline gboolean colors_equal (const gfloat *col1,
@ -103,9 +103,9 @@ crop_create_procedure (GimpPlugIn *plug_in,
if (! strcmp (name, PLUG_IN_PROC))
{
procedure = gimp_image_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
crop_run, NULL, NULL);
procedure = gimp_image_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
crop_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "*");
gimp_procedure_set_sensitivity_mask (procedure,
@ -134,7 +134,7 @@ crop_run (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpDrawable *drawable;

View File

@ -100,7 +100,7 @@ static GimpValueArray * decompose_run (GimpProcedure *proced
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
static gint decompose (GimpImage *image,
@ -271,9 +271,9 @@ decompose_create_procedure (GimpPlugIn *plug_in,
g_string_append_c (type_desc, '"');
}
procedure = gimp_image_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
decompose_run, NULL, NULL);
procedure = gimp_image_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
decompose_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "RGB*");
gimp_procedure_set_sensitivity_mask (procedure,
@ -351,20 +351,19 @@ decompose_run (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
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];
gint num_layers;
GString *data;
gchar *decompose_type;
gchar *tmp;
gint j;
GimpValueArray *return_vals;
GimpDrawable *drawable;
gint num_images;
GimpImage *image_extract[MAX_EXTRACT_IMAGES];
GimpLayer *layer_extract[MAX_EXTRACT_IMAGES];
gint num_layers;
GString *data;
gchar *decompose_type;
gchar *tmp;
gint j;
gegl_init (NULL, NULL);
@ -385,9 +384,6 @@ decompose_run (GimpProcedure *procedure,
drawable = drawables[0];
}
config = gimp_procedure_create_config (procedure);
gimp_procedure_config_begin_run (config, NULL, run_mode, args);
g_object_get (config,
"decompose-type", &decompose_type,
NULL);
@ -401,15 +397,8 @@ decompose_run (GimpProcedure *procedure,
g_free (tmp);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
if (! decompose_dialog (procedure, G_OBJECT (config)))
{
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
}
}
if (run_mode == GIMP_RUN_INTERACTIVE && ! decompose_dialog (procedure, G_OBJECT (config)))
return gimp_procedure_new_return_values (procedure, GIMP_PDB_CANCEL, NULL);
gimp_progress_init (_("Decomposing"));
@ -421,14 +410,7 @@ decompose_run (GimpProcedure *procedure,
layer_extract);
if (num_images <= 0)
{
gimp_procedure_config_end_run (config, GIMP_PDB_EXECUTION_ERROR);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
NULL);
}
return gimp_procedure_new_return_values (procedure, GIMP_PDB_EXECUTION_ERROR, NULL);
/* create decompose-data parasite */
data = g_string_new ("");
@ -469,9 +451,6 @@ decompose_run (GimpProcedure *procedure,
gimp_display_new (image_extract[j]);
}
gimp_procedure_config_end_run (config, GIMP_PDB_SUCCESS);
g_object_unref (config);
gimp_progress_end ();
return return_vals;

View File

@ -94,7 +94,7 @@ static GimpValueArray * despeckle_run (GimpProcedure *proced
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
static void despeckle (GimpDrawable *drawable,
@ -158,9 +158,9 @@ despeckle_create_procedure (GimpPlugIn *plug_in,
if (! strcmp (name, PLUG_IN_PROC))
{
procedure = gimp_image_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
despeckle_run, NULL, NULL);
procedure = gimp_image_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
despeckle_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
gimp_procedure_set_sensitivity_mask (procedure,
@ -216,11 +216,10 @@ despeckle_run (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpProcedureConfig *config;
GimpDrawable *drawable;
GimpDrawable *drawable;
gegl_init (NULL, NULL);
@ -241,35 +240,14 @@ despeckle_run (GimpProcedure *procedure,
drawable = drawables[0];
}
if (! gimp_drawable_is_rgb (drawable) &&
! gimp_drawable_is_gray (drawable))
{
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
NULL);
}
if (! gimp_drawable_is_rgb (drawable) && ! gimp_drawable_is_gray (drawable))
return gimp_procedure_new_return_values (procedure, GIMP_PDB_EXECUTION_ERROR, NULL);
config = gimp_procedure_create_config (procedure);
gimp_procedure_config_begin_run (config, NULL, run_mode, args);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
if (! despeckle_dialog (procedure, G_OBJECT (config), drawable))
{
gimp_procedure_config_end_run (config, GIMP_PDB_CANCEL);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
}
}
if (run_mode == GIMP_RUN_INTERACTIVE && ! despeckle_dialog (procedure, G_OBJECT (config), drawable))
return gimp_procedure_new_return_values (procedure, GIMP_PDB_CANCEL, NULL);
despeckle (drawable, G_OBJECT (config));
gimp_procedure_config_end_run (config, GIMP_PDB_SUCCESS);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL);
}

View File

@ -66,7 +66,7 @@ static GimpValueArray * destripe_run (GimpProcedure *procedu
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
static void destripe (GObject *config,
@ -115,9 +115,9 @@ destripe_create_procedure (GimpPlugIn *plug_in,
if (! strcmp (name, PLUG_IN_PROC))
{
procedure = gimp_image_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
destripe_run, NULL, NULL);
procedure = gimp_image_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
destripe_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
gimp_procedure_set_sensitivity_mask (procedure,
@ -160,24 +160,17 @@ destripe_run (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpProcedureConfig *config;
GimpDrawable *drawable;
GimpDrawable *drawable;
gegl_init (NULL, NULL);
config = gimp_procedure_create_config (procedure);
gimp_procedure_config_begin_run (config, NULL, run_mode, args);
if (n_drawables != 1)
{
GError *error = NULL;
gimp_procedure_config_end_run (config, GIMP_PDB_EXECUTION_ERROR);
g_object_unref (config);
g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
_("Procedure '%s' only works with one drawable."),
PLUG_IN_PROC);
@ -191,44 +184,20 @@ destripe_run (GimpProcedure *procedure,
drawable = drawables[0];
}
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
if (! destripe_dialog (procedure, G_OBJECT (config), drawable))
{
gimp_procedure_config_end_run (config, GIMP_PDB_CANCEL);
g_object_unref (config);
if (run_mode == GIMP_RUN_INTERACTIVE && ! destripe_dialog (procedure, G_OBJECT (config), drawable))
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
}
break;
default:
break;
};
if (gimp_drawable_is_rgb (drawable) ||
gimp_drawable_is_gray (drawable))
{
destripe (G_OBJECT (config), drawable, NULL);
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush ();
}
if (gimp_drawable_is_rgb (drawable)|| gimp_drawable_is_gray (drawable))
destripe (G_OBJECT (config), drawable, NULL);
else
{
gimp_procedure_config_end_run (config, GIMP_PDB_EXECUTION_ERROR);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
NULL);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
NULL);
}
gimp_procedure_config_end_run (config, GIMP_PDB_SUCCESS);
g_object_unref (config);
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush ();
return gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL);
}

View File

@ -158,7 +158,7 @@ static GimpValueArray * hot_run (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
static gboolean pluginCore (GimpImage *image,
@ -238,9 +238,9 @@ hot_create_procedure (GimpPlugIn *plug_in,
if (! strcmp (name, PLUG_IN_PROC))
{
procedure = gimp_image_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
hot_run, NULL, NULL);
procedure = gimp_image_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
hot_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "RGB");
gimp_procedure_set_sensitivity_mask (procedure,
@ -295,11 +295,10 @@ hot_run (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpProcedureConfig *config;
GimpDrawable *drawable;
GimpDrawable *drawable;
gegl_init (NULL, NULL);
@ -320,41 +319,15 @@ hot_run (GimpProcedure *procedure,
drawable = drawables[0];
}
config = gimp_procedure_create_config (procedure);
gimp_procedure_config_begin_run (config, NULL, run_mode, args);
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
if (! plugin_dialog (procedure, G_OBJECT (config)))
{
gimp_procedure_config_end_run (config, GIMP_PDB_CANCEL);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
}
break;
case GIMP_RUN_NONINTERACTIVE:
case GIMP_RUN_WITH_LAST_VALS:
break;
}
if (run_mode == GIMP_RUN_INTERACTIVE && ! plugin_dialog (procedure, G_OBJECT (config)))
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
if (! pluginCore (image, drawable, G_OBJECT (config)))
{
gimp_procedure_config_end_run (config, GIMP_PDB_CANCEL);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
NULL);
}
gimp_procedure_config_end_run (config, GIMP_PDB_SUCCESS);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
NULL);
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush ();

View File

@ -201,7 +201,7 @@ static GimpValueArray * jigsaw_run (GimpProcedure *procedure
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
static void jigsaw (GObject *config,
@ -387,9 +387,9 @@ jigsaw_create_procedure (GimpPlugIn *plug_in,
if (! strcmp (name, PLUG_IN_PROC))
{
procedure = gimp_image_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
jigsaw_run, NULL, NULL);
procedure = gimp_image_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
jigsaw_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "RGB*");
gimp_procedure_set_sensitivity_mask (procedure,
@ -451,24 +451,17 @@ jigsaw_run (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpProcedureConfig *config;
GimpDrawable *drawable;
GimpDrawable *drawable;
gegl_init (NULL, NULL);
config = gimp_procedure_create_config (procedure);
gimp_procedure_config_begin_run (config, NULL, run_mode, args);
if (n_drawables != 1)
{
GError *error = NULL;
gimp_procedure_config_end_run (config, GIMP_PDB_EXECUTION_ERROR);
g_object_unref (config);
g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
_("Procedure '%s' only works with one drawable."),
PLUG_IN_PROC);
@ -482,23 +475,10 @@ jigsaw_run (GimpProcedure *procedure,
drawable = drawables[0];
}
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
if (! jigsaw_dialog (procedure, G_OBJECT (config), drawable))
{
gimp_procedure_config_end_run (config, GIMP_PDB_CANCEL);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
}
break;
default:
break;
};
if (run_mode == GIMP_RUN_INTERACTIVE && ! jigsaw_dialog (procedure, G_OBJECT (config), drawable))
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
gimp_progress_init (_("Assembling jigsaw"));
@ -507,9 +487,6 @@ jigsaw_run (GimpProcedure *procedure,
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush ();
gimp_procedure_config_end_run (config, GIMP_PDB_SUCCESS);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL);
}

View File

@ -86,7 +86,7 @@ static GimpValueArray * nlfilter_run (GimpProcedure *procedu
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
static void nlfilter (GObject *config,
@ -147,9 +147,9 @@ nlfilter_create_procedure (GimpPlugIn *plug_in,
if (! strcmp (name, PLUG_IN_PROC))
{
procedure = gimp_image_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
nlfilter_run, NULL, NULL);
procedure = gimp_image_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
nlfilter_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "RGB, GRAY");
gimp_procedure_set_sensitivity_mask (procedure,
@ -202,24 +202,17 @@ nlfilter_run (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpProcedureConfig *config;
GimpDrawable *drawable;
GimpDrawable *drawable;
gegl_init (NULL, NULL);
config = gimp_procedure_create_config (procedure);
gimp_procedure_config_begin_run (config, NULL, run_mode, args);
if (n_drawables != 1)
{
GError *error = NULL;
gimp_procedure_config_end_run (config, GIMP_PDB_EXECUTION_ERROR);
g_object_unref (config);
g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
_("Procedure '%s' only works with one drawable."),
gimp_procedure_get_name (procedure));
@ -233,32 +226,16 @@ nlfilter_run (GimpProcedure *procedure,
drawable = drawables[0];
}
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
if (! nlfilter_dialog (procedure, G_OBJECT (config), drawable))
{
gimp_procedure_config_end_run (config, GIMP_PDB_CANCEL);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
}
break;
default:
break;
};
if (run_mode == GIMP_RUN_INTERACTIVE && ! nlfilter_dialog (procedure, G_OBJECT (config), drawable))
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
nlfilter (G_OBJECT (config), drawable, NULL);
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush ();
gimp_procedure_config_end_run (config, GIMP_PDB_SUCCESS);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL);
}

View File

@ -112,7 +112,7 @@ static GimpValueArray * qbist_run (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
static gboolean dialog_run (void);
@ -174,9 +174,9 @@ qbist_create_procedure (GimpPlugIn *plug_in,
if (! strcmp (name, PLUG_IN_PROC))
{
procedure = gimp_image_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
qbist_run, NULL, NULL);
procedure = gimp_image_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
qbist_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "RGB*");
gimp_procedure_set_sensitivity_mask (procedure,
@ -228,20 +228,19 @@ qbist_run (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpProcedureConfig *config;
gint sel_x1, sel_y1, sel_width, sel_height;
gint img_height, img_width;
GeglBuffer *buffer;
GeglBufferIterator *iter;
GimpDrawable *drawable;
GimpParasite *pattern_parasite;
gconstpointer pattern_data;
guint32 pattern_data_length;
gint total_pixels;
gint done_pixels;
gint sel_x1, sel_y1, sel_width, sel_height;
gint img_height, img_width;
GeglBuffer *buffer;
GeglBufferIterator *iter;
GimpDrawable *drawable;
GimpParasite *pattern_parasite;
gconstpointer pattern_data;
guint32 pattern_data_length;
gint total_pixels;
gint done_pixels;
gegl_init (NULL, NULL);
@ -262,9 +261,6 @@ qbist_run (GimpProcedure *procedure,
drawable = drawables[0];
}
config = gimp_procedure_create_config (procedure);
gimp_procedure_config_begin_run (config, image, run_mode, args);
img_width = gimp_drawable_get_width (drawable);
img_height = gimp_drawable_get_height (drawable);
@ -308,13 +304,9 @@ qbist_run (GimpProcedure *procedure,
}
if (! dialog_run ())
{
gimp_procedure_config_end_run (config, GIMP_PDB_CANCEL);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
}
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
pattern_parasite = gimp_parasite_new ("pattern", 0,
sizeof (qbist_info.info),
@ -404,9 +396,6 @@ qbist_run (GimpProcedure *procedure,
g_rand_free (gr);
gimp_procedure_config_end_run (config, GIMP_PDB_SUCCESS);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL);
}

View File

@ -78,7 +78,7 @@ static GimpValueArray * sparkle_run (GimpProcedure *procedur
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
static gboolean sparkle_dialog (GimpProcedure *procedure,
@ -166,9 +166,9 @@ sparkle_create_procedure (GimpPlugIn *plug_in,
if (! strcmp (name, PLUG_IN_PROC))
{
procedure = gimp_image_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
sparkle_run, NULL, NULL);
procedure = gimp_image_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
sparkle_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
gimp_procedure_set_sensitivity_mask (procedure,
@ -284,25 +284,18 @@ sparkle_run (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpProcedureConfig *config;
GimpDrawable *drawable;
gint x, y, w, h;
GimpDrawable *drawable;
gint x, y, w, h;
gegl_init (NULL, NULL);
config = gimp_procedure_create_config (procedure);
gimp_procedure_config_begin_run (config, NULL, run_mode, args);
if (n_drawables != 1)
{
GError *error = NULL;
gimp_procedure_config_end_run (config, GIMP_PDB_EXECUTION_ERROR);
g_object_unref (config);
g_set_error (&error, GIMP_PLUG_IN_ERROR, 0,
_("Procedure '%s' only works with one drawable."),
PLUG_IN_PROC);
@ -320,32 +313,15 @@ sparkle_run (GimpProcedure *procedure,
{
g_message (_("Region selected for filter is empty"));
gimp_procedure_config_end_run (config, GIMP_PDB_SUCCESS);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_SUCCESS,
NULL);
}
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
if (! sparkle_dialog (procedure, G_OBJECT (config), drawable))
{
gimp_procedure_config_end_run (config, GIMP_PDB_CANCEL);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
}
break;
default:
break;
}
if (run_mode == GIMP_RUN_INTERACTIVE && ! sparkle_dialog (procedure, G_OBJECT (config), drawable))
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
if (gimp_drawable_is_rgb (drawable) ||
gimp_drawable_is_gray (drawable))
@ -359,17 +335,11 @@ sparkle_run (GimpProcedure *procedure,
}
else
{
gimp_procedure_config_end_run (config, GIMP_PDB_EXECUTION_ERROR);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
NULL);
}
gimp_procedure_config_end_run (config, GIMP_PDB_SUCCESS);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL);
}

View File

@ -60,7 +60,7 @@ static GimpValueArray * wavelet_run (GimpProcedure *procedur
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
static void wavelet_blur (GimpDrawable *drawable,
@ -107,9 +107,9 @@ wavelet_create_procedure (GimpPlugIn *plug_in,
if (! strcmp (name, PLUG_IN_PROC))
{
procedure = gimp_image_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
wavelet_run, NULL, NULL);
procedure = gimp_image_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
wavelet_run, NULL, NULL);
gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
gimp_procedure_set_sensitivity_mask (procedure,
@ -157,20 +157,19 @@ wavelet_run (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpProcedureConfig *config;
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;
gint scales;
gboolean create_group;
gboolean create_masks;
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;
gint scales;
gboolean create_group;
gboolean create_masks;
gegl_init (NULL, NULL);
@ -191,36 +190,16 @@ wavelet_run (GimpProcedure *procedure,
drawable = drawables[0];
}
config = gimp_procedure_create_config (procedure);
gimp_procedure_config_begin_run (config, NULL, run_mode, args);
if (run_mode == GIMP_RUN_INTERACTIVE && ! wavelet_decompose_dialog (procedure, G_OBJECT (config)))
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
if (! wavelet_decompose_dialog (procedure, G_OBJECT (config)))
{
gimp_procedure_config_end_run (config, GIMP_PDB_CANCEL);
g_object_unref (config);
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
NULL);
}
break;
case GIMP_RUN_NONINTERACTIVE:
case GIMP_RUN_WITH_LAST_VALS:
break;
default:
break;
}
g_object_get (config,
"scales", &scales,
"create-group", &create_group,
"create-masks", &create_masks,
NULL);
g_object_get (config,
"scales", &scales,
"create-group", &create_group,
"create-masks", &create_masks,
NULL);
gimp_progress_init (_("Wavelet-Decompose"));
@ -356,9 +335,6 @@ wavelet_run (GimpProcedure *procedure,
gimp_displays_flush ();
gimp_procedure_config_end_run (config, GIMP_PDB_SUCCESS);
g_object_unref (config);
gegl_exit ();
return gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL);

View File

@ -89,7 +89,7 @@ static GimpValueArray * dds_decode (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data);
#endif
@ -312,9 +312,9 @@ dds_create_procedure (GimpPlugIn *plug_in,
#if 0
else if (! strcmp (name, DECODE_YCOCG_PROC))
{
procedure = gimp_image_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
dds_decode, NULL, NULL);
procedure = gimp_image_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
dds_decode, NULL, NULL);
gimp_procedure_set_image_types (procedure, "RGBA");
gimp_procedure_set_sensitivity_mask (procedure,
@ -334,9 +334,9 @@ dds_create_procedure (GimpPlugIn *plug_in,
}
else if (! strcmp (name, DECODE_YCOCG_SCALED_PROC))
{
procedure = gimp_image_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
dds_decode, NULL, NULL);
procedure = gimp_image_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
dds_decode, NULL, NULL);
gimp_procedure_set_image_types (procedure, "RGBA");
gimp_procedure_set_sensitivity_mask (procedure,
@ -358,9 +358,9 @@ dds_create_procedure (GimpPlugIn *plug_in,
}
else if (! strcmp (name, DECODE_ALPHA_EXP_PROC))
{
procedure = gimp_image_procedure_new (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
dds_decode, NULL, NULL);
procedure = gimp_image_procedure_new2 (plug_in, name,
GIMP_PDB_PROC_TYPE_PLUGIN,
dds_decode, NULL, NULL);
gimp_procedure_set_image_types (procedure, "RGBA");
gimp_procedure_set_sensitivity_mask (procedure,
@ -505,7 +505,7 @@ dds_decode (GimpProcedure *procedure,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
const GimpValueArray *args,
GimpProcedureConfig *config,
gpointer run_data)
{
const gchar *name = gimp_procedure_get_name (procedure);