use rint(). The old behaviour was broken for neagtive values.

2000-11-27  Sven Neumann  <sven@gimp.org>

	* libgimp/gimpwidgets.c (gimp_int_adjustment_update): use rint().
	The old behaviour was broken for neagtive values.
This commit is contained in:
Sven Neumann
2000-11-27 14:39:58 +00:00
committed by Sven Neumann
parent af3aec76bb
commit ceab8aa358
3 changed files with 11 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2000-11-27 Sven Neumann <sven@gimp.org>
* libgimp/gimpwidgets.c (gimp_int_adjustment_update): use rint().
The old behaviour was broken for neagtive values.
2000-11-27 Michael Natterer <mitch@gimp.org> 2000-11-27 Michael Natterer <mitch@gimp.org>
* plug-ins/print/README * plug-ins/print/README

View File

@ -1007,7 +1007,7 @@ gimp_mem_size_entry_new (GtkAdjustment *adjustment)
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
if ( (gint)adjustment->value % (mem_size_unit * 1024) != 0 ) if ( (gint) adjustment->value % (mem_size_unit * 1024) != 0 )
break; break;
mem_size_unit *= 1024; mem_size_unit *= 1024;
} }
@ -1221,7 +1221,7 @@ gimp_menu_item_update (GtkWidget *widget,
* value. * value.
* *
* Note that the #GtkAdjustment's value (which is a #gfloat) will be rounded * Note that the #GtkAdjustment's value (which is a #gfloat) will be rounded
* with (#gint) (value + 0.5). * with (#gint) rint (value).
**/ **/
void void
gimp_int_adjustment_update (GtkAdjustment *adjustment, gimp_int_adjustment_update (GtkAdjustment *adjustment,
@ -1230,7 +1230,7 @@ gimp_int_adjustment_update (GtkAdjustment *adjustment,
gint *val; gint *val;
val = (gint *) data; val = (gint *) data;
*val = (gint) (adjustment->value + 0.5); *val = (gint) rint (adjustment->value);
} }
/** /**

View File

@ -1007,7 +1007,7 @@ gimp_mem_size_entry_new (GtkAdjustment *adjustment)
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
if ( (gint)adjustment->value % (mem_size_unit * 1024) != 0 ) if ( (gint) adjustment->value % (mem_size_unit * 1024) != 0 )
break; break;
mem_size_unit *= 1024; mem_size_unit *= 1024;
} }
@ -1221,7 +1221,7 @@ gimp_menu_item_update (GtkWidget *widget,
* value. * value.
* *
* Note that the #GtkAdjustment's value (which is a #gfloat) will be rounded * Note that the #GtkAdjustment's value (which is a #gfloat) will be rounded
* with (#gint) (value + 0.5). * with (#gint) rint (value).
**/ **/
void void
gimp_int_adjustment_update (GtkAdjustment *adjustment, gimp_int_adjustment_update (GtkAdjustment *adjustment,
@ -1230,7 +1230,7 @@ gimp_int_adjustment_update (GtkAdjustment *adjustment,
gint *val; gint *val;
val = (gint *) data; val = (gint *) data;
*val = (gint) (adjustment->value + 0.5); *val = (gint) rint (adjustment->value);
} }
/** /**