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

View File

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

View File

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

View File

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

View File

@ -367,11 +367,14 @@ pnm_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"pnm");
gimp_procedure_add_int_argument (procedure, "raw",
_("Data formatting"),
_("TRUE for raw output, FALSE for ascii output"),
0, 1, 1,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "raw",
_("_Data formatting"),
_("Whether to export ASCII or raw output"),
gimp_choice_new_with_values ("ascii-output", 0, _("ASCII"), NULL,
"raw-output", 1, _("Raw"), NULL,
NULL),
"raw-output",
G_PARAM_READWRITE);
}
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),
"pbm");
gimp_procedure_add_int_argument (procedure, "raw",
_("Data formatting"),
_("TRUE for raw output, FALSE for ascii output"),
0, 1, 1,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "raw",
_("_Data formatting"),
_("Whether to export ASCII or raw output"),
gimp_choice_new_with_values ("ascii-output", 0, _("ASCII"), NULL,
"raw-output", 1, _("Raw"), NULL,
NULL),
"raw-output",
G_PARAM_READWRITE);
}
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),
"pgm");
gimp_procedure_add_int_argument (procedure, "raw",
_("Data formatting"),
_("TRUE for raw output, FALSE for ascii output"),
0, 1, 1,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "raw",
_("_Data formatting"),
_("Whether to export ASCII or raw output"),
gimp_choice_new_with_values ("ascii-output", 0, _("ASCII"), NULL,
"raw-output", 1, _("Raw"), NULL,
NULL),
"raw-output",
G_PARAM_READWRITE);
}
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),
"ppm");
gimp_procedure_add_int_argument (procedure, "raw",
"Data formatting",
_("TRUE for raw output, FALSE for ascii output"),
0, 1, 1,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "raw",
_("_Data formatting"),
_("Whether to export ASCII or raw output"),
gimp_choice_new_with_values ("ascii-output", 0, _("ASCII"), NULL,
"raw-output", 1, _("Raw"), NULL,
NULL),
"raw-output",
G_PARAM_READWRITE);
}
else if (! strcmp (name, PAM_EXPORT_PROC))
{
@ -1592,9 +1604,8 @@ export_image (GFile *file,
gboolean config_raw = TRUE;
if (file_type != FILE_TYPE_PFM && file_type != FILE_TYPE_PAM)
g_object_get (config,
"raw", &config_raw,
NULL);
config_raw = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"raw");
/* Make sure we're not saving an image with an alpha channel
* unless we're exporting a PAM file */
@ -1990,18 +2001,14 @@ save_dialog (GimpProcedure *procedure,
{
GtkWidget *dialog;
GtkWidget *frame;
GtkListStore *store;
gboolean run;
dialog = gimp_export_procedure_dialog_new (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_PROCEDURE_CONFIG (config),
image);
/* file save type */
store = gimp_int_store_new (_("_ASCII"), 0,
_("_Raw"), 1,
NULL);
frame = gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (dialog),
"raw", GIMP_INT_STORE (store));
frame = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
"raw", GIMP_TYPE_INT_RADIO_FRAME);
gtk_container_set_border_width (GTK_CONTAINER (frame), 12);
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),
"psp,tub");
gimp_procedure_add_int_argument (procedure, "compression",
"_Data Compression",
"Specify 0 for no compression, "
"1 for RLE, and 2 for LZ77",
0, 2, PSP_COMP_LZ77,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "compression",
_("_Data Compression"),
_("Type of compression"),
gimp_choice_new_with_values ("none", PSP_COMP_NONE, _("none"), NULL,
"rle", PSP_COMP_RLE, _("rle"), NULL,
"lz77", PSP_COMP_LZ77, _("lz77"), NULL,
NULL),
"lz77",
G_PARAM_READWRITE);
}
return procedure;
@ -829,12 +832,8 @@ save_dialog (GimpProcedure *procedure,
image);
/* file save type */
store = gimp_int_store_new (_("None"), PSP_COMP_NONE,
_("RLE"), PSP_COMP_RLE,
_("LZ77"), PSP_COMP_LZ77,
NULL);
frame = gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (dialog),
"compression", GIMP_INT_STORE (store));
frame = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
"compression", GIMP_TYPE_INT_RADIO_FRAME);
gtk_container_set_border_width (GTK_CONTAINER (frame), 12);
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog), NULL);

View File

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

View File

@ -421,12 +421,14 @@ jigsaw_create_procedure (GimpPlugIn *plug_in,
MIN_YTILES, MAX_YTILES, 5,
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "style",
_("Jigsaw Style"),
_("The style/shape of the jigsaw puzzle "
"{ Square (0), Curved (1) }"),
0, 1, BEZIER_1,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "style",
_("_Jigsaw Style"),
_("The style/shape of the jigsaw puzzle"),
gimp_choice_new_with_values ("square", BEZIER_1, _("Square"), NULL,
"curved", BEZIER_2, _("Curved"), NULL,
NULL),
"square",
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "blend-lines",
_("_Blend width"),
@ -654,8 +656,9 @@ draw_jigsaw (GObject *config,
"y", &ytiles,
"blend-lines", &blend_lines,
"blend-amount", &blend_amount,
"style", &style,
NULL);
style = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"style");
xlines = xtiles - 1;
ylines = ytiles - 1;
@ -2468,7 +2471,6 @@ jigsaw_dialog (GimpProcedure *procedure,
GtkWidget *preview;
GtkWidget *frame;
GtkWidget *scale;
GtkListStore *store;
gboolean run;
gimp_ui_init (PLUG_IN_BINARY);
@ -2477,13 +2479,6 @@ jigsaw_dialog (GimpProcedure *procedure,
GIMP_PROCEDURE_CONFIG (config),
_("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 */
scale = gimp_procedure_dialog_get_scale_entry (GIMP_PROCEDURE_DIALOG (dialog),
"x", 1.0);
@ -2522,11 +2517,8 @@ jigsaw_dialog (GimpProcedure *procedure,
"bevel-vbox");
/* frame for primitive radio buttons */
store = gimp_int_store_new (_("Square"), BEZIER_1,
_("Curved"), BEZIER_2,
NULL);
frame = gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (dialog),
"style", GIMP_INT_STORE (store));
frame = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
"style", GIMP_TYPE_INT_RADIO_FRAME);
gtk_widget_set_margin_bottom (frame, 12);
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,
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "filter",
_("Filter"),
_("The Filter to Run, "
"0 - alpha trimmed mean; "
"1 - optimal estimation "
"(alpha controls noise variance); "
"2 - edge enhancement"),
0, 2, 0,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "filter",
_("_Filter"),
_("The Filter to Run"),
gimp_choice_new_with_values ("alpha-trim", filter_alpha_trim, _("Alpha trimmed mean"), NULL,
"optimal-estimation", filter_opt_est, _("Optimal estimation"), NULL,
"edge-enhancement", filter_edge_enhance, _("Edge enhancement"), NULL,
NULL),
"alpha-trim",
G_PARAM_READWRITE);
}
return procedure;
@ -957,8 +957,9 @@ nlfilter (GObject *config,
g_object_get (config,
"alpha", &alpha,
"radius", &radius,
"filter", &filter,
NULL);
filter = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"filter");
if (preview)
{
@ -1092,12 +1093,11 @@ nlfilter_dialog (GimpProcedure *procedure,
GObject *config,
GimpDrawable *drawable)
{
GtkWidget *dialog;
GtkWidget *preview;
GtkListStore *store;
GtkWidget *frame;
GtkWidget *scale;
gboolean run;
GtkWidget *dialog;
GtkWidget *preview;
GtkWidget *frame;
GtkWidget *scale;
gboolean run;
gimp_ui_init (PLUG_IN_BINARY);
@ -1105,19 +1105,8 @@ nlfilter_dialog (GimpProcedure *procedure,
GIMP_PROCEDURE_CONFIG (config),
_("NL Filter"));
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
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));
frame = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
"filter", GIMP_TYPE_INT_RADIO_FRAME);
gtk_widget_set_margin_bottom (frame, 12);
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),
"0,string,SIMPLE");
gimp_procedure_add_int_aux_argument (procedure, "replace",
_("Replacement for undefined pixels"),
_("Replacement for undefined pixels"),
0, 255, 0,
G_PARAM_READWRITE);
gimp_procedure_add_choice_aux_argument (procedure, "replace",
_("Re_placement for undefined pixels"),
_("Replacement for undefined pixels"),
gimp_choice_new_with_values ("black", 0, _("Black"), NULL,
"white", 255, _("White"), NULL,
NULL),
"black",
G_PARAM_READWRITE);
gimp_procedure_add_int_aux_argument (procedure, "use-data-min-max",
_("Pixel value scaling"),
_("Use DATAMIN/DATAMAX-scaling if possible"),
0, 1, 0,
G_PARAM_READWRITE);
gimp_procedure_add_choice_aux_argument (procedure, "use-data-min-max",
_("Pi_xel value scaling"),
_("Whether to use DATAMIN/DATAMAX-scaling if possible"),
gimp_choice_new_with_values ("automatic", 0, _("Automatic"), NULL,
"data-min-max", 1, _("By DATAMIN/DATAMAX"), NULL,
NULL),
"automatic",
G_PARAM_READWRITE);
}
else if (! strcmp (name, EXPORT_PROC))
{
@ -366,10 +372,10 @@ load_image (GFile *file,
gdouble replace_val = 0;
gboolean use_datamin;
g_object_get (config,
"replace", &replace,
"use-data-min-max", &use_datamin,
NULL);
replace = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"replace");
use_datamin = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"use-data-min-max");
fp = g_fopen (g_file_peek_path (file), "rb");
@ -995,10 +1001,9 @@ static gboolean
load_dialog (GimpProcedure *procedure,
GObject *config)
{
GtkWidget *dialog;
GtkListStore *store;
GtkWidget *frame;
gboolean run;
GtkWidget *dialog;
GtkWidget *frame;
gboolean run;
gimp_ui_init (PLUG_IN_BINARY);
@ -1006,22 +1011,12 @@ load_dialog (GimpProcedure *procedure,
GIMP_PROCEDURE_CONFIG (config),
_("Open FITS File"));
gimp_window_set_transient (GTK_WINDOW (dialog));
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));
frame = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
"replace", GIMP_TYPE_INT_RADIO_FRAME);
gtk_widget_set_margin_bottom (frame, 12);
store = gimp_int_store_new (_("Automatic"), 0,
_("By DATAMIN/DATAMAX"), 1,
NULL);
frame = gimp_procedure_dialog_get_int_radio (GIMP_PROCEDURE_DIALOG (dialog),
"use-data-min-max",
GIMP_INT_STORE (store));
frame = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
"use-data-min-max", GIMP_TYPE_INT_RADIO_FRAME);
gtk_widget_set_margin_bottom (frame, 12);
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),