13
0

reduce clumsiness of font-scale slider:

* work-around update/snap on release
* remove textual display with decimals
* towards ending the 'font-scale percent' discussion
This commit is contained in:
Robin Gareus 2014-12-28 19:29:39 +01:00
parent f3604814a4
commit 000ffe2c7e

View File

@ -533,15 +533,31 @@ class FontScalingOptions : public OptionEditorBox
public: public:
FontScalingOptions (UIConfiguration* uic) : FontScalingOptions (UIConfiguration* uic) :
_ui_config (uic), _ui_config (uic),
_dpi_adjustment (50, 50, 250, 1, 10), _dpi_adjustment (100, 50, 250, 1, 5),
_dpi_slider (_dpi_adjustment) _dpi_slider (_dpi_adjustment)
{ {
_dpi_adjustment.set_value (floor ((double)(uic->get_font_scale () / 1024))); _dpi_adjustment.set_value (_ui_config->get_font_scale() / 1024.);
Label* l = manage (new Label (_("Font scaling:"))); Label* l = manage (new Label (_("Font scaling:")));
l->set_name ("OptionsLabel"); l->set_name ("OptionsLabel");
const Glib::ustring dflt = _("Default");
const Glib::ustring empty = X_(""); // despite gtk-doc saying so, NULL does not work as reference
_dpi_slider.set_update_policy (UPDATE_DISCONTINUOUS); _dpi_slider.set_update_policy (UPDATE_DISCONTINUOUS);
_dpi_slider.set_draw_value(false);
_dpi_slider.add_mark(50, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(60, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(70, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(80, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(90, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(100, Gtk::POS_TOP, dflt);
_dpi_slider.add_mark(125, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(150, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(175, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(200, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(225, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(250, Gtk::POS_TOP, empty);
HBox* h = manage (new HBox); HBox* h = manage (new HBox);
h->set_spacing (4); h->set_spacing (4);
h->pack_start (*l, false, false); h->pack_start (*l, false, false);
@ -557,7 +573,7 @@ public:
void parameter_changed (string const & p) void parameter_changed (string const & p)
{ {
if (p == "font-scale") { if (p == "font-scale") {
_dpi_adjustment.set_value (floor ((double)(_ui_config->get_font_scale() / 1024))); _dpi_adjustment.set_value (_ui_config->get_font_scale() / 1024.);
} }
} }
@ -570,7 +586,7 @@ private:
void dpi_changed () void dpi_changed ()
{ {
_ui_config->set_font_scale ((long) floor (_dpi_adjustment.get_value() * 1024)); _ui_config->set_font_scale ((long) floor (_dpi_adjustment.get_value() * 1024.));
/* XXX: should be triggered from the parameter changed signal */ /* XXX: should be triggered from the parameter changed signal */
reset_dpi (); reset_dpi ();
} }