Re: fixing GtkScale default quantization



Tim Janik <timj gtk org> writes:

> > The patch makes sense to me, I don't have any memory of why there's a
> > separate digits field in GtkScale. (The only reason I can think of is
> > that scale->digits doesn't actually change what's in the adjustment,
> > only changes what's displayed; while range->round_digits does change 
> > what goes in the adjustment; but probably the displayed value should
> > match what gets set on the adjustment.)
> > 
> > However IMO the default should remain 1 not -1, because for the vast
> > majority of scales you never want to see numbers like 5.234265109 and
> > you don't want the number of displayed decimal places to keep
> > changing. Perhaps the default should be 2 or 3, but it should be a
> > small fixed number.
> 
> i see, this is about the number _display_.
> the main point of my patch is fixing the value quantization however.
> by default, sliders with an adjustment ranging from say 0.3 to 0.6 shouldn't
> snap to 0.3, 0.4, 0.5, 0.6 as the only possible positions.
> i.e. gtk_scale_set_digits() should affect the printf format only, but
> not range->round_digits.
> there should be extra API for when snapping is desired, and that'll also
> need a scaling factor, e.g. when you want the snapping, but for numbers
> like 30, 40, 50, 60.
> 
> however, that's an argument for keeping the ->digits field.

I discussed this at some length with Tim this morning on IRC, and it turns out
that the correct fix was:

Tue Jan 29 20:38:04 2002  Owen Taylor  <otaylor redhat com>

	* 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.

Regards,
                                        Owen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]