From 68991a79a8befd84ef9af0fd4ee9922e149c5205 Mon Sep 17 00:00:00 2001 From: nicholasbishop Date: Thu, 26 Jul 2007 09:08:25 +0000 Subject: [PATCH] SpinSlider: If the digits value is set to zero, truncate the value when setting the attribute so it is an int, rather than a double. --- src/ui/widget/spin-slider.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ui/widget/spin-slider.cpp b/src/ui/widget/spin-slider.cpp index a76f1db49..311d09963 100644 --- a/src/ui/widget/spin-slider.cpp +++ b/src/ui/widget/spin-slider.cpp @@ -32,7 +32,12 @@ SpinSlider::SpinSlider(double value, double lower, double upper, double step_inc Glib::ustring SpinSlider::get_as_attribute() const { - return Glib::Ascii::dtostr((int)_adjustment.get_value()); + const double val = _adjustment.get_value(); + + if(_spin.get_digits() == 0) + return Glib::Ascii::dtostr((int)val); + else + return Glib::Ascii::dtostr(val); } void SpinSlider::set_from_attribute(SPObject* o) -- 2.30.2