From 8427faf1fb7f704c4d3161ab80639e685845508b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 6 Jul 2013 01:40:17 +0200 Subject: proper peak-indicator threshold config widget --- gtk2_ardour/option_editor.h | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'gtk2_ardour/option_editor.h') diff --git a/gtk2_ardour/option_editor.h b/gtk2_ardour/option_editor.h index d39abfa810..1ee4baa938 100644 --- a/gtk2_ardour/option_editor.h +++ b/gtk2_ardour/option_editor.h @@ -310,7 +310,31 @@ public: _hscale = manage (new Gtk::HScale(adj)); } - void set_state_from_config () { } + HSliderOption ( + std::string const & i, + std::string const & n, + Gtk::Adjustment *adj, + sigc::slot g, + sigc::slot s + ) + : Option (i, n) + , _get (g) + , _set (s) + , _adj (adj) + { + _label = manage (new Gtk::Label (n + ":")); + _label->set_alignment (0, 0.5); + _hscale = manage (new Gtk::HScale(*_adj)); + _adj->signal_value_changed().connect (sigc::mem_fun (*this, &HSliderOption::changed)); + } + + void set_state_from_config () { + if (_adj) _adj->set_value (_get()); + } + + void changed () { + if (_adj) _set (_adj->get_value ()); + } void add_to_page (OptionEditorPage* p) { @@ -324,8 +348,11 @@ public: Gtk::Widget& tip_widget() { return *_hscale; } private: + sigc::slot _get; + sigc::slot _set; Gtk::Label* _label; Gtk::HScale* _hscale; + Gtk::Adjustment* _adj; }; /** Component which provides the UI to handle an enumerated option using a GTK ComboBox. -- cgit v1.2.3