plug-ins: Use GimpProcedureDialog's Radio widget...

...from GimpChoice.
0b2d8fed let us display GimpChoice
options as IntRadioFrames. Therefore, we
can convert a number of plug-in parameters
that were being built manually to use
GimpChoice instead. This decreases the
amount of GUI code and makes the
non-interactive inputs more descriptive.
This commit is contained in:
Alx Sa 2024-07-14 04:12:26 +00:00
parent f2699aaeeb
commit d7a3a161e0
10 changed files with 245 additions and 291 deletions

View file

@ -162,13 +162,14 @@ blinds_create_procedure (GimpPlugIn *plug_in,
1, MAX_FANS, 3, 1, MAX_FANS, 3,
G_PARAM_READWRITE); G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "orientation", gimp_procedure_add_choice_argument (procedure, "orientation",
_("Orientation"), _("Orient_ation"),
_("The orientation"), _("The orientation"),
GIMP_ORIENTATION_HORIZONTAL, gimp_choice_new_with_values ("horizontal", GIMP_ORIENTATION_HORIZONTAL, _("Horizontal"), NULL,
GIMP_ORIENTATION_VERTICAL, "vertical", GIMP_ORIENTATION_VERTICAL, _("Vertical"), NULL,
GIMP_ORIENTATION_HORIZONTAL, NULL),
G_PARAM_READWRITE); "horizontal",
G_PARAM_READWRITE);
gimp_procedure_add_boolean_argument (procedure, "bg-transparent", gimp_procedure_add_boolean_argument (procedure, "bg-transparent",
_("_Transparent"), _("_Transparent"),
@ -246,7 +247,6 @@ blinds_dialog (GimpProcedure *procedure,
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *scale; GtkWidget *scale;
GtkListStore *store;
gboolean run; gboolean run;
gimp_ui_init (PLUG_IN_BINARY); gimp_ui_init (PLUG_IN_BINARY);
@ -255,18 +255,8 @@ blinds_dialog (GimpProcedure *procedure,
GIMP_PROCEDURE_CONFIG (config), GIMP_PROCEDURE_CONFIG (config),
_("Blinds")); _("Blinds"));
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog), gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
GTK_RESPONSE_OK, "orientation", GIMP_TYPE_INT_RADIO_FRAME);
GTK_RESPONSE_CANCEL,
-1);
gimp_window_set_transient (GTK_WINDOW (dialog));
store = gimp_int_store_new (_("Horizontal"), GIMP_ORIENTATION_HORIZONTAL,
_("Vertical"), GIMP_ORIENTATION_VERTICAL,
NULL);
gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (dialog),
"orientation", GIMP_INT_STORE (store));
gimp_procedure_dialog_get_label (GIMP_PROCEDURE_DIALOG (dialog), gimp_procedure_dialog_get_label (GIMP_PROCEDURE_DIALOG (dialog),
"bg_label", _("Background"), FALSE, FALSE); "bg_label", _("Background"), FALSE, FALSE);
@ -317,7 +307,7 @@ blinds_dialog (GimpProcedure *procedure,
"preview", "blinds-vbox", "preview", "blinds-vbox",
NULL); NULL);
gtk_widget_show (dialog); gtk_widget_set_visible (dialog, TRUE);
run = gimp_procedure_dialog_run (GIMP_PROCEDURE_DIALOG (dialog)); run = gimp_procedure_dialog_run (GIMP_PROCEDURE_DIALOG (dialog));
@ -460,8 +450,9 @@ dialog_update_preview (GtkWidget *widget,
g_object_get (config, g_object_get (config,
"bg-transparent", &bg_trans, "bg-transparent", &bg_trans,
"orientation", &orientation,
NULL); NULL);
orientation = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"orientation");
gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height); gimp_preview_get_size (GIMP_PREVIEW (preview), &width, &height);
cache = gimp_drawable_get_thumbnail_data (drawable, cache = gimp_drawable_get_thumbnail_data (drawable,
@ -593,8 +584,9 @@ apply_blinds (GObject *config,
g_object_get (config, g_object_get (config,
"bg-transparent", &bg_trans, "bg-transparent", &bg_trans,
"orientation", &orientation,
NULL); NULL);
orientation = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"orientation");
background = gimp_context_get_background (); background = gimp_context_get_background ();

View file

@ -447,18 +447,24 @@ bender_create_procedure (GimpPlugIn *plug_in,
FALSE, FALSE,
G_PARAM_READWRITE); G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "curve-type", gimp_procedure_add_choice_argument (procedure, "curve-type",
_("Curve Type"), _("Cur_ve Type"),
_("{ 0 == smooth (use 17 points), " _("Whether to use Smooth (17 points) or "
"1 == freehand (use 256 val_y) }"), "Freehand (256 points) to draw the curve"),
0, 1, 0, gimp_choice_new_with_values ("smooth", SMOOTH, _("Smooth"), NULL,
G_PARAM_READWRITE); "freehand", GFREE, _("Freehand"), NULL,
NULL),
"smooth",
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "curve-border", gimp_procedure_add_choice_argument (procedure, "curve-border",
_("Curve for Border"), _("Curve for _Border"),
_("Choose the active border line to edit"), _("Choose the active border line to edit"),
0, 1, 0, gimp_choice_new_with_values ("upper", OUTLINE_UPPER, _("Upper"), NULL,
G_PARAM_READWRITE); "lower", OUTLINE_LOWER, C_("adjective", "Lower"), NULL,
NULL),
"upper",
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "argc-upper-point-x", gimp_procedure_add_int_argument (procedure, "argc-upper-point-x",
_("Argc upper point X"), _("Argc upper point X"),
@ -1025,7 +1031,6 @@ bender_new_dialog (GimpProcedure *procedure,
GtkWidget *toggle; GtkWidget *toggle;
GtkWidget *button; GtkWidget *button;
GdkDisplay *display; GdkDisplay *display;
GtkListStore *store;
gint i, j; gint i, j;
cd = g_new (BenderDialog, 1); cd = g_new (BenderDialog, 1);
@ -1151,19 +1156,13 @@ bender_new_dialog (GimpProcedure *procedure,
/* The curves graph */ /* The curves graph */
/* Config-connected widgets first */ /* Config-connected widgets first */
store = gimp_int_store_new (_("Smooth"), 0, gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (cd->shell),
_("Free"), 1, "curve-type", GIMP_TYPE_INT_RADIO_FRAME);
NULL);
gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (cd->shell),
"curve-type", GIMP_INT_STORE (store));
g_signal_connect (config, "notify::curve-type", g_signal_connect (config, "notify::curve-type",
G_CALLBACK (bender_type_callback), cd); G_CALLBACK (bender_type_callback), cd);
store = gimp_int_store_new (_("Upper"), OUTLINE_UPPER, gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (cd->shell),
C_("adjective", "Lower"), OUTLINE_LOWER, "curve-border", GIMP_TYPE_INT_RADIO_FRAME);
NULL);
gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (cd->shell),
"curve-border", GIMP_INT_STORE (store));
g_signal_connect (config, "notify::curve-border", g_signal_connect (config, "notify::curve-border",
G_CALLBACK (bender_global_notify), cd); G_CALLBACK (bender_global_notify), cd);
@ -1363,9 +1362,8 @@ bender_plot_curve (BenderDialog *cd,
gint32 i; gint32 i;
gint outline; gint outline;
g_object_get (cd->config, outline = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (cd->config),
"curve-border", &outline, "curve-border");
NULL);
/* construct the geometry matrix from the segment */ /* construct the geometry matrix from the segment */
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
@ -1484,10 +1482,10 @@ bender_calculate_curve (BenderDialog *cd,
gint curve_type; gint curve_type;
gint outline; gint outline;
g_object_get (cd->config, curve_type = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (cd->config),
"curve-type", &curve_type, "curve-type");
"curve-border", &outline, outline = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (cd->config),
NULL); "curve-border");
switch (curve_type) switch (curve_type)
{ {
@ -1571,10 +1569,10 @@ bender_type_callback (GtkWidget *widget,
if (! cd) if (! cd)
return; return;
g_object_get (cd->config, curve_type = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (cd->config),
"curve-type", &curve_type, "curve-type");
"curve-border", &outline, outline = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (cd->config),
NULL); "curve-border");
if (curve_type == SMOOTH) if (curve_type == SMOOTH)
{ {
@ -1608,9 +1606,8 @@ bender_reset_callback (GtkWidget *widget,
gint i; gint i;
gint outline; gint outline;
g_object_get (cd->config, outline = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (cd->config),
"curve-border", &outline, "curve-border");
NULL);
/* Initialize the values */ /* Initialize the values */
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
@ -1641,9 +1638,8 @@ bender_copy_callback (GtkWidget *widget,
gint other; gint other;
gint outline; gint outline;
g_object_get (cd->config, outline = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (cd->config),
"curve-border", &outline, "curve-border");
NULL);
other = (outline) ? 0 : 1; other = (outline) ? 0 : 1;
@ -1672,9 +1668,8 @@ bender_copy_inv_callback (GtkWidget *widget,
gint other; gint other;
gint outline; gint outline;
g_object_get (cd->config, outline = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (cd->config),
"curve-border", &outline, "curve-border");
NULL);
other = (outline) ? 0 : 1; other = (outline) ? 0 : 1;
@ -1707,9 +1702,8 @@ bender_swap_callback (GtkWidget *widget,
gdouble hd; gdouble hd;
guchar hu; guchar hu;
g_object_get (cd->config, outline = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (cd->config),
"curve-border", &outline, "curve-border");
NULL);
other = (outline) ? 0 : 1; other = (outline) ? 0 : 1;
@ -1877,10 +1871,10 @@ bender_graph_events (GtkWidget *widget,
gint curve_type; gint curve_type;
gint outline; gint outline;
g_object_get (cd->config, curve_type = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (cd->config),
"curve-type", &curve_type, "curve-type");
"curve-border", &outline, outline = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (cd->config),
NULL); "curve-border");
new_type = GDK_X_CURSOR; new_type = GDK_X_CURSOR;
closest_point = 0; closest_point = 0;
@ -2062,10 +2056,10 @@ bender_graph_draw (GtkWidget *widget,
gint curve_type; gint curve_type;
gint outline; gint outline;
g_object_get (cd->config, curve_type = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (cd->config),
"curve-type", &curve_type, "curve-type");
"curve-border", &outline, outline = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (cd->config),
NULL); "curve-border");
cairo_set_line_width (cr, 1.0); cairo_set_line_width (cr, 1.0);
cairo_translate (cr, 0.5, 0.5); cairo_translate (cr, 0.5, 0.5);
@ -2602,36 +2596,37 @@ p_bender_calculate_iter_curve (BenderDialog *cd,
gint32 xmax, gint32 xmax,
gint32 ymax) gint32 ymax)
{ {
gint outline; gint outline;
gint curve_type; gint curve_type;
g_object_get (config, curve_type = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (cd->config),
"curve-type", &curve_type, "curve-type");
"curve-border", &outline, outline = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (cd->config),
NULL); "curve-border");
if (gb_debug) if (gb_debug)
g_printf ("p_bender_calculate_iter_curve NORMAL1\n"); g_printf ("p_bender_calculate_iter_curve NORMAL1\n");
if (curve_type == SMOOTH) if (curve_type == SMOOTH)
{ {
g_object_set (cd->config, g_object_set (cd->config,
"curve-border", OUTLINE_UPPER, "curve-border", "upper",
NULL); NULL);
bender_calculate_curve (cd, xmax, ymax, FALSE); bender_calculate_curve (cd, xmax, ymax, FALSE);
g_object_set (cd->config, g_object_set (cd->config,
"curve-border", OUTLINE_LOWER, "curve-border", "lower",
NULL); NULL);
bender_calculate_curve (cd, xmax, ymax, FALSE); bender_calculate_curve (cd, xmax, ymax, FALSE);
} }
else else
{ {
p_stretch_curves (cd, xmax, ymax); p_stretch_curves (cd, xmax, ymax);
} }
g_object_set (config, g_object_set (config,
"curve-border", outline, "curve-border", (outline == OUTLINE_UPPER) ?
NULL); "upper" : "lower",
NULL);
} }
/* ============================================================================ /* ============================================================================

View file

@ -298,7 +298,7 @@ decompose_create_procedure (GimpPlugIn *plug_in,
_("Color _model"), _("Color _model"),
_("The model to decompose to"), _("The model to decompose to"),
gimp_choice_new_with_values ("rgb", 0, _("RGB"), NULL, gimp_choice_new_with_values ("rgb", 0, _("RGB"), NULL,
"rgba", 1, _("RGBA"), NULL, "rgba", 1, _("RGBA"), NULL,
"alpha", 2, _("Alpha"), NULL, "alpha", 2, _("Alpha"), NULL,
"hsv", 3, _("HSV"), NULL, "hsv", 3, _("HSV"), NULL,
"hsl", 4, _("HSL"), NULL, "hsl", 4, _("HSL"), NULL,

View file

@ -218,12 +218,15 @@ pcx_create_procedure (GimpPlugIn *plug_in,
"Nick Lamb <njl195@zepler.org.uk>", "Nick Lamb <njl195@zepler.org.uk>",
"January 1997"); "January 1997");
gimp_procedure_add_int_argument (procedure, "override-palette", gimp_procedure_add_choice_argument (procedure, "override-palette",
_("Palette Options"), _("_Palette Options"),
_("Use built-in palette (0) or override with " _("Whether to use the built-in palette or "
"black/white (1)"), "a black and white palette for 1 bit images."),
0, 1, 0, gimp_choice_new_with_values ("use-built-in-palette", 0, _("Use PCX image's built-in palette"), NULL,
G_PARAM_READWRITE); "use-bw-palette", 1, _("Use black and white palette"), NULL,
NULL),
"use-built-in-palette",
G_PARAM_READWRITE);
gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
"image/x-pcx"); "image/x-pcx");
@ -249,12 +252,15 @@ pcx_create_procedure (GimpPlugIn *plug_in,
"Alex S.", "Alex S.",
"2023"); "2023");
gimp_procedure_add_int_argument (procedure, "override-palette", gimp_procedure_add_choice_argument (procedure, "override-palette",
_("Palette Options"), _("_Palette Options"),
_("Use built-in palette (0) or override with " _("Whether to use the built-in palette or "
"black/white (1)"), "a black and white palette for 1 bit images."),
0, 1, 0, gimp_choice_new_with_values ("use-built-in-palette", 0, _("Use PCX image's built-in palette"), NULL,
G_PARAM_READWRITE); "use-bw-palette", 1, _("Use black and white palette"), NULL,
NULL),
"use-built-in-palette",
G_PARAM_READWRITE);
gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
"image/x-dcx"); "image/x-dcx");
@ -745,16 +751,13 @@ load_image (GimpProcedure *procedure,
if (run_mode == GIMP_RUN_INTERACTIVE) if (run_mode == GIMP_RUN_INTERACTIVE)
{ {
g_object_get (config, override_palette = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"override-palette", &override_palette, "override-palette");
NULL);
/* Only show dialogue once for DCX import */ /* Only show dialogue once for DCX import */
if (image_num == 0 && pcx_load_dialog (procedure, config)) if (image_num == 0 && pcx_load_dialog (procedure, config))
{ override_palette = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
g_object_get (config, "override-palette");
"override-palette", &override_palette,
NULL);
}
} }
/* Monochrome does not mean necessarily B&W. Therefore we still /* Monochrome does not mean necessarily B&W. Therefore we still
* want to check the header palette, even for just 2 colors. * want to check the header palette, even for just 2 colors.
@ -847,7 +850,6 @@ pcx_load_dialog (GimpProcedure *procedure,
GObject *config) GObject *config)
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkListStore *store;
gboolean run; gboolean run;
gimp_ui_init (PLUG_IN_BINARY); gimp_ui_init (PLUG_IN_BINARY);
@ -856,18 +858,8 @@ pcx_load_dialog (GimpProcedure *procedure,
GIMP_PROCEDURE_CONFIG (config), GIMP_PROCEDURE_CONFIG (config),
_("Import from PCX")); _("Import from PCX"));
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog), gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
GTK_RESPONSE_OK, "override-palette", GIMP_TYPE_INT_RADIO_FRAME);
GTK_RESPONSE_CANCEL,
-1);
gimp_window_set_transient (GTK_WINDOW (dialog));
store = gimp_int_store_new (_("Use PCX image's built-in palette"), 0,
_("Use black and white palette"), 1,
NULL);
gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (dialog),
"override-palette", GIMP_INT_STORE (store));
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog), gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),
NULL); NULL);

View file

@ -367,11 +367,14 @@ pnm_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"pnm"); "pnm");
gimp_procedure_add_int_argument (procedure, "raw", gimp_procedure_add_choice_argument (procedure, "raw",
_("Data formatting"), _("_Data formatting"),
_("TRUE for raw output, FALSE for ascii output"), _("Whether to export ASCII or raw output"),
0, 1, 1, gimp_choice_new_with_values ("ascii-output", 0, _("ASCII"), NULL,
G_PARAM_READWRITE); "raw-output", 1, _("Raw"), NULL,
NULL),
"raw-output",
G_PARAM_READWRITE);
} }
else if (! strcmp (name, PBM_EXPORT_PROC)) else if (! strcmp (name, PBM_EXPORT_PROC))
{ {
@ -403,11 +406,14 @@ pnm_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"pbm"); "pbm");
gimp_procedure_add_int_argument (procedure, "raw", gimp_procedure_add_choice_argument (procedure, "raw",
_("Data formatting"), _("_Data formatting"),
_("TRUE for raw output, FALSE for ascii output"), _("Whether to export ASCII or raw output"),
0, 1, 1, gimp_choice_new_with_values ("ascii-output", 0, _("ASCII"), NULL,
G_PARAM_READWRITE); "raw-output", 1, _("Raw"), NULL,
NULL),
"raw-output",
G_PARAM_READWRITE);
} }
else if (! strcmp (name, PGM_EXPORT_PROC)) else if (! strcmp (name, PGM_EXPORT_PROC))
{ {
@ -439,11 +445,14 @@ pnm_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"pgm"); "pgm");
gimp_procedure_add_int_argument (procedure, "raw", gimp_procedure_add_choice_argument (procedure, "raw",
_("Data formatting"), _("_Data formatting"),
_("TRUE for raw output, FALSE for ascii output"), _("Whether to export ASCII or raw output"),
0, 1, 1, gimp_choice_new_with_values ("ascii-output", 0, _("ASCII"), NULL,
G_PARAM_READWRITE); "raw-output", 1, _("Raw"), NULL,
NULL),
"raw-output",
G_PARAM_READWRITE);
} }
else if (! strcmp (name, PPM_EXPORT_PROC)) else if (! strcmp (name, PPM_EXPORT_PROC))
{ {
@ -475,11 +484,14 @@ pnm_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"ppm"); "ppm");
gimp_procedure_add_int_argument (procedure, "raw", gimp_procedure_add_choice_argument (procedure, "raw",
"Data formatting", _("_Data formatting"),
_("TRUE for raw output, FALSE for ascii output"), _("Whether to export ASCII or raw output"),
0, 1, 1, gimp_choice_new_with_values ("ascii-output", 0, _("ASCII"), NULL,
G_PARAM_READWRITE); "raw-output", 1, _("Raw"), NULL,
NULL),
"raw-output",
G_PARAM_READWRITE);
} }
else if (! strcmp (name, PAM_EXPORT_PROC)) else if (! strcmp (name, PAM_EXPORT_PROC))
{ {
@ -1592,9 +1604,8 @@ export_image (GFile *file,
gboolean config_raw = TRUE; gboolean config_raw = TRUE;
if (file_type != FILE_TYPE_PFM && file_type != FILE_TYPE_PAM) if (file_type != FILE_TYPE_PFM && file_type != FILE_TYPE_PAM)
g_object_get (config, config_raw = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"raw", &config_raw, "raw");
NULL);
/* Make sure we're not saving an image with an alpha channel /* Make sure we're not saving an image with an alpha channel
* unless we're exporting a PAM file */ * unless we're exporting a PAM file */
@ -1990,18 +2001,14 @@ save_dialog (GimpProcedure *procedure,
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *frame; GtkWidget *frame;
GtkListStore *store;
gboolean run; gboolean run;
dialog = gimp_export_procedure_dialog_new (GIMP_EXPORT_PROCEDURE (procedure), dialog = gimp_export_procedure_dialog_new (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_PROCEDURE_CONFIG (config), GIMP_PROCEDURE_CONFIG (config),
image); image);
/* file save type */ /* file save type */
store = gimp_int_store_new (_("_ASCII"), 0, frame = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
_("_Raw"), 1, "raw", GIMP_TYPE_INT_RADIO_FRAME);
NULL);
frame = gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (dialog),
"raw", GIMP_INT_STORE (store));
gtk_container_set_border_width (GTK_CONTAINER (frame), 12); gtk_container_set_border_width (GTK_CONTAINER (frame), 12);
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog), NULL); gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog), NULL);

View file

@ -713,12 +713,15 @@ psp_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"psp,tub"); "psp,tub");
gimp_procedure_add_int_argument (procedure, "compression", gimp_procedure_add_choice_argument (procedure, "compression",
"_Data Compression", _("_Data Compression"),
"Specify 0 for no compression, " _("Type of compression"),
"1 for RLE, and 2 for LZ77", gimp_choice_new_with_values ("none", PSP_COMP_NONE, _("none"), NULL,
0, 2, PSP_COMP_LZ77, "rle", PSP_COMP_RLE, _("rle"), NULL,
G_PARAM_READWRITE); "lz77", PSP_COMP_LZ77, _("lz77"), NULL,
NULL),
"lz77",
G_PARAM_READWRITE);
} }
return procedure; return procedure;
@ -829,12 +832,8 @@ save_dialog (GimpProcedure *procedure,
image); image);
/* file save type */ /* file save type */
store = gimp_int_store_new (_("None"), PSP_COMP_NONE, frame = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
_("RLE"), PSP_COMP_RLE, "compression", GIMP_TYPE_INT_RADIO_FRAME);
_("LZ77"), PSP_COMP_LZ77,
NULL);
frame = gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (dialog),
"compression", GIMP_INT_STORE (store));
gtk_container_set_border_width (GTK_CONTAINER (frame), 12); gtk_container_set_border_width (GTK_CONTAINER (frame), 12);
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog), NULL); gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog), NULL);

View file

@ -254,7 +254,7 @@ hot_create_procedure (GimpPlugIn *plug_in,
"be unsafely bright"), "be unsafely bright"),
"hot scans an image for pixels that " "hot scans an image for pixels that "
"will give unsave values of " "will give unsave values of "
"chrominance or composite signale " "chrominance or composite signal "
"amplitude when encoded into an NTSC " "amplitude when encoded into an NTSC "
"or PAL signal. Three actions can be " "or PAL signal. Three actions can be "
"performed on these 'hot' pixels. " "performed on these 'hot' pixels. "
@ -266,18 +266,24 @@ hot_create_procedure (GimpPlugIn *plug_in,
"Eric L. Hernes", "Eric L. Hernes",
"1997"); "1997");
gimp_procedure_add_int_argument (procedure, "mode", gimp_procedure_add_choice_argument (procedure, "mode",
_("Mode"), _("_Mode"),
_("Mode { NTSC (0), PAL (1) }"), _("Signal mode"),
0, 1, MODE_NTSC, gimp_choice_new_with_values ("ntsc", MODE_NTSC, _("NTSC"), NULL,
G_PARAM_READWRITE); "pal", MODE_PAL, _("PAL"), NULL,
NULL),
"ntsc",
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "action", gimp_procedure_add_choice_argument (procedure, "action",
_("Action"), _("_Action"),
_("Action { (0) reduce luminance, " _("Action"),
"(1) reduce saturation, or (2) Blacken }"), gimp_choice_new_with_values ("reduce-luminance", ACT_LREDUX, _("Reduce Luminance"), NULL,
0, 2, ACT_LREDUX, "reduce-saturation", ACT_SREDUX, _("Reduce Saturation"), NULL,
G_PARAM_READWRITE); "blacken", ACT_FLAG, _("Blacken"), NULL,
NULL),
"reduce-luminance",
G_PARAM_READWRITE);
gimp_procedure_add_boolean_argument (procedure, "new-layer", gimp_procedure_add_boolean_argument (procedure, "new-layer",
_("Create _new layer"), _("Create _new layer"),
@ -365,10 +371,12 @@ pluginCore (GimpImage *image,
gdouble py; gdouble py;
g_object_get (config, g_object_get (config,
"mode", &mode,
"action", &action,
"new-layer", &new_layer, "new-layer", &new_layer,
NULL); NULL);
mode = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"mode");
action = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"action");
width = gimp_drawable_get_width (drawable); width = gimp_drawable_get_width (drawable);
height = gimp_drawable_get_height (drawable); height = gimp_drawable_get_height (drawable);
@ -653,25 +661,10 @@ plugin_dialog (GimpProcedure *procedure,
GIMP_PROCEDURE_CONFIG (config), GIMP_PROCEDURE_CONFIG (config),
_("Hot")); _("Hot"));
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dlg), gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dlg),
GTK_RESPONSE_OK, "mode", GIMP_TYPE_INT_RADIO_FRAME);
GTK_RESPONSE_CANCEL, gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dlg),
-1); "action", GIMP_TYPE_INT_RADIO_FRAME);
gimp_window_set_transient (GTK_WINDOW (dlg));
store = gimp_int_store_new (_("N_TSC"), MODE_NTSC,
_("_PAL"), MODE_PAL,
NULL);
gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (dlg),
"mode", GIMP_INT_STORE (store));
store = gimp_int_store_new (_("Reduce _Luminance"), ACT_LREDUX,
_("Reduce _Saturation"), ACT_SREDUX,
_("_Blacken"), ACT_FLAG,
NULL);
gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (dlg),
"action", GIMP_INT_STORE (store));
vbox = gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dlg), vbox = gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dlg),
"hot-left-side", "hot-left-side",

View file

@ -421,12 +421,14 @@ jigsaw_create_procedure (GimpPlugIn *plug_in,
MIN_YTILES, MAX_YTILES, 5, MIN_YTILES, MAX_YTILES, 5,
G_PARAM_READWRITE); G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "style", gimp_procedure_add_choice_argument (procedure, "style",
_("Jigsaw Style"), _("_Jigsaw Style"),
_("The style/shape of the jigsaw puzzle " _("The style/shape of the jigsaw puzzle"),
"{ Square (0), Curved (1) }"), gimp_choice_new_with_values ("square", BEZIER_1, _("Square"), NULL,
0, 1, BEZIER_1, "curved", BEZIER_2, _("Curved"), NULL,
G_PARAM_READWRITE); NULL),
"square",
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "blend-lines", gimp_procedure_add_int_argument (procedure, "blend-lines",
_("_Blend width"), _("_Blend width"),
@ -654,8 +656,9 @@ draw_jigsaw (GObject *config,
"y", &ytiles, "y", &ytiles,
"blend-lines", &blend_lines, "blend-lines", &blend_lines,
"blend-amount", &blend_amount, "blend-amount", &blend_amount,
"style", &style,
NULL); NULL);
style = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"style");
xlines = xtiles - 1; xlines = xtiles - 1;
ylines = ytiles - 1; ylines = ytiles - 1;
@ -2468,7 +2471,6 @@ jigsaw_dialog (GimpProcedure *procedure,
GtkWidget *preview; GtkWidget *preview;
GtkWidget *frame; GtkWidget *frame;
GtkWidget *scale; GtkWidget *scale;
GtkListStore *store;
gboolean run; gboolean run;
gimp_ui_init (PLUG_IN_BINARY); gimp_ui_init (PLUG_IN_BINARY);
@ -2477,13 +2479,6 @@ jigsaw_dialog (GimpProcedure *procedure,
GIMP_PROCEDURE_CONFIG (config), GIMP_PROCEDURE_CONFIG (config),
_("Jigsaw")); _("Jigsaw"));
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gimp_window_set_transient (GTK_WINDOW (dialog));
/* xtiles */ /* xtiles */
scale = gimp_procedure_dialog_get_scale_entry (GIMP_PROCEDURE_DIALOG (dialog), scale = gimp_procedure_dialog_get_scale_entry (GIMP_PROCEDURE_DIALOG (dialog),
"x", 1.0); "x", 1.0);
@ -2522,11 +2517,8 @@ jigsaw_dialog (GimpProcedure *procedure,
"bevel-vbox"); "bevel-vbox");
/* frame for primitive radio buttons */ /* frame for primitive radio buttons */
store = gimp_int_store_new (_("Square"), BEZIER_1, frame = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
_("Curved"), BEZIER_2, "style", GIMP_TYPE_INT_RADIO_FRAME);
NULL);
frame = gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (dialog),
"style", GIMP_INT_STORE (store));
gtk_widget_set_margin_bottom (frame, 12); gtk_widget_set_margin_bottom (frame, 12);
gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog), gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),

View file

@ -182,15 +182,15 @@ nlfilter_create_procedure (GimpPlugIn *plug_in,
1.0 / 3.0, 1, 1.0 / 3.0, 1.0 / 3.0, 1, 1.0 / 3.0,
G_PARAM_READWRITE); G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "filter", gimp_procedure_add_choice_argument (procedure, "filter",
_("Filter"), _("_Filter"),
_("The Filter to Run, " _("The Filter to Run"),
"0 - alpha trimmed mean; " gimp_choice_new_with_values ("alpha-trim", filter_alpha_trim, _("Alpha trimmed mean"), NULL,
"1 - optimal estimation " "optimal-estimation", filter_opt_est, _("Optimal estimation"), NULL,
"(alpha controls noise variance); " "edge-enhancement", filter_edge_enhance, _("Edge enhancement"), NULL,
"2 - edge enhancement"), NULL),
0, 2, 0, "alpha-trim",
G_PARAM_READWRITE); G_PARAM_READWRITE);
} }
return procedure; return procedure;
@ -957,8 +957,9 @@ nlfilter (GObject *config,
g_object_get (config, g_object_get (config,
"alpha", &alpha, "alpha", &alpha,
"radius", &radius, "radius", &radius,
"filter", &filter,
NULL); NULL);
filter = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"filter");
if (preview) if (preview)
{ {
@ -1092,12 +1093,11 @@ nlfilter_dialog (GimpProcedure *procedure,
GObject *config, GObject *config,
GimpDrawable *drawable) GimpDrawable *drawable)
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *preview; GtkWidget *preview;
GtkListStore *store; GtkWidget *frame;
GtkWidget *frame; GtkWidget *scale;
GtkWidget *scale; gboolean run;
gboolean run;
gimp_ui_init (PLUG_IN_BINARY); gimp_ui_init (PLUG_IN_BINARY);
@ -1105,19 +1105,8 @@ nlfilter_dialog (GimpProcedure *procedure,
GIMP_PROCEDURE_CONFIG (config), GIMP_PROCEDURE_CONFIG (config),
_("NL Filter")); _("NL Filter"));
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog), frame = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
GTK_RESPONSE_OK, "filter", GIMP_TYPE_INT_RADIO_FRAME);
GTK_RESPONSE_CANCEL,
-1);
gimp_window_set_transient (GTK_WINDOW (dialog));
store = gimp_int_store_new (_("Alpha trimmed mean"), 0,
_("Optimal estimation"), 1,
_("Edge enhancement"), 2,
NULL);
frame = gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (dialog),
"filter", GIMP_INT_STORE (store));
gtk_widget_set_margin_bottom (frame, 12); gtk_widget_set_margin_bottom (frame, 12);
scale = gimp_procedure_dialog_get_scale_entry (GIMP_PROCEDURE_DIALOG (dialog), scale = gimp_procedure_dialog_get_scale_entry (GIMP_PROCEDURE_DIALOG (dialog),

View file

@ -195,17 +195,23 @@ fits_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_magics (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_magics (GIMP_FILE_PROCEDURE (procedure),
"0,string,SIMPLE"); "0,string,SIMPLE");
gimp_procedure_add_int_aux_argument (procedure, "replace", gimp_procedure_add_choice_aux_argument (procedure, "replace",
_("Replacement for undefined pixels"), _("Re_placement for undefined pixels"),
_("Replacement for undefined pixels"), _("Replacement for undefined pixels"),
0, 255, 0, gimp_choice_new_with_values ("black", 0, _("Black"), NULL,
G_PARAM_READWRITE); "white", 255, _("White"), NULL,
NULL),
"black",
G_PARAM_READWRITE);
gimp_procedure_add_int_aux_argument (procedure, "use-data-min-max", gimp_procedure_add_choice_aux_argument (procedure, "use-data-min-max",
_("Pixel value scaling"), _("Pi_xel value scaling"),
_("Use DATAMIN/DATAMAX-scaling if possible"), _("Whether to use DATAMIN/DATAMAX-scaling if possible"),
0, 1, 0, gimp_choice_new_with_values ("automatic", 0, _("Automatic"), NULL,
G_PARAM_READWRITE); "data-min-max", 1, _("By DATAMIN/DATAMAX"), NULL,
NULL),
"automatic",
G_PARAM_READWRITE);
} }
else if (! strcmp (name, EXPORT_PROC)) else if (! strcmp (name, EXPORT_PROC))
{ {
@ -366,10 +372,10 @@ load_image (GFile *file,
gdouble replace_val = 0; gdouble replace_val = 0;
gboolean use_datamin; gboolean use_datamin;
g_object_get (config, replace = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"replace", &replace, "replace");
"use-data-min-max", &use_datamin, use_datamin = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
NULL); "use-data-min-max");
fp = g_fopen (g_file_peek_path (file), "rb"); fp = g_fopen (g_file_peek_path (file), "rb");
@ -995,10 +1001,9 @@ static gboolean
load_dialog (GimpProcedure *procedure, load_dialog (GimpProcedure *procedure,
GObject *config) GObject *config)
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkListStore *store; GtkWidget *frame;
GtkWidget *frame; gboolean run;
gboolean run;
gimp_ui_init (PLUG_IN_BINARY); gimp_ui_init (PLUG_IN_BINARY);
@ -1006,22 +1011,12 @@ load_dialog (GimpProcedure *procedure,
GIMP_PROCEDURE_CONFIG (config), GIMP_PROCEDURE_CONFIG (config),
_("Open FITS File")); _("Open FITS File"));
gimp_window_set_transient (GTK_WINDOW (dialog)); frame = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
"replace", GIMP_TYPE_INT_RADIO_FRAME);
store = gimp_int_store_new (_("Black"), 0,
_("White"), 255,
NULL);
frame = gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (dialog),
"replace",
GIMP_INT_STORE (store));
gtk_widget_set_margin_bottom (frame, 12); gtk_widget_set_margin_bottom (frame, 12);
store = gimp_int_store_new (_("Automatic"), 0, frame = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
_("By DATAMIN/DATAMAX"), 1, "use-data-min-max", GIMP_TYPE_INT_RADIO_FRAME);
NULL);
frame = gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (dialog),
"use-data-min-max",
GIMP_INT_STORE (store));
gtk_widget_set_margin_bottom (frame, 12); gtk_widget_set_margin_bottom (frame, 12);
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog), gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),