plug-ins: Additional radio frame changes from d7a3a161

* file-sunras, sparkle, and fractal-explorer
were converted to use GimpChoice with
the RadioFrame setting
* Unnecessary store variables were
removed from hot and file-psp
This commit is contained in:
Alx Sa 2024-07-15 18:12:30 +00:00
parent febb2126c9
commit bfd374ed1a
6 changed files with 69 additions and 81 deletions

View File

@ -813,10 +813,9 @@ save_dialog (GimpProcedure *procedure,
GObject *config,
GimpImage *image)
{
GtkWidget *dialog;
GtkListStore *store;
GtkWidget *frame;
gint run;
GtkWidget *dialog;
GtkWidget *frame;
gint run;
dialog = gimp_export_procedure_dialog_new (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_PROCEDURE_CONFIG (config),

View File

@ -319,11 +319,14 @@ sunras_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"im1,im8,im24,im32,rs,ras,sun");
gimp_procedure_add_int_argument (procedure, "rle",
_("Data Formatting"),
_("Use standard (0) or Run-Length Encoded (1) output"),
0, 1, 1,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "rle",
_("_Data Formatting"),
_("Use standard or Run-Length Encoded output"),
gimp_choice_new_with_values ("standard", 0, _("Standard"), NULL,
"rle", 1, _("Run-Length Encoding"), NULL,
NULL),
"rle",
G_PARAM_READWRITE);
}
return procedure;
@ -571,9 +574,8 @@ export_image (GFile *file,
drawable_type = gimp_drawable_type (drawable);
g_object_get (config,
"rle", &rle,
NULL);
rle = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"rle");
/* Make sure we're not exporting an image with an alpha channel */
if (gimp_drawable_has_alpha (drawable))
@ -1753,19 +1755,15 @@ save_dialog (GimpImage *image,
GimpProcedure *procedure,
GObject *config)
{
GtkWidget *dialog;
GtkListStore *store;
gboolean run;
GtkWidget *dialog;
gboolean run;
dialog = gimp_export_procedure_dialog_new (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_PROCEDURE_CONFIG (config),
image);
store = gimp_int_store_new (_("S_tandard"), FALSE,
_("R_un-Length Encoded"), TRUE,
NULL);
gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (dialog),
"rle", GIMP_INT_STORE (store));
gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
"rle", GIMP_TYPE_INT_RADIO_FRAME);
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),
NULL);

View File

@ -649,11 +649,10 @@ static gboolean
plugin_dialog (GimpProcedure *procedure,
GObject *config)
{
GtkWidget *dlg;
GtkWidget *vbox;
GtkWidget *hbox;
GtkListStore *store;
gboolean run;
GtkWidget *dlg;
GtkWidget *vbox;
GtkWidget *hbox;
gboolean run;
gimp_ui_init (PLUG_IN_BINARY);

View File

@ -267,12 +267,15 @@ sparkle_create_procedure (GimpPlugIn *plug_in,
FALSE,
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "color-type",
_("Color type"),
_("Color of sparkles: { NATURAL (0), "
"FOREGROUND (1), BACKGROUND (2) }"),
0, 2, NATURAL,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "color-type",
_("_Color type"),
_("Color of sparkles"),
gimp_choice_new_with_values ("natural-color", NATURAL, _("Natural color"), NULL,
"foreground-color", FOREGROUND, _("Foreground color"), NULL,
"background-color", BACKGROUND, _("Background color"), NULL,
NULL),
"natural-color",
G_PARAM_READWRITE);
}
return procedure;
@ -348,12 +351,11 @@ sparkle_dialog (GimpProcedure *procedure,
GObject *config,
GimpDrawable *drawable)
{
GtkWidget *dialog;
GtkWidget *preview;
GtkWidget *hbox;
GtkWidget *scale;
GtkListStore *store;
gboolean run;
GtkWidget *dialog;
GtkWidget *preview;
GtkWidget *hbox;
GtkWidget *scale;
gboolean run;
gimp_ui_init (PLUG_IN_BINARY);
@ -361,12 +363,6 @@ sparkle_dialog (GimpProcedure *procedure,
GIMP_PROCEDURE_CONFIG (config),
_("Sparkle"));
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gimp_window_set_transient (GTK_WINDOW (dialog));
gtk_widget_set_size_request (dialog, 430, -1);
gtk_container_set_border_width (
GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 12);
@ -416,12 +412,8 @@ sparkle_dialog (GimpProcedure *procedure,
FALSE, "sparkle-bool-vbox");
/* colortype */
store = gimp_int_store_new (_("Natural color"), NATURAL,
_("Foreground color"), FOREGROUND,
_("Background color"), BACKGROUND,
NULL);
gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (dialog),
"color-type", GIMP_INT_STORE (store));
gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
"color-type", GIMP_TYPE_INT_RADIO_FRAME);
hbox = gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
"sparkle-row", "sparkle-bool-frame",
@ -1007,8 +999,9 @@ fspike (GObject *config,
"random-hue", &random_hue,
"random-saturation", &random_saturation,
"inverse", &inverse,
"color-type", &colortype,
NULL);
colortype = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"color-type");
theta = angle;

View File

@ -356,8 +356,8 @@ explorer_gradient_select_callback (gpointer data, /* config */
g_object_get (config,
"n-colors", &n_colors,
"color-mode", &color_mode,
NULL);
color_mode = gimp_procedure_config_get_choice_id (config, "color-mode");
set_grad_data_cache (gradient, n_colors);
if (color_mode == 1)
@ -563,19 +563,18 @@ gint
explorer_dialog (GimpProcedure *procedure,
GimpProcedureConfig *config)
{
GtkWidget *dialog;
GtkWidget *top_hbox;
GtkWidget *left_vbox;
GtkWidget *vbox;
GtkWidget *bbox;
GtkWidget *frame;
GtkWidget *toggle;
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *gradient_button;
gchar *path;
GtkListStore *store;
gint n_colors;
GtkWidget *dialog;
GtkWidget *top_hbox;
GtkWidget *left_vbox;
GtkWidget *vbox;
GtkWidget *bbox;
GtkWidget *frame;
GtkWidget *toggle;
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *gradient_button;
gchar *path;
gint n_colors;
gimp_ui_init (PLUG_IN_BINARY);
@ -929,11 +928,8 @@ explorer_dialog (GimpProcedure *procedure,
"color-function-label", FALSE,
"function-hbox");
store = gimp_int_store_new (_("As specified above"), 0,
_("Apply active gradient to final image"), 1,
NULL);
gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (dialog),
"color-mode", GIMP_INT_STORE (store));
gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
"color-mode", GIMP_TYPE_INT_RADIO_FRAME);
hbox = gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
"color-mode-hbox",
@ -1213,14 +1209,14 @@ make_color_map (GimpProcedureConfig *config)
"red-stretch", &redstretch,
"green-stretch", &greenstretch,
"blue-stretch", &bluestretch,
"color-mode", &color_mode,
"red-invert", &red_invert,
"green-invert", &green_invert,
"blue-invert", &blue_invert,
NULL);
red_mode = gimp_procedure_config_get_choice_id (config, "red-mode");
green_mode = gimp_procedure_config_get_choice_id (config, "green-mode");
blue_mode = gimp_procedure_config_get_choice_id (config, "blue-mode");
red_mode = gimp_procedure_config_get_choice_id (config, "red-mode");
green_mode = gimp_procedure_config_get_choice_id (config, "green-mode");
blue_mode = gimp_procedure_config_get_choice_id (config, "blue-mode");
color_mode = gimp_procedure_config_get_choice_id (config, "color-mode");
/* get gradient samples if they don't exist -- fixes gradient color
* mode for noninteractive use (bug #103470).
@ -1354,7 +1350,6 @@ save_options (FILE * fp)
"red-stretch", &red_stretch,
"green-stretch", &green_stretch,
"blue-stretch", &blue_stretch,
"color-mode", &color_mode,
"red-invert", &red_invert,
"green-invert", &green_invert,
"blue-invert", &blue_invert,
@ -1364,6 +1359,7 @@ save_options (FILE * fp)
red_mode = gimp_procedure_config_get_choice_id (wvals.config, "red-mode");
green_mode = gimp_procedure_config_get_choice_id (wvals.config, "green-mode");
blue_mode = gimp_procedure_config_get_choice_id (wvals.config, "blue-mode");
color_mode = gimp_procedure_config_get_choice_id (wvals.config, "color-mode");
/* Save options */
@ -1813,7 +1809,8 @@ explorer_load (void)
"red-stretch", current_obj->opts.redstretch,
"green-stretch", current_obj->opts.greenstretch,
"blue-stretch", current_obj->opts.bluestretch,
"color-mode", current_obj->opts.colormode,
"color-mode", (current_obj->opts.colormode == 0) ?
"colormap" : "gradient",
"red-invert", current_obj->opts.redinvert,
"green-invert", current_obj->opts.greeninvert,
"blue-invert", current_obj->opts.blueinvert,

View File

@ -311,12 +311,14 @@ explorer_create_procedure (GimpPlugIn *plug_in,
-2.5000, 2.5000, -0.2,
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "color-mode",
_("Color mode"),
_("0: Apply colormap as specified by the parameters "
"above; 1: Apply active gradient to final image"),
0, 1, 0,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "color-mode",
_("Color mode"),
_("Apply specified color map or active gradient to final image"),
gimp_choice_new_with_values ("colormap", 0, _("As specified above"), NULL,
"gradient", 1, _("Apply active gradient to final image"), NULL,
NULL),
"colormap",
G_PARAM_READWRITE);
gimp_procedure_add_double_argument (procedure, "red-stretch",
_("Red stretch"),