plug-ins: Replace guchar PDB parameters with more appropriate types

For improved readability, int or boolean types are used in place of
guchar for PDB parameters where the parameter description better fits
one or the other type.

This change affects `plug-in-alienmap2` and `plug-in-maze`.

Also, the problem with `guchar` parameters is that they currently cannot
 be modified via `GimpProcedureConfig` due to the type not being
supported.
This commit is contained in:
Kamil Burda 2024-02-06 19:58:57 +01:00 committed by Lloyd Konneker
parent 905e8777a7
commit 08c1fdc719
2 changed files with 52 additions and 52 deletions

View file

@ -442,10 +442,10 @@ plug_in_alienmap2_invoker (GimpProcedure *procedure,
gdouble greenangle; gdouble greenangle;
gdouble bluefrequency; gdouble bluefrequency;
gdouble blueangle; gdouble blueangle;
guchar colormodel; gint colormodel;
guchar redmode; gboolean redmode;
guchar greenmode; gboolean greenmode;
guchar bluemode; gboolean bluemode;
drawable = g_value_get_object (gimp_value_array_index (args, 2)); drawable = g_value_get_object (gimp_value_array_index (args, 2));
redfrequency = g_value_get_double (gimp_value_array_index (args, 3)); redfrequency = g_value_get_double (gimp_value_array_index (args, 3));
@ -454,10 +454,10 @@ plug_in_alienmap2_invoker (GimpProcedure *procedure,
greenangle = g_value_get_double (gimp_value_array_index (args, 6)); greenangle = g_value_get_double (gimp_value_array_index (args, 6));
bluefrequency = g_value_get_double (gimp_value_array_index (args, 7)); bluefrequency = g_value_get_double (gimp_value_array_index (args, 7));
blueangle = g_value_get_double (gimp_value_array_index (args, 8)); blueangle = g_value_get_double (gimp_value_array_index (args, 8));
colormodel = g_value_get_uchar (gimp_value_array_index (args, 9)); colormodel = g_value_get_int (gimp_value_array_index (args, 9));
redmode = g_value_get_uchar (gimp_value_array_index (args, 10)); redmode = g_value_get_boolean (gimp_value_array_index (args, 10));
greenmode = g_value_get_uchar (gimp_value_array_index (args, 11)); greenmode = g_value_get_boolean (gimp_value_array_index (args, 11));
bluemode = g_value_get_uchar (gimp_value_array_index (args, 12)); bluemode = g_value_get_boolean (gimp_value_array_index (args, 12));
if (success) if (success)
{ {
@ -2383,15 +2383,15 @@ plug_in_maze_invoker (GimpProcedure *procedure,
GimpDrawable *drawable; GimpDrawable *drawable;
gint width; gint width;
gint height; gint height;
guchar tileable; gboolean tileable;
guchar algorithm; gint algorithm;
gint seed; gint seed;
drawable = g_value_get_object (gimp_value_array_index (args, 2)); drawable = g_value_get_object (gimp_value_array_index (args, 2));
width = g_value_get_int (gimp_value_array_index (args, 3)); width = g_value_get_int (gimp_value_array_index (args, 3));
height = g_value_get_int (gimp_value_array_index (args, 4)); height = g_value_get_int (gimp_value_array_index (args, 4));
tileable = g_value_get_uchar (gimp_value_array_index (args, 5)); tileable = g_value_get_boolean (gimp_value_array_index (args, 5));
algorithm = g_value_get_uchar (gimp_value_array_index (args, 6)); algorithm = g_value_get_int (gimp_value_array_index (args, 6));
seed = g_value_get_int (gimp_value_array_index (args, 7)); seed = g_value_get_int (gimp_value_array_index (args, 7));
if (success) if (success)
@ -4921,28 +4921,28 @@ register_plug_in_compat_procs (GimpPDB *pdb)
0, 360, 0, 0, 360, 0,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure, gimp_procedure_add_argument (procedure,
g_param_spec_uchar ("colormodel", g_param_spec_int ("colormodel",
"colormodel", "colormodel",
"Color model { RGB-MODEL (0), HSL-MODEL (1) }", "Color model { RGB-MODEL (0), HSL-MODEL (1) }",
0, 1, 0, 0, 1, 0,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure, gimp_procedure_add_argument (procedure,
g_param_spec_uchar ("redmode", g_param_spec_boolean ("redmode",
"redmode", "redmode",
"Red/hue application mode { TRUE, FALSE }", "Red/hue application mode",
0, 1, 0, FALSE,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure, gimp_procedure_add_argument (procedure,
g_param_spec_uchar ("greenmode", g_param_spec_boolean ("greenmode",
"greenmode", "greenmode",
"Green/saturation application mode { TRUE, FALSE }", "Green/saturation application mode",
0, 1, 0, FALSE,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure, gimp_procedure_add_argument (procedure,
g_param_spec_uchar ("bluemode", g_param_spec_boolean ("bluemode",
"bluemode", "bluemode",
"Blue/luminance application mode { TRUE, FALSE }", "Blue/luminance application mode",
0, 1, 0, FALSE,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure); gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure); g_object_unref (procedure);
@ -7105,13 +7105,13 @@ register_plug_in_compat_procs (GimpPDB *pdb)
1, 1024, 1, 1, 1024, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure, gimp_procedure_add_argument (procedure,
g_param_spec_uchar ("tileable", g_param_spec_boolean ("tileable",
"tileable", "tileable",
"Tileable maze? (TRUE or FALSE)", "Tileable maze?",
0, 1, 0, FALSE,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure, gimp_procedure_add_argument (procedure,
g_param_spec_uchar ("algorithm", g_param_spec_int ("algorithm",
"algorithm", "algorithm",
"Generation algorithm (0 = DEPTH FIRST, 1 = PRIM'S ALGORITHM)", "Generation algorithm (0 = DEPTH FIRST, 1 = PRIM'S ALGORITHM)",
0, 1, 0, 0, 1, 0,

View file

@ -45,14 +45,14 @@ HELP
desc => 'Blue/luminance component frequency factor' }, desc => 'Blue/luminance component frequency factor' },
{ name => 'blueangle', type => '0 <= float <= 360', { name => 'blueangle', type => '0 <= float <= 360',
desc => 'Blue/luminance component angle factor (0-360)' }, desc => 'Blue/luminance component angle factor (0-360)' },
{ name => 'colormodel', type => '0 <= uchar <= 1', { name => 'colormodel', type => '0 <= int32 <= 1',
desc => 'Color model { RGB-MODEL (0), HSL-MODEL (1) }' }, desc => 'Color model { RGB-MODEL (0), HSL-MODEL (1) }' },
{ name => 'redmode', type => '0 <= uchar <= 1', { name => 'redmode', type => 'boolean',
desc => 'Red/hue application mode { TRUE, FALSE }' }, desc => 'Red/hue application mode' },
{ name => 'greenmode', type => '0 <= uchar <= 1', { name => 'greenmode', type => 'boolean',
desc => 'Green/saturation application mode { TRUE, FALSE }' }, desc => 'Green/saturation application mode' },
{ name => 'bluemode', type => '0 <= uchar <= 1', { name => 'bluemode', type => 'boolean',
desc => 'Blue/luminance application mode { TRUE, FALSE }' } desc => 'Blue/luminance application mode' }
); );
%invoke = ( %invoke = (
@ -2276,9 +2276,9 @@ HELP
desc => 'Width of the passages' }, desc => 'Width of the passages' },
{ name => 'height', type => '1 <= int32 <= 1024', { name => 'height', type => '1 <= int32 <= 1024',
desc => 'Height of the passages' }, desc => 'Height of the passages' },
{ name => 'tileable', type => '0 <= uchar <= 1', { name => 'tileable', type => 'boolean',
desc => 'Tileable maze? (TRUE or FALSE)' }, desc => 'Tileable maze?' },
{ name => 'algorithm', type => '0 <= uchar <= 1', { name => 'algorithm', type => '0 <= int32 <= 1',
desc => 'Generation algorithm (0 = DEPTH FIRST, 1 = PRIM\'S ALGORITHM)' }, desc => 'Generation algorithm (0 = DEPTH FIRST, 1 = PRIM\'S ALGORITHM)' },
{ name => 'seed', type => 'int32', { name => 'seed', type => 'int32',
desc => 'Random Seed' }, desc => 'Random Seed' },