overworked my latest change and fixed some typos

--Sven
This commit is contained in:
Sven Neumann 2000-01-08 12:42:53 +00:00
parent 440b86e12f
commit 1b10f54b5a
28 changed files with 83 additions and 69 deletions

View File

@ -1,13 +1,23 @@
Sat Jan 8 13:22:15 CET 2000 Sven Neumann <sven@gimp.org>
Sat Jan 8 15:04:48 CET 2000 Sven Neumann <sven@gimp.org>
* app/gimpimage.c: don't allow to set the resolution to zero
* app/gimpimage.c: in gimp_image_set_resolution() check that
resolutions are inside our limits (see libgimp/gimplimits.h)
* app/xcf.c: if the resolution is invalid, do not hardcode it to
72 dpi, use the configurable default values
* plug-ins/FractalExplorer/Dialogs.c
* plug-ins/FractalExplorer/FractalExplorer.c
* plug-ins/bmp/bmpread.c
* plug-ins/common/jpeg.c
* plug-ins/common/laplace.c
* plug-ins/common/png.c
* plug-ins/common/ps.c
* plug-ins/common/psp.c
* plug-ins/common/tiff.c: Check the resolution before setting it.
If it is not valid, do nothing. GIMP will use the default values.
* plug-ins/common/tiff.c
* plug-ins/gap/gap_mov_dialog.c: fixed some typos, got rif of
compiler warnings, checked that the resolution is set correctly
(the validity of the resolution is now checked in the core)
Fri Jan 7 23:03:51 CET 2000 Sven Neumann <sven@gimp.org>

View File

@ -34,6 +34,7 @@
#include "gimprc.h"
#include "libgimp/gimpintl.h"
#include "libgimp/gimplimits.h"
#include "tile_manager.h"
#include "tile.h"
@ -358,8 +359,9 @@ gimp_image_set_resolution (GimpImage *gimage,
(ABS (gimage->yresolution - yresolution) < 1e-5))
return;
/* don't allow to set the resolution to zero */
if (xresolution < 1e-5 || yresolution < 1e-5)
/* don't allow to set the resolution out of bounds */
if (xresolution < GIMP_MIN_RESOLUTION || xresolution > GIMP_MAX_RESOLUTION ||
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
return;
undo_push_resolution (gimage);
@ -2287,7 +2289,7 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
GSList *layer_list;
GSList *merge_list = NULL;
gboolean had_floating_sel = FALSE;
Layer *layer;
Layer *layer = NULL;
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))

View File

@ -34,6 +34,7 @@
#include "gimprc.h"
#include "libgimp/gimpintl.h"
#include "libgimp/gimplimits.h"
#include "tile_manager.h"
#include "tile.h"
@ -358,8 +359,9 @@ gimp_image_set_resolution (GimpImage *gimage,
(ABS (gimage->yresolution - yresolution) < 1e-5))
return;
/* don't allow to set the resolution to zero */
if (xresolution < 1e-5 || yresolution < 1e-5)
/* don't allow to set the resolution out of bounds */
if (xresolution < GIMP_MIN_RESOLUTION || xresolution > GIMP_MAX_RESOLUTION ||
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
return;
undo_push_resolution (gimage);
@ -2287,7 +2289,7 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
GSList *layer_list;
GSList *merge_list = NULL;
gboolean had_floating_sel = FALSE;
Layer *layer;
Layer *layer = NULL;
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))

View File

@ -34,6 +34,7 @@
#include "gimprc.h"
#include "libgimp/gimpintl.h"
#include "libgimp/gimplimits.h"
#include "tile_manager.h"
#include "tile.h"
@ -358,8 +359,9 @@ gimp_image_set_resolution (GimpImage *gimage,
(ABS (gimage->yresolution - yresolution) < 1e-5))
return;
/* don't allow to set the resolution to zero */
if (xresolution < 1e-5 || yresolution < 1e-5)
/* don't allow to set the resolution out of bounds */
if (xresolution < GIMP_MIN_RESOLUTION || xresolution > GIMP_MAX_RESOLUTION ||
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
return;
undo_push_resolution (gimage);
@ -2287,7 +2289,7 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
GSList *layer_list;
GSList *merge_list = NULL;
gboolean had_floating_sel = FALSE;
Layer *layer;
Layer *layer = NULL;
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))

View File

@ -34,6 +34,7 @@
#include "gimprc.h"
#include "libgimp/gimpintl.h"
#include "libgimp/gimplimits.h"
#include "tile_manager.h"
#include "tile.h"
@ -358,8 +359,9 @@ gimp_image_set_resolution (GimpImage *gimage,
(ABS (gimage->yresolution - yresolution) < 1e-5))
return;
/* don't allow to set the resolution to zero */
if (xresolution < 1e-5 || yresolution < 1e-5)
/* don't allow to set the resolution out of bounds */
if (xresolution < GIMP_MIN_RESOLUTION || xresolution > GIMP_MAX_RESOLUTION ||
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
return;
undo_push_resolution (gimage);
@ -2287,7 +2289,7 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
GSList *layer_list;
GSList *merge_list = NULL;
gboolean had_floating_sel = FALSE;
Layer *layer;
Layer *layer = NULL;
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))

View File

@ -34,6 +34,7 @@
#include "gimprc.h"
#include "libgimp/gimpintl.h"
#include "libgimp/gimplimits.h"
#include "tile_manager.h"
#include "tile.h"
@ -358,8 +359,9 @@ gimp_image_set_resolution (GimpImage *gimage,
(ABS (gimage->yresolution - yresolution) < 1e-5))
return;
/* don't allow to set the resolution to zero */
if (xresolution < 1e-5 || yresolution < 1e-5)
/* don't allow to set the resolution out of bounds */
if (xresolution < GIMP_MIN_RESOLUTION || xresolution > GIMP_MAX_RESOLUTION ||
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
return;
undo_push_resolution (gimage);
@ -2287,7 +2289,7 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
GSList *layer_list;
GSList *merge_list = NULL;
gboolean had_floating_sel = FALSE;
Layer *layer;
Layer *layer = NULL;
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))

View File

@ -34,6 +34,7 @@
#include "gimprc.h"
#include "libgimp/gimpintl.h"
#include "libgimp/gimplimits.h"
#include "tile_manager.h"
#include "tile.h"
@ -358,8 +359,9 @@ gimp_image_set_resolution (GimpImage *gimage,
(ABS (gimage->yresolution - yresolution) < 1e-5))
return;
/* don't allow to set the resolution to zero */
if (xresolution < 1e-5 || yresolution < 1e-5)
/* don't allow to set the resolution out of bounds */
if (xresolution < GIMP_MIN_RESOLUTION || xresolution > GIMP_MAX_RESOLUTION ||
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
return;
undo_push_resolution (gimage);
@ -2287,7 +2289,7 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
GSList *layer_list;
GSList *merge_list = NULL;
gboolean had_floating_sel = FALSE;
Layer *layer;
Layer *layer = NULL;
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))

View File

@ -34,6 +34,7 @@
#include "gimprc.h"
#include "libgimp/gimpintl.h"
#include "libgimp/gimplimits.h"
#include "tile_manager.h"
#include "tile.h"
@ -358,8 +359,9 @@ gimp_image_set_resolution (GimpImage *gimage,
(ABS (gimage->yresolution - yresolution) < 1e-5))
return;
/* don't allow to set the resolution to zero */
if (xresolution < 1e-5 || yresolution < 1e-5)
/* don't allow to set the resolution out of bounds */
if (xresolution < GIMP_MIN_RESOLUTION || xresolution > GIMP_MAX_RESOLUTION ||
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
return;
undo_push_resolution (gimage);
@ -2287,7 +2289,7 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
GSList *layer_list;
GSList *merge_list = NULL;
gboolean had_floating_sel = FALSE;
Layer *layer;
Layer *layer = NULL;
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))

View File

@ -34,6 +34,7 @@
#include "gimprc.h"
#include "libgimp/gimpintl.h"
#include "libgimp/gimplimits.h"
#include "tile_manager.h"
#include "tile.h"
@ -358,8 +359,9 @@ gimp_image_set_resolution (GimpImage *gimage,
(ABS (gimage->yresolution - yresolution) < 1e-5))
return;
/* don't allow to set the resolution to zero */
if (xresolution < 1e-5 || yresolution < 1e-5)
/* don't allow to set the resolution out of bounds */
if (xresolution < GIMP_MIN_RESOLUTION || xresolution > GIMP_MAX_RESOLUTION ||
yresolution < GIMP_MIN_RESOLUTION || yresolution > GIMP_MAX_RESOLUTION)
return;
undo_push_resolution (gimage);
@ -2287,7 +2289,7 @@ gimp_image_merge_visible_layers (GimpImage *gimage,
GSList *layer_list;
GSList *merge_list = NULL;
gboolean had_floating_sel = FALSE;
Layer *layer;
Layer *layer = NULL;
/* if there's a floating selection, anchor it */
if (gimp_image_floating_sel (gimage))

View File

@ -21,6 +21,7 @@
#include "floating_sel.h"
#include "gimage.h"
#include "gimage_mask.h"
#include "gimprc.h"
#include "interface.h"
#include "plug_in.h"
#include "procedural_db.h"
@ -1846,7 +1847,8 @@ xcf_load_image_props (XcfInfo *info,
yres < GIMP_MIN_RESOLUTION || yres > GIMP_MAX_RESOLUTION)
{
g_message ("Warning, resolution out of range in XCF file");
xres = yres = 72.0;
xres = default_xresolution;
yres = default_yresolution;
}
gimage->xresolution = xres;
gimage->yresolution = yres;

View File

@ -21,6 +21,7 @@
#include "floating_sel.h"
#include "gimage.h"
#include "gimage_mask.h"
#include "gimprc.h"
#include "interface.h"
#include "plug_in.h"
#include "procedural_db.h"
@ -1846,7 +1847,8 @@ xcf_load_image_props (XcfInfo *info,
yres < GIMP_MIN_RESOLUTION || yres > GIMP_MAX_RESOLUTION)
{
g_message ("Warning, resolution out of range in XCF file");
xres = yres = 72.0;
xres = default_xresolution;
yres = default_yresolution;
}
gimage->xresolution = xres;
gimage->yresolution = yres;

View File

@ -2252,7 +2252,7 @@ explorer_load()
return;
}
if (load_options(current_obj,fp)) {
g_message (_("File '%s' is corrupt.\nLine %d Option section incorrect"),
g_message (_("File '%s' is corrupt\nLine %d Option section incorrect"),
filename, line_no);
return;
}

View File

@ -1574,7 +1574,7 @@ fractalexplorer_load (gchar *filename, gchar *name)
if(load_options(fractalexplorer,fp))
{
g_message (_("File '%s' is corrupt\nLine %d Option section incorrect"), filename, line_no);
g_message (_("File '%s' is corrupt.\nLine %d Option section incorrect"), filename, line_no);
fclose(fp);
return(NULL);

View File

@ -26,9 +26,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libgimp/gimp.h>
#include <gtk/gtk.h>
#include "bmp.h"
#include <libgimp/gimp.h>
#include "libgimp/stdplugins-intl.h"
@ -193,8 +193,8 @@ ReadBMP (char *name)
xresolution = LROUND((Bitmap_Head.biXPels * 2.54 / 100.0));
yresolution = LROUND((Bitmap_Head.biYPels * 2.54 / 100.0));
#undef LROUND
if (xresolution > 1e-5 && yresolution > 1e-5)
gimp_image_set_resolution (image_ID, xresolution, yresolution);
gimp_image_set_resolution (image_ID, xresolution, yresolution);
}
#endif /* GIMP_HAVE_RESOLUTION_INFO */

View File

@ -921,8 +921,7 @@ load_image (char *filename,
break;
}
if (xresolution > 1e-5 && yresolution > 1e-5)
gimp_image_set_resolution (image_ID, xresolution, yresolution);
gimp_image_set_resolution (image_ID, xresolution, yresolution);
}
#endif /* GIMP_HAVE_RESOLUTION_INFO */

View File

@ -80,7 +80,7 @@ query ()
gimp_install_procedure ("plug_in_laplace",
_("Edge Detection with Laplace Operation"),
_("This plugin creates one-pixel wide edges from the image, with the value proportional to the gradient. It uses the Laplace operator (a 3x3 kernel with -8 in the middle)The image has to be laplacered to get usefull results, a gauss_iir with 1.5 - 5.0 depending on the noise in the image is best"),
_("This plugin creates one-pixel wide edges from the image, with the value proportional to the gradient. It uses the Laplace operator (a 3x3 kernel with -8 in the middle). The image has to be laplacered to get useful results, a gauss_iir with 1.5 - 5.0 depending on the noise in the image is best."),
"Thorsten Schnier",
"Thorsten Schnier",
"1997",

View File

@ -493,8 +493,7 @@ load_image (char *filename) /* I - File to load */
*/
#ifdef GIMP_HAVE_RESOLUTION_INFO
if ((info->valid & PNG_INFO_pHYs) &&
(info->x_pixels_per_unit > 1e-5) && (info->y_pixels_per_unit > 1e-5))
if (info->valid & PNG_INFO_pHYs)
{
if (info->phys_unit_type == PNG_RESOLUTION_METER)
gimp_image_set_resolution(image,

View File

@ -663,12 +663,9 @@ load_image (char *filename)
image_ID = load_ps (filename, page_count, ifp, llx, lly, urx, ury);
if (image_ID == -1) break;
#ifdef GIMP_HAVE_RESOLUTION_INFO
if (plvals.resolution > 1e-5)
{
gimp_image_set_resolution (image_ID, (float)plvals.resolution,
(float)plvals.resolution);
gimp_image_set_unit (image_ID, UNIT_INCH);
}
gimp_image_set_resolution (image_ID,
(double)plvals.resolution, (double)plvals.resolution);
gimp_image_set_unit (image_ID, UNIT_INCH);
#endif
if (n_images == max_images)
{

View File

@ -663,12 +663,9 @@ load_image (char *filename)
image_ID = load_ps (filename, page_count, ifp, llx, lly, urx, ury);
if (image_ID == -1) break;
#ifdef GIMP_HAVE_RESOLUTION_INFO
if (plvals.resolution > 1e-5)
{
gimp_image_set_resolution (image_ID, (float)plvals.resolution,
(float)plvals.resolution);
gimp_image_set_unit (image_ID, UNIT_INCH);
}
gimp_image_set_resolution (image_ID,
(double)plvals.resolution, (double)plvals.resolution);
gimp_image_set_unit (image_ID, UNIT_INCH);
#endif
if (n_images == max_images)
{

View File

@ -1670,9 +1670,7 @@ load_image (char *filename)
gimp_image_set_filename (image_ID, filename);
if ((int) ia.resolution > 1)
gimp_image_set_resolution (image_ID,
(int) ia.resolution, (int) ia.resolution);
gimp_image_set_resolution (image_ID, ia.resolution, ia.resolution);
}
else
{

View File

@ -540,7 +540,7 @@ load_image (char *filename)
/* If it is invalid, instead of forcing 72dpi, do not set the resolution
at all. Gimp will then use the default set by the user */
if (read_unit != RESUNIT_NONE && xres > 1e-5 && yres > 1e-5)
if (read_unit != RESUNIT_NONE)
{
gimp_image_set_resolution (image, xres, yres);
if (unit != UNIT_PIXEL)

View File

@ -1354,7 +1354,7 @@ mov_src_sel_create()
menu = p_buildmenu (option_step_items);
gtk_option_menu_set_menu(GTK_OPTION_MENU(option_menu), menu);
gtk_tooltips_set_tip(g_tooltips, option_menu,
_("How to fetch te next SrcLayer \nat the next handled frame")
_("How to fetch the next SrcLayer \nat the next handled frame")
, NULL);
gtk_widget_show(option_menu);

View File

@ -921,8 +921,7 @@ load_image (char *filename,
break;
}
if (xresolution > 1e-5 && yresolution > 1e-5)
gimp_image_set_resolution (image_ID, xresolution, yresolution);
gimp_image_set_resolution (image_ID, xresolution, yresolution);
}
#endif /* GIMP_HAVE_RESOLUTION_INFO */

View File

@ -921,8 +921,7 @@ load_image (char *filename,
break;
}
if (xresolution > 1e-5 && yresolution > 1e-5)
gimp_image_set_resolution (image_ID, xresolution, yresolution);
gimp_image_set_resolution (image_ID, xresolution, yresolution);
}
#endif /* GIMP_HAVE_RESOLUTION_INFO */

View File

@ -921,8 +921,7 @@ load_image (char *filename,
break;
}
if (xresolution > 1e-5 && yresolution > 1e-5)
gimp_image_set_resolution (image_ID, xresolution, yresolution);
gimp_image_set_resolution (image_ID, xresolution, yresolution);
}
#endif /* GIMP_HAVE_RESOLUTION_INFO */

View File

@ -921,8 +921,7 @@ load_image (char *filename,
break;
}
if (xresolution > 1e-5 && yresolution > 1e-5)
gimp_image_set_resolution (image_ID, xresolution, yresolution);
gimp_image_set_resolution (image_ID, xresolution, yresolution);
}
#endif /* GIMP_HAVE_RESOLUTION_INFO */

View File

@ -921,8 +921,7 @@ load_image (char *filename,
break;
}
if (xresolution > 1e-5 && yresolution > 1e-5)
gimp_image_set_resolution (image_ID, xresolution, yresolution);
gimp_image_set_resolution (image_ID, xresolution, yresolution);
}
#endif /* GIMP_HAVE_RESOLUTION_INFO */

View File

@ -921,8 +921,7 @@ load_image (char *filename,
break;
}
if (xresolution > 1e-5 && yresolution > 1e-5)
gimp_image_set_resolution (image_ID, xresolution, yresolution);
gimp_image_set_resolution (image_ID, xresolution, yresolution);
}
#endif /* GIMP_HAVE_RESOLUTION_INFO */