plug-ins/common/gif-save.c improved error messages.

2008-03-26  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/gif-save.c
	* plug-ins/common/psd-save.c (save_image): improved error messages.

svn path=/trunk/; revision=25238
This commit is contained in:
Sven Neumann 2008-03-26 13:12:02 +00:00 committed by Sven Neumann
parent 86f0c83d52
commit 19c2344a8d
3 changed files with 22 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2008-03-26 Sven Neumann <sven@gimp.org>
* plug-ins/common/gif-save.c
* plug-ins/common/psd-save.c (save_image): improved error messages.
2008-03-26 Michael Natterer <mitch@gimp.org> 2008-03-26 Michael Natterer <mitch@gimp.org>
* app/display/gimpcanvas.c (gimp_canvas_draw_drop_zone): add * app/display/gimpcanvas.c (gimp_canvas_draw_drop_zone): add

View File

@ -93,7 +93,8 @@ static gint save_image (const gchar *filename,
gint32 drawable_ID, gint32 drawable_ID,
gint32 orig_image_ID); gint32 orig_image_ID);
static gboolean sanity_check (gint32 image_ID); static gboolean sanity_check (const gchar *filename,
gint32 image_ID);
static gboolean bad_bounds_dialog (void); static gboolean bad_bounds_dialog (void);
static gboolean save_dialog (gint32 image_ID); static gboolean save_dialog (gint32 image_ID);
@ -180,9 +181,6 @@ run (const gchar *name,
{ {
static GimpParam values[2]; static GimpParam values[2];
GimpPDBStatusType status = GIMP_PDB_SUCCESS; GimpPDBStatusType status = GIMP_PDB_SUCCESS;
gint32 image_ID;
gint32 drawable_ID;
gint32 orig_image_ID;
GimpExportReturn export = GIMP_EXPORT_CANCEL; GimpExportReturn export = GIMP_EXPORT_CANCEL;
run_mode = param[0].data.d_int32; run_mode = param[0].data.d_int32;
@ -191,13 +189,20 @@ run (const gchar *name,
*nreturn_vals = 1; *nreturn_vals = 1;
*return_vals = values; *return_vals = values;
values[0].type = GIMP_PDB_STATUS; values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
if (strcmp (name, SAVE_PROC) == 0) if (strcmp (name, SAVE_PROC) == 0)
{ {
const gchar *filename;
gint32 image_ID;
gint32 drawable_ID;
gint32 orig_image_ID;
image_ID = orig_image_ID = param[1].data.d_int32; image_ID = orig_image_ID = param[1].data.d_int32;
drawable_ID = param[2].data.d_int32; drawable_ID = param[2].data.d_int32;
filename = param[3].data.d_string;
/* eventually export the image */ /* eventually export the image */
switch (run_mode) switch (run_mode)
@ -220,7 +225,7 @@ run (const gchar *name,
break; break;
} }
if (sanity_check (image_ID)) if (sanity_check (filename, image_ID))
{ {
switch (run_mode) switch (run_mode)
{ {
@ -531,7 +536,8 @@ parse_disposal_tag (const gchar *str)
static gboolean static gboolean
sanity_check (gint32 image_ID) sanity_check (const gchar *filename,
gint32 image_ID)
{ {
gint32 *layers; gint32 *layers;
gint nlayers; gint nlayers;
@ -544,8 +550,8 @@ sanity_check (gint32 image_ID)
if (image_width > G_MAXUSHORT || image_height > G_MAXUSHORT) if (image_width > G_MAXUSHORT || image_height > G_MAXUSHORT)
{ {
g_message (_("The GIF format does not support images larger " g_message (_("Unable to save '%s'. The GIF file format does not support images that are more than %d pixels wide or tall."),
"than %d x %d pixels."), G_MAXUSHORT, G_MAXUSHORT); gimp_filename_to_utf8 (filename), G_MAXUSHORT);
return FALSE; return FALSE;
} }

View File

@ -1528,9 +1528,9 @@ save_image (const gchar *filename,
IFDBG printf (" Function: save_image\n"); IFDBG printf (" Function: save_image\n");
if (gimp_image_width (image_id) > 30000 || if (gimp_image_width (image_id) > 30000 ||
gimp_image_height(image_id) > 30000) gimp_image_height (image_id) > 30000)
{ {
g_message (_("Unable to save '%s'. The psd file format does not support images that are more than 30000 pixels wide or tall."), g_message (_("Unable to save '%s'. The PSD file format does not support images that are more than 30,000 pixels wide or tall."),
gimp_filename_to_utf8 (filename)); gimp_filename_to_utf8 (filename));
return FALSE; return FALSE;
} }
@ -1542,7 +1542,7 @@ save_image (const gchar *filename,
drawable = gimp_drawable_get (layers[i]); drawable = gimp_drawable_get (layers[i]);
if (drawable->width > 30000 || drawable->height > 30000) if (drawable->width > 30000 || drawable->height > 30000)
{ {
g_message (_("Unable to save '%s'. The psd file format does not support images with layers that are more than 30000 pixels wide or tall."), g_message (_("Unable to save '%s'. The PSD file format does not support images with layers that are more than 30,000 pixels wide or tall."),
gimp_filename_to_utf8 (filename)); gimp_filename_to_utf8 (filename));
g_free (layers); g_free (layers);
return FALSE; return FALSE;