mirror of https://github.com/GNOME/gimp.git
plug-ins: Port bmp-save widgets to use...
...GimpDialogProcedure functions rather than gimp_prop_* directly. Minor typos in the original descriptions were also fixed.
This commit is contained in:
parent
7d827d6ec1
commit
e6a679f233
|
@ -68,6 +68,7 @@ static void write_image (FILE *f,
|
|||
|
||||
static gboolean save_dialog (GimpProcedure *procedure,
|
||||
GObject *config,
|
||||
GimpImage *image,
|
||||
gint channels,
|
||||
gint bpp);
|
||||
|
||||
|
@ -276,7 +277,7 @@ save_image (GFile *file,
|
|||
BitsPerPixel == 4 ||
|
||||
BitsPerPixel == 1))
|
||||
{
|
||||
if (! save_dialog (procedure, config, 1, BitsPerPixel))
|
||||
if (! save_dialog (procedure, config, image, 1, BitsPerPixel))
|
||||
return GIMP_PDB_CANCEL;
|
||||
}
|
||||
else if (BitsPerPixel == 24 ||
|
||||
|
@ -284,7 +285,7 @@ save_image (GFile *file,
|
|||
{
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||
{
|
||||
if (! save_dialog (procedure, config, channels, BitsPerPixel))
|
||||
if (! save_dialog (procedure, config, image, channels, BitsPerPixel))
|
||||
return GIMP_PDB_CANCEL;
|
||||
}
|
||||
|
||||
|
@ -924,11 +925,16 @@ write_image (FILE *f,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
format_sensitive_callback (gint value,
|
||||
format_sensitive_callback (GObject *config,
|
||||
gpointer data)
|
||||
{
|
||||
gint value;
|
||||
gint channels = GPOINTER_TO_INT (data);
|
||||
|
||||
g_object_get (config,
|
||||
"rgb-format", &value,
|
||||
NULL);
|
||||
|
||||
switch (value)
|
||||
{
|
||||
case RGBA_5551:
|
||||
|
@ -974,44 +980,36 @@ config_notify (GObject *config,
|
|||
static gboolean
|
||||
save_dialog (GimpProcedure *procedure,
|
||||
GObject *config,
|
||||
GimpImage *image,
|
||||
gint channels,
|
||||
gint bpp)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *toggle;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *frame;
|
||||
GtkListStore *store;
|
||||
GtkWidget *combo;
|
||||
GtkListStore *store;
|
||||
gboolean is_format_sensitive;
|
||||
gboolean run;
|
||||
|
||||
dialog = gimp_procedure_dialog_new (procedure,
|
||||
GIMP_PROCEDURE_CONFIG (config),
|
||||
_("Export Image as BMP"));
|
||||
dialog = gimp_save_procedure_dialog_new (GIMP_SAVE_PROCEDURE (procedure),
|
||||
GIMP_PROCEDURE_CONFIG (config),
|
||||
image);
|
||||
|
||||
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
|
||||
gtk_box_pack_start (GTK_BOX (gimp_export_dialog_get_content_area (dialog)),
|
||||
vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* Run-Length Encoded */
|
||||
toggle = gimp_prop_check_button_new (config, "use-rle",
|
||||
_("_Run-Length Encoded"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
|
||||
if (channels > 1 || bpp == 1)
|
||||
gtk_widget_set_sensitive (toggle, FALSE);
|
||||
gimp_procedure_dialog_set_sensitive (GIMP_PROCEDURE_DIALOG (dialog),
|
||||
"use-rle",
|
||||
(channels > 1 || bpp == 1),
|
||||
NULL, NULL, FALSE);
|
||||
|
||||
/* Compatibility Options */
|
||||
frame = gimp_frame_new (_("Compatibility"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
toggle = gimp_prop_check_button_new (config, "write-color-space",
|
||||
_("_Write color space information"));
|
||||
gimp_procedure_dialog_get_label (GIMP_PROCEDURE_DIALOG (dialog),
|
||||
"color-space-title", _("Compatibility"));
|
||||
toggle = gimp_procedure_dialog_get_widget (GIMP_PROCEDURE_DIALOG (dialog),
|
||||
"write-color-space",
|
||||
GTK_TYPE_CHECK_BUTTON);
|
||||
gimp_help_set_help_data (toggle,
|
||||
_("Some applications can not read BMP images that "
|
||||
"include color space information. GIMP writes "
|
||||
|
@ -1019,16 +1017,11 @@ save_dialog (GimpProcedure *procedure,
|
|||
"this option will cause GIMP to not write color "
|
||||
"space information to the file."),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (frame), toggle);
|
||||
|
||||
/* RGB Encoding Pptions */
|
||||
frame = gimp_frame_new (_("RGB Encoding"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
if (channels < 3)
|
||||
gtk_widget_set_sensitive (frame, FALSE);
|
||||
gimp_procedure_dialog_fill_frame (GIMP_PROCEDURE_DIALOG (dialog),
|
||||
"color-space-frame", "color-space-title",
|
||||
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,
|
||||
|
@ -1036,13 +1029,36 @@ save_dialog (GimpProcedure *procedure,
|
|||
_("32 bit (A8 R8 G8 B8)"), RGBA_8888,
|
||||
_("32 bit (X8 R8 G8 B8)"), RGBX_8888,
|
||||
NULL);
|
||||
combo = gimp_prop_int_combo_box_new (config, "rgb-format",
|
||||
GIMP_INT_STORE (store));
|
||||
gtk_container_add (GTK_CONTAINER (frame), combo);
|
||||
combo = gimp_procedure_dialog_get_int_combo (GIMP_PROCEDURE_DIALOG (dialog),
|
||||
"rgb-format",
|
||||
GIMP_INT_STORE (store));
|
||||
g_object_set (combo, "margin", 12, NULL);
|
||||
|
||||
gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (combo),
|
||||
format_sensitive_callback,
|
||||
GINT_TO_POINTER (channels), NULL);
|
||||
/* Determine if RGB Format combo should be initially sensitive */
|
||||
is_format_sensitive = format_sensitive_callback (config,
|
||||
GINT_TO_POINTER (channels));
|
||||
gimp_procedure_dialog_set_sensitive (GIMP_PROCEDURE_DIALOG (dialog),
|
||||
"rgb-format",
|
||||
is_format_sensitive,
|
||||
NULL, NULL, FALSE);
|
||||
|
||||
gimp_procedure_dialog_set_sensitive (GIMP_PROCEDURE_DIALOG (dialog),
|
||||
"rgb-format",
|
||||
(channels < 3),
|
||||
NULL, NULL, FALSE);
|
||||
|
||||
/* Formatting the dialog */
|
||||
vbox = gimp_procedure_dialog_fill_box (GIMP_PROCEDURE_DIALOG (dialog),
|
||||
"bmp-save-vbox",
|
||||
"use-rle",
|
||||
"color-space-frame",
|
||||
"rgb-format",
|
||||
NULL);
|
||||
gtk_box_set_spacing (GTK_BOX (vbox), 12);
|
||||
|
||||
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),
|
||||
"bmp-save-vbox",
|
||||
NULL);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
|
|
|
@ -152,8 +152,8 @@ bmp_create_procedure (GimpPlugIn *plug_in,
|
|||
gimp_procedure_set_menu_label (procedure, _("Windows BMP image"));
|
||||
|
||||
gimp_procedure_set_documentation (procedure,
|
||||
"Loads files of Windows BMP file format",
|
||||
"Loads files of Windows BMP file format",
|
||||
_("Loads files of Windows BMP file format"),
|
||||
_("Loads files of Windows BMP file format"),
|
||||
name);
|
||||
gimp_procedure_set_attribution (procedure,
|
||||
"Alexander Schulz",
|
||||
|
@ -176,10 +176,12 @@ bmp_create_procedure (GimpPlugIn *plug_in,
|
|||
gimp_procedure_set_image_types (procedure, "INDEXED, GRAY, RGB*");
|
||||
|
||||
gimp_procedure_set_menu_label (procedure, _("Windows BMP image"));
|
||||
gimp_file_procedure_set_format_name (GIMP_FILE_PROCEDURE (procedure),
|
||||
_("BMP"));
|
||||
|
||||
gimp_procedure_set_documentation (procedure,
|
||||
"Saves files in Windows BMP file format",
|
||||
"Saves files in Windows BMP file format",
|
||||
_("Saves files in Windows BMP file format"),
|
||||
_("Saves files in Windows BMP file format"),
|
||||
name);
|
||||
gimp_procedure_set_attribution (procedure,
|
||||
"Alexander Schulz",
|
||||
|
@ -192,24 +194,24 @@ bmp_create_procedure (GimpPlugIn *plug_in,
|
|||
"bmp");
|
||||
|
||||
GIMP_PROC_ARG_BOOLEAN (procedure, "use-rle",
|
||||
"Use RLE",
|
||||
"Use run-lengh-encoding compression "
|
||||
"(only valid for 4 and 8-bit indexed images)",
|
||||
_("Ru_n-Length Encoded"),
|
||||
_("Use run-length-encoding compression "
|
||||
"(only valid for 4 and 8-bit indexed images)"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
GIMP_PROC_ARG_BOOLEAN (procedure, "write-color-space",
|
||||
"Write color space information",
|
||||
"Whether or not to write BITMAPV5HEADER "
|
||||
"color space data",
|
||||
_("_Write color space information"),
|
||||
_("Whether or not to write BITMAPV5HEADER "
|
||||
"color space data"),
|
||||
TRUE,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
GIMP_PROC_ARG_INT (procedure, "rgb-format",
|
||||
"RGB format",
|
||||
"Export format for RGB images "
|
||||
"(0=RGB_565, 1=RGBA_5551, 2=RGB_555, 3=RGB_888,"
|
||||
" 4=RGBA_8888, 5=RGBX_8888)",
|
||||
_("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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue