mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-12 20:00:09 +00:00
fix default value for ::digits property, leave as 1 as per havoc's
Tue Jan 29 11:51:14 2002 Tim Janik <timj@gtk.org> * gtk/gtkscale.[hc]: fix default value for ::digits property, leave as 1 as per havoc's request. don't apply the draw_digits value to range->round_digits, so we don't perform gross quantization by default.
This commit is contained in:
parent
5d82c0a4b6
commit
c8a1ae5bce
@ -1,3 +1,10 @@
|
|||||||
|
Tue Jan 29 11:51:14 2002 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkscale.[hc]: fix default value for ::digits property,
|
||||||
|
leave as 1 as per havoc's request.
|
||||||
|
don't apply the draw_digits value to range->round_digits,
|
||||||
|
so we don't perform gross quantization by default.
|
||||||
|
|
||||||
2002-01-25 Havoc Pennington <hp@redhat.com>
|
2002-01-25 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextbtree.c (_gtk_text_btree_delete): fix assertion
|
* gtk/gtktextbtree.c (_gtk_text_btree_delete): fix assertion
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Tue Jan 29 11:51:14 2002 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkscale.[hc]: fix default value for ::digits property,
|
||||||
|
leave as 1 as per havoc's request.
|
||||||
|
don't apply the draw_digits value to range->round_digits,
|
||||||
|
so we don't perform gross quantization by default.
|
||||||
|
|
||||||
2002-01-25 Havoc Pennington <hp@redhat.com>
|
2002-01-25 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextbtree.c (_gtk_text_btree_delete): fix assertion
|
* gtk/gtktextbtree.c (_gtk_text_btree_delete): fix assertion
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Tue Jan 29 11:51:14 2002 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkscale.[hc]: fix default value for ::digits property,
|
||||||
|
leave as 1 as per havoc's request.
|
||||||
|
don't apply the draw_digits value to range->round_digits,
|
||||||
|
so we don't perform gross quantization by default.
|
||||||
|
|
||||||
2002-01-25 Havoc Pennington <hp@redhat.com>
|
2002-01-25 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextbtree.c (_gtk_text_btree_delete): fix assertion
|
* gtk/gtktextbtree.c (_gtk_text_btree_delete): fix assertion
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Tue Jan 29 11:51:14 2002 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkscale.[hc]: fix default value for ::digits property,
|
||||||
|
leave as 1 as per havoc's request.
|
||||||
|
don't apply the draw_digits value to range->round_digits,
|
||||||
|
so we don't perform gross quantization by default.
|
||||||
|
|
||||||
2002-01-25 Havoc Pennington <hp@redhat.com>
|
2002-01-25 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextbtree.c (_gtk_text_btree_delete): fix assertion
|
* gtk/gtktextbtree.c (_gtk_text_btree_delete): fix assertion
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Tue Jan 29 11:51:14 2002 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkscale.[hc]: fix default value for ::digits property,
|
||||||
|
leave as 1 as per havoc's request.
|
||||||
|
don't apply the draw_digits value to range->round_digits,
|
||||||
|
so we don't perform gross quantization by default.
|
||||||
|
|
||||||
2002-01-25 Havoc Pennington <hp@redhat.com>
|
2002-01-25 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextbtree.c (_gtk_text_btree_delete): fix assertion
|
* gtk/gtktextbtree.c (_gtk_text_btree_delete): fix assertion
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Tue Jan 29 11:51:14 2002 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkscale.[hc]: fix default value for ::digits property,
|
||||||
|
leave as 1 as per havoc's request.
|
||||||
|
don't apply the draw_digits value to range->round_digits,
|
||||||
|
so we don't perform gross quantization by default.
|
||||||
|
|
||||||
2002-01-25 Havoc Pennington <hp@redhat.com>
|
2002-01-25 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextbtree.c (_gtk_text_btree_delete): fix assertion
|
* gtk/gtktextbtree.c (_gtk_text_btree_delete): fix assertion
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
Tue Jan 29 11:51:14 2002 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gtk/gtkscale.[hc]: fix default value for ::digits property,
|
||||||
|
leave as 1 as per havoc's request.
|
||||||
|
don't apply the draw_digits value to range->round_digits,
|
||||||
|
so we don't perform gross quantization by default.
|
||||||
|
|
||||||
2002-01-25 Havoc Pennington <hp@redhat.com>
|
2002-01-25 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextbtree.c (_gtk_text_btree_delete): fix assertion
|
* gtk/gtktextbtree.c (_gtk_text_btree_delete): fix assertion
|
||||||
|
@ -32,6 +32,13 @@
|
|||||||
#include "gdk/gdkkeysyms.h"
|
#include "gdk/gdkkeysyms.h"
|
||||||
#include "gtkbindings.h"
|
#include "gtkbindings.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define MAX_DIGITS (64) /* don't change this,
|
||||||
|
* a) you don't need to and
|
||||||
|
* b) you might cause buffer owerflows in
|
||||||
|
* unrelated code portions otherwise
|
||||||
|
*/
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_DIGITS,
|
PROP_DIGITS,
|
||||||
@ -147,9 +154,9 @@ gtk_scale_class_init (GtkScaleClass *class)
|
|||||||
g_param_spec_int ("digits",
|
g_param_spec_int ("digits",
|
||||||
_("Digits"),
|
_("Digits"),
|
||||||
_("The number of decimal places that are displayed in the value"),
|
_("The number of decimal places that are displayed in the value"),
|
||||||
0,
|
-1,
|
||||||
G_MAXINT,
|
MAX_DIGITS,
|
||||||
0,
|
1,
|
||||||
G_PARAM_READWRITE));
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
@ -346,7 +353,7 @@ gtk_scale_get_property (GObject *object,
|
|||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_DIGITS:
|
case PROP_DIGITS:
|
||||||
g_value_set_int (value, scale->digits);
|
g_value_set_int (value, scale->draw_digits);
|
||||||
break;
|
break;
|
||||||
case PROP_DRAW_VALUE:
|
case PROP_DRAW_VALUE:
|
||||||
g_value_set_boolean (value, scale->draw_value);
|
g_value_set_boolean (value, scale->draw_value);
|
||||||
@ -374,11 +381,10 @@ gtk_scale_init (GtkScale *scale)
|
|||||||
range->has_stepper_b = FALSE;
|
range->has_stepper_b = FALSE;
|
||||||
range->has_stepper_c = FALSE;
|
range->has_stepper_c = FALSE;
|
||||||
range->has_stepper_d = FALSE;
|
range->has_stepper_d = FALSE;
|
||||||
|
|
||||||
|
scale->draw_digits = 1;
|
||||||
scale->draw_value = TRUE;
|
scale->draw_value = TRUE;
|
||||||
scale->value_pos = GTK_POS_TOP;
|
scale->value_pos = GTK_POS_TOP;
|
||||||
scale->digits = 1;
|
|
||||||
range->round_digits = scale->digits;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -391,12 +397,11 @@ gtk_scale_set_digits (GtkScale *scale,
|
|||||||
|
|
||||||
range = GTK_RANGE (scale);
|
range = GTK_RANGE (scale);
|
||||||
|
|
||||||
digits = CLAMP (digits, -1, 16);
|
digits = CLAMP (digits, -1, MAX_DIGITS);
|
||||||
|
|
||||||
if (scale->digits != digits)
|
if (scale->draw_digits != digits)
|
||||||
{
|
{
|
||||||
scale->digits = digits;
|
scale->draw_digits = digits;
|
||||||
range->round_digits = digits;
|
|
||||||
|
|
||||||
gtk_widget_queue_resize (GTK_WIDGET (scale));
|
gtk_widget_queue_resize (GTK_WIDGET (scale));
|
||||||
|
|
||||||
@ -409,7 +414,7 @@ gtk_scale_get_digits (GtkScale *scale)
|
|||||||
{
|
{
|
||||||
g_return_val_if_fail (GTK_IS_SCALE (scale), -1);
|
g_return_val_if_fail (GTK_IS_SCALE (scale), -1);
|
||||||
|
|
||||||
return scale->digits;
|
return scale->draw_digits;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -602,6 +607,6 @@ _gtk_scale_format_value (GtkScale *scale,
|
|||||||
if (fmt)
|
if (fmt)
|
||||||
return fmt;
|
return fmt;
|
||||||
else
|
else
|
||||||
return g_strdup_printf ("%0.*f", scale->digits,
|
return g_strdup_printf ("%0.*f", scale->draw_digits,
|
||||||
value);
|
value);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ struct _GtkScale
|
|||||||
{
|
{
|
||||||
GtkRange range;
|
GtkRange range;
|
||||||
|
|
||||||
gint digits;
|
gint draw_digits;
|
||||||
guint draw_value : 1;
|
guint draw_value : 1;
|
||||||
guint value_pos : 2;
|
guint value_pos : 2;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user