app/[all files with resolution info] libgimp/gimp.h libgimp/gimpimage.c

1999-05-22  Michael Natterer  <mitschel@cs.tu-berlin.de>

	* app/[all files with resolution info]
	* libgimp/gimp.h
	* libgimp/gimpimage.c
	* libgimp/gimpsizeentry.[ch]
	* libgimp/gimpunit.[ch]
	* plug-ins/newsprint/newsprint.c
	* plug-ins/pgn/png.c
	* plug-ins/tiff/tiff.c: double instead of float for all resolution
	and unit-factor variables.

	* app/commands.c
	* app/crop.c
	* app/interface.c
	* app/layers_dialog.c
	* app/move_tool.c
	* app/resize.c
	* app/rotate_tool.c
	* app/scale_tool.c: pass the image's unit *and* gdisp->dot_for_dot
	to all functions which create sizeentries. Never create a
	sizeentry with UNIT_PIXEL but with the image's unit and set it's
	unit to UNIT_PIXEL after creation if dot_for_dot is on.
	This way the image's unit can always be picked from the menu
	without selecting "More...".

	* app/interface.c: made the query_*_box() functions use the
	ActionArea.

	* plug-ins/gimpunitmenu.c: GTK_WIN_POS_MOUSE for the unit
	selection dialog.
This commit is contained in:
Michael Natterer 1999-05-22 17:56:35 +00:00 committed by Michael Natterer
parent c79272ac6a
commit dcfb450b25
102 changed files with 920 additions and 786 deletions

View file

@ -1,4 +1,37 @@
1999-05-22 Michael Natterer <mitschel@cs.tu-berlin.de>
* app/[all files with resolution info]
* libgimp/gimp.h
* libgimp/gimpimage.c
* libgimp/gimpsizeentry.[ch]
* libgimp/gimpunit.[ch]
* plug-ins/newsprint/newsprint.c
* plug-ins/pgn/png.c
* plug-ins/tiff/tiff.c: double instead of float for all resolution
and unit-factor variables.
* app/commands.c
* app/crop.c
* app/interface.c
* app/layers_dialog.c
* app/move_tool.c
* app/resize.c
* app/rotate_tool.c
* app/scale_tool.c: pass the image's unit *and* gdisp->dot_for_dot
to all functions which create sizeentries. Never create a
sizeentry with UNIT_PIXEL but with the image's unit and set it's
unit to UNIT_PIXEL after creation if dot_for_dot is on.
This way the image's unit can always be picked from the menu
without selecting "More...".
* app/interface.c: made the query_*_box() functions use the
ActionArea.
* plug-ins/gimpunitmenu.c: GTK_WIN_POS_MOUSE for the unit
selection dialog.
Fri May 21 10:39:00 CST 1999 Seth Burgess <sjburges@gimp.org>
* app/gimprc.c
* app/gimprc.h
* app/gimprc_cmds.c : wrapped up value_to_str and added it to

View file

@ -365,9 +365,10 @@ select_border_cmd_callback (GtkWidget *widget,
query_size_box (_("Border Selection"), _("Border selection by:"),
selection_border_radius, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_border_callback, gdisp->gimage);
}
@ -382,9 +383,10 @@ select_feather_cmd_callback (GtkWidget *widget,
query_size_box (_("Feather Selection"), _("Feather selection by:"),
selection_feather_radius, 0, 32767, 3,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_feather_callback, gdisp->gimage);
}
@ -399,9 +401,10 @@ select_grow_cmd_callback (GtkWidget *widget,
query_size_box (_("Grow Selection"), _("Grow selection by:"),
selection_grow_pixels, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_grow_callback, gdisp->gimage);
}
@ -416,9 +419,10 @@ select_shrink_cmd_callback (GtkWidget *widget,
query_size_box (_("Shrink Selection"), _("Shrink selection by:"),
selection_shrink_pixels, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_shrink_callback, gdisp->gimage);
}
@ -1211,7 +1215,7 @@ gimage_mask_feather_callback (GtkWidget *w,
double radius_x;
double radius_y;
selection_feather_radius = *(float*) call_data;
selection_feather_radius = *(double*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
@ -1245,7 +1249,7 @@ gimage_mask_border_callback (GtkWidget *w,
double radius_x;
double radius_y;
selection_border_radius = (int) *(float*) call_data;
selection_border_radius = (int) *(double*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
@ -1279,7 +1283,7 @@ gimage_mask_grow_callback (GtkWidget *w,
double radius_x;
double radius_y;
selection_grow_pixels = (int) *(float*) call_data;
selection_grow_pixels = (int) *(double*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
@ -1313,7 +1317,7 @@ gimage_mask_shrink_callback (GtkWidget *w,
int radius_x;
int radius_y;
selection_shrink_pixels = (int) *(float*) call_data;
selection_shrink_pixels = (int) *(double*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");

View file

@ -87,6 +87,7 @@
#include "color_select.h"
#include "gimpparasite.h"
#include "libgimp/gimplimits.h"
#include "libgimp/gimpintl.h"
#define LOGO_WIDTH_MIN 300
@ -497,13 +498,10 @@ app_init (void)
restore_session = TRUE;
/* make sure the monitor resolution is valid */
if (monitor_xres < 1e-5 || monitor_yres < 1e-5)
if (monitor_xres < GIMP_MIN_RESOLUTION ||
monitor_yres < GIMP_MIN_RESOLUTION)
{
gfloat xres, yres;
gdisplay_xserver_resolution (&xres, &yres);
monitor_xres = xres;
monitor_yres = yres;
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
using_xserver_resolution = TRUE;
}

View file

@ -643,7 +643,7 @@ blend_motion (Tool *tool,
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Blend: "),

View file

@ -365,9 +365,10 @@ select_border_cmd_callback (GtkWidget *widget,
query_size_box (_("Border Selection"), _("Border selection by:"),
selection_border_radius, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_border_callback, gdisp->gimage);
}
@ -382,9 +383,10 @@ select_feather_cmd_callback (GtkWidget *widget,
query_size_box (_("Feather Selection"), _("Feather selection by:"),
selection_feather_radius, 0, 32767, 3,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_feather_callback, gdisp->gimage);
}
@ -399,9 +401,10 @@ select_grow_cmd_callback (GtkWidget *widget,
query_size_box (_("Grow Selection"), _("Grow selection by:"),
selection_grow_pixels, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_grow_callback, gdisp->gimage);
}
@ -416,9 +419,10 @@ select_shrink_cmd_callback (GtkWidget *widget,
query_size_box (_("Shrink Selection"), _("Shrink selection by:"),
selection_shrink_pixels, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_shrink_callback, gdisp->gimage);
}
@ -1211,7 +1215,7 @@ gimage_mask_feather_callback (GtkWidget *w,
double radius_x;
double radius_y;
selection_feather_radius = *(float*) call_data;
selection_feather_radius = *(double*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
@ -1245,7 +1249,7 @@ gimage_mask_border_callback (GtkWidget *w,
double radius_x;
double radius_y;
selection_border_radius = (int) *(float*) call_data;
selection_border_radius = (int) *(double*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
@ -1279,7 +1283,7 @@ gimage_mask_grow_callback (GtkWidget *w,
double radius_x;
double radius_y;
selection_grow_pixels = (int) *(float*) call_data;
selection_grow_pixels = (int) *(double*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
@ -1313,7 +1317,7 @@ gimage_mask_shrink_callback (GtkWidget *w,
int radius_x;
int radius_y;
selection_shrink_pixels = (int) *(float*) call_data;
selection_shrink_pixels = (int) *(double*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");

View file

@ -643,7 +643,7 @@ blend_motion (Tool *tool,
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Blend: "),

View file

@ -319,8 +319,8 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
void
gimp_image_set_resolution (GimpImage *gimage,
float xresolution,
float yresolution)
double xresolution,
double yresolution)
{
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
@ -328,8 +328,8 @@ gimp_image_set_resolution (GimpImage *gimage,
void
gimp_image_get_resolution (GimpImage *gimage,
float *xresolution,
float *yresolution)
double *xresolution,
double *yresolution)
{
g_return_if_fail(xresolution && yresolution);
*xresolution = gimage->xresolution;

View file

@ -108,10 +108,11 @@ GtkType gimp_image_get_type(void);
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_set_resolution (GimpImage *, float, float);
void gimp_image_set_resolution (GimpImage *,
double, double);
void gimp_image_get_resolution (GimpImage *,
float *,
float *);
double *,
double *);
void gimp_image_set_unit (GimpImage *, GUnit);
GUnit gimp_image_get_unit (GimpImage *);
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);

View file

@ -319,8 +319,8 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
void
gimp_image_set_resolution (GimpImage *gimage,
float xresolution,
float yresolution)
double xresolution,
double yresolution)
{
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
@ -328,8 +328,8 @@ gimp_image_set_resolution (GimpImage *gimage,
void
gimp_image_get_resolution (GimpImage *gimage,
float *xresolution,
float *yresolution)
double *xresolution,
double *yresolution)
{
g_return_if_fail(xresolution && yresolution);
*xresolution = gimage->xresolution;

View file

@ -108,10 +108,11 @@ GtkType gimp_image_get_type(void);
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_set_resolution (GimpImage *, float, float);
void gimp_image_set_resolution (GimpImage *,
double, double);
void gimp_image_get_resolution (GimpImage *,
float *,
float *);
double *,
double *);
void gimp_image_set_unit (GimpImage *, GUnit);
GUnit gimp_image_get_unit (GimpImage *);
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);

View file

@ -319,8 +319,8 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
void
gimp_image_set_resolution (GimpImage *gimage,
float xresolution,
float yresolution)
double xresolution,
double yresolution)
{
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
@ -328,8 +328,8 @@ gimp_image_set_resolution (GimpImage *gimage,
void
gimp_image_get_resolution (GimpImage *gimage,
float *xresolution,
float *yresolution)
double *xresolution,
double *yresolution)
{
g_return_if_fail(xresolution && yresolution);
*xresolution = gimage->xresolution;

View file

@ -108,10 +108,11 @@ GtkType gimp_image_get_type(void);
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_set_resolution (GimpImage *, float, float);
void gimp_image_set_resolution (GimpImage *,
double, double);
void gimp_image_get_resolution (GimpImage *,
float *,
float *);
double *,
double *);
void gimp_image_set_unit (GimpImage *, GUnit);
GUnit gimp_image_get_unit (GimpImage *);
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);

View file

@ -319,8 +319,8 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
void
gimp_image_set_resolution (GimpImage *gimage,
float xresolution,
float yresolution)
double xresolution,
double yresolution)
{
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
@ -328,8 +328,8 @@ gimp_image_set_resolution (GimpImage *gimage,
void
gimp_image_get_resolution (GimpImage *gimage,
float *xresolution,
float *yresolution)
double *xresolution,
double *yresolution)
{
g_return_if_fail(xresolution && yresolution);
*xresolution = gimage->xresolution;

View file

@ -108,10 +108,11 @@ GtkType gimp_image_get_type(void);
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_set_resolution (GimpImage *, float, float);
void gimp_image_set_resolution (GimpImage *,
double, double);
void gimp_image_get_resolution (GimpImage *,
float *,
float *);
double *,
double *);
void gimp_image_set_unit (GimpImage *, GUnit);
GUnit gimp_image_get_unit (GimpImage *);
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);

View file

@ -319,8 +319,8 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
void
gimp_image_set_resolution (GimpImage *gimage,
float xresolution,
float yresolution)
double xresolution,
double yresolution)
{
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
@ -328,8 +328,8 @@ gimp_image_set_resolution (GimpImage *gimage,
void
gimp_image_get_resolution (GimpImage *gimage,
float *xresolution,
float *yresolution)
double *xresolution,
double *yresolution)
{
g_return_if_fail(xresolution && yresolution);
*xresolution = gimage->xresolution;

View file

@ -108,10 +108,11 @@ GtkType gimp_image_get_type(void);
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_set_resolution (GimpImage *, float, float);
void gimp_image_set_resolution (GimpImage *,
double, double);
void gimp_image_get_resolution (GimpImage *,
float *,
float *);
double *,
double *);
void gimp_image_set_unit (GimpImage *, GUnit);
GUnit gimp_image_get_unit (GimpImage *);
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);

View file

@ -319,8 +319,8 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
void
gimp_image_set_resolution (GimpImage *gimage,
float xresolution,
float yresolution)
double xresolution,
double yresolution)
{
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
@ -328,8 +328,8 @@ gimp_image_set_resolution (GimpImage *gimage,
void
gimp_image_get_resolution (GimpImage *gimage,
float *xresolution,
float *yresolution)
double *xresolution,
double *yresolution)
{
g_return_if_fail(xresolution && yresolution);
*xresolution = gimage->xresolution;

View file

@ -108,10 +108,11 @@ GtkType gimp_image_get_type(void);
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_set_resolution (GimpImage *, float, float);
void gimp_image_set_resolution (GimpImage *,
double, double);
void gimp_image_get_resolution (GimpImage *,
float *,
float *);
double *,
double *);
void gimp_image_set_unit (GimpImage *, GUnit);
GUnit gimp_image_get_unit (GimpImage *);
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);

View file

@ -319,8 +319,8 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
void
gimp_image_set_resolution (GimpImage *gimage,
float xresolution,
float yresolution)
double xresolution,
double yresolution)
{
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
@ -328,8 +328,8 @@ gimp_image_set_resolution (GimpImage *gimage,
void
gimp_image_get_resolution (GimpImage *gimage,
float *xresolution,
float *yresolution)
double *xresolution,
double *yresolution)
{
g_return_if_fail(xresolution && yresolution);
*xresolution = gimage->xresolution;

View file

@ -108,10 +108,11 @@ GtkType gimp_image_get_type(void);
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_set_resolution (GimpImage *, float, float);
void gimp_image_set_resolution (GimpImage *,
double, double);
void gimp_image_get_resolution (GimpImage *,
float *,
float *);
double *,
double *);
void gimp_image_set_unit (GimpImage *, GUnit);
GUnit gimp_image_get_unit (GimpImage *);
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);

View file

@ -1024,14 +1024,14 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
double unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (buffer, CURSOR_STR_LENGTH,
gdisp->cursor_format_str,
"",
(float)t_x * unit_factor / gdisp->gimage->xresolution,
", ",
(float)t_y * unit_factor / gdisp->gimage->yresolution);
g_snprintf
(buffer, CURSOR_STR_LENGTH, gdisp->cursor_format_str,
"",
(double) t_x * unit_factor / gdisp->gimage->xresolution,
", ",
(double) t_y * unit_factor / gdisp->gimage->yresolution);
}
gtk_label_set (GTK_LABEL (gdisp->cursor_label), buffer);
}
@ -1076,7 +1076,7 @@ gdisplay_resize_cursor_label (GDisplay *gdisp)
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (gdisp->cursor_format_str, sizeof(gdisp->cursor_format_str),
"%%s%%.%df%%s%%.%df %s",
@ -1086,14 +1086,14 @@ gdisplay_resize_cursor_label (GDisplay *gdisp)
g_snprintf (buffer, sizeof(buffer), gdisp->cursor_format_str,
"",
(float)gdisp->gimage->width * unit_factor /
(gdouble) gdisp->gimage->width * unit_factor /
gdisp->gimage->xresolution,
", ",
(float)gdisp->gimage->height * unit_factor /
(gdouble) gdisp->gimage->height * unit_factor /
gdisp->gimage->yresolution);
}
cursor_label_width =
gdk_string_width ( gtk_widget_get_style(gdisp->cursor_label)->font, buffer );
gdk_string_width (gtk_widget_get_style (gdisp->cursor_label)->font, buffer);
/* find out how many pixels the label's parent frame is bigger than
* the label itself */

View file

@ -35,11 +35,11 @@
#define SCALESRC(g) (g->scale & 0x00ff)
#define SCALEDEST(g) (g->scale >> 8)
/* finding the effective screen resolution (float) */
/* finding the effective screen resolution (double) */
#define SCREEN_XRES(g) (g->dot_for_dot? g->gimage->xresolution : monitor_xres)
#define SCREEN_YRES(g) (g->dot_for_dot? g->gimage->yresolution : monitor_yres)
/* calculate scale factors (float) */
/* calculate scale factors (double) */
#define SCALEFACTOR_X(g) ((SCALEDEST(g) * SCREEN_XRES(g)) / \
(SCALESRC(g) * g->gimage->xresolution))
#define SCALEFACTOR_Y(g) ((SCALEDEST(g) * SCREEN_YRES(g)) / \

View file

@ -40,7 +40,7 @@
typedef struct {
guint delete_on_exit;
float factor;
gdouble factor;
gint digits;
gchar *identifier;
gchar *symbol;
@ -100,13 +100,13 @@ gimp_unit_get_number_of_built_in_units (void)
GUnit
gimp_unit_new (gchar *identifier,
gfloat factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural)
gimp_unit_new (gchar *identifier,
gdouble factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural)
{
GimpUnitDef *user_unit;
@ -151,7 +151,7 @@ gimp_unit_set_deletion_flag (GUnit unit,
}
gfloat
gdouble
gimp_unit_get_factor (GUnit unit)
{
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&

View file

@ -502,14 +502,14 @@ crop_motion (Tool *tool,
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Crop: "),
(float)(crop->tx2 - crop->tx1) * unit_factor /
(gdouble) (crop->tx2 - crop->tx1) * unit_factor /
gdisp->gimage->xresolution,
" x ",
(float)(crop->ty2 - crop->ty1) * unit_factor /
(gdouble) (crop->ty2 - crop->ty1) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), crop->context_id,

View file

@ -295,8 +295,9 @@ file_new_confirm_dialog (NewImageValues *vals)
vals->confirm_dlg = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (vals->confirm_dlg),
"really_create", "Gimp");
"confirm_size", "Gimp");
gtk_window_set_title (GTK_WINDOW (vals->confirm_dlg), _("Confirm Image Size"));
gtk_window_set_policy (GTK_WINDOW (vals->confirm_dlg), FALSE, FALSE, FALSE);
gtk_window_position (GTK_WINDOW (vals->confirm_dlg), GTK_WIN_POS_MOUSE);
/* Handle the wm close signal */
@ -480,7 +481,6 @@ file_new_cmd_callback (GtkWidget *widget,
N_("RGB"),
N_("Grayscale")
};
static gchar *fill_type_names[] =
{
N_("Foreground"),

View file

@ -200,7 +200,7 @@ info_window_update (InfoDialog *info_win,
GDisplay *gdisp;
InfoWinData *iwd;
int type;
gfloat unit_factor;
gdouble unit_factor;
gint unit_digits;
gchar format_buf[32];

View file

@ -33,6 +33,7 @@
#include "libgimp/gimpfileselection.h"
#include "libgimp/gimppatheditor.h"
#include "libgimp/gimpsizeentry.h"
#include "libgimp/gimplimits.h"
#include "libgimp/gimpintl.h"
/* preferences local functions */
@ -245,7 +246,8 @@ file_prefs_ok_callback (GtkWidget *widget,
default_units = old_default_units;
return;
}
if (default_xresolution < 1e-5 || default_yresolution < 1e-5)
if (default_xresolution < GIMP_MIN_RESOLUTION ||
default_yresolution < GIMP_MIN_RESOLUTION)
{
g_message (_("Error: default resolution must not be zero."));
default_xresolution = old_default_xresolution;
@ -259,7 +261,8 @@ file_prefs_ok_callback (GtkWidget *widget,
default_resolution_units = old_default_resolution_units;
return;
}
if (monitor_xres < 1e-5 || monitor_yres < 1e-5)
if (monitor_xres < GIMP_MIN_RESOLUTION ||
monitor_yres < GIMP_MIN_RESOLUTION)
{
g_message (_("Error: Monitor resolution must not be zero."));
monitor_xres = old_monitor_xres;
@ -388,9 +391,9 @@ file_prefs_save_callback (GtkWidget *widget,
update = g_list_append (update, "default-image-size");
if (default_units != old_default_units)
update = g_list_append (update, "default-units");
if (ABS(default_xresolution - old_default_xresolution) > 1e-5)
if (ABS(default_xresolution - old_default_xresolution) > GIMP_MIN_RESOLUTION)
update = g_list_append (update, "default-xresolution");
if (ABS(default_yresolution - old_default_yresolution) > 1e-5)
if (ABS(default_yresolution - old_default_yresolution) > GIMP_MIN_RESOLUTION)
update = g_list_append (update, "default-yresolution");
if (default_resolution_units != old_default_resolution_units)
update = g_list_append (update, "default-resolution-units");
@ -405,10 +408,10 @@ file_prefs_save_callback (GtkWidget *widget,
if (transparency_size != old_transparency_size)
update = g_list_append (update, "transparency-size");
if (using_xserver_resolution != old_using_xserver_resolution ||
ABS(monitor_xres - old_monitor_xres) > 1e-5)
ABS(monitor_xres - old_monitor_xres) > GIMP_MIN_RESOLUTION)
update = g_list_append (update, "monitor-xresolution");
if (using_xserver_resolution != old_using_xserver_resolution ||
ABS(monitor_yres - old_monitor_yres) > 1e-5)
ABS(monitor_yres - old_monitor_yres) > GIMP_MIN_RESOLUTION)
update = g_list_append (update, "monitor-yresolution");
if (edit_num_processors != num_processors)
update = g_list_append (update, "num-processors");
@ -510,13 +513,7 @@ file_prefs_save_callback (GtkWidget *widget,
save_gimprc (&update, &remove);
if (using_xserver_resolution)
{
gfloat xres, yres;
gdisplay_xserver_resolution (&xres, &yres);
monitor_xres = xres;
monitor_yres = yres;
}
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
/* Restore variables which must not change */
stingy_memory_use = save_stingy_memory_use;
@ -863,21 +860,17 @@ file_prefs_res_source_callback (GtkWidget *widget,
if (GTK_TOGGLE_BUTTON (widget)->active)
{
gfloat xres, yres;
gdisplay_xserver_resolution (&xres, &yres);
monitor_xres = xres;
monitor_yres = yres;
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
using_xserver_resolution = TRUE;
}
else
{
if (monitor_resolution_sizeentry)
{
monitor_xres =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0);
monitor_yres =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1);
monitor_xres = gimp_size_entry_get_refval
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0);
monitor_yres = gimp_size_entry_get_refval
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1);
}
using_xserver_resolution = FALSE;
}
@ -1535,9 +1528,11 @@ file_pref_cmd_callback (GtkWidget *widget,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
1, default_yresolution, FALSE);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_size_sizeentry), 0, 1, 32767);
(GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_size_sizeentry), 1, 1, 32767);
(GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
default_width);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
@ -1572,9 +1567,11 @@ file_pref_cmd_callback (GtkWidget *widget,
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0, 1, 32767);
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0,
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1, 1, 32767);
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1,
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
0, default_xresolution);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
@ -1603,7 +1600,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_table_attach_defaults (GTK_TABLE (default_resolution_sizeentry),
button, 1, 3, 3, 4);
if (ABS (default_xresolution - default_yresolution) < 1e-5)
if (ABS (default_xresolution - default_yresolution) < GIMP_MIN_RESOLUTION)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
gtk_widget_show (button);
@ -2205,7 +2202,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_widget_show (button);
{
gfloat xres, yres;
gdouble xres, yres;
gchar buf[80];
gdisplay_xserver_resolution (&xres, &yres);
@ -2234,9 +2231,11 @@ file_pref_cmd_callback (GtkWidget *widget,
gimp_size_entry_new (2, UNIT_INCH, "Pixels/%s", FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0, 1, 32767);
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0,
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1, 1, 32767);
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1,
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
0, monitor_xres);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
@ -2258,7 +2257,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_container_add (GTK_CONTAINER (abox), monitor_resolution_sizeentry);
gtk_widget_show (monitor_resolution_sizeentry);
if (ABS (monitor_xres - monitor_yres) < 1e-5)
if (ABS (monitor_xres - monitor_yres) < GIMP_MIN_RESOLUTION)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
gtk_table_attach_defaults (GTK_TABLE (monitor_resolution_sizeentry),
button, 1, 3, 3, 4);

View file

@ -58,7 +58,7 @@ struct _ResizePrivate
double ratio;
int old_width, old_height;
int old_res_x, old_res_y;
double old_res_x, old_res_y;
int area_width, area_height;
int start_x, start_y;
int orig_x, orig_y;
@ -82,10 +82,10 @@ Resize *
resize_widget_new (ResizeType type,
ResizeTarget target,
GtkObject *object,
int width,
int height,
float resolution_x,
float resolution_y,
gint width,
gint height,
gdouble resolution_x,
gdouble resolution_y,
GUnit unit,
gboolean dot_for_dot,
GtkSignalFunc ok_cb,
@ -281,8 +281,7 @@ resize_widget_new (ResizeType type,
gtk_widget_set_usize (spinbutton, 75, 0);
private->size_se =
gimp_size_entry_new (1, dot_for_dot ? UNIT_PIXEL : unit, "%a",
TRUE, TRUE, FALSE, 75,
gimp_size_entry_new (1, unit, "%a", TRUE, TRUE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->size_se),
GTK_SPIN_BUTTON (spinbutton), NULL);
@ -311,6 +310,9 @@ resize_widget_new (ResizeType type,
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->size_se), 0, width);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->size_se), 1, height);
if (dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->size_se), UNIT_PIXEL);
gtk_signal_connect (GTK_OBJECT (private->size_se), "value_changed",
(GtkSignalFunc) size_callback,
resize);
@ -428,8 +430,7 @@ resize_widget_new (ResizeType type,
gtk_widget_set_usize (spinbutton, 75, 0);
private->offset_se =
gimp_size_entry_new (1, dot_for_dot ? UNIT_PIXEL : unit, "%a",
TRUE, FALSE, FALSE, 75,
gimp_size_entry_new (1, unit, "%a", TRUE, FALSE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->offset_se),
GTK_SPIN_BUTTON (spinbutton), NULL);
@ -453,6 +454,10 @@ resize_widget_new (ResizeType type,
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->offset_se), 0, 0);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->offset_se), 1, 0);
if (dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->offset_se),
UNIT_PIXEL);
gtk_signal_connect (GTK_OBJECT (private->offset_se),
"value_changed", (GtkSignalFunc) offset_update,
resize);

View file

@ -45,8 +45,8 @@ struct _Resize
int width;
int height;
float resolution_x;
float resolution_y;
double resolution_x;
double resolution_y;
GUnit unit;
double ratio_x;
@ -65,10 +65,10 @@ struct _Resize
Resize * resize_widget_new (ResizeType type,
ResizeTarget target,
GtkObject * object,
int width,
int height,
float resolution_x,
float resolution_y,
gint width,
gint height,
gdouble resolution_x,
gdouble resolution_y,
GUnit unit,
gboolean dot_for_dot,
GtkSignalFunc ok_cb,

View file

@ -70,7 +70,7 @@ gdisplay_color_pixel (GDisplay *gdisp)
void
gdisplay_xserver_resolution (float *xres, float *yres)
gdisplay_xserver_resolution (gdouble *xres, gdouble *yres)
{
gint width, height;
gint widthMM, heightMM;
@ -91,8 +91,8 @@ gdisplay_xserver_resolution (float *xres, float *yres)
* = N * 25.4 pixels / M inch
*/
*xres = (width * 25.4) / ((float)widthMM);
*yres = (height * 25.4) / ((float)heightMM);
*xres = (width * 25.4) / ((gdouble) widthMM);
*yres = (height * 25.4) / ((gdouble) heightMM);
}

View file

@ -25,7 +25,7 @@ gulong gdisplay_black_pixel (GDisplay *);
gulong gdisplay_gray_pixel (GDisplay *);
gulong gdisplay_white_pixel (GDisplay *);
gulong gdisplay_color_pixel (GDisplay *);
void gdisplay_xserver_resolution (float *, float *);
void gdisplay_xserver_resolution (gdouble *, gdouble *);
void gdisplay_new_view (GDisplay *);
void gdisplay_close_window (GDisplay *, int);
void gdisplay_shrink_wrap (GDisplay *);

View file

@ -166,7 +166,7 @@ change_scale (GDisplay *gdisp,
static gdouble
img2real (GDisplay *gdisp, gboolean xdir, gdouble a)
{
float res;
gdouble res;
if (gdisp->dot_for_dot)
return a;

View file

@ -1024,14 +1024,14 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
double unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (buffer, CURSOR_STR_LENGTH,
gdisp->cursor_format_str,
"",
(float)t_x * unit_factor / gdisp->gimage->xresolution,
", ",
(float)t_y * unit_factor / gdisp->gimage->yresolution);
g_snprintf
(buffer, CURSOR_STR_LENGTH, gdisp->cursor_format_str,
"",
(double) t_x * unit_factor / gdisp->gimage->xresolution,
", ",
(double) t_y * unit_factor / gdisp->gimage->yresolution);
}
gtk_label_set (GTK_LABEL (gdisp->cursor_label), buffer);
}
@ -1076,7 +1076,7 @@ gdisplay_resize_cursor_label (GDisplay *gdisp)
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (gdisp->cursor_format_str, sizeof(gdisp->cursor_format_str),
"%%s%%.%df%%s%%.%df %s",
@ -1086,14 +1086,14 @@ gdisplay_resize_cursor_label (GDisplay *gdisp)
g_snprintf (buffer, sizeof(buffer), gdisp->cursor_format_str,
"",
(float)gdisp->gimage->width * unit_factor /
(gdouble) gdisp->gimage->width * unit_factor /
gdisp->gimage->xresolution,
", ",
(float)gdisp->gimage->height * unit_factor /
(gdouble) gdisp->gimage->height * unit_factor /
gdisp->gimage->yresolution);
}
cursor_label_width =
gdk_string_width ( gtk_widget_get_style(gdisp->cursor_label)->font, buffer );
gdk_string_width (gtk_widget_get_style (gdisp->cursor_label)->font, buffer);
/* find out how many pixels the label's parent frame is bigger than
* the label itself */

View file

@ -35,11 +35,11 @@
#define SCALESRC(g) (g->scale & 0x00ff)
#define SCALEDEST(g) (g->scale >> 8)
/* finding the effective screen resolution (float) */
/* finding the effective screen resolution (double) */
#define SCREEN_XRES(g) (g->dot_for_dot? g->gimage->xresolution : monitor_xres)
#define SCREEN_YRES(g) (g->dot_for_dot? g->gimage->yresolution : monitor_yres)
/* calculate scale factors (float) */
/* calculate scale factors (double) */
#define SCALEFACTOR_X(g) ((SCALEDEST(g) * SCREEN_XRES(g)) / \
(SCALESRC(g) * g->gimage->xresolution))
#define SCALEFACTOR_Y(g) ((SCALEDEST(g) * SCREEN_YRES(g)) / \

View file

@ -790,7 +790,7 @@ create_display_shell (GDisplay* gdisp,
/*
* String, integer, float and size query boxes
* String, integer, double and size query boxes
*/
typedef struct _QueryBox QueryBox;
@ -812,7 +812,7 @@ static gint query_box_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void query_box_cancel_callback (GtkWidget *, gpointer);
static void string_query_box_ok_callback (GtkWidget *, gpointer);
static void int_query_box_ok_callback (GtkWidget *, gpointer);
static void float_query_box_ok_callback (GtkWidget *, gpointer);
static void double_query_box_ok_callback (GtkWidget *, gpointer);
static void size_query_box_ok_callback (GtkWidget *, gpointer);
/* create a generic query box without any entry widget
@ -830,8 +830,12 @@ create_query_box (gchar *title,
GtkWidget *qbox;
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *ok_button;
GtkWidget *button;
static ActionAreaItem action_items[] =
{
{ N_("OK"), (ActionCallback) NULL, NULL, NULL },
{ N_("Cancel"), (ActionCallback) query_box_cancel_callback, NULL, NULL }
};
query_box = (QueryBox *) g_malloc (sizeof (QueryBox));
@ -852,23 +856,9 @@ create_query_box (gchar *title,
else
object = NULL;
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (qbox)->action_area), 2);
ok_button = gtk_button_new_with_label (_("OK"));
GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (qbox)->action_area), ok_button,
TRUE, TRUE, 0);
gtk_widget_grab_default (ok_button);
gtk_widget_show (ok_button);
button = gtk_button_new_with_label (_("Cancel"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) query_box_cancel_callback,
query_box);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (qbox)->action_area), button,
TRUE, TRUE, 0);
gtk_widget_show (button);
/* The action area */
action_items[1].user_data = query_box;
build_action_area (GTK_DIALOG (qbox), action_items, 2, 0);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
@ -882,7 +872,7 @@ create_query_box (gchar *title,
query_box->qbox = qbox;
query_box->vbox = vbox;
query_box->entry = NULL;
query_box->ok_button = ok_button;
query_box->ok_button = action_items[0].widget;
query_box->object = object;
query_box->callback = callback;
query_box->data = data;
@ -958,16 +948,16 @@ query_int_box (gchar *title,
}
GtkWidget *
query_float_box (gchar *title,
gchar *message,
gfloat initial,
gfloat lower,
gfloat upper,
gint digits,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data)
query_double_box (gchar *title,
gchar *message,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkAdjustment* adjustment;
@ -976,7 +966,7 @@ query_float_box (gchar *title,
query_box = create_query_box (title, message, object, signal, callback, data);
gtk_signal_connect (GTK_OBJECT (query_box->ok_button), "clicked",
(GtkSignalFunc) float_query_box_ok_callback,
(GtkSignalFunc) double_query_box_ok_callback,
query_box);
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper,
@ -996,12 +986,13 @@ query_float_box (gchar *title,
GtkWidget *
query_size_box (gchar *title,
gchar *message,
gfloat initial,
gfloat lower,
gfloat upper,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GUnit unit,
gfloat resolution,
gdouble resolution,
gint dot_for_dot,
GtkObject *object,
gchar *signal,
QueryFunc callback,
@ -1025,6 +1016,9 @@ query_size_box (gchar *title,
lower, upper);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, initial);
if (dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
gtk_box_pack_start (GTK_BOX (query_box->vbox), sizeentry, TRUE, TRUE, 0);
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (sizeentry));
gtk_widget_show (sizeentry);
@ -1106,7 +1100,7 @@ int_query_box_ok_callback (GtkWidget *w,
/* Get the spinbutton data */
integer_value = g_malloc (sizeof (gint));
*integer_value =
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(query_box->entry));
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (query_box->entry));
/* Call the user defined callback */
(* query_box->callback) (w, query_box->data, (gpointer) integer_value);
@ -1118,11 +1112,11 @@ int_query_box_ok_callback (GtkWidget *w,
}
static void
float_query_box_ok_callback (GtkWidget *w,
gpointer client_data)
double_query_box_ok_callback (GtkWidget *w,
gpointer client_data)
{
QueryBox *query_box;
gfloat *float_value;
gdouble *double_value;
query_box = (QueryBox *) client_data;
@ -1131,12 +1125,12 @@ float_query_box_ok_callback (GtkWidget *w,
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the spinbutton data */
float_value = g_malloc (sizeof (gfloat));
*float_value =
gtk_spin_button_get_value_as_float(GTK_SPIN_BUTTON(query_box->entry));
double_value = g_malloc (sizeof (gdouble));
*double_value =
gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON (query_box->entry));
/* Call the user defined callback */
(* query_box->callback) (w, query_box->data, (gpointer) float_value);
(* query_box->callback) (w, query_box->data, (gpointer) double_value);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
@ -1149,7 +1143,7 @@ size_query_box_ok_callback (GtkWidget *w,
gpointer client_data)
{
QueryBox *query_box;
gfloat *float_value;
gdouble *double_value;
query_box = (QueryBox *) client_data;
@ -1158,8 +1152,8 @@ size_query_box_ok_callback (GtkWidget *w,
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the sizeentry data */
float_value = g_malloc (sizeof (gfloat));
*float_value =
double_value = g_malloc (sizeof (gdouble));
*double_value =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (query_box->entry), 0);
/* Pass the selected unit to the callback */
@ -1168,7 +1162,7 @@ size_query_box_ok_callback (GtkWidget *w,
(gpointer) gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (query_box->entry)));
/* Call the user defined callback */
(* query_box->callback) (w, query_box->data, (gpointer) float_value);
(* query_box->callback) (w, query_box->data, (gpointer) double_value);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
@ -1217,7 +1211,7 @@ message_box (char *message,
gtk_window_set_wmclass (GTK_WINDOW (mbox), "gimp_message", "Gimp");
gtk_window_set_title (GTK_WINDOW (mbox), _("GIMP Message"));
gtk_window_position (GTK_WINDOW (mbox), GTK_WIN_POS_MOUSE);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (mbox)->action_area), 2);
gtk_signal_connect (GTK_OBJECT (mbox), "delete_event",
GTK_SIGNAL_FUNC (message_box_delete_callback),
msg_box);

View file

@ -77,11 +77,11 @@ GtkWidget * query_int_box (gchar *title,
gchar *signal,
QueryFunc callback,
gpointer data);
GtkWidget * query_float_box (gchar *title,
GtkWidget * query_double_box (gchar *title,
gchar *message,
gfloat initial,
gfloat lower,
gfloat upper,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GtkObject *object,
gchar *signal,
@ -89,12 +89,13 @@ GtkWidget * query_float_box (gchar *title,
gpointer data);
GtkWidget * query_size_box (gchar *title,
gchar *message,
gfloat initial,
gfloat lower,
gfloat upper,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GUnit unit,
gfloat resolution,
gdouble resolution,
gint dot_for_dot,
GtkObject *object,
gchar *signal,
QueryFunc callback,

View file

@ -166,7 +166,7 @@ change_scale (GDisplay *gdisp,
static gdouble
img2real (GDisplay *gdisp, gboolean xdir, gdouble a)
{
float res;
gdouble res;
if (gdisp->dot_for_dot)
return a;

View file

@ -790,7 +790,7 @@ create_display_shell (GDisplay* gdisp,
/*
* String, integer, float and size query boxes
* String, integer, double and size query boxes
*/
typedef struct _QueryBox QueryBox;
@ -812,7 +812,7 @@ static gint query_box_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void query_box_cancel_callback (GtkWidget *, gpointer);
static void string_query_box_ok_callback (GtkWidget *, gpointer);
static void int_query_box_ok_callback (GtkWidget *, gpointer);
static void float_query_box_ok_callback (GtkWidget *, gpointer);
static void double_query_box_ok_callback (GtkWidget *, gpointer);
static void size_query_box_ok_callback (GtkWidget *, gpointer);
/* create a generic query box without any entry widget
@ -830,8 +830,12 @@ create_query_box (gchar *title,
GtkWidget *qbox;
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *ok_button;
GtkWidget *button;
static ActionAreaItem action_items[] =
{
{ N_("OK"), (ActionCallback) NULL, NULL, NULL },
{ N_("Cancel"), (ActionCallback) query_box_cancel_callback, NULL, NULL }
};
query_box = (QueryBox *) g_malloc (sizeof (QueryBox));
@ -852,23 +856,9 @@ create_query_box (gchar *title,
else
object = NULL;
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (qbox)->action_area), 2);
ok_button = gtk_button_new_with_label (_("OK"));
GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (qbox)->action_area), ok_button,
TRUE, TRUE, 0);
gtk_widget_grab_default (ok_button);
gtk_widget_show (ok_button);
button = gtk_button_new_with_label (_("Cancel"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) query_box_cancel_callback,
query_box);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (qbox)->action_area), button,
TRUE, TRUE, 0);
gtk_widget_show (button);
/* The action area */
action_items[1].user_data = query_box;
build_action_area (GTK_DIALOG (qbox), action_items, 2, 0);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
@ -882,7 +872,7 @@ create_query_box (gchar *title,
query_box->qbox = qbox;
query_box->vbox = vbox;
query_box->entry = NULL;
query_box->ok_button = ok_button;
query_box->ok_button = action_items[0].widget;
query_box->object = object;
query_box->callback = callback;
query_box->data = data;
@ -958,16 +948,16 @@ query_int_box (gchar *title,
}
GtkWidget *
query_float_box (gchar *title,
gchar *message,
gfloat initial,
gfloat lower,
gfloat upper,
gint digits,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data)
query_double_box (gchar *title,
gchar *message,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkAdjustment* adjustment;
@ -976,7 +966,7 @@ query_float_box (gchar *title,
query_box = create_query_box (title, message, object, signal, callback, data);
gtk_signal_connect (GTK_OBJECT (query_box->ok_button), "clicked",
(GtkSignalFunc) float_query_box_ok_callback,
(GtkSignalFunc) double_query_box_ok_callback,
query_box);
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper,
@ -996,12 +986,13 @@ query_float_box (gchar *title,
GtkWidget *
query_size_box (gchar *title,
gchar *message,
gfloat initial,
gfloat lower,
gfloat upper,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GUnit unit,
gfloat resolution,
gdouble resolution,
gint dot_for_dot,
GtkObject *object,
gchar *signal,
QueryFunc callback,
@ -1025,6 +1016,9 @@ query_size_box (gchar *title,
lower, upper);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, initial);
if (dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
gtk_box_pack_start (GTK_BOX (query_box->vbox), sizeentry, TRUE, TRUE, 0);
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (sizeentry));
gtk_widget_show (sizeentry);
@ -1106,7 +1100,7 @@ int_query_box_ok_callback (GtkWidget *w,
/* Get the spinbutton data */
integer_value = g_malloc (sizeof (gint));
*integer_value =
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(query_box->entry));
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (query_box->entry));
/* Call the user defined callback */
(* query_box->callback) (w, query_box->data, (gpointer) integer_value);
@ -1118,11 +1112,11 @@ int_query_box_ok_callback (GtkWidget *w,
}
static void
float_query_box_ok_callback (GtkWidget *w,
gpointer client_data)
double_query_box_ok_callback (GtkWidget *w,
gpointer client_data)
{
QueryBox *query_box;
gfloat *float_value;
gdouble *double_value;
query_box = (QueryBox *) client_data;
@ -1131,12 +1125,12 @@ float_query_box_ok_callback (GtkWidget *w,
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the spinbutton data */
float_value = g_malloc (sizeof (gfloat));
*float_value =
gtk_spin_button_get_value_as_float(GTK_SPIN_BUTTON(query_box->entry));
double_value = g_malloc (sizeof (gdouble));
*double_value =
gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON (query_box->entry));
/* Call the user defined callback */
(* query_box->callback) (w, query_box->data, (gpointer) float_value);
(* query_box->callback) (w, query_box->data, (gpointer) double_value);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
@ -1149,7 +1143,7 @@ size_query_box_ok_callback (GtkWidget *w,
gpointer client_data)
{
QueryBox *query_box;
gfloat *float_value;
gdouble *double_value;
query_box = (QueryBox *) client_data;
@ -1158,8 +1152,8 @@ size_query_box_ok_callback (GtkWidget *w,
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the sizeentry data */
float_value = g_malloc (sizeof (gfloat));
*float_value =
double_value = g_malloc (sizeof (gdouble));
*double_value =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (query_box->entry), 0);
/* Pass the selected unit to the callback */
@ -1168,7 +1162,7 @@ size_query_box_ok_callback (GtkWidget *w,
(gpointer) gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (query_box->entry)));
/* Call the user defined callback */
(* query_box->callback) (w, query_box->data, (gpointer) float_value);
(* query_box->callback) (w, query_box->data, (gpointer) double_value);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
@ -1217,7 +1211,7 @@ message_box (char *message,
gtk_window_set_wmclass (GTK_WINDOW (mbox), "gimp_message", "Gimp");
gtk_window_set_title (GTK_WINDOW (mbox), _("GIMP Message"));
gtk_window_position (GTK_WINDOW (mbox), GTK_WIN_POS_MOUSE);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (mbox)->action_area), 2);
gtk_signal_connect (GTK_OBJECT (mbox), "delete_event",
GTK_SIGNAL_FUNC (message_box_delete_callback),
msg_box);

View file

@ -77,11 +77,11 @@ GtkWidget * query_int_box (gchar *title,
gchar *signal,
QueryFunc callback,
gpointer data);
GtkWidget * query_float_box (gchar *title,
GtkWidget * query_double_box (gchar *title,
gchar *message,
gfloat initial,
gfloat lower,
gfloat upper,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GtkObject *object,
gchar *signal,
@ -89,12 +89,13 @@ GtkWidget * query_float_box (gchar *title,
gpointer data);
GtkWidget * query_size_box (gchar *title,
gchar *message,
gfloat initial,
gfloat lower,
gfloat upper,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GUnit unit,
gfloat resolution,
gdouble resolution,
gint dot_for_dot,
GtkObject *object,
gchar *signal,
QueryFunc callback,

View file

@ -447,7 +447,7 @@ edit_selection_motion (Tool *tool,
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (offset, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Move: "),

View file

@ -295,8 +295,9 @@ file_new_confirm_dialog (NewImageValues *vals)
vals->confirm_dlg = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (vals->confirm_dlg),
"really_create", "Gimp");
"confirm_size", "Gimp");
gtk_window_set_title (GTK_WINDOW (vals->confirm_dlg), _("Confirm Image Size"));
gtk_window_set_policy (GTK_WINDOW (vals->confirm_dlg), FALSE, FALSE, FALSE);
gtk_window_position (GTK_WINDOW (vals->confirm_dlg), GTK_WIN_POS_MOUSE);
/* Handle the wm close signal */
@ -480,7 +481,6 @@ file_new_cmd_callback (GtkWidget *widget,
N_("RGB"),
N_("Grayscale")
};
static gchar *fill_type_names[] =
{
N_("Foreground"),

View file

@ -1024,14 +1024,14 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
double unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (buffer, CURSOR_STR_LENGTH,
gdisp->cursor_format_str,
"",
(float)t_x * unit_factor / gdisp->gimage->xresolution,
", ",
(float)t_y * unit_factor / gdisp->gimage->yresolution);
g_snprintf
(buffer, CURSOR_STR_LENGTH, gdisp->cursor_format_str,
"",
(double) t_x * unit_factor / gdisp->gimage->xresolution,
", ",
(double) t_y * unit_factor / gdisp->gimage->yresolution);
}
gtk_label_set (GTK_LABEL (gdisp->cursor_label), buffer);
}
@ -1076,7 +1076,7 @@ gdisplay_resize_cursor_label (GDisplay *gdisp)
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (gdisp->cursor_format_str, sizeof(gdisp->cursor_format_str),
"%%s%%.%df%%s%%.%df %s",
@ -1086,14 +1086,14 @@ gdisplay_resize_cursor_label (GDisplay *gdisp)
g_snprintf (buffer, sizeof(buffer), gdisp->cursor_format_str,
"",
(float)gdisp->gimage->width * unit_factor /
(gdouble) gdisp->gimage->width * unit_factor /
gdisp->gimage->xresolution,
", ",
(float)gdisp->gimage->height * unit_factor /
(gdouble) gdisp->gimage->height * unit_factor /
gdisp->gimage->yresolution);
}
cursor_label_width =
gdk_string_width ( gtk_widget_get_style(gdisp->cursor_label)->font, buffer );
gdk_string_width (gtk_widget_get_style (gdisp->cursor_label)->font, buffer);
/* find out how many pixels the label's parent frame is bigger than
* the label itself */

View file

@ -35,11 +35,11 @@
#define SCALESRC(g) (g->scale & 0x00ff)
#define SCALEDEST(g) (g->scale >> 8)
/* finding the effective screen resolution (float) */
/* finding the effective screen resolution (double) */
#define SCREEN_XRES(g) (g->dot_for_dot? g->gimage->xresolution : monitor_xres)
#define SCREEN_YRES(g) (g->dot_for_dot? g->gimage->yresolution : monitor_yres)
/* calculate scale factors (float) */
/* calculate scale factors (double) */
#define SCALEFACTOR_X(g) ((SCALEDEST(g) * SCREEN_XRES(g)) / \
(SCALESRC(g) * g->gimage->xresolution))
#define SCALEFACTOR_Y(g) ((SCALEDEST(g) * SCREEN_YRES(g)) / \

View file

@ -70,7 +70,7 @@ gdisplay_color_pixel (GDisplay *gdisp)
void
gdisplay_xserver_resolution (float *xres, float *yres)
gdisplay_xserver_resolution (gdouble *xres, gdouble *yres)
{
gint width, height;
gint widthMM, heightMM;
@ -91,8 +91,8 @@ gdisplay_xserver_resolution (float *xres, float *yres)
* = N * 25.4 pixels / M inch
*/
*xres = (width * 25.4) / ((float)widthMM);
*yres = (height * 25.4) / ((float)heightMM);
*xres = (width * 25.4) / ((gdouble) widthMM);
*yres = (height * 25.4) / ((gdouble) heightMM);
}

View file

@ -25,7 +25,7 @@ gulong gdisplay_black_pixel (GDisplay *);
gulong gdisplay_gray_pixel (GDisplay *);
gulong gdisplay_white_pixel (GDisplay *);
gulong gdisplay_color_pixel (GDisplay *);
void gdisplay_xserver_resolution (float *, float *);
void gdisplay_xserver_resolution (gdouble *, gdouble *);
void gdisplay_new_view (GDisplay *);
void gdisplay_close_window (GDisplay *, int);
void gdisplay_shrink_wrap (GDisplay *);

View file

@ -319,8 +319,8 @@ gimp_image_set_filename (GimpImage *gimage, char *filename)
void
gimp_image_set_resolution (GimpImage *gimage,
float xresolution,
float yresolution)
double xresolution,
double yresolution)
{
gimage->xresolution = xresolution;
gimage->yresolution = yresolution;
@ -328,8 +328,8 @@ gimp_image_set_resolution (GimpImage *gimage,
void
gimp_image_get_resolution (GimpImage *gimage,
float *xresolution,
float *yresolution)
double *xresolution,
double *yresolution)
{
g_return_if_fail(xresolution && yresolution);
*xresolution = gimage->xresolution;

View file

@ -108,10 +108,11 @@ GtkType gimp_image_get_type(void);
GimpImage * gimp_image_new (int, int, int);
void gimp_image_set_filename (GimpImage *, char *);
void gimp_image_set_resolution (GimpImage *, float, float);
void gimp_image_set_resolution (GimpImage *,
double, double);
void gimp_image_get_resolution (GimpImage *,
float *,
float *);
double *,
double *);
void gimp_image_set_unit (GimpImage *, GUnit);
GUnit gimp_image_get_unit (GimpImage *);
void gimp_image_set_save_proc (GimpImage *, PlugInProcDef *);

View file

@ -22,8 +22,8 @@ struct _GimpImage
PlugInProcDef *save_proc; /* last PDB save proc used */
int width, height; /* width and height attributes */
float xresolution; /* image x-res, in dpi */
float yresolution; /* image y-res, in dpi */
double xresolution; /* image x-res, in dpi */
double yresolution; /* image y-res, in dpi */
GUnit unit; /* image unit */
int base_type; /* base gimp_image type */

View file

@ -40,7 +40,7 @@
typedef struct {
guint delete_on_exit;
float factor;
gdouble factor;
gint digits;
gchar *identifier;
gchar *symbol;
@ -100,13 +100,13 @@ gimp_unit_get_number_of_built_in_units (void)
GUnit
gimp_unit_new (gchar *identifier,
gfloat factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural)
gimp_unit_new (gchar *identifier,
gdouble factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural)
{
GimpUnitDef *user_unit;
@ -151,7 +151,7 @@ gimp_unit_set_deletion_flag (GUnit unit,
}
gfloat
gdouble
gimp_unit_get_factor (GUnit unit)
{
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&

View file

@ -365,9 +365,10 @@ select_border_cmd_callback (GtkWidget *widget,
query_size_box (_("Border Selection"), _("Border selection by:"),
selection_border_radius, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_border_callback, gdisp->gimage);
}
@ -382,9 +383,10 @@ select_feather_cmd_callback (GtkWidget *widget,
query_size_box (_("Feather Selection"), _("Feather selection by:"),
selection_feather_radius, 0, 32767, 3,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_feather_callback, gdisp->gimage);
}
@ -399,9 +401,10 @@ select_grow_cmd_callback (GtkWidget *widget,
query_size_box (_("Grow Selection"), _("Grow selection by:"),
selection_grow_pixels, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_grow_callback, gdisp->gimage);
}
@ -416,9 +419,10 @@ select_shrink_cmd_callback (GtkWidget *widget,
query_size_box (_("Shrink Selection"), _("Shrink selection by:"),
selection_shrink_pixels, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_shrink_callback, gdisp->gimage);
}
@ -1211,7 +1215,7 @@ gimage_mask_feather_callback (GtkWidget *w,
double radius_x;
double radius_y;
selection_feather_radius = *(float*) call_data;
selection_feather_radius = *(double*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
@ -1245,7 +1249,7 @@ gimage_mask_border_callback (GtkWidget *w,
double radius_x;
double radius_y;
selection_border_radius = (int) *(float*) call_data;
selection_border_radius = (int) *(double*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
@ -1279,7 +1283,7 @@ gimage_mask_grow_callback (GtkWidget *w,
double radius_x;
double radius_y;
selection_grow_pixels = (int) *(float*) call_data;
selection_grow_pixels = (int) *(double*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
@ -1313,7 +1317,7 @@ gimage_mask_shrink_callback (GtkWidget *w,
int radius_x;
int radius_y;
selection_shrink_pixels = (int) *(float*) call_data;
selection_shrink_pixels = (int) *(double*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");

View file

@ -295,8 +295,9 @@ file_new_confirm_dialog (NewImageValues *vals)
vals->confirm_dlg = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (vals->confirm_dlg),
"really_create", "Gimp");
"confirm_size", "Gimp");
gtk_window_set_title (GTK_WINDOW (vals->confirm_dlg), _("Confirm Image Size"));
gtk_window_set_policy (GTK_WINDOW (vals->confirm_dlg), FALSE, FALSE, FALSE);
gtk_window_position (GTK_WINDOW (vals->confirm_dlg), GTK_WIN_POS_MOUSE);
/* Handle the wm close signal */
@ -480,7 +481,6 @@ file_new_cmd_callback (GtkWidget *widget,
N_("RGB"),
N_("Grayscale")
};
static gchar *fill_type_names[] =
{
N_("Foreground"),

View file

@ -365,9 +365,10 @@ select_border_cmd_callback (GtkWidget *widget,
query_size_box (_("Border Selection"), _("Border selection by:"),
selection_border_radius, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_border_callback, gdisp->gimage);
}
@ -382,9 +383,10 @@ select_feather_cmd_callback (GtkWidget *widget,
query_size_box (_("Feather Selection"), _("Feather selection by:"),
selection_feather_radius, 0, 32767, 3,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_feather_callback, gdisp->gimage);
}
@ -399,9 +401,10 @@ select_grow_cmd_callback (GtkWidget *widget,
query_size_box (_("Grow Selection"), _("Grow selection by:"),
selection_grow_pixels, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_grow_callback, gdisp->gimage);
}
@ -416,9 +419,10 @@ select_shrink_cmd_callback (GtkWidget *widget,
query_size_box (_("Shrink Selection"), _("Shrink selection by:"),
selection_shrink_pixels, 1, 32767, 0,
gdisp->dot_for_dot ? UNIT_PIXEL : gdisp->gimage->unit,
gdisp->gimage->unit,
MIN (gdisp->gimage->xresolution,
gdisp->gimage->yresolution),
gdisp->dot_for_dot,
GTK_OBJECT (gdisp->gimage), "destroy",
gimage_mask_shrink_callback, gdisp->gimage);
}
@ -1211,7 +1215,7 @@ gimage_mask_feather_callback (GtkWidget *w,
double radius_x;
double radius_y;
selection_feather_radius = *(float*) call_data;
selection_feather_radius = *(double*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
@ -1245,7 +1249,7 @@ gimage_mask_border_callback (GtkWidget *w,
double radius_x;
double radius_y;
selection_border_radius = (int) *(float*) call_data;
selection_border_radius = (int) *(double*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
@ -1279,7 +1283,7 @@ gimage_mask_grow_callback (GtkWidget *w,
double radius_x;
double radius_y;
selection_grow_pixels = (int) *(float*) call_data;
selection_grow_pixels = (int) *(double*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");
@ -1313,7 +1317,7 @@ gimage_mask_shrink_callback (GtkWidget *w,
int radius_x;
int radius_y;
selection_shrink_pixels = (int) *(float*) call_data;
selection_shrink_pixels = (int) *(double*) call_data;
g_free (call_data);
unit = (GUnit) gtk_object_get_data (GTK_OBJECT (w), "size_query_unit");

View file

@ -200,7 +200,7 @@ info_window_update (InfoDialog *info_win,
GDisplay *gdisp;
InfoWinData *iwd;
int type;
gfloat unit_factor;
gdouble unit_factor;
gint unit_digits;
gchar format_buf[32];

View file

@ -3129,11 +3129,6 @@ new_layer_query_fill_type_callback (GtkWidget *w,
static void
layers_dialog_new_layer_query (GimpImage* gimage)
{
static ActionAreaItem action_items[2] =
{
{ N_("OK"), new_layer_query_ok_callback, NULL, NULL },
{ N_("Cancel"), new_layer_query_cancel_callback, NULL, NULL }
};
NewLayerOptions *options;
GtkWidget *vbox;
GtkWidget *table;
@ -3145,13 +3140,18 @@ layers_dialog_new_layer_query (GimpImage* gimage)
GtkWidget *radio_button;
GSList *group = NULL;
int i;
char *button_names[4] =
char *button_names[] =
{
N_("Foreground"),
N_("Background"),
N_("White"),
N_("Transparent")
};
static ActionAreaItem action_items[] =
{
{ N_("OK"), new_layer_query_ok_callback, NULL, NULL },
{ N_("Cancel"), new_layer_query_cancel_callback, NULL, NULL }
};
/* the new options structure */
options = (NewLayerOptions *) g_malloc (sizeof (NewLayerOptions));
@ -3160,7 +3160,8 @@ layers_dialog_new_layer_query (GimpImage* gimage)
/* the dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box), "new_layer_options", "Gimp");
gtk_window_set_wmclass (GTK_WINDOW (options->query_box),
"new_layer_options", "Gimp");
gtk_window_set_title (GTK_WINDOW (options->query_box), _("New Layer Options"));
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
@ -3215,7 +3216,7 @@ layers_dialog_new_layer_query (GimpImage* gimage)
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_widget_set_usize (spinbutton, 75, 0);
options->size_se = gimp_size_entry_new (1, UNIT_PIXEL, "%a",
options->size_se = gimp_size_entry_new (1, gimage->unit, "%a",
TRUE, TRUE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (options->size_se),
@ -3249,6 +3250,8 @@ layers_dialog_new_layer_query (GimpImage* gimage)
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (options->size_se), 1,
gimage->height);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (options->size_se), UNIT_PIXEL);
gtk_widget_show (table);
/* the radio frame and box */

View file

@ -33,6 +33,7 @@
#include "libgimp/gimpfileselection.h"
#include "libgimp/gimppatheditor.h"
#include "libgimp/gimpsizeentry.h"
#include "libgimp/gimplimits.h"
#include "libgimp/gimpintl.h"
/* preferences local functions */
@ -245,7 +246,8 @@ file_prefs_ok_callback (GtkWidget *widget,
default_units = old_default_units;
return;
}
if (default_xresolution < 1e-5 || default_yresolution < 1e-5)
if (default_xresolution < GIMP_MIN_RESOLUTION ||
default_yresolution < GIMP_MIN_RESOLUTION)
{
g_message (_("Error: default resolution must not be zero."));
default_xresolution = old_default_xresolution;
@ -259,7 +261,8 @@ file_prefs_ok_callback (GtkWidget *widget,
default_resolution_units = old_default_resolution_units;
return;
}
if (monitor_xres < 1e-5 || monitor_yres < 1e-5)
if (monitor_xres < GIMP_MIN_RESOLUTION ||
monitor_yres < GIMP_MIN_RESOLUTION)
{
g_message (_("Error: Monitor resolution must not be zero."));
monitor_xres = old_monitor_xres;
@ -388,9 +391,9 @@ file_prefs_save_callback (GtkWidget *widget,
update = g_list_append (update, "default-image-size");
if (default_units != old_default_units)
update = g_list_append (update, "default-units");
if (ABS(default_xresolution - old_default_xresolution) > 1e-5)
if (ABS(default_xresolution - old_default_xresolution) > GIMP_MIN_RESOLUTION)
update = g_list_append (update, "default-xresolution");
if (ABS(default_yresolution - old_default_yresolution) > 1e-5)
if (ABS(default_yresolution - old_default_yresolution) > GIMP_MIN_RESOLUTION)
update = g_list_append (update, "default-yresolution");
if (default_resolution_units != old_default_resolution_units)
update = g_list_append (update, "default-resolution-units");
@ -405,10 +408,10 @@ file_prefs_save_callback (GtkWidget *widget,
if (transparency_size != old_transparency_size)
update = g_list_append (update, "transparency-size");
if (using_xserver_resolution != old_using_xserver_resolution ||
ABS(monitor_xres - old_monitor_xres) > 1e-5)
ABS(monitor_xres - old_monitor_xres) > GIMP_MIN_RESOLUTION)
update = g_list_append (update, "monitor-xresolution");
if (using_xserver_resolution != old_using_xserver_resolution ||
ABS(monitor_yres - old_monitor_yres) > 1e-5)
ABS(monitor_yres - old_monitor_yres) > GIMP_MIN_RESOLUTION)
update = g_list_append (update, "monitor-yresolution");
if (edit_num_processors != num_processors)
update = g_list_append (update, "num-processors");
@ -510,13 +513,7 @@ file_prefs_save_callback (GtkWidget *widget,
save_gimprc (&update, &remove);
if (using_xserver_resolution)
{
gfloat xres, yres;
gdisplay_xserver_resolution (&xres, &yres);
monitor_xres = xres;
monitor_yres = yres;
}
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
/* Restore variables which must not change */
stingy_memory_use = save_stingy_memory_use;
@ -863,21 +860,17 @@ file_prefs_res_source_callback (GtkWidget *widget,
if (GTK_TOGGLE_BUTTON (widget)->active)
{
gfloat xres, yres;
gdisplay_xserver_resolution (&xres, &yres);
monitor_xres = xres;
monitor_yres = yres;
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
using_xserver_resolution = TRUE;
}
else
{
if (monitor_resolution_sizeentry)
{
monitor_xres =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0);
monitor_yres =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1);
monitor_xres = gimp_size_entry_get_refval
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0);
monitor_yres = gimp_size_entry_get_refval
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1);
}
using_xserver_resolution = FALSE;
}
@ -1535,9 +1528,11 @@ file_pref_cmd_callback (GtkWidget *widget,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
1, default_yresolution, FALSE);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_size_sizeentry), 0, 1, 32767);
(GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_size_sizeentry), 1, 1, 32767);
(GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
default_width);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
@ -1572,9 +1567,11 @@ file_pref_cmd_callback (GtkWidget *widget,
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0, 1, 32767);
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0,
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1, 1, 32767);
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1,
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
0, default_xresolution);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
@ -1603,7 +1600,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_table_attach_defaults (GTK_TABLE (default_resolution_sizeentry),
button, 1, 3, 3, 4);
if (ABS (default_xresolution - default_yresolution) < 1e-5)
if (ABS (default_xresolution - default_yresolution) < GIMP_MIN_RESOLUTION)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
gtk_widget_show (button);
@ -2205,7 +2202,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_widget_show (button);
{
gfloat xres, yres;
gdouble xres, yres;
gchar buf[80];
gdisplay_xserver_resolution (&xres, &yres);
@ -2234,9 +2231,11 @@ file_pref_cmd_callback (GtkWidget *widget,
gimp_size_entry_new (2, UNIT_INCH, "Pixels/%s", FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0, 1, 32767);
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0,
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1, 1, 32767);
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1,
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
0, monitor_xres);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
@ -2258,7 +2257,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_container_add (GTK_CONTAINER (abox), monitor_resolution_sizeentry);
gtk_widget_show (monitor_resolution_sizeentry);
if (ABS (monitor_xres - monitor_yres) < 1e-5)
if (ABS (monitor_xres - monitor_yres) < GIMP_MIN_RESOLUTION)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
gtk_table_attach_defaults (GTK_TABLE (monitor_resolution_sizeentry),
button, 1, 3, 3, 4);

View file

@ -58,7 +58,7 @@ struct _ResizePrivate
double ratio;
int old_width, old_height;
int old_res_x, old_res_y;
double old_res_x, old_res_y;
int area_width, area_height;
int start_x, start_y;
int orig_x, orig_y;
@ -82,10 +82,10 @@ Resize *
resize_widget_new (ResizeType type,
ResizeTarget target,
GtkObject *object,
int width,
int height,
float resolution_x,
float resolution_y,
gint width,
gint height,
gdouble resolution_x,
gdouble resolution_y,
GUnit unit,
gboolean dot_for_dot,
GtkSignalFunc ok_cb,
@ -281,8 +281,7 @@ resize_widget_new (ResizeType type,
gtk_widget_set_usize (spinbutton, 75, 0);
private->size_se =
gimp_size_entry_new (1, dot_for_dot ? UNIT_PIXEL : unit, "%a",
TRUE, TRUE, FALSE, 75,
gimp_size_entry_new (1, unit, "%a", TRUE, TRUE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->size_se),
GTK_SPIN_BUTTON (spinbutton), NULL);
@ -311,6 +310,9 @@ resize_widget_new (ResizeType type,
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->size_se), 0, width);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->size_se), 1, height);
if (dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->size_se), UNIT_PIXEL);
gtk_signal_connect (GTK_OBJECT (private->size_se), "value_changed",
(GtkSignalFunc) size_callback,
resize);
@ -428,8 +430,7 @@ resize_widget_new (ResizeType type,
gtk_widget_set_usize (spinbutton, 75, 0);
private->offset_se =
gimp_size_entry_new (1, dot_for_dot ? UNIT_PIXEL : unit, "%a",
TRUE, FALSE, FALSE, 75,
gimp_size_entry_new (1, unit, "%a", TRUE, FALSE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->offset_se),
GTK_SPIN_BUTTON (spinbutton), NULL);
@ -453,6 +454,10 @@ resize_widget_new (ResizeType type,
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->offset_se), 0, 0);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->offset_se), 1, 0);
if (dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->offset_se),
UNIT_PIXEL);
gtk_signal_connect (GTK_OBJECT (private->offset_se),
"value_changed", (GtkSignalFunc) offset_update,
resize);

View file

@ -45,8 +45,8 @@ struct _Resize
int width;
int height;
float resolution_x;
float resolution_y;
double resolution_x;
double resolution_y;
GUnit unit;
double ratio_x;
@ -65,10 +65,10 @@ struct _Resize
Resize * resize_widget_new (ResizeType type,
ResizeTarget target,
GtkObject * object,
int width,
int height,
float resolution_x,
float resolution_y,
gint width,
gint height,
gdouble resolution_x,
gdouble resolution_y,
GUnit unit,
gboolean dot_for_dot,
GtkSignalFunc ok_cb,

View file

@ -200,7 +200,7 @@ info_window_update (InfoDialog *info_win,
GDisplay *gdisp;
InfoWinData *iwd;
int type;
gfloat unit_factor;
gdouble unit_factor;
gint unit_digits;
gchar format_buf[32];

View file

@ -790,7 +790,7 @@ create_display_shell (GDisplay* gdisp,
/*
* String, integer, float and size query boxes
* String, integer, double and size query boxes
*/
typedef struct _QueryBox QueryBox;
@ -812,7 +812,7 @@ static gint query_box_delete_callback (GtkWidget *, GdkEvent *, gpointer);
static void query_box_cancel_callback (GtkWidget *, gpointer);
static void string_query_box_ok_callback (GtkWidget *, gpointer);
static void int_query_box_ok_callback (GtkWidget *, gpointer);
static void float_query_box_ok_callback (GtkWidget *, gpointer);
static void double_query_box_ok_callback (GtkWidget *, gpointer);
static void size_query_box_ok_callback (GtkWidget *, gpointer);
/* create a generic query box without any entry widget
@ -830,8 +830,12 @@ create_query_box (gchar *title,
GtkWidget *qbox;
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *ok_button;
GtkWidget *button;
static ActionAreaItem action_items[] =
{
{ N_("OK"), (ActionCallback) NULL, NULL, NULL },
{ N_("Cancel"), (ActionCallback) query_box_cancel_callback, NULL, NULL }
};
query_box = (QueryBox *) g_malloc (sizeof (QueryBox));
@ -852,23 +856,9 @@ create_query_box (gchar *title,
else
object = NULL;
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (qbox)->action_area), 2);
ok_button = gtk_button_new_with_label (_("OK"));
GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (qbox)->action_area), ok_button,
TRUE, TRUE, 0);
gtk_widget_grab_default (ok_button);
gtk_widget_show (ok_button);
button = gtk_button_new_with_label (_("Cancel"));
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) query_box_cancel_callback,
query_box);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (qbox)->action_area), button,
TRUE, TRUE, 0);
gtk_widget_show (button);
/* The action area */
action_items[1].user_data = query_box;
build_action_area (GTK_DIALOG (qbox), action_items, 2, 0);
vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
@ -882,7 +872,7 @@ create_query_box (gchar *title,
query_box->qbox = qbox;
query_box->vbox = vbox;
query_box->entry = NULL;
query_box->ok_button = ok_button;
query_box->ok_button = action_items[0].widget;
query_box->object = object;
query_box->callback = callback;
query_box->data = data;
@ -958,16 +948,16 @@ query_int_box (gchar *title,
}
GtkWidget *
query_float_box (gchar *title,
gchar *message,
gfloat initial,
gfloat lower,
gfloat upper,
gint digits,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data)
query_double_box (gchar *title,
gchar *message,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GtkObject *object,
gchar *signal,
QueryFunc callback,
gpointer data)
{
QueryBox *query_box;
GtkAdjustment* adjustment;
@ -976,7 +966,7 @@ query_float_box (gchar *title,
query_box = create_query_box (title, message, object, signal, callback, data);
gtk_signal_connect (GTK_OBJECT (query_box->ok_button), "clicked",
(GtkSignalFunc) float_query_box_ok_callback,
(GtkSignalFunc) double_query_box_ok_callback,
query_box);
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (initial, lower, upper,
@ -996,12 +986,13 @@ query_float_box (gchar *title,
GtkWidget *
query_size_box (gchar *title,
gchar *message,
gfloat initial,
gfloat lower,
gfloat upper,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GUnit unit,
gfloat resolution,
gdouble resolution,
gint dot_for_dot,
GtkObject *object,
gchar *signal,
QueryFunc callback,
@ -1025,6 +1016,9 @@ query_size_box (gchar *title,
lower, upper);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 0, initial);
if (dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
gtk_box_pack_start (GTK_BOX (query_box->vbox), sizeentry, TRUE, TRUE, 0);
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (sizeentry));
gtk_widget_show (sizeentry);
@ -1106,7 +1100,7 @@ int_query_box_ok_callback (GtkWidget *w,
/* Get the spinbutton data */
integer_value = g_malloc (sizeof (gint));
*integer_value =
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON(query_box->entry));
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (query_box->entry));
/* Call the user defined callback */
(* query_box->callback) (w, query_box->data, (gpointer) integer_value);
@ -1118,11 +1112,11 @@ int_query_box_ok_callback (GtkWidget *w,
}
static void
float_query_box_ok_callback (GtkWidget *w,
gpointer client_data)
double_query_box_ok_callback (GtkWidget *w,
gpointer client_data)
{
QueryBox *query_box;
gfloat *float_value;
gdouble *double_value;
query_box = (QueryBox *) client_data;
@ -1131,12 +1125,12 @@ float_query_box_ok_callback (GtkWidget *w,
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the spinbutton data */
float_value = g_malloc (sizeof (gfloat));
*float_value =
gtk_spin_button_get_value_as_float(GTK_SPIN_BUTTON(query_box->entry));
double_value = g_malloc (sizeof (gdouble));
*double_value =
gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON (query_box->entry));
/* Call the user defined callback */
(* query_box->callback) (w, query_box->data, (gpointer) float_value);
(* query_box->callback) (w, query_box->data, (gpointer) double_value);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
@ -1149,7 +1143,7 @@ size_query_box_ok_callback (GtkWidget *w,
gpointer client_data)
{
QueryBox *query_box;
gfloat *float_value;
gdouble *double_value;
query_box = (QueryBox *) client_data;
@ -1158,8 +1152,8 @@ size_query_box_ok_callback (GtkWidget *w,
gtk_signal_disconnect_by_data (query_box->object, query_box);
/* Get the sizeentry data */
float_value = g_malloc (sizeof (gfloat));
*float_value =
double_value = g_malloc (sizeof (gdouble));
*double_value =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (query_box->entry), 0);
/* Pass the selected unit to the callback */
@ -1168,7 +1162,7 @@ size_query_box_ok_callback (GtkWidget *w,
(gpointer) gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (query_box->entry)));
/* Call the user defined callback */
(* query_box->callback) (w, query_box->data, (gpointer) float_value);
(* query_box->callback) (w, query_box->data, (gpointer) double_value);
/* Destroy the box */
gtk_widget_destroy (query_box->qbox);
@ -1217,7 +1211,7 @@ message_box (char *message,
gtk_window_set_wmclass (GTK_WINDOW (mbox), "gimp_message", "Gimp");
gtk_window_set_title (GTK_WINDOW (mbox), _("GIMP Message"));
gtk_window_position (GTK_WINDOW (mbox), GTK_WIN_POS_MOUSE);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (mbox)->action_area), 2);
gtk_signal_connect (GTK_OBJECT (mbox), "delete_event",
GTK_SIGNAL_FUNC (message_box_delete_callback),
msg_box);

View file

@ -77,11 +77,11 @@ GtkWidget * query_int_box (gchar *title,
gchar *signal,
QueryFunc callback,
gpointer data);
GtkWidget * query_float_box (gchar *title,
GtkWidget * query_double_box (gchar *title,
gchar *message,
gfloat initial,
gfloat lower,
gfloat upper,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GtkObject *object,
gchar *signal,
@ -89,12 +89,13 @@ GtkWidget * query_float_box (gchar *title,
gpointer data);
GtkWidget * query_size_box (gchar *title,
gchar *message,
gfloat initial,
gfloat lower,
gfloat upper,
gdouble initial,
gdouble lower,
gdouble upper,
gint digits,
GUnit unit,
gfloat resolution,
gdouble resolution,
gint dot_for_dot,
GtkObject *object,
gchar *signal,
QueryFunc callback,

View file

@ -3129,11 +3129,6 @@ new_layer_query_fill_type_callback (GtkWidget *w,
static void
layers_dialog_new_layer_query (GimpImage* gimage)
{
static ActionAreaItem action_items[2] =
{
{ N_("OK"), new_layer_query_ok_callback, NULL, NULL },
{ N_("Cancel"), new_layer_query_cancel_callback, NULL, NULL }
};
NewLayerOptions *options;
GtkWidget *vbox;
GtkWidget *table;
@ -3145,13 +3140,18 @@ layers_dialog_new_layer_query (GimpImage* gimage)
GtkWidget *radio_button;
GSList *group = NULL;
int i;
char *button_names[4] =
char *button_names[] =
{
N_("Foreground"),
N_("Background"),
N_("White"),
N_("Transparent")
};
static ActionAreaItem action_items[] =
{
{ N_("OK"), new_layer_query_ok_callback, NULL, NULL },
{ N_("Cancel"), new_layer_query_cancel_callback, NULL, NULL }
};
/* the new options structure */
options = (NewLayerOptions *) g_malloc (sizeof (NewLayerOptions));
@ -3160,7 +3160,8 @@ layers_dialog_new_layer_query (GimpImage* gimage)
/* the dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box), "new_layer_options", "Gimp");
gtk_window_set_wmclass (GTK_WINDOW (options->query_box),
"new_layer_options", "Gimp");
gtk_window_set_title (GTK_WINDOW (options->query_box), _("New Layer Options"));
gtk_window_position (GTK_WINDOW (options->query_box), GTK_WIN_POS_MOUSE);
@ -3215,7 +3216,7 @@ layers_dialog_new_layer_query (GimpImage* gimage)
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_widget_set_usize (spinbutton, 75, 0);
options->size_se = gimp_size_entry_new (1, UNIT_PIXEL, "%a",
options->size_se = gimp_size_entry_new (1, gimage->unit, "%a",
TRUE, TRUE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (options->size_se),
@ -3249,6 +3250,8 @@ layers_dialog_new_layer_query (GimpImage* gimage)
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (options->size_se), 1,
gimage->height);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (options->size_se), UNIT_PIXEL);
gtk_widget_show (table);
/* the radio frame and box */

View file

@ -33,6 +33,7 @@
#include "libgimp/gimpfileselection.h"
#include "libgimp/gimppatheditor.h"
#include "libgimp/gimpsizeentry.h"
#include "libgimp/gimplimits.h"
#include "libgimp/gimpintl.h"
/* preferences local functions */
@ -245,7 +246,8 @@ file_prefs_ok_callback (GtkWidget *widget,
default_units = old_default_units;
return;
}
if (default_xresolution < 1e-5 || default_yresolution < 1e-5)
if (default_xresolution < GIMP_MIN_RESOLUTION ||
default_yresolution < GIMP_MIN_RESOLUTION)
{
g_message (_("Error: default resolution must not be zero."));
default_xresolution = old_default_xresolution;
@ -259,7 +261,8 @@ file_prefs_ok_callback (GtkWidget *widget,
default_resolution_units = old_default_resolution_units;
return;
}
if (monitor_xres < 1e-5 || monitor_yres < 1e-5)
if (monitor_xres < GIMP_MIN_RESOLUTION ||
monitor_yres < GIMP_MIN_RESOLUTION)
{
g_message (_("Error: Monitor resolution must not be zero."));
monitor_xres = old_monitor_xres;
@ -388,9 +391,9 @@ file_prefs_save_callback (GtkWidget *widget,
update = g_list_append (update, "default-image-size");
if (default_units != old_default_units)
update = g_list_append (update, "default-units");
if (ABS(default_xresolution - old_default_xresolution) > 1e-5)
if (ABS(default_xresolution - old_default_xresolution) > GIMP_MIN_RESOLUTION)
update = g_list_append (update, "default-xresolution");
if (ABS(default_yresolution - old_default_yresolution) > 1e-5)
if (ABS(default_yresolution - old_default_yresolution) > GIMP_MIN_RESOLUTION)
update = g_list_append (update, "default-yresolution");
if (default_resolution_units != old_default_resolution_units)
update = g_list_append (update, "default-resolution-units");
@ -405,10 +408,10 @@ file_prefs_save_callback (GtkWidget *widget,
if (transparency_size != old_transparency_size)
update = g_list_append (update, "transparency-size");
if (using_xserver_resolution != old_using_xserver_resolution ||
ABS(monitor_xres - old_monitor_xres) > 1e-5)
ABS(monitor_xres - old_monitor_xres) > GIMP_MIN_RESOLUTION)
update = g_list_append (update, "monitor-xresolution");
if (using_xserver_resolution != old_using_xserver_resolution ||
ABS(monitor_yres - old_monitor_yres) > 1e-5)
ABS(monitor_yres - old_monitor_yres) > GIMP_MIN_RESOLUTION)
update = g_list_append (update, "monitor-yresolution");
if (edit_num_processors != num_processors)
update = g_list_append (update, "num-processors");
@ -510,13 +513,7 @@ file_prefs_save_callback (GtkWidget *widget,
save_gimprc (&update, &remove);
if (using_xserver_resolution)
{
gfloat xres, yres;
gdisplay_xserver_resolution (&xres, &yres);
monitor_xres = xres;
monitor_yres = yres;
}
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
/* Restore variables which must not change */
stingy_memory_use = save_stingy_memory_use;
@ -863,21 +860,17 @@ file_prefs_res_source_callback (GtkWidget *widget,
if (GTK_TOGGLE_BUTTON (widget)->active)
{
gfloat xres, yres;
gdisplay_xserver_resolution (&xres, &yres);
monitor_xres = xres;
monitor_yres = yres;
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
using_xserver_resolution = TRUE;
}
else
{
if (monitor_resolution_sizeentry)
{
monitor_xres =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0);
monitor_yres =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1);
monitor_xres = gimp_size_entry_get_refval
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0);
monitor_yres = gimp_size_entry_get_refval
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1);
}
using_xserver_resolution = FALSE;
}
@ -1535,9 +1528,11 @@ file_pref_cmd_callback (GtkWidget *widget,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
1, default_yresolution, FALSE);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_size_sizeentry), 0, 1, 32767);
(GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_size_sizeentry), 1, 1, 32767);
(GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
GIMP_MIN_IMAGE_SIZE, GIMP_MAX_IMAGE_SIZE);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
default_width);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
@ -1572,9 +1567,11 @@ file_pref_cmd_callback (GtkWidget *widget,
FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0, 1, 32767);
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0,
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1, 1, 32767);
(GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1,
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
0, default_xresolution);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry),
@ -1603,7 +1600,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_table_attach_defaults (GTK_TABLE (default_resolution_sizeentry),
button, 1, 3, 3, 4);
if (ABS (default_xresolution - default_yresolution) < 1e-5)
if (ABS (default_xresolution - default_yresolution) < GIMP_MIN_RESOLUTION)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
gtk_widget_show (button);
@ -2205,7 +2202,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_widget_show (button);
{
gfloat xres, yres;
gdouble xres, yres;
gchar buf[80];
gdisplay_xserver_resolution (&xres, &yres);
@ -2234,9 +2231,11 @@ file_pref_cmd_callback (GtkWidget *widget,
gimp_size_entry_new (2, UNIT_INCH, "Pixels/%s", FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0, 1, 32767);
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0,
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
gimp_size_entry_set_refval_boundaries
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1, 1, 32767);
(GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1,
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
0, monitor_xres);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
@ -2258,7 +2257,7 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_container_add (GTK_CONTAINER (abox), monitor_resolution_sizeentry);
gtk_widget_show (monitor_resolution_sizeentry);
if (ABS (monitor_xres - monitor_yres) < 1e-5)
if (ABS (monitor_xres - monitor_yres) < GIMP_MIN_RESOLUTION)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
gtk_table_attach_defaults (GTK_TABLE (monitor_resolution_sizeentry),
button, 1, 3, 3, 4);

View file

@ -99,7 +99,7 @@ rect_select_button_press (Tool *tool,
gchar select_mode[STATUSBAR_SIZE];
int x, y;
GUnit unit = UNIT_PIXEL;
float unit_factor;
double unit_factor;
gdisp = (GDisplay *) gdisp_ptr;
rect_sel = (RectSelect *) tool->private;
@ -405,14 +405,14 @@ rect_select_motion (Tool *tool,
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Selection: "),
(float)abs(rect_sel->w) * unit_factor /
(gdouble) abs(rect_sel->w) * unit_factor /
gdisp->gimage->xresolution,
" x ",
(float)abs(rect_sel->h) * unit_factor /
(gdouble) abs(rect_sel->h) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id,

View file

@ -58,7 +58,7 @@ struct _ResizePrivate
double ratio;
int old_width, old_height;
int old_res_x, old_res_y;
double old_res_x, old_res_y;
int area_width, area_height;
int start_x, start_y;
int orig_x, orig_y;
@ -82,10 +82,10 @@ Resize *
resize_widget_new (ResizeType type,
ResizeTarget target,
GtkObject *object,
int width,
int height,
float resolution_x,
float resolution_y,
gint width,
gint height,
gdouble resolution_x,
gdouble resolution_y,
GUnit unit,
gboolean dot_for_dot,
GtkSignalFunc ok_cb,
@ -281,8 +281,7 @@ resize_widget_new (ResizeType type,
gtk_widget_set_usize (spinbutton, 75, 0);
private->size_se =
gimp_size_entry_new (1, dot_for_dot ? UNIT_PIXEL : unit, "%a",
TRUE, TRUE, FALSE, 75,
gimp_size_entry_new (1, unit, "%a", TRUE, TRUE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->size_se),
GTK_SPIN_BUTTON (spinbutton), NULL);
@ -311,6 +310,9 @@ resize_widget_new (ResizeType type,
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->size_se), 0, width);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->size_se), 1, height);
if (dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->size_se), UNIT_PIXEL);
gtk_signal_connect (GTK_OBJECT (private->size_se), "value_changed",
(GtkSignalFunc) size_callback,
resize);
@ -428,8 +430,7 @@ resize_widget_new (ResizeType type,
gtk_widget_set_usize (spinbutton, 75, 0);
private->offset_se =
gimp_size_entry_new (1, dot_for_dot ? UNIT_PIXEL : unit, "%a",
TRUE, FALSE, FALSE, 75,
gimp_size_entry_new (1, unit, "%a", TRUE, FALSE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->offset_se),
GTK_SPIN_BUTTON (spinbutton), NULL);
@ -453,6 +454,10 @@ resize_widget_new (ResizeType type,
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->offset_se), 0, 0);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->offset_se), 1, 0);
if (dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->offset_se),
UNIT_PIXEL);
gtk_signal_connect (GTK_OBJECT (private->offset_se),
"value_changed", (GtkSignalFunc) offset_update,
resize);

View file

@ -45,8 +45,8 @@ struct _Resize
int width;
int height;
float resolution_x;
float resolution_y;
double resolution_x;
double resolution_y;
GUnit unit;
double ratio_x;
@ -65,10 +65,10 @@ struct _Resize
Resize * resize_widget_new (ResizeType type,
ResizeTarget target,
GtkObject * object,
int width,
int height,
float resolution_x,
float resolution_y,
gint width,
gint height,
gdouble resolution_x,
gdouble resolution_y,
GUnit unit,
gboolean dot_for_dot,
GtkSignalFunc ok_cb,

View file

@ -103,8 +103,7 @@ rotate_tool_transform (Tool *tool,
sizeentry =
info_dialog_add_sizeentry (transform_info, _("Y:"),
center_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
gdisp->gimage->unit, "%a",
TRUE, TRUE, FALSE,
GIMP_SIZE_ENTRY_UPDATE_SIZE,
rotate_center_changed, tool);
@ -127,6 +126,9 @@ rotate_tool_transform (Tool *tool,
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
center_vals[1]);
if (gdisp->dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),
1, 6);
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),

View file

@ -166,7 +166,7 @@ change_scale (GDisplay *gdisp,
static gdouble
img2real (GDisplay *gdisp, gboolean xdir, gdouble a)
{
float res;
gdouble res;
if (gdisp->dot_for_dot)
return a;

View file

@ -80,8 +80,7 @@ scale_tool_transform (Tool *tool,
sizeentry =
info_dialog_add_sizeentry (transform_info, _("Height:"),
size_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
gdisp->gimage->unit, "%a",
TRUE, TRUE, FALSE,
GIMP_SIZE_ENTRY_UPDATE_SIZE,
scale_size_changed, tool);
@ -104,6 +103,9 @@ scale_tool_transform (Tool *tool,
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
size_vals[1]);
if (gdisp->dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
info_dialog_add_label (transform_info, _("Scale Ratio X:"),
x_ratio_buf);
info_dialog_add_label (transform_info, _("Y:"),
@ -191,7 +193,7 @@ scale_info_update (Tool *tool)
double ratio_x, ratio_y;
int x1, y1, x2, y2, x3, y3, x4, y4;
GUnit unit;
float unit_factor;
double unit_factor;
gchar format_buf[16];
static GUnit label_unit = UNIT_PIXEL;

View file

@ -643,7 +643,7 @@ blend_motion (Tool *tool,
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Blend: "),

View file

@ -502,14 +502,14 @@ crop_motion (Tool *tool,
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Crop: "),
(float)(crop->tx2 - crop->tx1) * unit_factor /
(gdouble) (crop->tx2 - crop->tx1) * unit_factor /
gdisp->gimage->xresolution,
" x ",
(float)(crop->ty2 - crop->ty1) * unit_factor /
(gdouble) (crop->ty2 - crop->ty1) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), crop->context_id,

View file

@ -447,7 +447,7 @@ edit_selection_motion (Tool *tool,
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (offset, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Move: "),

View file

@ -643,7 +643,7 @@ blend_motion (Tool *tool,
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Blend: "),

View file

@ -502,14 +502,14 @@ crop_motion (Tool *tool,
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Crop: "),
(float)(crop->tx2 - crop->tx1) * unit_factor /
(gdouble) (crop->tx2 - crop->tx1) * unit_factor /
gdisp->gimage->xresolution,
" x ",
(float)(crop->ty2 - crop->ty1) * unit_factor /
(gdouble) (crop->ty2 - crop->ty1) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), crop->context_id,

View file

@ -447,7 +447,7 @@ edit_selection_motion (Tool *tool,
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (offset, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Move: "),

View file

@ -99,7 +99,7 @@ rect_select_button_press (Tool *tool,
gchar select_mode[STATUSBAR_SIZE];
int x, y;
GUnit unit = UNIT_PIXEL;
float unit_factor;
double unit_factor;
gdisp = (GDisplay *) gdisp_ptr;
rect_sel = (RectSelect *) tool->private;
@ -405,14 +405,14 @@ rect_select_motion (Tool *tool,
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Selection: "),
(float)abs(rect_sel->w) * unit_factor /
(gdouble) abs(rect_sel->w) * unit_factor /
gdisp->gimage->xresolution,
" x ",
(float)abs(rect_sel->h) * unit_factor /
(gdouble) abs(rect_sel->h) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id,

View file

@ -103,8 +103,7 @@ rotate_tool_transform (Tool *tool,
sizeentry =
info_dialog_add_sizeentry (transform_info, _("Y:"),
center_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
gdisp->gimage->unit, "%a",
TRUE, TRUE, FALSE,
GIMP_SIZE_ENTRY_UPDATE_SIZE,
rotate_center_changed, tool);
@ -127,6 +126,9 @@ rotate_tool_transform (Tool *tool,
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
center_vals[1]);
if (gdisp->dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),
1, 6);
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),

View file

@ -80,8 +80,7 @@ scale_tool_transform (Tool *tool,
sizeentry =
info_dialog_add_sizeentry (transform_info, _("Height:"),
size_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
gdisp->gimage->unit, "%a",
TRUE, TRUE, FALSE,
GIMP_SIZE_ENTRY_UPDATE_SIZE,
scale_size_changed, tool);
@ -104,6 +103,9 @@ scale_tool_transform (Tool *tool,
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
size_vals[1]);
if (gdisp->dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
info_dialog_add_label (transform_info, _("Scale Ratio X:"),
x_ratio_buf);
info_dialog_add_label (transform_info, _("Y:"),
@ -191,7 +193,7 @@ scale_info_update (Tool *tool)
double ratio_x, ratio_y;
int x1, y1, x2, y2, x3, y3, x4, y4;
GUnit unit;
float unit_factor;
double unit_factor;
gchar format_buf[16];
static GUnit label_unit = UNIT_PIXEL;

View file

@ -99,7 +99,7 @@ rect_select_button_press (Tool *tool,
gchar select_mode[STATUSBAR_SIZE];
int x, y;
GUnit unit = UNIT_PIXEL;
float unit_factor;
double unit_factor;
gdisp = (GDisplay *) gdisp_ptr;
rect_sel = (RectSelect *) tool->private;
@ -405,14 +405,14 @@ rect_select_motion (Tool *tool,
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
gdouble unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Selection: "),
(float)abs(rect_sel->w) * unit_factor /
(gdouble) abs(rect_sel->w) * unit_factor /
gdisp->gimage->xresolution,
" x ",
(float)abs(rect_sel->h) * unit_factor /
(gdouble) abs(rect_sel->h) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id,

View file

@ -103,8 +103,7 @@ rotate_tool_transform (Tool *tool,
sizeentry =
info_dialog_add_sizeentry (transform_info, _("Y:"),
center_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
gdisp->gimage->unit, "%a",
TRUE, TRUE, FALSE,
GIMP_SIZE_ENTRY_UPDATE_SIZE,
rotate_center_changed, tool);
@ -127,6 +126,9 @@ rotate_tool_transform (Tool *tool,
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
center_vals[1]);
if (gdisp->dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),
1, 6);
gtk_table_set_row_spacing (GTK_TABLE (transform_info->info_table),

View file

@ -80,8 +80,7 @@ scale_tool_transform (Tool *tool,
sizeentry =
info_dialog_add_sizeentry (transform_info, _("Height:"),
size_vals, 1,
gdisp->dot_for_dot ?
UNIT_PIXEL : gdisp->gimage->unit, "%a",
gdisp->gimage->unit, "%a",
TRUE, TRUE, FALSE,
GIMP_SIZE_ENTRY_UPDATE_SIZE,
scale_size_changed, tool);
@ -104,6 +103,9 @@ scale_tool_transform (Tool *tool,
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (sizeentry), 1,
size_vals[1]);
if (gdisp->dot_for_dot)
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (sizeentry), UNIT_PIXEL);
info_dialog_add_label (transform_info, _("Scale Ratio X:"),
x_ratio_buf);
info_dialog_add_label (transform_info, _("Y:"),
@ -191,7 +193,7 @@ scale_info_update (Tool *tool)
double ratio_x, ratio_y;
int x1, y1, x2, y2, x3, y3, x4, y4;
GUnit unit;
float unit_factor;
double unit_factor;
gchar format_buf[16];
static GUnit label_unit = UNIT_PIXEL;

View file

@ -40,6 +40,7 @@
#include "parasitelist.h"
#include "pathsP.h"
#include <libgimp/gimpunit.h>
#include <libgimp/gimplimits.h>
/* #define SWAP_FROM_FILE */
@ -1134,7 +1135,6 @@ xcf_save_prop (XcfInfo *info,
info->cp += xcf_write_float (info->fp, &xresolution, 1);
info->cp += xcf_write_float (info->fp, &yresolution, 1);
}
break;
case PROP_TATTOO:
@ -1838,16 +1838,18 @@ xcf_load_image_props (XcfInfo *info,
break;
case PROP_RESOLUTION:
{
info->cp += xcf_read_float (info->fp, &gimage->xresolution, 1);
info->cp += xcf_read_float (info->fp, &gimage->yresolution, 1);
if (gimage->xresolution < 1e-5 || gimage->xresolution > 1e+5 ||
gimage->yresolution < 1e-5 || gimage->yresolution > 1e+5)
{
g_message(_("Warning, resolution out of range in XCF file"));
gimage->xresolution = 72.0;
gimage->yresolution = 72.0;
}
float xres, yres;
info->cp += xcf_read_float (info->fp, &xres, 1);
info->cp += xcf_read_float (info->fp, &yres, 1);
if (xres < GIMP_MIN_RESOLUTION || xres > GIMP_MAX_RESOLUTION ||
yres < GIMP_MIN_RESOLUTION || yres > GIMP_MAX_RESOLUTION)
{
g_message(_("Warning, resolution out of range in XCF file"));
xres = yres = 72.0;
}
gimage->xresolution = xres;
gimage->yresolution = yres;
}
break;
case PROP_TATTOO:

View file

@ -40,6 +40,7 @@
#include "parasitelist.h"
#include "pathsP.h"
#include <libgimp/gimpunit.h>
#include <libgimp/gimplimits.h>
/* #define SWAP_FROM_FILE */
@ -1134,7 +1135,6 @@ xcf_save_prop (XcfInfo *info,
info->cp += xcf_write_float (info->fp, &xresolution, 1);
info->cp += xcf_write_float (info->fp, &yresolution, 1);
}
break;
case PROP_TATTOO:
@ -1838,16 +1838,18 @@ xcf_load_image_props (XcfInfo *info,
break;
case PROP_RESOLUTION:
{
info->cp += xcf_read_float (info->fp, &gimage->xresolution, 1);
info->cp += xcf_read_float (info->fp, &gimage->yresolution, 1);
if (gimage->xresolution < 1e-5 || gimage->xresolution > 1e+5 ||
gimage->yresolution < 1e-5 || gimage->yresolution > 1e+5)
{
g_message(_("Warning, resolution out of range in XCF file"));
gimage->xresolution = 72.0;
gimage->yresolution = 72.0;
}
float xres, yres;
info->cp += xcf_read_float (info->fp, &xres, 1);
info->cp += xcf_read_float (info->fp, &yres, 1);
if (xres < GIMP_MIN_RESOLUTION || xres > GIMP_MAX_RESOLUTION ||
yres < GIMP_MIN_RESOLUTION || yres > GIMP_MAX_RESOLUTION)
{
g_message(_("Warning, resolution out of range in XCF file"));
xres = yres = 72.0;
}
gimage->xresolution = xres;
gimage->yresolution = yres;
}
break;
case PROP_TATTOO:

View file

@ -503,11 +503,11 @@ void gimp_image_attach_new_parasite (gint32 image_ID,
void gimp_image_detach_parasite (gint32 image_ID,
const char *name);
void gimp_image_set_resolution (gint32 image_ID,
float xresolution,
float yresolution);
double xresolution,
double yresolution);
void gimp_image_get_resolution (gint32 image_ID,
float *xresolution,
float *yresolution);
double *xresolution,
double *yresolution);
void gimp_image_set_unit (gint32 image_ID,
GUnit unit);
GUnit gimp_image_get_unit (gint32 image_ID);

View file

@ -1012,15 +1012,15 @@ gimp_image_detach_parasite (gint32 image_ID, const char *name)
void
gimp_image_get_resolution (gint32 image_ID,
float *xresolution,
float *yresolution)
double *xresolution,
double *yresolution)
{
GParam *return_vals;
int nreturn_vals;
float xres;
float yres;
double xres;
double yres;
g_return_if_fail(xresolution && yresolution);
g_return_if_fail (xresolution && yresolution);
return_vals = gimp_run_procedure ("gimp_image_get_resolution",
&nreturn_vals,
@ -1045,8 +1045,8 @@ gimp_image_get_resolution (gint32 image_ID,
void
gimp_image_set_resolution (gint32 image_ID,
float xresolution,
float yresolution)
double xresolution,
double yresolution)
{
GParam *return_vals;
int nreturn_vals;

View file

@ -1012,15 +1012,15 @@ gimp_image_detach_parasite (gint32 image_ID, const char *name)
void
gimp_image_get_resolution (gint32 image_ID,
float *xresolution,
float *yresolution)
double *xresolution,
double *yresolution)
{
GParam *return_vals;
int nreturn_vals;
float xres;
float yres;
double xres;
double yres;
g_return_if_fail(xresolution && yresolution);
g_return_if_fail (xresolution && yresolution);
return_vals = gimp_run_procedure ("gimp_image_get_resolution",
&nreturn_vals,
@ -1045,8 +1045,8 @@ gimp_image_get_resolution (gint32 image_ID,
void
gimp_image_set_resolution (gint32 image_ID,
float xresolution,
float yresolution)
double xresolution,
double yresolution)
{
GParam *return_vals;
int nreturn_vals;

View file

@ -46,23 +46,22 @@ enum {
struct _GimpSizeEntryField
{
GimpSizeEntry *gse;
gint index;
gfloat resolution;
gfloat lower;
gfloat upper;
gdouble resolution;
gdouble lower;
gdouble upper;
GtkObject *value_adjustment;
GtkWidget *value_spinbutton;
gfloat value;
gfloat min_value;
gfloat max_value;
gdouble value;
gdouble min_value;
gdouble max_value;
GtkObject *refval_adjustment;
GtkWidget *refval_spinbutton;
gfloat refval;
gfloat min_refval;
gfloat max_refval;
gdouble refval;
gdouble min_refval;
gdouble max_refval;
gint refval_digits;
gint stop_recursion;
@ -221,7 +220,6 @@ gimp_size_entry_new (gint number_of_fields,
gse->fields = g_slist_append (gse->fields, gsef);
gsef->gse = gse;
gsef->index = i;
gsef->resolution = 1.0; /* just to avoid division by zero */
gsef->lower = 0.0;
gsef->upper = 100.0;
@ -343,7 +341,6 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
gse->number_of_fields++;
gsef->gse = gse;
gsef->index = 0;
gsef->resolution = 1.0; /* just to avoid division by zero */
gsef->lower = 0.0;
gsef->upper = 100.0;
@ -431,7 +428,7 @@ gimp_size_entry_attach_label (GimpSizeEntry *gse,
void
gimp_size_entry_set_resolution (GimpSizeEntry *gse,
gint field,
gfloat resolution,
gdouble resolution,
guint keep_size)
{
GimpSizeEntryField *gsef;
@ -461,8 +458,8 @@ gimp_size_entry_set_resolution (GimpSizeEntry *gse,
void
gimp_size_entry_set_size (GimpSizeEntry *gse,
gint field,
gfloat lower,
gfloat upper)
gdouble lower,
gdouble upper)
{
GimpSizeEntryField *gsef;
@ -484,8 +481,8 @@ gimp_size_entry_set_size (GimpSizeEntry *gse,
void
gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
gint field,
gfloat lower,
gfloat upper)
gdouble lower,
gdouble upper)
{
GimpSizeEntryField *gsef;
@ -552,7 +549,7 @@ gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
gimp_size_entry_set_value (gse, field, gsef->value);
}
gfloat
gdouble
gimp_size_entry_get_value (GimpSizeEntry *gse,
gint field)
{
@ -568,7 +565,7 @@ gimp_size_entry_get_value (GimpSizeEntry *gse,
static void
gimp_size_entry_update_value (GimpSizeEntryField *gsef,
gfloat value)
gdouble value)
{
if (gsef->stop_recursion > 1)
return;
@ -619,7 +616,7 @@ gimp_size_entry_update_value (GimpSizeEntryField *gsef,
void
gimp_size_entry_set_value (GimpSizeEntry *gse,
gint field,
gfloat value)
gdouble value)
{
GimpSizeEntryField *gsef;
@ -642,7 +639,7 @@ gimp_size_entry_value_callback (GtkWidget *widget,
gpointer data)
{
GimpSizeEntryField *gsef;
gfloat new_value;
gdouble new_value;
gsef = (GimpSizeEntryField*) data;
@ -662,8 +659,8 @@ gimp_size_entry_value_callback (GtkWidget *widget,
void
gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse,
gint field,
gfloat lower,
gfloat upper)
gdouble lower,
gdouble upper)
{
GimpSizeEntryField *gsef;
@ -761,7 +758,7 @@ gimp_size_entry_set_refval_digits (GimpSizeEntry *gse,
}
}
gfloat
gdouble
gimp_size_entry_get_refval (GimpSizeEntry *gse,
gint field)
{
@ -778,7 +775,7 @@ gimp_size_entry_get_refval (GimpSizeEntry *gse,
static void
gimp_size_entry_update_refval (GimpSizeEntryField *gsef,
gfloat refval)
gdouble refval)
{
if (gsef->stop_recursion > 1)
return;
@ -827,7 +824,7 @@ gimp_size_entry_update_refval (GimpSizeEntryField *gsef,
void
gimp_size_entry_set_refval (GimpSizeEntry *gse,
gint field,
gfloat refval)
gdouble refval)
{
GimpSizeEntryField *gsef;
@ -853,7 +850,7 @@ gimp_size_entry_refval_callback (GtkWidget *widget,
gpointer data)
{
GimpSizeEntryField *gsef;
gfloat new_refval;
gdouble new_refval;
gsef = (GimpSizeEntryField*) data;

View file

@ -16,7 +16,6 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_SIZE_ENTRY_H__
#define __GIMP_SIZE_ENTRY_H__
@ -133,7 +132,7 @@ void gimp_size_entry_attach_label (GimpSizeEntry *gse,
*/
void gimp_size_entry_set_resolution (GimpSizeEntry *gse,
gint field,
gfloat resolution,
gdouble resolution,
guint keep_size);
/* this one sets the values (in pixels) which will be treated as
@ -143,8 +142,8 @@ void gimp_size_entry_set_resolution (GimpSizeEntry *gse,
*/
void gimp_size_entry_set_size (GimpSizeEntry *gse,
gint field,
gfloat lower,
gfloat upper);
gdouble lower,
gdouble upper);
/* these functions set/return the value in the units the user selected
* note that in some cases where the caller chooses not to have the
@ -153,13 +152,13 @@ void gimp_size_entry_set_size (GimpSizeEntry *gse,
*/
void gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
gint field,
gfloat lower,
gfloat upper);
gfloat gimp_size_entry_get_value (GimpSizeEntry *gse,
gdouble lower,
gdouble upper);
gdouble gimp_size_entry_get_value (GimpSizeEntry *gse,
gint field);
void gimp_size_entry_set_value (GimpSizeEntry *gse,
gint field,
gfloat value);
gdouble value);
/* these functions set/return the value in the 'reference unit' for the
* current update policy
@ -171,16 +170,16 @@ void gimp_size_entry_set_value (GimpSizeEntry *gse,
*/
void gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse,
gint field,
gfloat lower,
gfloat upper);
gdouble lower,
gdouble upper);
void gimp_size_entry_set_refval_digits (GimpSizeEntry *gse,
gint field,
gint digits);
gfloat gimp_size_entry_get_refval (GimpSizeEntry *gse,
gdouble gimp_size_entry_get_refval (GimpSizeEntry *gse,
gint field);
void gimp_size_entry_set_refval (GimpSizeEntry *gse,
gint field,
gfloat refval);
gdouble refval);
/* these functions set/return the currently used unit
* note that for GIMP_SIZE_ENTRY_UPDATE_SIZE a value of UNIT_PIXEL

View file

@ -28,7 +28,7 @@
typedef struct {
guint delete_on_exit;
float factor;
gdouble factor;
gint digits;
gchar *identifier;
gchar *symbol;
@ -89,13 +89,13 @@ gimp_unit_get_number_of_built_in_units (void)
GUnit
gimp_unit_new (gchar *identifier,
gfloat factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural)
gimp_unit_new (gchar *identifier,
gdouble factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural)
{
GParam *return_vals;
int nreturn_vals;
@ -172,13 +172,13 @@ gimp_unit_set_deletion_flag (GUnit unit,
}
gfloat
gdouble
gimp_unit_get_factor (GUnit unit)
{
GParam *return_vals;
int nreturn_vals;
gfloat factor;
gdouble factor;
g_return_val_if_fail (unit >= UNIT_INCH, 1.0);

View file

@ -67,13 +67,13 @@ gint gimp_unit_get_number_of_built_in_units (void);
* set to TRUE. You will have to set it to FALSE after creation to make
* the unit definition persistant.
*/
GUnit gimp_unit_new (gchar *identifier,
gfloat factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural);
GUnit gimp_unit_new (gchar *identifier,
gdouble factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural);
/* The following functions fall back to inch (not pixel, as pixel is not
* a 'real' unit) if the value passed is out of range.
@ -93,7 +93,7 @@ void gimp_unit_set_deletion_flag (GUnit unit,
*
* Returns 0 for unit == UNIT_PIXEL as we don't have resolution info here
*/
gfloat gimp_unit_get_factor (GUnit unit);
gdouble gimp_unit_get_factor (GUnit unit);
/* The following function gives a hint how many digits a spinbutton
* should provide to get approximately the accuracy of an inch-spinbutton

View file

@ -28,7 +28,7 @@
typedef struct {
guint delete_on_exit;
float factor;
gdouble factor;
gint digits;
gchar *identifier;
gchar *symbol;
@ -89,13 +89,13 @@ gimp_unit_get_number_of_built_in_units (void)
GUnit
gimp_unit_new (gchar *identifier,
gfloat factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural)
gimp_unit_new (gchar *identifier,
gdouble factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural)
{
GParam *return_vals;
int nreturn_vals;
@ -172,13 +172,13 @@ gimp_unit_set_deletion_flag (GUnit unit,
}
gfloat
gdouble
gimp_unit_get_factor (GUnit unit)
{
GParam *return_vals;
int nreturn_vals;
gfloat factor;
gdouble factor;
g_return_val_if_fail (unit >= UNIT_INCH, 1.0);

View file

@ -28,7 +28,7 @@
typedef struct {
guint delete_on_exit;
float factor;
gdouble factor;
gint digits;
gchar *identifier;
gchar *symbol;
@ -89,13 +89,13 @@ gimp_unit_get_number_of_built_in_units (void)
GUnit
gimp_unit_new (gchar *identifier,
gfloat factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural)
gimp_unit_new (gchar *identifier,
gdouble factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural)
{
GParam *return_vals;
int nreturn_vals;
@ -172,13 +172,13 @@ gimp_unit_set_deletion_flag (GUnit unit,
}
gfloat
gdouble
gimp_unit_get_factor (GUnit unit)
{
GParam *return_vals;
int nreturn_vals;
gfloat factor;
gdouble factor;
g_return_val_if_fail (unit >= UNIT_INCH, 1.0);

View file

@ -453,9 +453,10 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
gum->selection = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (gum->selection),
"unitselection", "Gimp");
"unit_selection", "Gimp");
gtk_window_set_title (GTK_WINDOW (gum->selection), _("Unit Selection"));
gtk_window_set_policy (GTK_WINDOW(gum->selection), FALSE, TRUE, FALSE);
gtk_window_set_policy (GTK_WINDOW (gum->selection), FALSE, TRUE, FALSE);
gtk_window_position (GTK_WINDOW (gum->selection), GTK_WIN_POS_MOUSE);
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (gum->selection)->vbox), vbox);

View file

@ -67,13 +67,13 @@ gint gimp_unit_get_number_of_built_in_units (void);
* set to TRUE. You will have to set it to FALSE after creation to make
* the unit definition persistant.
*/
GUnit gimp_unit_new (gchar *identifier,
gfloat factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural);
GUnit gimp_unit_new (gchar *identifier,
gdouble factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural);
/* The following functions fall back to inch (not pixel, as pixel is not
* a 'real' unit) if the value passed is out of range.
@ -93,7 +93,7 @@ void gimp_unit_set_deletion_flag (GUnit unit,
*
* Returns 0 for unit == UNIT_PIXEL as we don't have resolution info here
*/
gfloat gimp_unit_get_factor (GUnit unit);
gdouble gimp_unit_get_factor (GUnit unit);
/* The following function gives a hint how many digits a spinbutton
* should provide to get approximately the accuracy of an inch-spinbutton

View file

@ -46,23 +46,22 @@ enum {
struct _GimpSizeEntryField
{
GimpSizeEntry *gse;
gint index;
gfloat resolution;
gfloat lower;
gfloat upper;
gdouble resolution;
gdouble lower;
gdouble upper;
GtkObject *value_adjustment;
GtkWidget *value_spinbutton;
gfloat value;
gfloat min_value;
gfloat max_value;
gdouble value;
gdouble min_value;
gdouble max_value;
GtkObject *refval_adjustment;
GtkWidget *refval_spinbutton;
gfloat refval;
gfloat min_refval;
gfloat max_refval;
gdouble refval;
gdouble min_refval;
gdouble max_refval;
gint refval_digits;
gint stop_recursion;
@ -221,7 +220,6 @@ gimp_size_entry_new (gint number_of_fields,
gse->fields = g_slist_append (gse->fields, gsef);
gsef->gse = gse;
gsef->index = i;
gsef->resolution = 1.0; /* just to avoid division by zero */
gsef->lower = 0.0;
gsef->upper = 100.0;
@ -343,7 +341,6 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
gse->number_of_fields++;
gsef->gse = gse;
gsef->index = 0;
gsef->resolution = 1.0; /* just to avoid division by zero */
gsef->lower = 0.0;
gsef->upper = 100.0;
@ -431,7 +428,7 @@ gimp_size_entry_attach_label (GimpSizeEntry *gse,
void
gimp_size_entry_set_resolution (GimpSizeEntry *gse,
gint field,
gfloat resolution,
gdouble resolution,
guint keep_size)
{
GimpSizeEntryField *gsef;
@ -461,8 +458,8 @@ gimp_size_entry_set_resolution (GimpSizeEntry *gse,
void
gimp_size_entry_set_size (GimpSizeEntry *gse,
gint field,
gfloat lower,
gfloat upper)
gdouble lower,
gdouble upper)
{
GimpSizeEntryField *gsef;
@ -484,8 +481,8 @@ gimp_size_entry_set_size (GimpSizeEntry *gse,
void
gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
gint field,
gfloat lower,
gfloat upper)
gdouble lower,
gdouble upper)
{
GimpSizeEntryField *gsef;
@ -552,7 +549,7 @@ gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
gimp_size_entry_set_value (gse, field, gsef->value);
}
gfloat
gdouble
gimp_size_entry_get_value (GimpSizeEntry *gse,
gint field)
{
@ -568,7 +565,7 @@ gimp_size_entry_get_value (GimpSizeEntry *gse,
static void
gimp_size_entry_update_value (GimpSizeEntryField *gsef,
gfloat value)
gdouble value)
{
if (gsef->stop_recursion > 1)
return;
@ -619,7 +616,7 @@ gimp_size_entry_update_value (GimpSizeEntryField *gsef,
void
gimp_size_entry_set_value (GimpSizeEntry *gse,
gint field,
gfloat value)
gdouble value)
{
GimpSizeEntryField *gsef;
@ -642,7 +639,7 @@ gimp_size_entry_value_callback (GtkWidget *widget,
gpointer data)
{
GimpSizeEntryField *gsef;
gfloat new_value;
gdouble new_value;
gsef = (GimpSizeEntryField*) data;
@ -662,8 +659,8 @@ gimp_size_entry_value_callback (GtkWidget *widget,
void
gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse,
gint field,
gfloat lower,
gfloat upper)
gdouble lower,
gdouble upper)
{
GimpSizeEntryField *gsef;
@ -761,7 +758,7 @@ gimp_size_entry_set_refval_digits (GimpSizeEntry *gse,
}
}
gfloat
gdouble
gimp_size_entry_get_refval (GimpSizeEntry *gse,
gint field)
{
@ -778,7 +775,7 @@ gimp_size_entry_get_refval (GimpSizeEntry *gse,
static void
gimp_size_entry_update_refval (GimpSizeEntryField *gsef,
gfloat refval)
gdouble refval)
{
if (gsef->stop_recursion > 1)
return;
@ -827,7 +824,7 @@ gimp_size_entry_update_refval (GimpSizeEntryField *gsef,
void
gimp_size_entry_set_refval (GimpSizeEntry *gse,
gint field,
gfloat refval)
gdouble refval)
{
GimpSizeEntryField *gsef;
@ -853,7 +850,7 @@ gimp_size_entry_refval_callback (GtkWidget *widget,
gpointer data)
{
GimpSizeEntryField *gsef;
gfloat new_refval;
gdouble new_refval;
gsef = (GimpSizeEntryField*) data;

View file

@ -16,7 +16,6 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_SIZE_ENTRY_H__
#define __GIMP_SIZE_ENTRY_H__
@ -133,7 +132,7 @@ void gimp_size_entry_attach_label (GimpSizeEntry *gse,
*/
void gimp_size_entry_set_resolution (GimpSizeEntry *gse,
gint field,
gfloat resolution,
gdouble resolution,
guint keep_size);
/* this one sets the values (in pixels) which will be treated as
@ -143,8 +142,8 @@ void gimp_size_entry_set_resolution (GimpSizeEntry *gse,
*/
void gimp_size_entry_set_size (GimpSizeEntry *gse,
gint field,
gfloat lower,
gfloat upper);
gdouble lower,
gdouble upper);
/* these functions set/return the value in the units the user selected
* note that in some cases where the caller chooses not to have the
@ -153,13 +152,13 @@ void gimp_size_entry_set_size (GimpSizeEntry *gse,
*/
void gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
gint field,
gfloat lower,
gfloat upper);
gfloat gimp_size_entry_get_value (GimpSizeEntry *gse,
gdouble lower,
gdouble upper);
gdouble gimp_size_entry_get_value (GimpSizeEntry *gse,
gint field);
void gimp_size_entry_set_value (GimpSizeEntry *gse,
gint field,
gfloat value);
gdouble value);
/* these functions set/return the value in the 'reference unit' for the
* current update policy
@ -171,16 +170,16 @@ void gimp_size_entry_set_value (GimpSizeEntry *gse,
*/
void gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse,
gint field,
gfloat lower,
gfloat upper);
gdouble lower,
gdouble upper);
void gimp_size_entry_set_refval_digits (GimpSizeEntry *gse,
gint field,
gint digits);
gfloat gimp_size_entry_get_refval (GimpSizeEntry *gse,
gdouble gimp_size_entry_get_refval (GimpSizeEntry *gse,
gint field);
void gimp_size_entry_set_refval (GimpSizeEntry *gse,
gint field,
gfloat refval);
gdouble refval);
/* these functions set/return the currently used unit
* note that for GIMP_SIZE_ENTRY_UPDATE_SIZE a value of UNIT_PIXEL

View file

@ -453,9 +453,10 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
gum->selection = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (gum->selection),
"unitselection", "Gimp");
"unit_selection", "Gimp");
gtk_window_set_title (GTK_WINDOW (gum->selection), _("Unit Selection"));
gtk_window_set_policy (GTK_WINDOW(gum->selection), FALSE, TRUE, FALSE);
gtk_window_set_policy (GTK_WINDOW (gum->selection), FALSE, TRUE, FALSE);
gtk_window_position (GTK_WINDOW (gum->selection), GTK_WIN_POS_MOUSE);
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (gum->selection)->vbox), vbox);

View file

@ -1270,13 +1270,13 @@ newsprint_dialog (GDrawable *drawable)
#ifdef GIMP_HAVE_RESOLUTION_INFO
{
float xres, yres;
gimp_image_get_resolution(gimp_drawable_image_id(drawable->id),
&xres, &yres);
/* XXX hack: should really note both resolutions, and use
* rectangular cells, not square cells. But I'm being lazy,
* and the majority of the world works with xres == yres */
pvals_ui.input_spi = xres;
double xres, yres;
gimp_image_get_resolution(gimp_drawable_image_id(drawable->id),
&xres, &yres);
/* XXX hack: should really note both resolutions, and use
* rectangular cells, not square cells. But I'm being lazy,
* and the majority of the world works with xres == yres */
pvals_ui.input_spi = xres;
}
#endif

View file

@ -37,6 +37,39 @@
* Revision History:
*
* $Log$
* Revision 1.18 1999/05/22 17:56:32 mitch
* 1999-05-22 Michael Natterer <mitschel@cs.tu-berlin.de>
*
* * app/[all files with resolution info]
* * libgimp/gimp.h
* * libgimp/gimpimage.c
* * libgimp/gimpsizeentry.[ch]
* * libgimp/gimpunit.[ch]
* * plug-ins/newsprint/newsprint.c
* * plug-ins/pgn/png.c
* * plug-ins/tiff/tiff.c: double instead of float for all resolution
* and unit-factor variables.
*
* * app/commands.c
* * app/crop.c
* * app/interface.c
* * app/layers_dialog.c
* * app/move_tool.c
* * app/resize.c
* * app/rotate_tool.c
* * app/scale_tool.c: pass the image's unit *and* gdisp->dot_for_dot
* to all functions which create sizeentries. Never create a
* sizeentry with UNIT_PIXEL but with the image's unit and set it's
* unit to UNIT_PIXEL after creation if dot_for_dot is on.
* This way the image's unit can always be picked from the menu
* without selecting "More...".
*
* * app/interface.c: made the query_*_box() functions use the
* ActionArea.
*
* * plug-ins/gimpunitmenu.c: GTK_WIN_POS_MOUSE for the unit
* selection dialog.
*
* Revision 1.17 1999/05/04 17:20:05 mitch
* 1999-05-02 Michael Natterer <mitschel@cs.tu-berlin.de>
*
@ -668,12 +701,12 @@ load_image(char *filename) /* I - File to load */
{
if (info->phys_unit_type == PNG_RESOLUTION_METER)
gimp_image_set_resolution(image,
((float) info->x_pixels_per_unit) * 0.0254,
((float) info->y_pixels_per_unit) * 0.0254);
((double) info->x_pixels_per_unit) * 0.0254,
((double) info->y_pixels_per_unit) * 0.0254);
else /* set aspect ratio as resolution */
gimp_image_set_resolution(image,
((float) info->x_pixels_per_unit),
((float) info->y_pixels_per_unit));
((double) info->x_pixels_per_unit),
((double) info->y_pixels_per_unit));
}
#endif /* GIMP_HAVE_RESOLUTION_INFO */
@ -793,7 +826,7 @@ save_image(char *filename, /* I - File to save to */
guchar **pixels, /* Pixel rows */
*pixel; /* Pixel data */
char progress[255]; /* Title for progress display... */
float xres, yres; /* GIMP resolution (dpi) */
gdouble xres, yres; /* GIMP resolution (dpi) */
gdouble gamma;
/*

View file

@ -518,7 +518,7 @@ static gint32 load_image (char *filename) {
/* now set the new image's resolution info */
gimp_image_set_resolution (image, xres, yres);
if (unit != UNIT_PIXEL)
gimp_image_set_unit(image, unit);
gimp_image_set_unit (image, unit);
}
/* no x res tag => we assume we have no resolution info, so we
@ -1138,33 +1138,33 @@ static gint save_image (char *filename, gint32 image, gint32 layer) {
#ifdef GIMP_HAVE_RESOLUTION_INFO
/* resolution fields */
{
float xresolution;
float yresolution;
unsigned short save_unit = RESUNIT_INCH;
GUnit unit;
float factor;
double xresolution;
double yresolution;
unsigned short save_unit = RESUNIT_INCH;
GUnit unit;
float factor;
gimp_image_get_resolution (image, &xresolution, &yresolution);
unit = gimp_image_get_unit (image);
factor = gimp_unit_get_factor (unit);
gimp_image_get_resolution (image, &xresolution, &yresolution);
unit = gimp_image_get_unit (image);
factor = gimp_unit_get_factor (unit);
/* if we have a metric unit, save the resolution as centimeters
*/
if ((ABS(factor - 0.0254) < 1e-5) || /* m */
(ABS(factor - 0.254) < 1e-5) || /* why not ;) */
(ABS(factor - 2.54) < 1e-5) || /* cm */
(ABS(factor - 25.4) < 1e-5)) /* mm */
{
save_unit = RESUNIT_CENTIMETER;
xresolution /= 2.54;
yresolution /= 2.54;
}
if (xresolution > 1e-5 && yresolution > 1e-5)
/* if we have a metric unit, save the resolution as centimeters
*/
if ((ABS(factor - 0.0254) < 1e-5) || /* m */
(ABS(factor - 0.254) < 1e-5) || /* why not ;) */
(ABS(factor - 2.54) < 1e-5) || /* cm */
(ABS(factor - 25.4) < 1e-5)) /* mm */
{
TIFFSetField (tif, TIFFTAG_XRESOLUTION, xresolution);
TIFFSetField (tif, TIFFTAG_YRESOLUTION, yresolution);
TIFFSetField (tif, TIFFTAG_RESOLUTIONUNIT, save_unit);
save_unit = RESUNIT_CENTIMETER;
xresolution /= 2.54;
yresolution /= 2.54;
}
if (xresolution > 1e-5 && yresolution > 1e-5)
{
TIFFSetField (tif, TIFFTAG_XRESOLUTION, xresolution);
TIFFSetField (tif, TIFFTAG_YRESOLUTION, yresolution);
TIFFSetField (tif, TIFFTAG_RESOLUTIONUNIT, save_unit);
}
}
#endif /* GIMP_HAVE_RESOLUTION_INFO */

View file

@ -1270,13 +1270,13 @@ newsprint_dialog (GDrawable *drawable)
#ifdef GIMP_HAVE_RESOLUTION_INFO
{
float xres, yres;
gimp_image_get_resolution(gimp_drawable_image_id(drawable->id),
&xres, &yres);
/* XXX hack: should really note both resolutions, and use
* rectangular cells, not square cells. But I'm being lazy,
* and the majority of the world works with xres == yres */
pvals_ui.input_spi = xres;
double xres, yres;
gimp_image_get_resolution(gimp_drawable_image_id(drawable->id),
&xres, &yres);
/* XXX hack: should really note both resolutions, and use
* rectangular cells, not square cells. But I'm being lazy,
* and the majority of the world works with xres == yres */
pvals_ui.input_spi = xres;
}
#endif

Some files were not shown because too many files have changed in this diff Show more