From 1d97a0fb3e4f9294308f3b5718f61b9d6bd1504c Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 29 Dec 2016 21:39:03 +0100 Subject: Consolidate Preferences/OptionEditor --- gtk2_ardour/color_theme_manager.cc | 16 +- gtk2_ardour/color_theme_manager.h | 2 +- gtk2_ardour/option_editor.cc | 222 +++++++++++--- gtk2_ardour/option_editor.h | 253 ++++++---------- gtk2_ardour/rc_option_editor.cc | 550 +++++++++++++++-------------------- gtk2_ardour/session_option_editor.cc | 1 + 6 files changed, 520 insertions(+), 524 deletions(-) diff --git a/gtk2_ardour/color_theme_manager.cc b/gtk2_ardour/color_theme_manager.cc index a2553404fb..cbf341a739 100644 --- a/gtk2_ardour/color_theme_manager.cc +++ b/gtk2_ardour/color_theme_manager.cc @@ -61,14 +61,10 @@ ColorThemeManager::ColorThemeManager () , palette_window (0) , color_theme_label (_("Color Theme")) { - Label* l = manage (new Label (string_compose ("%1", _("Colors")))); - l->set_alignment (0, 0.5); - l->set_use_markup (true); - _box->pack_start (*l, false, false); - std::map color_themes; get_color_themes (color_themes); + int n = 0; if (color_themes.size() > 1) { theme_list = TreeStore::create (color_theme_columns); @@ -108,8 +104,9 @@ ColorThemeManager::ColorThemeManager () hbox->set_spacing (6); hbox->pack_start (color_theme_label, false, false); hbox->pack_start (*align, true, true); - _box->pack_start (*hbox, PACK_SHRINK); hbox->show_all (); + table.attach (*hbox, 0, 3, n, n + 1); + ++n; } reset_button.signal_clicked().connect (sigc::mem_fun (*this, &ColorThemeManager::reset_canvas_colors)); @@ -149,8 +146,9 @@ ColorThemeManager::ColorThemeManager () notebook.set_size_request (400, 400); - _box->pack_start (notebook, true, true, 6); - _box->pack_start (reset_button, false, false); + table.attach (notebook, 0, 3, n, n + 1); + ++n; + table.attach (reset_button, 0, 3, n, n + 1); color_dialog.get_colorsel()->set_has_opacity_control (true); color_dialog.get_colorsel()->set_has_palette (true); @@ -164,8 +162,6 @@ ColorThemeManager::ColorThemeManager () setup_modifiers (); UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &ColorThemeManager::colors_changed)); - - _box->show_all (); } diff --git a/gtk2_ardour/color_theme_manager.h b/gtk2_ardour/color_theme_manager.h index afb6a00fc9..21485464d8 100644 --- a/gtk2_ardour/color_theme_manager.h +++ b/gtk2_ardour/color_theme_manager.h @@ -39,7 +39,7 @@ namespace ArdourCanvas { class ArdourDialog; -class ColorThemeManager : public OptionEditorPageBox +class ColorThemeManager : public OptionEditorMiniPage { public: ColorThemeManager(); diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc index 0a71a82b0f..0aa571fbb8 100644 --- a/gtk2_ardour/option_editor.cc +++ b/gtk2_ardour/option_editor.cc @@ -91,6 +91,8 @@ OptionEditorComponent::set_note (string const & n) _note = n; } +/*--------------------------*/ + OptionEditorHeading::OptionEditorHeading (string const & h) { std::stringstream s; @@ -99,6 +101,8 @@ OptionEditorHeading::OptionEditorHeading (string const & h) _label->set_use_markup (true); } +/*--------------------------*/ + void OptionEditorHeading::add_to_page (OptionEditorPage* p) { @@ -114,50 +118,19 @@ OptionEditorHeading::add_to_page (OptionEditorPage* p) maybe_add_note (p, n + 2); } -void -OptionEditorBox::add_to_page (OptionEditorPage* p) -{ - add_widget_to_page (p, _box); -} +/*--------------------------*/ void -OptionEditorPageBox::add_to_page (OptionEditorPage* p) +OptionEditorBlank::add_to_page (OptionEditorPage* p) { int const n = p->table.property_n_rows(); - int m = n + 2; - if (!_note.empty ()) { - ++m; - } - _box->set_border_width (0); - p->table.resize (m, 3); - p->table.attach (*manage (new Label ("")), 0, 3, n, n + 1, FILL | EXPAND); - p->table.attach (*_box, 0, 3, n + 1, n + 2, FILL | EXPAND); - maybe_add_note (p, n + 2); + p->table.resize (n + 1, 3); + p->table.attach (_dummy, 2, 3, n, n + 1, FILL | EXPAND, SHRINK, 0, 0); + _dummy.set_size_request (-1, 1); + _dummy.show (); } -RcActionButton::RcActionButton (std::string const & t, const Glib::SignalProxy0< void >::SlotType & slot, std::string const & l) - : _label (NULL) -{ - _button = manage (new Button (t)); - _button->signal_clicked().connect (slot); - if (!l.empty ()) { - _label = manage (right_aligned_label (l)); - } -} - -void -RcActionButton::add_to_page (OptionEditorPage *p) -{ - int const n = p->table.property_n_rows(); - int m = n + 1; - p->table.resize (m, 3); - if (_label) { - p->table.attach (*_label, 1, 2, n, n + 1, FILL | EXPAND); - p->table.attach (*_button, 2, 3, n, n + 1, FILL | EXPAND); - } else { - p->table.attach (*_button, 1, 3, n, n + 1, FILL | EXPAND); - } -} +/*--------------------------*/ RcConfigDisplay::RcConfigDisplay (string const & i, string const & n, sigc::slot g, char s) : _get (g) @@ -198,6 +171,33 @@ RcConfigDisplay::add_to_page (OptionEditorPage *p) p->table.attach (*_info, 2, 3, n, n + 1, FILL | EXPAND); } +/*--------------------------*/ + +RcActionButton::RcActionButton (std::string const & t, const Glib::SignalProxy0< void >::SlotType & slot, std::string const & l) + : _label (NULL) +{ + _button = manage (new Button (t)); + _button->signal_clicked().connect (slot); + if (!l.empty ()) { + _label = manage (right_aligned_label (l)); + } +} + +void +RcActionButton::add_to_page (OptionEditorPage *p) +{ + int const n = p->table.property_n_rows(); + int m = n + 1; + p->table.resize (m, 3); + if (_label) { + p->table.attach (*_label, 1, 2, n, n + 1, FILL | EXPAND); + p->table.attach (*_button, 2, 3, n, n + 1, FILL | EXPAND); + } else { + p->table.attach (*_button, 1, 3, n, n + 1, FILL | EXPAND); + } +} + +/*--------------------------*/ BoolOption::BoolOption (string const & i, string const & n, sigc::slot g, sigc::slot s) : Option (i, n), @@ -232,6 +232,8 @@ BoolOption::toggled () } } +/*--------------------------*/ + RouteDisplayBoolOption::RouteDisplayBoolOption (string const & i, string const & n, sigc::slot g, sigc::slot s) : BoolOption (i, n, g, s) { @@ -244,6 +246,8 @@ RouteDisplayBoolOption::toggled () BoolOption::toggled (); } +/*--------------------------*/ + EntryOption::EntryOption (string const & i, string const & n, sigc::slot g, sigc::slot s) : Option (i, n), _get (g), @@ -299,6 +303,123 @@ EntryOption::focus_out (GdkEventFocus*) return true; } +/*--------------------------*/ +HSliderOption::HSliderOption ( + std::string const& i, + std::string const& n, + sigc::slot g, + sigc::slot s, + double lower, double upper, + double step_increment, + double page_increment, + double mult, + bool logarithmic + ) + : Option (i, n) + , _get (g) + , _set (s) + , _adj (lower, lower, upper, step_increment, page_increment, 0) + , _hscale (_adj) + , _label (n + ":") + , _mult (mult) + , _log (logarithmic) +{ + _label.set_alignment (0, 0.5); + _label.set_name ("OptionsLabel"); + _adj.set_value (_get()); + _adj.signal_value_changed().connect (sigc::mem_fun (*this, &HSliderOption::changed)); + _hscale.set_update_policy (Gtk::UPDATE_DISCONTINUOUS); +} + +void +HSliderOption::set_state_from_config () +{ + if (_log) { + _adj.set_value (log10(_get()) / _mult); + } else { + _adj.set_value (_get() / _mult); + } +} + +void +HSliderOption::changed () +{ + if (_log) { + _set (pow (10, _adj.get_value () * _mult)); + } else { + _set (_adj.get_value () * _mult); + } +} + +void +HSliderOption::add_to_page (OptionEditorPage* p) +{ + add_widgets_to_page (p, &_label, &_hscale); +} + +void +HSliderOption::set_sensitive (bool yn) +{ + _hscale.set_sensitive (yn); +} + +/*--------------------------*/ + +ComboStringOption::ComboStringOption ( + std::string const & i, + std::string const & n, + sigc::slot g, + sigc::slot s + ) + : Option (i, n) + , _get (g) + , _set (s) +{ + _label = Gtk::manage (new Gtk::Label (n + ":")); + _label->set_alignment (0, 0.5); + _combo = Gtk::manage (new Gtk::ComboBoxText); + _combo->signal_changed().connect (sigc::mem_fun (*this, &ComboStringOption::changed)); +} + +void +ComboStringOption::set_state_from_config () { + _combo->set_active_text (_get()); +} + +void +ComboStringOption::add_to_page (OptionEditorPage* p) +{ + add_widgets_to_page (p, _label, _combo); +} + +/** Set the allowed strings for this option + * @param strings a vector of allowed strings + */ +void +ComboStringOption::set_popdown_strings (const std::vector& strings) { + _combo->clear_items (); + for (std::vector::const_iterator i = strings.begin(); i != strings.end(); ++i) { + _combo->append_text (*i); + } +} + +void +ComboStringOption::clear () { + _combo->clear_items(); +} + +void +ComboStringOption::changed () { + _set (_combo->get_active_text ()); +} + +void +ComboStringOption::set_sensitive (bool yn) { + _combo->set_sensitive (yn); +} + +/*--------------------------*/ + /** Construct a BoolComboOption. * @param i id * @param n User-visible name. @@ -351,7 +472,7 @@ 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) @@ -430,6 +551,8 @@ FaderOption::add_to_page (OptionEditorPage* p) add_widgets_to_page (p, &_label, &_box); } +/*--------------------------*/ + ClockOption::ClockOption (string const & i, string const & n, sigc::slot g, sigc::slot s) : Option (i, n) , _clock (X_("timecode-offset"), true, X_(""), true, false, true, false) @@ -478,6 +601,8 @@ ClockOption::set_session (Session* s) _clock.set_session (s); } +/*--------------------------*/ + OptionEditorPage::OptionEditorPage () : table (1, 3) { @@ -500,6 +625,23 @@ OptionEditorPage::init () table.set_col_spacing (0, 32); } +/*--------------------------*/ + +void +OptionEditorMiniPage::add_to_page (OptionEditorPage* p) +{ + int const n = p->table.property_n_rows(); + int m = n + 1; + if (!_note.empty ()) { + ++m; + } + p->table.resize (m, 3); + p->table.attach (box, 0, 3, n, n + 1, FILL | EXPAND, SHRINK, 0, 0); + maybe_add_note (p, n + 1); +} + +/*--------------------------*/ + /** Construct an OptionEditor. * @param o Configuration to edit. * @param t Title for the dialog. @@ -679,6 +821,7 @@ OptionEditor::set_current_page (string const & p) } +/*--------------------------*/ DirectoryOption::DirectoryOption (string const & i, string const & n, sigc::slot g, sigc::slot s) : Option (i, n) @@ -689,7 +832,6 @@ DirectoryOption::DirectoryOption (string const & i, string const & n, sigc::slot _file_chooser.signal_selection_changed().connect (sigc::mem_fun (*this, &DirectoryOption::selection_changed)); } - void DirectoryOption::set_state_from_config () { diff --git a/gtk2_ardour/option_editor.h b/gtk2_ardour/option_editor.h index 653e804f43..59fc6da376 100644 --- a/gtk2_ardour/option_editor.h +++ b/gtk2_ardour/option_editor.h @@ -14,7 +14,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ #ifndef __gtk_ardour_option_editor_h__ @@ -77,7 +76,7 @@ public: void set_note (std::string const &); - virtual Gtk::Widget& tip_widget() = 0; + virtual Gtk::Widget& tip_widget() = 0; protected: void maybe_add_note (OptionEditorPage *, int); @@ -95,39 +94,26 @@ public: void set_state_from_config () {} void add_to_page (OptionEditorPage *); - Gtk::Widget& tip_widget() { return *_label; } + Gtk::Widget& tip_widget() { return *_label; } private: Gtk::Label* _label; ///< the label used for the heading }; -/** A component which provides a box into which a subclass can put arbitrary widgets */ -class OptionEditorBox : public OptionEditorComponent +/** Expanding layout helper to push elements to the left on a single column page */ +class OptionEditorBlank : public OptionEditorComponent { public: + OptionEditorBlank () {} - /** Construct an OpenEditorBox */ - OptionEditorBox () - { - _box = Gtk::manage (new Gtk::VBox); - _box->set_spacing (4); - } - - void parameter_changed (std::string const &) = 0; - void set_state_from_config () = 0; - virtual void add_to_page (OptionEditorPage *); - - Gtk::Widget& tip_widget() { return *_box->children().front().get_widget(); } - -protected: + void parameter_changed (std::string const &) {} + void set_state_from_config () {} + void add_to_page (OptionEditorPage *); - Gtk::VBox* _box; ///< constituent box for subclasses to add widgets to -}; + Gtk::Widget& tip_widget() { return _dummy; } -class OptionEditorPageBox : public OptionEditorBox -{ -public: - virtual void add_to_page (OptionEditorPage *); +private: + Gtk::EventBox _dummy; }; class RcConfigDisplay : public OptionEditorComponent @@ -192,7 +178,6 @@ public: } protected: - std::string _id; std::string _name; }; @@ -201,7 +186,6 @@ protected: class BoolOption : public Option { public: - BoolOption (std::string const &, std::string const &, sigc::slot, sigc::slot); void set_state_from_config (); void add_to_page (OptionEditorPage*); @@ -213,7 +197,6 @@ public: Gtk::Widget& tip_widget() { return *_button; } protected: - virtual void toggled (); sigc::slot _get; ///< slot to get the configuration variable's value @@ -226,6 +209,7 @@ class RouteDisplayBoolOption : public BoolOption { public: RouteDisplayBoolOption (std::string const &, std::string const &, sigc::slot, sigc::slot); + protected: virtual void toggled (); }; @@ -251,7 +235,6 @@ private: class EntryOption : public Option { public: - EntryOption (std::string const &, std::string const &, sigc::slot, sigc::slot); void set_state_from_config (); void add_to_page (OptionEditorPage*); @@ -261,7 +244,6 @@ public: Gtk::Widget& tip_widget() { return *_entry; } private: - void activated (); bool focus_out (GdkEventFocus*); void filter_text (const Glib::ustring&, int*); @@ -281,7 +263,6 @@ template class ComboOption : public Option { public: - /** Construct an ComboOption. * @param i id * @param n User-visible name. @@ -294,9 +275,9 @@ public: sigc::slot g, sigc::slot s ) - : Option (i, n), - _get (g), - _set (s) + : Option (i, n) + , _get (g) + , _set (s) { _label = Gtk::manage (new Gtk::Label (n + ":")); _label->set_alignment (0, 0.5); @@ -304,7 +285,8 @@ public: _combo->signal_changed().connect (sigc::mem_fun (*this, &ComboOption::changed)); } - void set_state_from_config () { + void set_state_from_config () + { uint32_t r = 0; while (r < _options.size() && _get () != _options[r]) { ++r; @@ -324,31 +306,33 @@ public: * @param e Enumeration. * @param o User-visible name for this value. */ - void add (T e, std::string const & o) { + void add (T e, std::string const & o) + { _options.push_back (e); _combo->append_text (o); } - void clear () { + void clear () + { _combo->clear_items(); _options.clear (); } - void changed () { + void changed () + { uint32_t const r = _combo->get_active_row_number (); if (r < _options.size()) { _set (_options[r]); } } - - void set_sensitive (bool yn) { + void set_sensitive (bool yn) + { _combo->set_sensitive (yn); } - Gtk::Widget& tip_widget() { return *_combo; } + Gtk::Widget& tip_widget() { return *_combo; } private: - sigc::slot _get; sigc::slot _set; Gtk::Label* _label; @@ -362,79 +346,43 @@ private: class HSliderOption : public Option { public: - - /** Construct an ComboOption. - * @param i id - * @param n User-visible name. - * @param g Slot to get the variable's value. - * @param s Slot to set the variable's value. - */ - HSliderOption ( - std::string const & i, - std::string const & n, - Gtk::Adjustment &adj - ) - : Option (i, n) - { - _label = Gtk::manage (new Gtk::Label (n + ":")); - _label->set_alignment (0, 0.5); - _hscale = Gtk::manage (new Gtk::HScale(adj)); - _adj = NULL; - } - 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 = Gtk::manage (new Gtk::Label (n + ":")); - _label->set_alignment (0, 0.5); - _hscale = Gtk::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) - { - add_widgets_to_page (p, _label, _hscale); - } + std::string const& i, + std::string const& n, + sigc::slot g, + sigc::slot s, + double lower, double upper, + double step_increment = 1, + double page_increment = 10, + double mult = 1.0, + bool logarithmic = false + ); - void set_sensitive (bool yn) { - _hscale->set_sensitive (yn); - } + void set_state_from_config (); + virtual void changed (); + void add_to_page (OptionEditorPage* p); + void set_sensitive (bool yn); - Gtk::Widget& tip_widget() { return *_hscale; } - Gtk::HScale& scale() { return *_hscale; } + Gtk::Widget& tip_widget() { return _hscale; } + Gtk::HScale& scale() { return _hscale; } -private: +protected: sigc::slot _get; sigc::slot _set; - Gtk::Label* _label; - Gtk::HScale* _hscale; - Gtk::Adjustment* _adj; + Gtk::Adjustment _adj; + Gtk::HScale _hscale; + Gtk::Label _label; + double _mult; + bool _log; }; + /** Component which provides the UI to handle an enumerated option using a GTK ComboBox. * The template parameter is the enumeration. */ class ComboStringOption : public Option { public: - /** Construct an ComboOption. * @param i id * @param n User-visible name. @@ -446,53 +394,25 @@ public: std::string const & n, sigc::slot g, sigc::slot s - ) - : Option (i, n), - _get (g), - _set (s) - { - _label = Gtk::manage (new Gtk::Label (n + ":")); - _label->set_alignment (0, 0.5); - _combo = Gtk::manage (new Gtk::ComboBoxText); - _combo->signal_changed().connect (sigc::mem_fun (*this, &ComboStringOption::changed)); - } - - void set_state_from_config () { - _combo->set_active_text (_get()); - } + ); - void add_to_page (OptionEditorPage* p) - { - add_widgets_to_page (p, _label, _combo); - } + void set_state_from_config (); + void add_to_page (OptionEditorPage* p); /** Set the allowed strings for this option * @param strings a vector of allowed strings */ - void set_popdown_strings (const std::vector& strings) { - _combo->clear_items (); - for (std::vector::const_iterator i = strings.begin(); i != strings.end(); ++i) { - _combo->append_text (*i); - } - } - - void clear () { - _combo->clear_items(); - } - - void changed () { - _set (_combo->get_active_text ()); - } + void set_popdown_strings (const std::vector& strings); - void set_sensitive (bool yn) { - _combo->set_sensitive (yn); - } + void clear (); + void changed (); + void set_sensitive (bool yn); - Gtk::Widget& tip_widget() { return *_combo; } + Gtk::Widget& tip_widget() { return *_combo; } private: - sigc::slot _get; - sigc::slot _set; + sigc::slot _get; + sigc::slot _set; Gtk::Label* _label; Gtk::ComboBoxText* _combo; }; @@ -504,7 +424,6 @@ private: class BoolComboOption : public Option { public: - BoolComboOption ( std::string const &, std::string const &, @@ -519,10 +438,9 @@ public: void changed (); void set_sensitive (bool); - Gtk::Widget& tip_widget() { return *_combo; } + Gtk::Widget& tip_widget() { return *_combo; } private: - sigc::slot _get; sigc::slot _set; Gtk::Label* _label; @@ -530,7 +448,6 @@ private: }; - /** Component which provides the UI to handle an numeric option using a GTK SpinButton */ template class SpinOption : public Option @@ -562,10 +479,10 @@ public: float scale = 1, unsigned digits = 0 ) - : Option (i, n), - _get (g), - _set (s), - _scale (scale) + : Option (i, n) + , _get (g) + , _set (s) + , _scale (scale) { _label = Gtk::manage (new Gtk::Label (n + ":")); _label->set_alignment (0, 0.5); @@ -600,7 +517,7 @@ public: _set (static_cast (_spin->get_value ()) * _scale); } - Gtk::Widget& tip_widget() { return *_spin; } + Gtk::Widget& tip_widget() { return *_spin; } private: sigc::slot _get; @@ -619,7 +536,7 @@ public: void set_state_from_config (); void add_to_page (OptionEditorPage *); - Gtk::Widget& tip_widget() { return *_db_slider; } + Gtk::Widget& tip_widget() { return *_db_slider; } private: void db_changed (); @@ -644,8 +561,8 @@ public: void add_to_page (OptionEditorPage *); void set_session (ARDOUR::Session *); - Gtk::Widget& tip_widget() { return _clock; } - AudioClock& clock() { return _clock; } + Gtk::Widget& tip_widget() { return _clock; } + AudioClock& clock() { return _clock; } private: void save_clock_time (); @@ -664,7 +581,7 @@ public: void set_state_from_config (); void add_to_page (OptionEditorPage *); - Gtk::Widget& tip_widget() { return _file_chooser; } + Gtk::Widget& tip_widget() { return _file_chooser; } private: void selection_changed (); @@ -692,6 +609,22 @@ private: void init (); }; +class OptionEditorMiniPage : public OptionEditorComponent, public OptionEditorPage +{ +public: + OptionEditorMiniPage () + { + box.pack_start (table, false, false); + box.set_border_width (0); + } + + void parameter_changed (std::string const &) = 0; + void set_state_from_config () = 0; + virtual void add_to_page (OptionEditorPage*); + + Gtk::Widget& tip_widget() { return *table.children().front().get_widget(); } +}; + /** The OptionEditor dialog base class */ class OptionEditor : virtual public sigc::trackable { @@ -713,14 +646,14 @@ protected: class OptionColumns : public Gtk::TreeModel::ColumnRecord { - public: - Gtk::TreeModelColumn name; - Gtk::TreeModelColumn widget; - - OptionColumns() { - add (name); - add (widget); - } + public: + Gtk::TreeModelColumn name; + Gtk::TreeModelColumn widget; + + OptionColumns() { + add (name); + add (widget); + } }; OptionColumns option_columns; diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 30b55259bd..cc710a1a9b 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -77,7 +77,7 @@ using namespace PBD; using namespace ARDOUR; using namespace ARDOUR_UI_UTILS; -class ClickOptions : public OptionEditorPageBox, public OptionEditorPage +class ClickOptions : public OptionEditorMiniPage { public: ClickOptions (RCConfiguration* c) @@ -123,8 +123,6 @@ public: fo->add_to_page (this); fo->set_state_from_config (); - _box->pack_start (table, true, true); - _click_path_entry.signal_activate().connect (sigc::mem_fun (*this, &ClickOptions::click_changed)); _click_emphasis_path_entry.signal_activate().connect (sigc::mem_fun (*this, &ClickOptions::click_emphasis_changed)); @@ -241,7 +239,7 @@ private: Button _click_emphasis_browse_button; }; -class UndoOptions : public OptionEditorBox +class UndoOptions : public OptionEditorComponent { public: UndoOptions (RCConfiguration* c) : @@ -249,24 +247,11 @@ public: _limit_undo_button (_("Limit undo history to")), _save_undo_button (_("Save undo history of")) { - Table* t = new Table (2, 3); - t->set_spacings (4); - - t->attach (_limit_undo_button, 0, 1, 0, 1, FILL); _limit_undo_spin.set_range (0, 512); _limit_undo_spin.set_increments (1, 10); - t->attach (_limit_undo_spin, 1, 2, 0, 1, FILL | EXPAND); - Label* l = manage (left_aligned_label (_("commands"))); - t->attach (*l, 2, 3, 0, 1); - t->attach (_save_undo_button, 0, 1, 1, 2, FILL); _save_undo_spin.set_range (0, 512); _save_undo_spin.set_increments (1, 10); - t->attach (_save_undo_spin, 1, 2, 1, 2, FILL | EXPAND); - l = manage (left_aligned_label (_("commands"))); - t->attach (*l, 2, 3, 1, 2); - - _box->pack_start (*t); _limit_undo_button.signal_toggled().connect (sigc::mem_fun (*this, &UndoOptions::limit_undo_toggled)); _limit_undo_spin.signal_value_changed().connect (sigc::mem_fun (*this, &UndoOptions::limit_undo_changed)); @@ -322,6 +307,34 @@ public: _rc_config->set_saved_history_depth (_save_undo_spin.get_value_as_int ()); } + void add_to_page (OptionEditorPage* p) + { + int const n = p->table.property_n_rows(); + Table* t = & p->table; + + t->resize (n + 2, 3); + + Label* l = manage (left_aligned_label (_("commands"))); + HBox* box = manage (new HBox()); + box->set_spacing (4); + box->pack_start (_limit_undo_spin, true, true); + box->pack_start (*l, false, false); + t->attach (_limit_undo_button, 1, 2, n, n +1, FILL); + t->attach (*box, 2, 3, n, n + 1, FILL | EXPAND); + + l = manage (left_aligned_label (_("commands"))); + box = manage (new HBox()); + box->set_spacing (4); + box->pack_start (_save_undo_spin, true, true); + box->pack_start (*l, false, false); + t->attach (_save_undo_button, 1, 2, n + 1, n + 2, FILL); + t->attach (*box, 2, 3, n + 1, n + 2, FILL | EXPAND); + } + + Gtk::Widget& tip_widget() { + return _limit_undo_button; // unused + } + private: RCConfiguration* _rc_config; CheckButton _limit_undo_button; @@ -331,7 +344,6 @@ private: }; - static const struct { const char *name; guint modifier; @@ -377,7 +389,7 @@ static const struct { }; -class KeyboardOptions : public OptionEditorBox +class KeyboardOptions : public OptionEditorMiniPage { public: KeyboardOptions () : @@ -407,8 +419,7 @@ public: } } - Table* t = manage (new Table (5, 11)); - t->set_spacings (4); + Table* t = &table; int row = 0; int col = 0; @@ -426,14 +437,15 @@ public: _keyboard_layout_selector.set_active_text (Keyboard::current_binding_name()); _keyboard_layout_selector.signal_changed().connect (sigc::mem_fun (*this, &KeyboardOptions::bindings_changed)); - t->attach (*l, col, col + 1, row, row + 1, FILL | EXPAND, FILL); - t->attach (_keyboard_layout_selector, col + 1, col + 2, row, row + 1, FILL | EXPAND, FILL); + t->attach (*l, col, col + 2, row, row + 1, FILL | EXPAND, FILL); + t->attach (_keyboard_layout_selector, col + 2, col + 3, row, row + 1, FILL | EXPAND, FILL); ++row; col = 0; - l = manage (left_aligned_label (_("When Clicking:"))); + l = manage (left_aligned_label (string_compose ("%1", _("When Clicking:")))); l->set_name ("OptionEditorHeading"); + l->set_use_markup (true); t->attach (*l, col, col + 2, row, row + 1, FILL | EXPAND, FILL); ++row; @@ -517,8 +529,9 @@ public: ++row; - l = manage (left_aligned_label (_("When Beginning a Drag:"))); + l = manage (left_aligned_label (string_compose ("%1", _("When Beginning a Drag:")))); l->set_name ("OptionEditorHeading"); + l->set_use_markup (true); t->attach (*l, 0, 2, row, row + 1, FILL | EXPAND, FILL); ++row; @@ -601,8 +614,9 @@ public: ++row; - l = manage (left_aligned_label (_("When Beginning a Trim:"))); + l = manage (left_aligned_label (string_compose ("%1", _("When Beginning a Trim:")))); l->set_name ("OptionEditorHeading"); + l->set_use_markup (true); t->attach (*l, 0, 2, row, row + 1, FILL | EXPAND, FILL); ++row; @@ -696,8 +710,9 @@ public: ++row; - l = manage (left_aligned_label (_("While Dragging:"))); + l = manage (left_aligned_label (string_compose ("%1", _("While Dragging:")))); l->set_name ("OptionEditorHeading"); + l->set_use_markup (true); t->attach (*l, 0, 2, row, row + 1, FILL | EXPAND, FILL); ++row; @@ -754,8 +769,9 @@ public: ++row; - l = manage (left_aligned_label (_("While Trimming:"))); + l = manage (left_aligned_label (string_compose ("%1", _("While Trimming:")))); l->set_name ("OptionEditorHeading"); + l->set_use_markup (true); t->attach (*l, 0, 2, row, row + 1, FILL | EXPAND, FILL); ++row; @@ -782,8 +798,9 @@ public: ++row; - l = manage (left_aligned_label (_("While Dragging Control Points:"))); + l = manage (left_aligned_label (string_compose ("%1", _("While Dragging Control Points:")))); l->set_name ("OptionEditorHeading"); + l->set_use_markup (true); t->attach (*l, 0, 2, row, row + 1, FILL | EXPAND, FILL); ++row; @@ -808,8 +825,6 @@ public: t->attach (*l, col, col + 1, row, row + 1, FILL | EXPAND, FILL); t->attach (_fine_adjust_combo, col + 1, col + 2, row, row + 1, FILL | EXPAND, FILL); - - _box->pack_start (*t, false, false); } void parameter_changed (string const &) @@ -822,6 +837,13 @@ public: /* XXX: these aren't really config options... */ } + void add_to_page (OptionEditorPage* p) + { + int const n = p->table.property_n_rows(); + p->table.resize (n + 1, 3); + p->table.attach (box, 1, 3, n, n + 1, FILL | EXPAND, SHRINK, 0, 0); + } + private: void bindings_changed () @@ -1034,155 +1056,82 @@ private: }; -class FontScalingOptions : public OptionEditorBox +class FontScalingOptions : public HSliderOption { -public: - FontScalingOptions () : - _dpi_adjustment (100, 50, 250, 1, 5), - _dpi_slider (_dpi_adjustment) + public: + FontScalingOptions () + : HSliderOption ("font-scale", _("GUI and Font scaling"), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_font_scale), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_font_scale), + 50, 250, 1, 5, + 1024, false) { - _dpi_adjustment.set_value (UIConfiguration::instance().get_font_scale() / 1024.); - - Label* l = manage (new Label (_("GUI and Font scaling:"))); - l->set_name ("OptionsLabel"); - - const std::string dflt = _("Default"); + const std::string dflt = _("100%"); const std::string empty = X_(""); // despite gtk-doc saying so, NULL does not work as reference - _dpi_slider.set_name("FontScaleSlider"); - _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); - h->set_spacing (4); - h->pack_start (*l, false, false); - h->pack_start (_dpi_slider, true, true); - - _box->pack_start (*h, false, false); + _hscale.set_name("FontScaleSlider"); + _hscale.set_draw_value(false); + _hscale.add_mark(50, Gtk::POS_TOP, empty); + _hscale.add_mark(60, Gtk::POS_TOP, empty); + _hscale.add_mark(70, Gtk::POS_TOP, empty); + _hscale.add_mark(80, Gtk::POS_TOP, empty); + _hscale.add_mark(90, Gtk::POS_TOP, empty); + _hscale.add_mark(100, Gtk::POS_TOP, dflt); + _hscale.add_mark(125, Gtk::POS_TOP, empty); + _hscale.add_mark(150, Gtk::POS_TOP, empty); + _hscale.add_mark(175, Gtk::POS_TOP, empty); + _hscale.add_mark(200, Gtk::POS_TOP, empty); + _hscale.add_mark(250, Gtk::POS_TOP, empty); set_note (_("Adjusting the scale requires an application restart to re-layout.")); - - _dpi_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &FontScalingOptions::dpi_changed)); - } - - void parameter_changed (string const & p) - { - if (p == "font-scale") { - _dpi_adjustment.set_value (UIConfiguration::instance().get_font_scale() / 1024.); - } } - void set_state_from_config () - { - parameter_changed ("font-scale"); - } - -private: - - void dpi_changed () + void changed () { - UIConfiguration::instance().set_font_scale ((long) floor (_dpi_adjustment.get_value() * 1024.)); + HSliderOption::changed (); /* XXX: should be triggered from the parameter changed signal */ UIConfiguration::instance().reset_dpi (); } - - Adjustment _dpi_adjustment; - HScale _dpi_slider; }; -class VstTimeOutSliderOption : public OptionEditorBox +class VstTimeOutSliderOption : public HSliderOption { public: VstTimeOutSliderOption (RCConfiguration* c) - : _rc_config (c) - , _timeout_adjustment (0, 0, 3000, 50, 50) - , _timeout_slider (_timeout_adjustment) + : HSliderOption ("vst-scan-timeout", _("Scan Time Out"), + sigc::mem_fun (*c, &RCConfiguration::get_vst_scan_timeout), + sigc::mem_fun (*c, &RCConfiguration::set_vst_scan_timeout), + 0, 3000, 50, 50) { - _timeout_slider.set_digits (0); - _timeout_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &VstTimeOutSliderOption::timeout_changed)); - - _timeout_slider.set_draw_value(false); - _timeout_slider.add_mark( 0, Gtk::POS_TOP, _("\u221e")); // infinity - _timeout_slider.add_mark( 300, Gtk::POS_TOP, _("30 sec")); - _timeout_slider.add_mark( 600, Gtk::POS_TOP, _("1 min")); - _timeout_slider.add_mark(1200, Gtk::POS_TOP, _("2 mins")); - _timeout_slider.add_mark(1800, Gtk::POS_TOP, _("3 mins")); - _timeout_slider.add_mark(2400, Gtk::POS_TOP, _("4 mins")); - _timeout_slider.add_mark(3000, Gtk::POS_TOP, _("5 mins")); - - Gtkmm2ext::UI::instance()->set_tip(_timeout_slider, + _label.set_alignment (1.0, 0.5); // match buttons below + _hscale.set_digits (0); + _hscale.set_draw_value(false); + _hscale.add_mark( 0, Gtk::POS_TOP, _("\u221e")); // infinity + _hscale.add_mark( 300, Gtk::POS_TOP, _("30 sec")); + _hscale.add_mark( 600, Gtk::POS_TOP, _("1 min")); + _hscale.add_mark(1200, Gtk::POS_TOP, _("2 mins")); + _hscale.add_mark(1800, Gtk::POS_TOP, _("3 mins")); + _hscale.add_mark(2400, Gtk::POS_TOP, _("4 mins")); + _hscale.add_mark(3000, Gtk::POS_TOP, _("5 mins")); + + Gtkmm2ext::UI::instance()->set_tip(_hscale, _("Specify the default timeout for plugin instantiation. Plugins that require more time to load will be blacklisted. A value of 0 disables the timeout.")); - - Label* l = manage (left_aligned_label (_("Scan Time Out:"))); - HBox* h = manage (new HBox); - h->set_spacing (4); - h->pack_start (*l, false, false); - h->pack_start (_timeout_slider, true, true); - - _box->pack_start (*h, false, false); } - - void parameter_changed (string const & p) - { - if (p == "vst-scan-timeout") { - int const x = _rc_config->get_vst_scan_timeout(); - _timeout_adjustment.set_value (x); - } - } - - void set_state_from_config () - { - parameter_changed ("vst-scan-timeout"); - } - -private: - - void timeout_changed () - { - int x = floor(_timeout_adjustment.get_value()); - _rc_config->set_vst_scan_timeout(x); - } - - RCConfiguration* _rc_config; - Adjustment _timeout_adjustment; - HScale _timeout_slider; }; - - - - -class ClipLevelOptions : public OptionEditorBox +class ClipLevelOptions : public OptionEditorComponent { public: ClipLevelOptions () : _clip_level_adjustment (-.5, -50.0, 0.0, 0.1, 1.0) /* units of dB */ , _clip_level_slider (_clip_level_adjustment) + , _label (_("Waveform Clip Level (dBFS):")) { - _clip_level_adjustment.set_value (UIConfiguration::instance().get_waveform_clip_level ()); + _label.set_name ("OptionsLabel"); - Label* l = manage (new Label (_("Waveform Clip Level (dBFS):"))); - l->set_name ("OptionsLabel"); + _clip_level_adjustment.set_value (UIConfiguration::instance().get_waveform_clip_level ()); _clip_level_slider.set_update_policy (UPDATE_DISCONTINUOUS); - HBox* h = manage (new HBox); - h->set_spacing (4); - h->pack_start (*l, false, false); - h->pack_start (_clip_level_slider, true, true); - - _box->pack_start (*h, false, false); _clip_level_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &ClipLevelOptions::clip_level_changed)); } @@ -1199,6 +1148,14 @@ public: parameter_changed ("waveform-clip-level"); } + void add_to_page (OptionEditorPage* p) { + add_widgets_to_page (p, &_label, &_clip_level_slider); + } + + Gtk::Widget& tip_widget() { + return _clip_level_slider; + } + private: void clip_level_changed () @@ -1210,110 +1167,87 @@ private: Adjustment _clip_level_adjustment; HScale _clip_level_slider; + Label _label; }; -class BufferingOptions : public OptionEditorBox +class BufferingOptions : public OptionEditorComponent { public: BufferingOptions (RCConfiguration* c) : _rc_config (c) - , _playback_adjustment (5, 1, 60, 1, 4) - , _capture_adjustment (5, 1, 60, 1, 4) - , _playback_slider (_playback_adjustment) - , _capture_slider (_capture_adjustment) - { - vector presets; - - /* these must match the order of the enums for BufferingPreset */ - - presets.push_back (_("Small sessions (4-16 tracks)")); - presets.push_back (_("Medium sessions (16-64 tracks)")); - presets.push_back (_("Large sessions (64+ tracks)")); - presets.push_back (_("Custom (set by sliders below)")); - - set_popdown_strings (_buffering_presets_combo, presets); - - Label* l = manage (new Label (_("Preset:"))); - l->set_name ("OptionsLabel"); - HBox* h = manage (new HBox); - h->set_spacing (12); - h->pack_start (*l, false, false); - h->pack_start (_buffering_presets_combo, true, true); - _box->pack_start (*h, false, false); - - _buffering_presets_combo.signal_changed().connect (sigc::mem_fun (*this, &BufferingOptions::preset_changed)); - - _playback_adjustment.set_value (_rc_config->get_audio_playback_buffer_seconds()); - - l = manage (new Label (_("Playback (seconds of buffering):"))); - l->set_name ("OptionsLabel"); - - _playback_slider.set_update_policy (UPDATE_DISCONTINUOUS); - h = manage (new HBox); - h->set_spacing (4); - h->pack_start (*l, false, false); - h->pack_start (_playback_slider, true, true); - - _box->pack_start (*h, false, false); + , _label (_("Preset:")) + , _playback ("playback-buffer-seconds", _("Playback (seconds of buffering)"), + sigc::mem_fun (*_rc_config, &RCConfiguration::get_audio_playback_buffer_seconds), + sigc::mem_fun (*_rc_config, &RCConfiguration::set_audio_playback_buffer_seconds), + 1, 60, 1, 4) + , _capture ("capture-buffer-seconds", _("Recording (seconds of buffering)"), + sigc::mem_fun (*_rc_config, &RCConfiguration::get_audio_capture_buffer_seconds), + sigc::mem_fun (*_rc_config, &RCConfiguration::set_audio_capture_buffer_seconds), + 1, 60, 1, 4) + { + // TODO use ComboOption + vector presets; - _capture_adjustment.set_value (_rc_config->get_audio_capture_buffer_seconds()); + /* these must match the order of the enums for BufferingPreset */ + presets.push_back (_("Small sessions (4-16 tracks)")); + presets.push_back (_("Medium sessions (16-64 tracks)")); + presets.push_back (_("Large sessions (64+ tracks)")); + presets.push_back (_("Custom (set by sliders below)")); - l = manage (new Label (_("Recording (seconds of buffering):"))); - l->set_name ("OptionsLabel"); + set_popdown_strings (_buffering_presets_combo, presets); + _buffering_presets_combo.signal_changed().connect (sigc::mem_fun (*this, &BufferingOptions::preset_changed)); - _capture_slider.set_update_policy (UPDATE_DISCONTINUOUS); - h = manage (new HBox); - h->set_spacing (4); - h->pack_start (*l, false, false); - h->pack_start (_capture_slider, true, true); - - _box->pack_start (*h, false, false); + _label.set_name ("OptionsLabel"); + _label.set_alignment (0, 0.5); + } - _capture_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &BufferingOptions::capture_changed)); - _playback_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &BufferingOptions::playback_changed)); - } + void + add_to_page (OptionEditorPage* p) + { + add_widgets_to_page (p, &_label, &_buffering_presets_combo); + _playback.add_to_page (p); + _capture.add_to_page (p); + } void parameter_changed (string const & p) { if (p == "buffering-preset") { switch (_rc_config->get_buffering_preset()) { case Small: - _playback_slider.set_sensitive (false); - _capture_slider.set_sensitive (false); + _playback.set_sensitive (false); + _capture.set_sensitive (false); _buffering_presets_combo.set_active (0); break; case Medium: - _playback_slider.set_sensitive (false); - _capture_slider.set_sensitive (false); + _playback.set_sensitive (false); + _capture.set_sensitive (false); _buffering_presets_combo.set_active (1); break; case Large: - _playback_slider.set_sensitive (false); - _capture_slider.set_sensitive (false); + _playback.set_sensitive (false); + _capture.set_sensitive (false); _buffering_presets_combo.set_active (2); break; case Custom: - _playback_slider.set_sensitive (true); - _capture_slider.set_sensitive (true); + _playback.set_sensitive (true); + _capture.set_sensitive (true); _buffering_presets_combo.set_active (3); break; } } - - if (p == "playback-buffer-seconds") { - _playback_adjustment.set_value (_rc_config->get_audio_playback_buffer_seconds()); - } else if (p == "capture-buffer-seconds") { - _capture_adjustment.set_value (_rc_config->get_audio_capture_buffer_seconds()); - } + _playback.parameter_changed (p); + _capture.parameter_changed (p); } void set_state_from_config () { parameter_changed ("buffering-preset"); - parameter_changed ("playback-buffer-seconds"); - parameter_changed ("capture-buffer-seconds"); + _playback.set_state_from_config(); + _capture.set_state_from_config(); } + Gtk::Widget& tip_widget() { return _buffering_presets_combo; } + private: void preset_changed () @@ -1341,25 +1275,14 @@ class BufferingOptions : public OptionEditorBox } } - void playback_changed () - { - _rc_config->set_audio_playback_buffer_seconds ((long) _playback_adjustment.get_value()); - } - - void capture_changed () - { - _rc_config->set_audio_capture_buffer_seconds ((long) _capture_adjustment.get_value()); - } - RCConfiguration* _rc_config; - Adjustment _playback_adjustment; - Adjustment _capture_adjustment; - HScale _playback_slider; - HScale _capture_slider; - ComboBoxText _buffering_presets_combo; + Label _label; + HSliderOption _playback; + HSliderOption _capture; + ComboBoxText _buffering_presets_combo; }; -class ControlSurfacesOptions : public OptionEditorPageBox +class ControlSurfacesOptions : public OptionEditorMiniPage { public: ControlSurfacesOptions () @@ -1372,15 +1295,8 @@ class ControlSurfacesOptions : public OptionEditorPageBox _view.get_column(0)->set_expand (true); _view.append_column_editable (_("Enable"), _model.enabled); - Label* l = manage (new Label (string_compose ("%1", _("Control Surfaces")))); - l->set_alignment (0, 0.5); - l->set_use_markup (true); - _box->pack_start (*l, false, false); - _box->pack_start (_view, false, false); - Gtk::HBox* edit_box = manage (new Gtk::HBox); edit_box->set_spacing(3); - _box->pack_start (*edit_box, false, false); edit_box->show (); Label* label = manage (new Label); @@ -1394,6 +1310,11 @@ class ControlSurfacesOptions : public OptionEditorPageBox edit_button->set_sensitive (false); edit_button->show (); + int const n = table.property_n_rows(); + table.resize (n + 2, 3); + table.attach (_view, 0, 3, n, n + 1); + table.attach (*edit_box, 0, 3, n + 1, n + 2); + ControlProtocolManager& m = ControlProtocolManager::instance (); m.ProtocolStatusChange.connect (protocol_status_connection, MISSING_INVALIDATOR, boost::bind (&ControlSurfacesOptions::protocol_status_changed, this, _1), gui_context()); @@ -1551,7 +1472,7 @@ class ControlSurfacesOptions : public OptionEditorPageBox Gtk::Button* edit_button; }; -class VideoTimelineOptions : public OptionEditorPageBox, public OptionEditorPage +class VideoTimelineOptions : public OptionEditorMiniPage { public: VideoTimelineOptions (RCConfiguration* c) @@ -1562,48 +1483,51 @@ class VideoTimelineOptions : public OptionEditorPageBox, public OptionEditorPage , _xjadeo_browse_button (_("Browse...")) { Table* t = &table; + int n = table.property_n_rows(); - Label* l = manage (new Label (string_compose ("%1", _("Video Server")))); - l->set_use_markup (true); - l->set_alignment (0, 0.5); - t->attach (*l, 0, 4, 0, 1, EXPAND | FILL, FILL | EXPAND, 0, 0); - - t->attach (_show_video_export_info_button, 1, 4, 1, 2); + t->attach (_show_video_export_info_button, 1, 4, n, n + 1); _show_video_export_info_button.signal_toggled().connect (sigc::mem_fun (*this, &VideoTimelineOptions::show_video_export_info_toggled)); Gtkmm2ext::UI::instance()->set_tip (_show_video_export_info_button, _("When enabled an information window with details is displayed before the video-export dialog.")); + ++n; - t->attach (_show_video_server_dialog_button, 1, 4, 2, 3); + t->attach (_show_video_server_dialog_button, 1, 4, n, n + 1); _show_video_server_dialog_button.signal_toggled().connect (sigc::mem_fun (*this, &VideoTimelineOptions::show_video_server_dialog_toggled)); Gtkmm2ext::UI::instance()->set_tip (_show_video_server_dialog_button, _("When enabled the video server is never launched automatically without confirmation")); + ++n; - t->attach (_video_advanced_setup_button, 1, 4, 3, 4, FILL); + t->attach (_video_advanced_setup_button, 1, 4, n, n + 1, FILL); _video_advanced_setup_button.signal_toggled().connect (sigc::mem_fun (*this, &VideoTimelineOptions::video_advanced_setup_toggled)); Gtkmm2ext::UI::instance()->set_tip (_video_advanced_setup_button, _("When enabled you can speficify a custom video-server URL and docroot. - Do not enable this option unless you know what you are doing.")); + ++n; - l = manage (new Label (_("Video Server URL:"))); + Label* l = manage (new Label (_("Video Server URL:"))); l->set_alignment (0, 0.5); - t->attach (*l, 1, 2, 4, 5, FILL); - t->attach (_video_server_url_entry, 2, 4, 4, 5, FILL); + t->attach (*l, 1, 2, n, n + 1, FILL); + t->attach (_video_server_url_entry, 2, 4, n, n + 1, FILL); Gtkmm2ext::UI::instance()->set_tip (_video_server_url_entry, _("Base URL of the video-server including http prefix. This is usually 'http://hostname.example.org:1554/' and defaults to 'http://localhost:1554/' when the video-server is running locally")); + ++n; l = manage (new Label (_("Video Folder:"))); l->set_alignment (0, 0.5); - t->attach (*l, 1, 2, 5, 6, FILL); - t->attach (_video_server_docroot_entry, 2, 4, 5, 6); + t->attach (*l, 1, 2, n, n + 1, FILL); + t->attach (_video_server_docroot_entry, 2, 4, n, n + 1); Gtkmm2ext::UI::instance()->set_tip (_video_server_docroot_entry, _("Local path to the video-server document-root. Only files below this directory will be accessible by the video-server. If the server run on a remote host, it should point to a network mounted folder of the server's docroot or be left empty if it is unvailable. It is used for the local video-monitor and file-browsing when opening/adding a video file.")); + ++n; l = manage (new Label ("")); - t->attach (*l, 0, 4, 6, 7, EXPAND | FILL); + t->attach (*l, 0, 4, n, n + 1, EXPAND | FILL); + ++n; l = manage (new Label (string_compose ("%1", _("Video Monitor")))); l->set_use_markup (true); l->set_alignment (0, 0.5); - t->attach (*l, 0, 4, 7, 8, EXPAND | FILL); + t->attach (*l, 0, 4, n, n + 1, EXPAND | FILL); + ++n; l = manage (new Label (string_compose (_("Custom Path to Video Monitor (%1) - leave empty for default:"), #ifdef __APPLE__ @@ -1615,10 +1539,12 @@ class VideoTimelineOptions : public OptionEditorPageBox, public OptionEditorPage #endif ))); l->set_alignment (0, 0.5); - t->attach (*l, 1, 4, 8, 9, FILL); - t->attach (_custom_xjadeo_path, 2, 3, 9, 10, EXPAND|FILL); + t->attach (*l, 1, 4, n, n + 1, FILL); + ++n; + + t->attach (_custom_xjadeo_path, 2, 3, n, n + 1, EXPAND|FILL); Gtkmm2ext::UI::instance()->set_tip (_custom_xjadeo_path, _("Set a custom path to the Video Monitor Executable, changing this requires a restart.")); - t->attach (_xjadeo_browse_button, 3, 4, 9, 10, FILL); + t->attach (_xjadeo_browse_button, 3, 4, n, n + 1, FILL); _video_server_url_entry.signal_changed().connect (sigc::mem_fun(*this, &VideoTimelineOptions::server_url_changed)); _video_server_url_entry.signal_activate().connect (sigc::mem_fun(*this, &VideoTimelineOptions::server_url_changed)); @@ -1629,8 +1555,6 @@ class VideoTimelineOptions : public OptionEditorPageBox, public OptionEditorPage // xjadeo-path is a UIConfig parameter UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &VideoTimelineOptions::parameter_changed)); - - _box->pack_start (*t, true, true); } void server_url_changed () @@ -1857,7 +1781,7 @@ private: }; -class MidiPortOptions : public OptionEditorPageBox, public sigc::trackable +class MidiPortOptions : public OptionEditorMiniPage, public sigc::trackable { public: MidiPortOptions() { @@ -1865,31 +1789,32 @@ class MidiPortOptions : public OptionEditorPageBox, public sigc::trackable setup_midi_port_view (midi_output_view, false); setup_midi_port_view (midi_input_view, true); - - _box->pack_start (*manage (new Label("")), false, false); - input_label.set_markup (string_compose ("%1", _("MIDI Inputs"))); - _box->pack_start (input_label, false, false); + OptionEditorHeading* h = new OptionEditorHeading (_("MIDI Inputs")); + h->add_to_page (this); Gtk::ScrolledWindow* scroller = manage (new Gtk::ScrolledWindow); scroller->add (midi_input_view); scroller->set_policy (POLICY_NEVER, POLICY_AUTOMATIC); scroller->set_size_request (-1, 180); - _box->pack_start (*scroller, false, false); - _box->pack_start (*manage (new Label("")), false, false); - output_label.set_markup (string_compose ("%1", _("MIDI Outputs"))); - _box->pack_start (output_label, false, false); + int n = table.property_n_rows(); + table.attach (*scroller, 0, 3, n, n + 1, FILL | EXPAND); + + h = new OptionEditorHeading (_("MIDI Outputs")); + h->add_to_page (this); scroller = manage (new Gtk::ScrolledWindow); scroller->add (midi_output_view); scroller->set_policy (POLICY_NEVER, POLICY_AUTOMATIC); scroller->set_size_request (-1, 180); - _box->pack_start (*scroller, false, false); + + n = table.property_n_rows(); + table.attach (*scroller, 0, 3, n, n + 1, FILL | EXPAND); midi_output_view.show (); midi_input_view.show (); - _box->signal_show().connect (sigc::mem_fun (*this, &MidiPortOptions::on_show)); + table.signal_show().connect (sigc::mem_fun (*this, &MidiPortOptions::on_show)); } void parameter_changed (string const&) {} @@ -2241,7 +2166,6 @@ RCOptionEditor::RCOptionEditor () )); add_option (_("Misc/Click"), new OptionEditorHeading (_("Click"))); - add_option (_("Misc/Click"), new ClickOptions (_rc_config)); add_option (_("Misc"), new OptionEditorHeading (_("Automation"))); @@ -2493,10 +2417,11 @@ RCOptionEditor::RCOptionEditor () string_compose (_("When enabled %1 will continue to send LTC information even when the transport (playhead) is not moving"), PROGRAM_NAME)); add_option (_("Transport/Sync"), _ltc_send_continuously); - _ltc_volume_adjustment = new Gtk::Adjustment(-18, -50, 0, .5, 5); - _ltc_volume_adjustment->set_value (20 * log10(_rc_config->get_ltc_output_volume())); - _ltc_volume_adjustment->signal_value_changed().connect (sigc::mem_fun (*this, &RCOptionEditor::ltc_generator_volume_changed)); - _ltc_volume_slider = new HSliderOption("ltcvol", _("LTC generator level"), *_ltc_volume_adjustment); + _ltc_volume_slider = new HSliderOption("ltcvol", _("LTC generator level"), + sigc::mem_fun (*_rc_config, &RCConfiguration::get_ltc_output_volume), + sigc::mem_fun (*_rc_config, &RCConfiguration::set_ltc_output_volume), + -50, 0, .5, 5, + .05, true); Gtkmm2ext::UI::instance()->set_tip (_ltc_volume_slider->tip_widget(), @@ -2622,8 +2547,6 @@ if (!Profile->get_mixbus()) { add_option (_("Editor"), fadeshape); -#if 1 - bco = new BoolComboOption ( "use-overlap-equivalency", _("Regions in edit groups are edited together"), @@ -2635,7 +2558,6 @@ if (!Profile->get_mixbus()) { add_option (_("Editor"), bco); -#endif ComboOption* lm = new ComboOption ( "layer-model", _("Layering model"), @@ -3053,6 +2975,7 @@ if (!ARDOUR::Profile->get_mixbus()) { )); add_option (_("MIDI/Ports"), new MidiPortOptions ()); + add_option (_("MIDI/Ports"), new OptionEditorBlank ()); add_option (_("MIDI/Sync"), new OptionEditorHeading (_("MIDI Clock"))); @@ -3150,9 +3073,11 @@ if (!ARDOUR::Profile->get_mixbus()) { /* Control Surfaces */ + add_option (_("Control Surfaces"), new OptionEditorHeading (_("Control Surfaces"))); add_option (_("Control Surfaces"), new ControlSurfacesOptions ()); /* VIDEO Timeline */ + add_option (_("Video"), new OptionEditorHeading (_("Video Server"))); add_option (_("Video"), new VideoTimelineOptions (_rc_config)); #if (defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT || defined MACVST_SUPPORT || defined AUDIOUNIT_SUPPORT) @@ -3199,9 +3124,11 @@ if (!ARDOUR::Profile->get_mixbus()) { #if (defined WINDOWS_VST_SUPPORT || defined MACVST_SUPPORT || defined LXVST_SUPPORT) add_option (_("Plugins/VST"), new OptionEditorHeading (_("VST"))); +#if 0 add_option (_("Plugins/VST"), new RcActionButton (_("Scan for Plugins"), sigc::mem_fun (*this, &RCOptionEditor::plugin_scan_refresh))); +#endif #if (defined AUDIOUNIT_SUPPORT && defined MACVST_SUPPORT) bo = new BoolOption ( @@ -3268,7 +3195,7 @@ if (!ARDOUR::Profile->get_mixbus()) { new RcActionButton (_("Edit"), sigc::mem_fun (*this, &RCOptionEditor::edit_vst_path), _("Windows VST Path:"))); - add_option (_("Plugins"), + add_option (_("Plugins/VST"), new RcConfigDisplay ( "plugin-path-vst", _("Path:"), @@ -3279,9 +3206,11 @@ if (!ARDOUR::Profile->get_mixbus()) { #ifdef AUDIOUNIT_SUPPORT add_option (_("Plugins/Audio Unit"), new OptionEditorHeading (_("Audio Unit"))); +#if 0 add_option (_("Plugins/Audio Unit"), new RcActionButton (_("Scan for Plugins"), sigc::mem_fun (*this, &RCOptionEditor::plugin_scan_refresh))); +#endif bo = new BoolOption ( "discover-audio-units", @@ -3353,6 +3282,7 @@ if (!ARDOUR::Profile->get_mixbus()) { _("When enabled show a dialog to select instrument channel configuration before adding a multichannel plugin.")); #endif + add_option (_("Plugins"), new OptionEditorBlank ()); /* INTERFACE */ #if (defined OPTIONAL_CAIRO_IMAGE_SURFACE || defined CAIRO_SUPPORTS_FORCE_BUGGY_GRADIENTS_ENVIRONMENT_VARIABLE) @@ -3383,7 +3313,6 @@ if (!ARDOUR::Profile->get_mixbus()) { Gtkmm2ext::UI::instance()->set_tip (bgo->tip_widget(), string_compose (_("Disables hardware gradient rendering on buggy video drivers (\"buggy gradients patch\").\nThis requires restarting %1 before having an effect"), PROGRAM_NAME)); add_option (S_("Preferences|GUI"), bgo); #endif - add_option (S_("Preferences|GUI"), new OptionEditorHeading (_("Graphical User Interface"))); add_option (S_("Preferences|GUI"), new BoolOption ( @@ -3425,7 +3354,6 @@ if (!ARDOUR::Profile->get_mixbus()) { sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_super_rapid_clock_update) )); - #ifndef __APPLE__ /* font scaling does nothing with GDK/Quartz */ add_option (S_("Preferences|GUI"), new FontScalingOptions ()); @@ -3433,32 +3361,30 @@ if (!ARDOUR::Profile->get_mixbus()) { /* Image cache size */ - Gtk::Adjustment *ics = manage (new Gtk::Adjustment(0, 1, 1024, 10)); /* 1 MB to 1GB in steps of 10MB */ - HSliderOption *sics = new HSliderOption("waveform-cache-size", - _("Waveform image cache size (megabytes)"), - ics, - sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_waveform_cache_size), - sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_waveform_cache_size) + HSliderOption *sics = new HSliderOption ("waveform-cache-size", + _("Waveform image cache size (megabytes)"), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_waveform_cache_size), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_waveform_cache_size), + 1, 1024, 10 /* 1 MB to 1GB in steps of 10MB */ ); sics->scale().set_digits (0); - Gtkmm2ext::UI::instance()->set_tip - (sics->tip_widget(), + Gtkmm2ext::UI::instance()->set_tip ( + sics->tip_widget(), _("Increasing the cache size uses more memory to store waveform images, which can improve graphical performance.")); add_option (S_("Preferences|GUI"), sics); if (!ARDOUR::Profile->get_mixbus()) { /* Lock GUI timeout */ - Gtk::Adjustment *lts = manage (new Gtk::Adjustment(0, 0, 1000, 1, 10)); HSliderOption *slts = new HSliderOption("lock-gui-after-seconds", _("Lock timeout (seconds)"), - lts, sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_lock_gui_after_seconds), - sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_lock_gui_after_seconds) + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_lock_gui_after_seconds), + 0, 1000, 1, 10 ); slts->scale().set_digits (0); - Gtkmm2ext::UI::instance()->set_tip - (slts->tip_widget(), + Gtkmm2ext::UI::instance()->set_tip ( + slts->tip_widget(), _("Lock GUI after this many idle seconds (zero to never lock)")); add_option (S_("Preferences|GUI"), slts); } // !mixbus @@ -3494,7 +3420,6 @@ if (!ARDOUR::Profile->get_mixbus()) { #ifdef ENABLE_NLS OptionEditorHeading* i18n_head = new OptionEditorHeading (_("Internationalization")); - i18n_head->set_note (string_compose (_("These settings will only take effect after %1 is restarted (if available for your language preferences)."), PROGRAM_NAME)); add_option (_("GUI/Translation"), i18n_head); @@ -3505,6 +3430,8 @@ if (!ARDOUR::Profile->get_mixbus()) { sigc::ptr_fun (ARDOUR::set_translations_enabled) ); + bo->set_note (string_compose (_("These settings will only take effect after %1 is restarted (if available for your language preferences)."), PROGRAM_NAME)); + add_option (_("GUI/Translation"), bo); _l10n = new ComboOption ( @@ -3569,6 +3496,7 @@ if (!ARDOUR::Profile->get_mixbus()) { sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_action_table_columns) ) ); + add_option (_("GUI/Toolbar"), new OptionEditorBlank ()); add_option (S_("Preferences|Metering"), new OptionEditorHeading (_("Metering"))); @@ -3649,15 +3577,6 @@ if (!ARDOUR::Profile->get_mixbus()) { add_option (S_("Preferences|Metering"), mvu); - Gtk::Adjustment *mpk = manage (new Gtk::Adjustment(0, -10, 0, .1, .1)); - HSliderOption *mpks = new HSliderOption("meter-peak", - _("Peak threshold [dBFS]"), - mpk, - sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_meter_peak), - sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_meter_peak) - ); - - ComboOption* mtm = new ComboOption ( "meter-type-master", _("Default Meter Type for Master Bus"), @@ -3704,10 +3623,16 @@ if (!ARDOUR::Profile->get_mixbus()) { add_option (S_("Preferences|Metering"), mtt); + HSliderOption *mpks = new HSliderOption("meter-peak", + _("Peak threshold [dBFS]"), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_meter_peak), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_meter_peak), + -10, 0, .1, .1 + ); - 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.")); + 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|Metering"), mpks); @@ -3753,6 +3678,7 @@ if (!ARDOUR::Profile->get_mixbus()) { add_option (_("Theme"), new OptionEditorHeading (_("Theme"))); add_page (_("Theme"), *tm); + add_option (_("Theme/Colors"), new OptionEditorHeading (_("Colors"))); add_option (_("Theme/Colors"), new ColorThemeManager); Widget::show_all (); @@ -3770,6 +3696,8 @@ if (!ARDOUR::Profile->get_mixbus()) { */ Tabbable::set_state (*node, Stateful::loading_state_version); } + + set_current_page (_("Misc")); } void @@ -3818,10 +3746,6 @@ RCOptionEditor::parameter_changed (string const & p) } } -void RCOptionEditor::ltc_generator_volume_changed () { - _rc_config->set_ltc_output_volume (pow(10, _ltc_volume_adjustment->get_value() / 20)); -} - void RCOptionEditor::plugin_scan_refresh () { PluginManager::instance().refresh(); } diff --git a/gtk2_ardour/session_option_editor.cc b/gtk2_ardour/session_option_editor.cc index baadcef795..81e4b9dff2 100644 --- a/gtk2_ardour/session_option_editor.cc +++ b/gtk2_ardour/session_option_editor.cc @@ -386,6 +386,7 @@ SessionOptionEditor::SessionOptionEditor (Session* s) btn->signal_clicked().connect (sigc::mem_fun (*this, &SessionOptionEditor::save_defaults)); add_option (_("Misc"), new FooOption (btn)); + set_current_page (_("Timecode")); } void -- cgit v1.2.3