From 1173bae7c20e1d7763ae092b1b98c92835b1562f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 19 Jun 2012 22:05:04 +0000 Subject: Clarify the meaning of the show-region-gain-envelopes option. git-svn-id: svn://localhost/ardour2/branches/3.0@12790 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/option_editor.cc | 54 +++++++++++++++++++++++++++++++++++++++++ gtk2_ardour/option_editor.h | 33 ++++++++++++++++++++++++- gtk2_ardour/rc_option_editor.cc | 4 ++- 3 files changed, 89 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc index e1946002c1..a6fcc734c5 100644 --- a/gtk2_ardour/option_editor.cc +++ b/gtk2_ardour/option_editor.cc @@ -163,6 +163,60 @@ EntryOption::activated () _set (_entry->get_text ()); } +/** Construct a BoolComboOption. + * @param i id + * @param n User-visible name. + * @param t Text to give for the variable being true. + * @param f Text to give for the variable being false. + * @param g Slot to get the variable's value. + * @param s Slot to set the variable's value. + */ +BoolComboOption::BoolComboOption ( + string const & i, string const & n, string const & t, string const & f, + sigc::slot g, sigc::slot s + ) + : Option (i, n) + , _get (g) + , _set (s) +{ + _label = manage (new Label (n + ":")); + _label->set_alignment (0, 0.5); + _combo = manage (new ComboBoxText); + + /* option 0 is the false option */ + _combo->append_text (f); + /* and option 1 is the true */ + _combo->append_text (t); + + _combo->signal_changed().connect (sigc::mem_fun (*this, &BoolComboOption::changed)); +} + +void +BoolComboOption::set_state_from_config () +{ + _combo->set_active (_get() ? 1 : 0); +} + +void +BoolComboOption::add_to_page (OptionEditorPage* p) +{ + add_widgets_to_page (p, _label, _combo); +} + +void +BoolComboOption::changed () +{ + _set (_combo->get_active_row_number () == 0 ? false : true); +} + +void +BoolComboOption::set_sensitive (bool yn) +{ + _combo->set_sensitive (yn); +} + + + FaderOption::FaderOption (string const & i, string const & n, sigc::slot g, sigc::slot s) : Option (i, n) , _db_adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0, 1, 0.01, 0.1) diff --git a/gtk2_ardour/option_editor.h b/gtk2_ardour/option_editor.h index 5d6a48a024..b896411a71 100644 --- a/gtk2_ardour/option_editor.h +++ b/gtk2_ardour/option_editor.h @@ -192,7 +192,7 @@ private: }; -/** Component which provides the UI to handle an enumerated option using a GTK CheckButton. +/** Component which provides the UI to handle an enumerated option using a GTK ComboBox. * The template parameter is the enumeration. */ template @@ -273,6 +273,37 @@ private: }; +/** Component which provides the UI to handle a boolean option which needs + * to be represented as a ComboBox to be clear to the user. + */ +class BoolComboOption : public Option +{ +public: + + BoolComboOption ( + std::string const &, + std::string const &, + std::string const &, + std::string const &, + sigc::slot, + sigc::slot + ); + + void set_state_from_config (); + void add_to_page (OptionEditorPage *); + void changed (); + void set_sensitive (bool); + +private: + + sigc::slot _get; + sigc::slot _set; + Gtk::Label* _label; + Gtk::ComboBoxText* _combo; +}; + + + /** Component which provides the UI to handle an numeric option using a GTK SpinButton */ template class SpinOption : public Option diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 362f421013..9ba83021d5 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -1063,9 +1063,11 @@ RCOptionEditor::RCOptionEditor () )); add_option (_("Editor"), - new BoolOption ( + new BoolComboOption ( "show-region-gain-envelopes", _("Show gain envelopes in audio regions"), + _("in all modes"), + _("only in region gain mode"), sigc::mem_fun (*_rc_config, &RCConfiguration::get_show_region_gain), sigc::mem_fun (*_rc_config, &RCConfiguration::set_show_region_gain) )); -- cgit v1.2.3