plug-ins/bmp/bmp.[ch] simplified run() method, renamed a variable.

2006-07-13  Sven Neumann  <sven@gimp.org>

	* plug-ins/bmp/bmp.[ch]
	* plug-ins/bmp/bmpwrite.c: simplified run() method, renamed a
	variable.
This commit is contained in:
Sven Neumann 2006-07-13 06:20:58 +00:00 committed by Sven Neumann
parent ced16ab85c
commit 597954af46
4 changed files with 48 additions and 55 deletions

View File

@ -1,3 +1,9 @@
2006-07-13 Sven Neumann <sven@gimp.org>
* plug-ins/bmp/bmp.[ch]
* plug-ins/bmp/bmpwrite.c: simplified run() method, renamed a
variable.
2006-07-13 Sven Neumann <sven@gimp.org>
* tools/gimp-remote.c: increased timeout to 5 seconds (bug #347345).

View File

@ -69,11 +69,12 @@
#define SAVE_PROC "file-bmp-save"
const gchar *filename = NULL;
gboolean interactive_bmp;
const gchar *filename = NULL;
gboolean interactive = FALSE;
struct Bitmap_File_Head_Struct Bitmap_File_Head;
struct Bitmap_Head_Struct Bitmap_Head;
struct Bitmap_Head_Struct Bitmap_Head;
/* Declare some local functions.
*/
@ -180,12 +181,11 @@ run (const gchar *name,
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
interactive_bmp = TRUE;
interactive = TRUE;
break;
case GIMP_RUN_NONINTERACTIVE:
/* Make sure all the arguments are there! */
interactive_bmp = FALSE;
if (nparams != 3)
status = GIMP_PDB_CALLING_ERROR;
break;
@ -219,6 +219,9 @@ run (const gchar *name,
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
interactive = TRUE;
/* fallthrough */
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init ("bmp", FALSE);
export = gimp_export_image (&image_ID, &drawable_ID, "BMP",
@ -226,41 +229,26 @@ run (const gchar *name,
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED));
if (export == GIMP_EXPORT_CANCEL)
{
values[0].data.d_status = GIMP_PDB_CANCEL;
return;
}
break;
default:
break;
}
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
interactive_bmp = TRUE;
break;
case GIMP_RUN_NONINTERACTIVE:
/* Make sure all the arguments are there! */
interactive_bmp = FALSE;
if (nparams != 5)
status = GIMP_PDB_CALLING_ERROR;
break;
case GIMP_RUN_WITH_LAST_VALS:
interactive_bmp = FALSE;
break;
default:
break;
}
if (status == GIMP_PDB_SUCCESS)
{
status = WriteBMP (param[3].data.d_string, image_ID, drawable_ID);
}
status = WriteBMP (param[3].data.d_string, image_ID, drawable_ID);
if (export == GIMP_EXPORT_EXPORT)
gimp_image_delete (image_ID);

View File

@ -30,7 +30,7 @@ GimpPDBStatusType WriteBMP (const gchar *filename,
gint32 image,
gint32 drawable_ID);
extern gboolean interactive_bmp;
extern gboolean interactive;
extern const gchar *filename;
extern struct Bitmap_File_Head_Struct

View File

@ -228,44 +228,43 @@ WriteBMP (const gchar *filename,
encoded = 0;
mask_info_size = 0;
if ((BitsPerPixel == 8 || BitsPerPixel == 4) && interactive_bmp)
if ((BitsPerPixel == 8 || BitsPerPixel == 4) && interactive)
{
if (! save_dialog ())
return GIMP_PDB_CANCEL;
}
else if ((BitsPerPixel == 24 || BitsPerPixel == 32))
{
if (interactive_bmp && !save_dialog_rgb (channels))
return GIMP_PDB_CANCEL;
{
if (interactive && !save_dialog_rgb (channels))
return GIMP_PDB_CANCEL;
switch (rgb_format)
{
default:
g_message (_("Unknown format."));
return GIMP_PDB_EXECUTION_ERROR;
case RGB_888:
BitsPerPixel = 24;
break;
case RGBA_8888:
BitsPerPixel = 32;
break;
case RGBX_8888:
BitsPerPixel = 32;
mask_info_size = 16;
break;
case RGB_565:
BitsPerPixel = 16;
mask_info_size = 16;
break;
case RGBA_5551:
BitsPerPixel = 16;
mask_info_size = 16;
break;
case RGB_555:
BitsPerPixel = 16;
break;
}
}
switch (rgb_format)
{
case RGB_888:
BitsPerPixel = 24;
break;
case RGBA_8888:
BitsPerPixel = 32;
break;
case RGBX_8888:
BitsPerPixel = 32;
mask_info_size = 16;
break;
case RGB_565:
BitsPerPixel = 16;
mask_info_size = 16;
break;
case RGBA_5551:
BitsPerPixel = 16;
mask_info_size = 16;
break;
case RGB_555:
BitsPerPixel = 16;
break;
default:
g_return_val_if_reached (GIMP_PDB_EXECUTION_ERROR);
}
}
/* Let's take some file */
outfile = g_fopen (filename, "wb");