From ebebafc09518010ca6cd9a4dc23f79ac3f4fb2a7 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 30 Jan 2002 01:47:27 +0000 Subject: [PATCH] Revert the last changes to make the number of digits only effect drawing, Tue Jan 29 20:38:04 2002 Owen Taylor * gtk/gtkscale.[ch]: Revert the last changes to make the number of digits only effect drawing, instead, don't round unless we are in the 'draw_value' mode -- this is the behavior of GTK+-1.2, and keeps the behavior that if the user sees a displayed value, it is the correct value. --- ChangeLog | 10 +++++++++- ChangeLog.pre-2-0 | 10 +++++++++- ChangeLog.pre-2-10 | 10 +++++++++- ChangeLog.pre-2-2 | 10 +++++++++- ChangeLog.pre-2-4 | 10 +++++++++- ChangeLog.pre-2-6 | 10 +++++++++- ChangeLog.pre-2-8 | 10 +++++++++- gtk/gtkscale.c | 23 +++++++++++++++-------- gtk/gtkscale.h | 2 +- 9 files changed, 79 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index fbf6159a9..9998d1087 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Tue Jan 29 20:38:04 2002 Owen Taylor + + * gtk/gtkscale.[ch]: Revert the last changes to make the + number of digits only effect drawing, instead, don't + round unless we are in the 'draw_value' mode -- this + is the behavior of GTK+-1.2, and keeps the behavior that + if the user sees a displayed value, it is the correct value. + Tue Jan 29 19:51:05 2002 Owen Taylor * gtk/gtkenums.h: Deprecate GtkPreviewType, @@ -413,7 +421,7 @@ Wed Jan 23 15:12:16 2002 Owen Taylor Wed Jan 23 14:44:12 2002 Owen Taylor - * gtk/gtkspinbutton.c (EPSILON): Decreate value since + * gtk/gtkspinbutton.c (EPSILON): Decrease value since we now use doubles. Tue Jan 22 16:58:37 2002 Jonathan Blandford diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index fbf6159a9..9998d1087 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,11 @@ +Tue Jan 29 20:38:04 2002 Owen Taylor + + * gtk/gtkscale.[ch]: Revert the last changes to make the + number of digits only effect drawing, instead, don't + round unless we are in the 'draw_value' mode -- this + is the behavior of GTK+-1.2, and keeps the behavior that + if the user sees a displayed value, it is the correct value. + Tue Jan 29 19:51:05 2002 Owen Taylor * gtk/gtkenums.h: Deprecate GtkPreviewType, @@ -413,7 +421,7 @@ Wed Jan 23 15:12:16 2002 Owen Taylor Wed Jan 23 14:44:12 2002 Owen Taylor - * gtk/gtkspinbutton.c (EPSILON): Decreate value since + * gtk/gtkspinbutton.c (EPSILON): Decrease value since we now use doubles. Tue Jan 22 16:58:37 2002 Jonathan Blandford diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index fbf6159a9..9998d1087 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +Tue Jan 29 20:38:04 2002 Owen Taylor + + * gtk/gtkscale.[ch]: Revert the last changes to make the + number of digits only effect drawing, instead, don't + round unless we are in the 'draw_value' mode -- this + is the behavior of GTK+-1.2, and keeps the behavior that + if the user sees a displayed value, it is the correct value. + Tue Jan 29 19:51:05 2002 Owen Taylor * gtk/gtkenums.h: Deprecate GtkPreviewType, @@ -413,7 +421,7 @@ Wed Jan 23 15:12:16 2002 Owen Taylor Wed Jan 23 14:44:12 2002 Owen Taylor - * gtk/gtkspinbutton.c (EPSILON): Decreate value since + * gtk/gtkspinbutton.c (EPSILON): Decrease value since we now use doubles. Tue Jan 22 16:58:37 2002 Jonathan Blandford diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index fbf6159a9..9998d1087 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,11 @@ +Tue Jan 29 20:38:04 2002 Owen Taylor + + * gtk/gtkscale.[ch]: Revert the last changes to make the + number of digits only effect drawing, instead, don't + round unless we are in the 'draw_value' mode -- this + is the behavior of GTK+-1.2, and keeps the behavior that + if the user sees a displayed value, it is the correct value. + Tue Jan 29 19:51:05 2002 Owen Taylor * gtk/gtkenums.h: Deprecate GtkPreviewType, @@ -413,7 +421,7 @@ Wed Jan 23 15:12:16 2002 Owen Taylor Wed Jan 23 14:44:12 2002 Owen Taylor - * gtk/gtkspinbutton.c (EPSILON): Decreate value since + * gtk/gtkspinbutton.c (EPSILON): Decrease value since we now use doubles. Tue Jan 22 16:58:37 2002 Jonathan Blandford diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index fbf6159a9..9998d1087 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +Tue Jan 29 20:38:04 2002 Owen Taylor + + * gtk/gtkscale.[ch]: Revert the last changes to make the + number of digits only effect drawing, instead, don't + round unless we are in the 'draw_value' mode -- this + is the behavior of GTK+-1.2, and keeps the behavior that + if the user sees a displayed value, it is the correct value. + Tue Jan 29 19:51:05 2002 Owen Taylor * gtk/gtkenums.h: Deprecate GtkPreviewType, @@ -413,7 +421,7 @@ Wed Jan 23 15:12:16 2002 Owen Taylor Wed Jan 23 14:44:12 2002 Owen Taylor - * gtk/gtkspinbutton.c (EPSILON): Decreate value since + * gtk/gtkspinbutton.c (EPSILON): Decrease value since we now use doubles. Tue Jan 22 16:58:37 2002 Jonathan Blandford diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index fbf6159a9..9998d1087 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +Tue Jan 29 20:38:04 2002 Owen Taylor + + * gtk/gtkscale.[ch]: Revert the last changes to make the + number of digits only effect drawing, instead, don't + round unless we are in the 'draw_value' mode -- this + is the behavior of GTK+-1.2, and keeps the behavior that + if the user sees a displayed value, it is the correct value. + Tue Jan 29 19:51:05 2002 Owen Taylor * gtk/gtkenums.h: Deprecate GtkPreviewType, @@ -413,7 +421,7 @@ Wed Jan 23 15:12:16 2002 Owen Taylor Wed Jan 23 14:44:12 2002 Owen Taylor - * gtk/gtkspinbutton.c (EPSILON): Decreate value since + * gtk/gtkspinbutton.c (EPSILON): Decrease value since we now use doubles. Tue Jan 22 16:58:37 2002 Jonathan Blandford diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index fbf6159a9..9998d1087 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +Tue Jan 29 20:38:04 2002 Owen Taylor + + * gtk/gtkscale.[ch]: Revert the last changes to make the + number of digits only effect drawing, instead, don't + round unless we are in the 'draw_value' mode -- this + is the behavior of GTK+-1.2, and keeps the behavior that + if the user sees a displayed value, it is the correct value. + Tue Jan 29 19:51:05 2002 Owen Taylor * gtk/gtkenums.h: Deprecate GtkPreviewType, @@ -413,7 +421,7 @@ Wed Jan 23 15:12:16 2002 Owen Taylor Wed Jan 23 14:44:12 2002 Owen Taylor - * gtk/gtkspinbutton.c (EPSILON): Decreate value since + * gtk/gtkspinbutton.c (EPSILON): Decrease value since we now use doubles. Tue Jan 22 16:58:37 2002 Jonathan Blandford diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c index d971a80d9..252a5dc50 100644 --- a/gtk/gtkscale.c +++ b/gtk/gtkscale.c @@ -353,7 +353,7 @@ gtk_scale_get_property (GObject *object, switch (prop_id) { case PROP_DIGITS: - g_value_set_int (value, scale->draw_digits); + g_value_set_int (value, scale->digits); break; case PROP_DRAW_VALUE: g_value_set_boolean (value, scale->draw_value); @@ -381,10 +381,11 @@ gtk_scale_init (GtkScale *scale) range->has_stepper_b = FALSE; range->has_stepper_c = FALSE; range->has_stepper_d = FALSE; - - scale->draw_digits = 1; + scale->draw_value = TRUE; scale->value_pos = GTK_POS_TOP; + scale->digits = 1; + range->round_digits = scale->digits; } void @@ -397,11 +398,13 @@ gtk_scale_set_digits (GtkScale *scale, range = GTK_RANGE (scale); - digits = CLAMP (digits, -1, MAX_DIGITS); + digits = CLAMP (digits, -1, 16); - if (scale->draw_digits != digits) + if (scale->digits != digits) { - scale->draw_digits = digits; + scale->digits = digits; + if (scale->draw_value) + range->round_digits = digits; gtk_widget_queue_resize (GTK_WIDGET (scale)); @@ -414,7 +417,7 @@ gtk_scale_get_digits (GtkScale *scale) { g_return_val_if_fail (GTK_IS_SCALE (scale), -1); - return scale->draw_digits; + return scale->digits; } void @@ -428,6 +431,10 @@ gtk_scale_set_draw_value (GtkScale *scale, if (scale->draw_value != draw_value) { scale->draw_value = draw_value; + if (draw_value) + GTK_RANGE (scale)->round_digits = scale->digits; + else + GTK_RANGE (scale)->round_digits = -1; gtk_widget_queue_resize (GTK_WIDGET (scale)); @@ -607,6 +614,6 @@ _gtk_scale_format_value (GtkScale *scale, if (fmt) return fmt; else - return g_strdup_printf ("%0.*f", scale->draw_digits, + return g_strdup_printf ("%0.*f", scale->digits, value); } diff --git a/gtk/gtkscale.h b/gtk/gtkscale.h index ecc028c60..7bfca7d77 100644 --- a/gtk/gtkscale.h +++ b/gtk/gtkscale.h @@ -52,7 +52,7 @@ struct _GtkScale { GtkRange range; - gint draw_digits; + gint digits; guint draw_value : 1; guint value_pos : 2; }; -- 2.43.2