proper peak-indicator threshold config widget

This commit is contained in:
Robin Gareus 2013-07-06 01:40:17 +02:00
parent 6d09070895
commit 8427faf1fb
2 changed files with 40 additions and 8 deletions

View File

@ -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<float> g,
sigc::slot<bool, float> 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<float> _get;
sigc::slot<bool, float> _set;
Gtk::Label* _label;
Gtk::HScale* _hscale;
Gtk::Adjustment* _adj;
};
/** Component which provides the UI to handle an enumerated option using a GTK ComboBox.

View File

@ -1938,13 +1938,18 @@ RCOptionEditor::RCOptionEditor ()
add_option (S_("Preferences|GUI"), mlu);
add_option (S_("Preferences|GUI"),
new FaderOption (
"meter-peak",
_("Meter Peak Threshold"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_meter_peak),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_meter_peak)
));
Gtk::Adjustment *mpk = manage (new Gtk::Adjustment(-.1, -10, 0, .01, .1));
HSliderOption *mpks = new HSliderOption("meter-peak", _("Meter peak threshold [dBFS]"),
mpk,
sigc::mem_fun (*_rc_config, &RCConfiguration::get_meter_peak),
sigc::mem_fun (*_rc_config, &RCConfiguration::set_meter_peak)
);
Gtkmm2ext::UI::instance()->set_tip
(mpks->tip_widget(),
_("Specify the audio signal level in dbFS at and above which the meter-peak indicator will flash red."));
add_option (S_("Preferences|GUI"), mpks);
}
void