plug-ins: Port more plug-ins to GimpChoice

This replaces most of the remaining
gimp_procedure_dialog_get_int_combo ()
parameters with defined GimpChoice
parameters.
The only exceptions are where we retrieve
the values from a library (such as file-aa)
or the integer value itself is intuitive
(such as bit-depth or rotation degree)
This commit is contained in:
Alx Sa 2024-08-19 14:40:46 +00:00
parent d7806d92ec
commit 8dd7783fc2
13 changed files with 263 additions and 314 deletions

View File

@ -217,14 +217,15 @@ gif_create_procedure (GimpPlugIn *plug_in,
0, G_MAXINT, 100,
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "default-dispose",
_("Frame disposal _when unspecified"),
_("(animated gif) Default disposal type "
"(0=`don't care`, "
"1=combine, "
"2=replace)"),
0, 2, 0,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "default-dispose",
_("Frame disposal _when unspecified"),
_("(animated gif) Default disposal type"),
gimp_choice_new_with_values ("unspecified", DISPOSE_UNSPECIFIED, _("I don't care"), NULL,
"combine", DISPOSE_COMBINE, _("Cumulative layers (combine)"), NULL,
"replace", DISPOSE_REPLACE, _("One frame per layer (replace)"), NULL,
NULL),
"unspecified",
G_PARAM_READWRITE);
gimp_procedure_add_boolean_argument (procedure, "as-animation",
_("_As animation"),
@ -795,13 +796,15 @@ export_image (GFile *file,
"loop", &config_loop,
"number-of-repeats", &config_number_of_repeats,
"default-delay", &config_default_delay,
"default-dispose", &config_default_dispose,
"force-delay", &config_use_default_delay,
"force-dispose", &config_use_default_dispose,
"as-animation", &config_as_animation,
"save-comment", &config_save_comment,
"gimp-comment", &config_comment,
NULL);
config_default_dispose =
gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"default-dispose");
/* The GIF spec says 7bit ASCII for the comment block. */
if (config_save_comment && config_comment && strlen (config_comment))
@ -1314,7 +1317,6 @@ save_dialog (GimpImage *image,
{
GtkWidget *grid;
GtkWidget *widget;
GtkListStore *store;
grid = gtk_grid_new ();
gtk_grid_set_column_spacing (GTK_GRID (grid), 1);
@ -1350,16 +1352,9 @@ save_dialog (GimpImage *image,
gtk_grid_attach (GTK_GRID (grid), widget, 1, 1, 1, 1);
gtk_widget_set_visible (widget, TRUE);
store = gimp_int_store_new (_("I don't care"),
DISPOSE_UNSPECIFIED,
_("Cumulative layers (combine)"),
DISPOSE_COMBINE,
_("One frame per layer (replace)"),
DISPOSE_REPLACE,
NULL);
widget = gimp_procedure_dialog_get_int_combo (GIMP_PROCEDURE_DIALOG (dialog),
"default-dispose",
GIMP_INT_STORE (store));
widget = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
"default-dispose",
G_TYPE_NONE);
gtk_grid_attach (GTK_GRID (grid), widget, 0, 2, 2, 1);
gtk_widget_set_visible (widget, TRUE);

View File

@ -282,19 +282,25 @@ heif_create_procedure (GimpPlugIn *plug_in,
8, 12, 8,
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "pixel-format",
_("_Pixel format"),
_("Format of color sub-sampling"),
HEIFPLUGIN_EXPORT_FORMAT_RGB, HEIFPLUGIN_EXPORT_FORMAT_YUV420,
HEIFPLUGIN_EXPORT_FORMAT_YUV420,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "pixel-format",
_("_Pixel format"),
_("Format of color sub-sampling"),
gimp_choice_new_with_values ("rgb", HEIFPLUGIN_EXPORT_FORMAT_RGB, _("RGB"), NULL,
"yuv444", HEIFPLUGIN_EXPORT_FORMAT_YUV444, _("YUV444"), NULL,
"yuv420", HEIFPLUGIN_EXPORT_FORMAT_YUV420, _("YUV420"), NULL,
NULL),
"yuv420",
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "encoder-speed",
_("Enco_der speed"),
_("Tradeoff between speed and compression"),
HEIFPLUGIN_ENCODER_SPEED_SLOW, HEIFPLUGIN_ENCODER_SPEED_FASTER,
HEIFPLUGIN_ENCODER_SPEED_BALANCED,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "encoder-speed",
_("Enco_der speed"),
_("Tradeoff between speed and compression"),
gimp_choice_new_with_values ("slow", HEIFPLUGIN_ENCODER_SPEED_SLOW, _("Slow"), NULL,
"balanced", HEIFPLUGIN_ENCODER_SPEED_BALANCED, _("Balanced"), NULL,
"fast", HEIFPLUGIN_ENCODER_SPEED_FASTER, _("Fast"), NULL,
NULL),
"balanced",
G_PARAM_READWRITE);
gimp_procedure_add_boolean_argument (procedure, "save-exif",
_("Save Exi_f"),
@ -397,19 +403,25 @@ heif_create_procedure (GimpPlugIn *plug_in,
8, 12, 8,
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "pixel-format",
_("_Pixel format"),
_("Format of color sub-sampling"),
HEIFPLUGIN_EXPORT_FORMAT_RGB, HEIFPLUGIN_EXPORT_FORMAT_YUV420,
HEIFPLUGIN_EXPORT_FORMAT_YUV420,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "pixel-format",
_("_Pixel format"),
_("Format of color sub-sampling"),
gimp_choice_new_with_values ("rgb", HEIFPLUGIN_EXPORT_FORMAT_RGB, _("RGB"), NULL,
"yuv444", HEIFPLUGIN_EXPORT_FORMAT_YUV444, _("YUV444"), NULL,
"yuv420", HEIFPLUGIN_EXPORT_FORMAT_YUV420, _("YUV420"), NULL,
NULL),
"yuv420",
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "encoder-speed",
_("Enco_der speed"),
_("Tradeoff between speed and compression"),
HEIFPLUGIN_ENCODER_SPEED_SLOW, HEIFPLUGIN_ENCODER_SPEED_FASTER,
HEIFPLUGIN_ENCODER_SPEED_BALANCED,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "encoder-speed",
_("Enco_der speed"),
_("Tradeoff between speed and compression"),
gimp_choice_new_with_values ("slow", HEIFPLUGIN_ENCODER_SPEED_SLOW, _("Slow"), NULL,
"balanced", HEIFPLUGIN_ENCODER_SPEED_BALANCED, _("Balanced"), NULL,
"fast", HEIFPLUGIN_ENCODER_SPEED_FASTER, _("Fast"), NULL,
NULL),
"balanced",
G_PARAM_READWRITE);
gimp_procedure_add_boolean_argument (procedure, "save-exif",
_("Save Exi_f"),
@ -1428,13 +1440,17 @@ export_image (GFile *file,
g_object_get (config,
"lossless", &lossless,
"quality", &quality,
"pixel-format", &pixel_format,
"save-bit-depth", &save_bit_depth,
"encoder-speed", &encoder_speed,
"save-color-profile", &save_profile,
"save-exif", &save_exif,
"save-xmp", &save_xmp,
NULL);
pixel_format =
gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"pixel-format");
encoder_speed =
gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"encoder-speed");
if (compression == heif_compression_HEVC)
{
@ -2410,9 +2426,7 @@ save_dialog (GimpProcedure *procedure,
{
GtkWidget *dialog;
GtkWidget *quality_scale;
GtkListStore *store_pixelformats;
GtkListStore *store_bitdepths;
GtkListStore *store_speeds;
gboolean run;
dialog = gimp_export_procedure_dialog_new (GIMP_EXPORT_PROCEDURE (procedure),
@ -2431,14 +2445,6 @@ save_dialog (GimpProcedure *procedure,
G_BINDING_SYNC_CREATE |
G_BINDING_INVERT_BOOLEAN);
store_pixelformats = gimp_int_store_new (_("RGB"), HEIFPLUGIN_EXPORT_FORMAT_RGB,
_("YUV444"), HEIFPLUGIN_EXPORT_FORMAT_YUV444,
_("YUV420"), HEIFPLUGIN_EXPORT_FORMAT_YUV420,
NULL);
gimp_procedure_dialog_get_int_combo (GIMP_PROCEDURE_DIALOG (dialog),
"pixel-format", GIMP_INT_STORE (store_pixelformats));
store_bitdepths = gimp_int_store_new (_("8 bit/channel"), 8,
_("10 bit/channel"), 10,
_("12 bit/channel"), 12,
@ -2447,14 +2453,6 @@ save_dialog (GimpProcedure *procedure,
gimp_procedure_dialog_get_int_combo (GIMP_PROCEDURE_DIALOG (dialog),
"save-bit-depth", GIMP_INT_STORE (store_bitdepths));
store_speeds = gimp_int_store_new (_("Slow"), HEIFPLUGIN_ENCODER_SPEED_SLOW,
_("Balanced"), HEIFPLUGIN_ENCODER_SPEED_BALANCED,
_("Fast"), HEIFPLUGIN_ENCODER_SPEED_FASTER,
NULL);
gimp_procedure_dialog_get_int_combo (GIMP_PROCEDURE_DIALOG (dialog),
"encoder-speed", GIMP_INT_STORE (store_speeds));
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),
"lossless", "quality",
"pixel-format",

View File

@ -245,12 +245,18 @@ jp2_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"j2k,j2c,jpc");
gimp_procedure_add_int_argument (procedure, "colorspace",
_("Color s_pace"),
_("Color space { UNKNOWN (0), GRAYSCALE (1), RGB (2), "
"CMYK (3), YCbCr (4), xvYCC (5) }"),
0, 5, 0,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "colorspace",
_("Color s_pace"),
_("Color space"),
gimp_choice_new_with_values ("srgb", OPJ_CLRSPC_SRGB, _("sRGB"), NULL,
"grayscale", OPJ_CLRSPC_GRAY, _("Grayscale"), NULL,
"ycbcr", OPJ_CLRSPC_SYCC, _("YCbCr"), NULL,
"xvycc", OPJ_CLRSPC_EYCC, _("xvYCC"), NULL,
"cmyk", OPJ_CLRSPC_CMYK, _("CMYK"), NULL,
"unknown", OPJ_CLRSPC_UNKNOWN, _("Unknown"), NULL,
NULL),
"unknown",
G_PARAM_READWRITE);
}
return procedure;
@ -284,38 +290,9 @@ jp2_load (GimpProcedure *procedure,
default:
if (! strcmp (gimp_procedure_get_name (procedure), LOAD_J2K_PROC))
{
gint color_space_argument = 0;
g_object_get (config,
"colorspace", &color_space_argument,
NULL);
/* Order is not the same as OpenJPEG enum on purpose,
* since it's better to not rely on a given order or
* on enum values.
*/
switch (color_space_argument)
{
case 1:
color_space = OPJ_CLRSPC_GRAY;
break;
case 2:
color_space = OPJ_CLRSPC_SRGB;
break;
case 3:
color_space = OPJ_CLRSPC_CMYK;
break;
case 4:
color_space = OPJ_CLRSPC_SYCC;
break;
case 5:
color_space = OPJ_CLRSPC_EYCC;
break;
default:
break;
}
}
color_space =
gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"colorspace");
interactive = FALSE;
break;
}
@ -959,11 +936,11 @@ open_dialog (GimpProcedure *procedure,
gint num_components,
GError **error)
{
const gchar *title;
GtkWidget *dialog;
GtkListStore *store = NULL;
gboolean run;
OPJ_COLOR_SPACE color_space = OPJ_CLRSPC_SRGB;
const gchar *title;
GtkWidget *dialog;
gboolean run;
GimpParamSpecChoice *cspec;
OPJ_COLOR_SPACE color_space = OPJ_CLRSPC_SRGB;
if (format == OPJ_CODEC_J2K)
/* Not having color information is expected. */
@ -978,27 +955,21 @@ open_dialog (GimpProcedure *procedure,
GIMP_PROCEDURE_CONFIG (config),
_(title));
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
cspec =
GIMP_PARAM_SPEC_CHOICE (g_object_class_find_property (G_OBJECT_GET_CLASS (config),
"colorspace"));
if (num_components == 3)
{
/* Can be RGB, YUV and YCC. */
store = gimp_int_store_new (_("sRGB"), OPJ_CLRSPC_SRGB,
_("YCbCr"), OPJ_CLRSPC_SYCC,
_("xvYCC"), OPJ_CLRSPC_EYCC,
NULL);
gimp_choice_set_sensitive (cspec->choice, "grayscale", FALSE);
gimp_choice_set_sensitive (cspec->choice, "cmyk", FALSE);
}
else if (num_components == 4)
{
/* Can be RGB, YUV and YCC with alpha or CMYK. */
store = gimp_int_store_new (_("sRGB"), OPJ_CLRSPC_SRGB,
_("YCbCr"), OPJ_CLRSPC_SYCC,
_("xvYCC"), OPJ_CLRSPC_EYCC,
_("CMYK"), OPJ_CLRSPC_CMYK,
NULL);
gimp_choice_set_sensitive (cspec->choice, "grayscale", FALSE);
}
else
{
@ -1006,22 +977,20 @@ open_dialog (GimpProcedure *procedure,
_("Unsupported JPEG 2000%s '%s' with %d components."),
(format == OPJ_CODEC_J2K) ? " codestream" : "",
gimp_file_get_utf8_name (file), num_components);
color_space = OPJ_CLRSPC_UNKNOWN;
g_object_set (config, "colorspace", "unknown", NULL);
}
if (store)
if (num_components == 3 || num_components == 4)
{
gimp_procedure_dialog_get_int_combo (GIMP_PROCEDURE_DIALOG (dialog),
"colorspace", GIMP_INT_STORE (store));
/* By default, RGB is active. */
g_object_set (config,
"colorspace", color_space,
NULL);
gimp_choice_set_sensitive (cspec->choice, "unknown", FALSE);
g_object_set (config, "colorspace", "srgb", NULL);
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),
NULL);
gtk_widget_show (dialog);
gtk_widget_set_visible (dialog, TRUE);
run = gimp_procedure_dialog_run (GIMP_PROCEDURE_DIALOG (dialog));
@ -1030,9 +999,9 @@ open_dialog (GimpProcedure *procedure,
* No error occurred. */
color_space = OPJ_CLRSPC_UNKNOWN;
else
g_object_get (config,
"colorspace", &color_space,
NULL);
color_space =
gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"colorspace");
}
gtk_widget_destroy (dialog);

View File

@ -207,12 +207,21 @@ jpegxl_create_procedure (GimpPlugIn *plug_in,
8, 16, 8,
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "speed",
_("Effort/S_peed"),
_("Encoder effort setting"),
1, 9,
7,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "speed",
_("Effort/S_peed"),
_("Encoder effort setting"),
gimp_choice_new_with_values ("lightning", 1, _("lightning (fastest)"), NULL,
"thunder", 2, _("thunder"), NULL,
"falcon", 3, _("falcon (faster)"), NULL,
"cheetah", 4, _("cheetah"), NULL,
"hare", 5, _("hare"), NULL,
"wombat", 6, _("wombat"), NULL,
"squirrel", 7, _("squirrel"), NULL,
"kitten", 8, _("kitten"), NULL,
"tortoise", 9, _("tortoise (slower)"), NULL,
NULL),
"squirrel",
G_PARAM_READWRITE);
gimp_procedure_add_boolean_argument (procedure, "uses-original-profile",
_("Save ori_ginal profile"),
@ -1399,13 +1408,14 @@ export_image (GFile *file,
g_object_get (config,
"lossless", &lossless,
"compression", &compression,
"speed", &speed,
"save-bit-depth", &bit_depth,
"cmyk", &cmyk,
"uses-original-profile", &uses_original_profile,
"save-exif", &save_exif,
"save-xmp", &save_xmp,
NULL);
speed = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"speed");
if (lossless || cmyk)
{
@ -2025,20 +2035,6 @@ save_dialog (GimpImage *image,
G_BINDING_SYNC_CREATE |
G_BINDING_INVERT_BOOLEAN);
store = gimp_int_store_new (_("lightning (fastest)"), 1,
_("thunder"), 2,
_("falcon (faster)"), 3,
_("cheetah"), 4,
_("hare"), 5,
_("wombat"), 6,
_("squirrel"), 7,
_("kitten"), 8,
_("tortoise (slower)"), 9,
NULL);
gimp_procedure_dialog_get_int_combo (GIMP_PROCEDURE_DIALOG (dialog),
"speed", GIMP_INT_STORE (store));
store = gimp_int_store_new (_("8 bit/channel"), 8,
_("16 bit/channel"), 16,
NULL);

View File

@ -319,20 +319,25 @@ mng_create_procedure (GimpPlugIn *plug_in,
1, G_MAXINT, 100,
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "default-chunks",
_("Default chunks t_ype"),
_("(ANIMATED MNG) Default chunks type "
"(0 = PNG + Delta PNG; 1 = JNG + Delta PNG; "
"2 = All PNG; 3 = All JNG)"),
0, 3, CHUNKS_PNG_D,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "default-chunks",
_("Default chunks t_ype"),
_("(ANIMATED MNG) Default chunks type"),
gimp_choice_new_with_values ("png-delta", CHUNKS_PNG_D, _("PNG + delta PNG"), NULL,
"jng-delta", CHUNKS_JNG_D, _("JNG + delta PNG"), NULL,
"all-png", CHUNKS_PNG, _("All PNG"), NULL,
"all-jng", CHUNKS_JNG, _("All JNG"), NULL,
NULL),
"png-delta",
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "default-dispose",
_("De_fault frame disposal"),
_("(ANIMATED MNG) Default dispose type "
"(0 = combine; 1 = replace)"),
0, 1, DISPOSE_COMBINE,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "default-dispose",
_("De_fault frame disposal"),
_("(ANIMATED MNG) Default dispose type"),
gimp_choice_new_with_values ("combine", DISPOSE_COMBINE, _("Combine"), NULL,
"replace", DISPOSE_REPLACE, _("Replace"), NULL,
NULL),
"combine",
G_PARAM_READWRITE);
gimp_procedure_add_boolean_argument (procedure, "bkgd",
_("Save _background color"),
@ -807,13 +812,17 @@ mng_export_image (GFile *file,
"jpeg-smoothing", &config_jpeg_smoothing,
"loop", &config_loop,
"default-delay", &config_default_delay,
"default-chunks", &config_default_chunks,
"default-dispose", &config_default_dispose,
"bkgd", &config_bkgd,
"gama", &config_gama,
"phys", &config_phys,
"time", &config_time,
NULL);
config_default_dispose =
gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"default-dispose");
config_default_chunks =
gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"default-chunks");
layers = gimp_image_get_layers (image, &num_layers);
@ -1566,15 +1575,14 @@ mng_save_dialog (GimpImage *image,
GimpProcedure *procedure,
GObject *config)
{
GtkWidget *dialog;
GtkWidget *frame;
GtkWidget *hbox;
GtkListStore *store;
GtkWidget *combo;
GtkWidget *label;
GtkWidget *scale;
gint num_layers;
gboolean run;
GtkWidget *dialog;
GtkWidget *frame;
GtkWidget *hbox;
GtkWidget *combo;
GtkWidget *label;
GtkWidget *scale;
gint num_layers;
gboolean run;
dialog = gimp_export_procedure_dialog_new (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_PROCEDURE_CONFIG (config),
@ -1594,27 +1602,25 @@ mng_save_dialog (GimpImage *image,
g_free (gimp_image_get_layers (image, &num_layers));
if (num_layers == 1)
store = gimp_int_store_new (_("PNG"), CHUNKS_PNG_D,
_("JNG"), CHUNKS_JNG_D,
NULL);
else
store = gimp_int_store_new (_("PNG + delta PNG"), CHUNKS_PNG_D,
_("JNG + delta PNG"), CHUNKS_JNG_D,
_("All PNG"), CHUNKS_PNG,
_("All JNG"), CHUNKS_JNG,
NULL);
{
GimpParamSpecChoice *cspec;
combo = gimp_procedure_dialog_get_int_combo (GIMP_PROCEDURE_DIALOG (dialog),
"default-chunks",
GIMP_INT_STORE (store));
cspec =
GIMP_PARAM_SPEC_CHOICE (g_object_class_find_property (G_OBJECT_GET_CLASS (config),
"default-chunks"));
gimp_choice_set_sensitive (cspec->choice, "all-png", FALSE);
gimp_choice_set_sensitive (cspec->choice, "all-jng", FALSE);
}
combo = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
"default-chunks",
G_TYPE_NONE);
gtk_widget_set_margin_bottom (combo, 6);
store = gimp_int_store_new (_("Combine"), DISPOSE_COMBINE,
_("Replace"), DISPOSE_REPLACE,
NULL);
combo = gimp_procedure_dialog_get_int_combo (GIMP_PROCEDURE_DIALOG (dialog),
"default-dispose",
GIMP_INT_STORE (store));
combo = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
"default-dispose",
G_TYPE_NONE);
gtk_widget_set_margin_bottom (combo, 6);
scale = gimp_procedure_dialog_get_scale_entry (GIMP_PROCEDURE_DIALOG (dialog),

View File

@ -316,11 +316,14 @@ tga_create_procedure (GimpPlugIn *plug_in,
TRUE,
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "origin",
_("Ori_gin"),
_("Image origin (0 = top-left, 1 = bottom-left)"),
0, 1, ORIGIN_BOTTOM_LEFT,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "origin",
_("Ori_gin"),
_("Image origin"),
gimp_choice_new_with_values ("bottom-left", ORIGIN_BOTTOM_LEFT, _("Bottom left"), NULL,
"top-left", ORIGIN_TOP_LEFT, _("Top left"), NULL,
NULL),
"bottom-left",
G_PARAM_READWRITE);
}
return procedure;
@ -1199,9 +1202,10 @@ export_image (GFile *file,
TgaOrigin origin;
g_object_get (config,
"rle", &rle,
"origin", &origin,
"rle", &rle,
NULL);
origin = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"origin");
buffer = gimp_drawable_get_buffer (drawable);
@ -1425,7 +1429,6 @@ save_dialog (GimpImage *image,
GObject *config)
{
GtkWidget *dialog;
GtkListStore *store;
GtkWidget *vbox;
gboolean run;
@ -1433,12 +1436,6 @@ save_dialog (GimpImage *image,
GIMP_PROCEDURE_CONFIG (config),
image);
store = gimp_int_store_new (_("Bottom left"), ORIGIN_BOTTOM_LEFT,
_("Top left"), ORIGIN_TOP_LEFT,
NULL);
gimp_procedure_dialog_get_int_combo (GIMP_PROCEDURE_DIALOG (dialog),
"origin", GIMP_INT_STORE (store));
vbox = gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
"tga-save-vbox",
"rle",

View File

@ -42,17 +42,6 @@
#include "libgimp/stdplugins-intl.h"
typedef enum
{
RGB_565,
RGBA_5551,
RGB_555,
RGB_888,
RGBA_8888,
RGBX_8888
} RGBMode;
static void write_image (FILE *f,
guchar *src,
gint width,
@ -167,7 +156,7 @@ export_image (GFile *file,
if (run_mode == GIMP_RUN_INTERACTIVE)
g_object_set (config,
"rgb-format", RGBA_8888,
"rgb-format", "rgba-8888",
"use-rle", FALSE,
NULL);
else
@ -185,7 +174,7 @@ export_image (GFile *file,
if (run_mode == GIMP_RUN_INTERACTIVE)
g_object_set (config,
"rgb-format", RGB_888,
"rgb-format", "rgb-888",
"use-rle", FALSE,
NULL);
else
@ -289,9 +278,9 @@ export_image (GFile *file,
return GIMP_PDB_CANCEL;
}
g_object_get (config,
"rgb-format", &rgb_format,
NULL);
rgb_format =
gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"rgb-format");
/* mask_info_size is only set to non-zero for 16- and 32-bpp */
switch (rgb_format)
@ -327,8 +316,10 @@ export_image (GFile *file,
g_object_get (config,
"use-rle", &use_rle,
"write-color-space", &write_color_space,
"rgb-format", &rgb_format,
NULL);
rgb_format =
gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"rgb-format");
gimp_progress_init_printf (_("Exporting '%s'"),
gimp_file_get_utf8_name (file));
@ -931,9 +922,8 @@ format_sensitive_callback (GObject *config,
gint value;
gint channels = GPOINTER_TO_INT (data);
g_object_get (config,
"rgb-format", &value,
NULL);
value = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"rgb-format");
switch (value)
{
@ -954,9 +944,8 @@ config_notify (GObject *config,
gint channels = GPOINTER_TO_INT (data);
RGBMode format;
g_object_get (config,
"rgb-format", &format,
NULL);
format = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"rgb-format");
switch (format)
{
@ -966,7 +955,10 @@ config_notify (GObject *config,
{
g_signal_handlers_block_by_func (config, config_notify, data);
g_object_set (config, "rgb-format", format - 1, NULL);
if (format == RGBA_5551)
g_object_set (config, "rgb-format", "rgb-565", NULL);
else if (format == RGBA_8888)
g_object_set (config, "rgb-format", "rgb-888", NULL);
g_signal_handlers_unblock_by_func (config, config_notify, data);
}
@ -984,13 +976,12 @@ save_dialog (GimpProcedure *procedure,
gint channels,
gint bpp)
{
GtkWidget *dialog;
GtkWidget *toggle;
GtkWidget *vbox;
GtkWidget *combo;
GtkListStore *store;
gboolean is_format_sensitive;
gboolean run;
GtkWidget *dialog;
GtkWidget *toggle;
GtkWidget *vbox;
GtkWidget *combo;
gboolean is_format_sensitive;
gboolean run;
dialog = gimp_export_procedure_dialog_new (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_PROCEDURE_CONFIG (config),
@ -1023,16 +1014,8 @@ save_dialog (GimpProcedure *procedure,
FALSE, "write-color-space");
/* RGB Encoding Options */
store = gimp_int_store_new (_("16 bit (R5 G6 B5)"), RGB_565,
_("16 bit (A1 R5 G5 B5)"), RGBA_5551,
_("16 bit (X1 R5 G5 B5)"), RGB_555,
_("24 bit (R8 G8 B8)"), RGB_888,
_("32 bit (A8 R8 G8 B8)"), RGBA_8888,
_("32 bit (X8 R8 G8 B8)"), RGBX_8888,
NULL);
combo = gimp_procedure_dialog_get_int_combo (GIMP_PROCEDURE_DIALOG (dialog),
"rgb-format",
GIMP_INT_STORE (store));
combo = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
"rgb-format", G_TYPE_NONE);
g_object_set (combo, "margin", 12, NULL);
/* Determine if RGB Format combo should be initially sensitive */

View File

@ -20,6 +20,17 @@
#define __BMP_EXPORT_H__
typedef enum
{
RGB_565,
RGBA_5551,
RGB_555,
RGB_888,
RGBA_8888,
RGBX_8888
} RGBMode;
GimpPDBStatusType export_image (GFile *file,
GimpImage *image,
GimpDrawable *drawable,

View File

@ -216,13 +216,18 @@ bmp_create_procedure (GimpPlugIn *plug_in,
TRUE,
G_PARAM_READWRITE);
gimp_procedure_add_int_argument (procedure, "rgb-format",
_("R_GB format"),
_("Export format for RGB images "
"(0=RGB_565, 1=RGBA_5551, 2=RGB_555, 3=RGB_888, "
"4=RGBA_8888, 5=RGBX_8888)"),
0, 5, 3,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "rgb-format",
_("R_GB format"),
_("Export format for RGB images"),
gimp_choice_new_with_values ("rgb-565", RGB_565, _("16 bit (R5 G6 B5)"), NULL,
"rgba-5551", RGBA_5551, _("16 bit (A1 R5 G5 B5)"), NULL,
"rgb-555", RGB_555, _("16 bit (X1 R5 G5 B5)"), NULL,
"rgb-888", RGB_888, _("24 bit (R8 G8 B8)"), NULL,
"rgba-8888", RGBA_8888, _("32 bit (A8 R8 G8 B8)"), NULL,
"rgbx-8888", RGBX_8888, _("32 bit (X8 R8 G8 B8"), NULL,
NULL),
"rgb-888",
G_PARAM_READWRITE);
}
return procedure;

View File

@ -196,11 +196,15 @@ sgi_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL, NULL);
gimp_procedure_add_int_argument (procedure, "compression",
_("Compression _type"),
_("Compression level (0 = none, 1 = RLE, 2 = ARLE)"),
0, 2, SGI_COMP_RLE,
GIMP_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "compression",
_("Compression _type"),
_("Compression level"),
gimp_choice_new_with_values ("none", SGI_COMP_NONE, _("No compression"), NULL,
"rle", SGI_COMP_RLE, _("RLE compression"), NULL,
"arle", SGI_COMP_ARLE, _("Aggressive RLE (not supported by SGI)"), NULL,
NULL),
"rle",
G_PARAM_READWRITE);
}
return procedure;
@ -574,9 +578,9 @@ export_image (GFile *file,
guchar *pptr; /* Current pixel */
gushort **rows; /* SGI image data */
g_object_get (config,
"compression", &compression,
NULL);
compression =
gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"compression");
/*
* Get the drawable for the current image...
@ -709,25 +713,14 @@ save_dialog (GimpProcedure *procedure,
GObject *config,
GimpImage *image)
{
GtkWidget *dialog;
GtkWidget *vbox;
GtkListStore *store;
gboolean run;
GtkWidget *dialog;
GtkWidget *vbox;
gboolean run;
dialog = gimp_export_procedure_dialog_new (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_PROCEDURE_CONFIG (config),
image);
store = gimp_int_store_new (_("No compression"),
SGI_COMP_NONE,
_("RLE compression"),
SGI_COMP_RLE,
_("Aggressive RLE (not supported by SGI)"),
SGI_COMP_ARLE,
NULL);
gimp_procedure_dialog_get_int_combo (GIMP_PROCEDURE_DIALOG (dialog),
"compression", GIMP_INT_STORE (store));
vbox = gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
"sgi-vbox", "compression", NULL);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);

View File

@ -62,11 +62,10 @@ save_dialog (GimpImage *image,
GimpProcedure *procedure,
GObject *config)
{
GtkWidget *dialog;
GtkListStore *store;
gint32 nlayers;
gboolean animation_supported = FALSE;
gboolean run;
GtkWidget *dialog;
gint32 nlayers;
gboolean animation_supported = FALSE;
gboolean run;
g_free (gimp_image_get_layers (image, &nlayers));
@ -76,17 +75,6 @@ save_dialog (GimpImage *image,
GIMP_PROCEDURE_CONFIG (config),
image);
/* Create the combobox containing the presets */
store = gimp_int_store_new (_("Default"), WEBP_PRESET_DEFAULT,
_("Picture"), WEBP_PRESET_PICTURE,
_("Photo"), WEBP_PRESET_PHOTO,
_("Drawing"), WEBP_PRESET_DRAWING,
_("Icon"), WEBP_PRESET_ICON,
_("Text"), WEBP_PRESET_TEXT,
NULL);
gimp_procedure_dialog_get_int_combo (GIMP_PROCEDURE_DIALOG (dialog),
"preset", GIMP_INT_STORE (store));
/* Create scale for image and alpha quality */
gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
"quality", GIMP_TYPE_SPIN_SCALE);

View File

@ -161,12 +161,13 @@ save_layer (GFile *file,
gboolean use_sharp_yuv;
g_object_get (config,
"preset", &preset,
"lossless", &lossless,
"quality", &quality,
"alpha-quality", &alpha_quality,
"use-sharp-yuv", &use_sharp_yuv,
NULL);
preset = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"preset");
webp_decide_output (image, config, &profile, &out_linear);
if (profile)
@ -543,18 +544,19 @@ save_animation (GFile *file,
g_return_val_if_fail (n_drawables > 0, FALSE);
g_object_get (config,
"preset", &preset,
"lossless", &lossless,
"animation", &animation,
"animation-loop", &loop,
"minimize-size", &minimize_size,
"keyframe-distance", &keyframe_distance,
"quality", &quality,
"alpha-quality", &alpha_quality,
"default-delay", &default_delay,
"force-delay", &force_delay,
"use-sharp-yuv", &use_sharp_yuv,
"lossless", &lossless,
"animation", &animation,
"animation-loop", &loop,
"minimize-size", &minimize_size,
"keyframe-distance", &keyframe_distance,
"quality", &quality,
"alpha-quality", &alpha_quality,
"default-delay", &default_delay,
"force-delay", &force_delay,
"use-sharp-yuv", &use_sharp_yuv,
NULL);
preset = gimp_procedure_config_get_choice_id (GIMP_PROCEDURE_CONFIG (config),
"preset");
layers = gimp_image_list_layers (image);

View File

@ -154,8 +154,8 @@ webp_create_procedure (GimpPlugIn *plug_in,
gimp_procedure_set_menu_label (procedure, _("WebP image"));
gimp_procedure_set_documentation (procedure,
"Saves files in the WebP image format",
"Saves files in the WebP image format",
_("Saves files in the WebP image format"),
_("Saves files in the WebP image format"),
name);
gimp_procedure_set_attribution (procedure,
"Nathan Osman, Ben Touchette",
@ -177,12 +177,18 @@ webp_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_ALPHA,
export_edit_options, NULL, NULL);
gimp_procedure_add_int_argument (procedure, "preset",
_("Source _type"),
_("WebP encoder preset (Default=0, Picture=1, Photo=2, Drawing=3, "
"Icon=4, Text=5)"),
0, 5, WEBP_PRESET_DEFAULT,
G_PARAM_READWRITE);
gimp_procedure_add_choice_argument (procedure, "preset",
_("Source _type"),
_("WebP encoder preset"),
gimp_choice_new_with_values ("default", WEBP_PRESET_DEFAULT, _("Default"), NULL,
"picture", WEBP_PRESET_PICTURE, _("Picture"), NULL,
"photo", WEBP_PRESET_PHOTO, _("Photo"), NULL,
"drawing", WEBP_PRESET_DRAWING, _("Drawing"), NULL,
"icon", WEBP_PRESET_ICON, _("Icon"), NULL,
"text", WEBP_PRESET_TEXT, _("Text"), NULL,
NULL),
"default",
G_PARAM_READWRITE);
gimp_procedure_add_boolean_argument (procedure, "lossless",
_("L_ossless"),