Only emit signal_value_changed from Slider when it actually changed
Use font ascent instead of size to align horizontally
max(1),
value(0),
step(0.1)
+{ }
+
+void Slider::set_range(double a, double b)
{
+ min=a;
+ max=b;
+ set_value(value);
+}
+
+void Slider::set_step(double s)
+{
+ step=s;
+ set_value(value);
}
void Slider::set_value(double v)
{
+ double old_value=value;
+
if(v<min)
value=min;
else if(v>max)
value=min+steps*step;
}
- signal_value_changed.emit(value);
+ if(value!=old_value)
+ signal_value_changed.emit(value);
}
} // namespace GLtk
GL::push_matrix();
- part.get_alignment().apply(geom, text_w, static_cast<unsigned>(font_size));
+ part.get_alignment().apply(geom, text_w, static_cast<unsigned>(font->get_ascent()*font_size));
GL::scale_uniform(font_size);
const Color &color=style->get_font_color();