Consolidate Preferences/OptionEditor

This commit is contained in:
Robin Gareus 2016-12-29 21:39:03 +01:00
parent 5091a04362
commit 1d97a0fb3e
6 changed files with 518 additions and 522 deletions

View file

@ -61,14 +61,10 @@ ColorThemeManager::ColorThemeManager ()
, palette_window (0) , palette_window (0)
, color_theme_label (_("Color Theme")) , color_theme_label (_("Color Theme"))
{ {
Label* l = manage (new Label (string_compose ("<b>%1</b>", _("Colors"))));
l->set_alignment (0, 0.5);
l->set_use_markup (true);
_box->pack_start (*l, false, false);
std::map<string,string> color_themes; std::map<string,string> color_themes;
get_color_themes (color_themes); get_color_themes (color_themes);
int n = 0;
if (color_themes.size() > 1) { if (color_themes.size() > 1) {
theme_list = TreeStore::create (color_theme_columns); theme_list = TreeStore::create (color_theme_columns);
@ -108,8 +104,9 @@ ColorThemeManager::ColorThemeManager ()
hbox->set_spacing (6); hbox->set_spacing (6);
hbox->pack_start (color_theme_label, false, false); hbox->pack_start (color_theme_label, false, false);
hbox->pack_start (*align, true, true); hbox->pack_start (*align, true, true);
_box->pack_start (*hbox, PACK_SHRINK);
hbox->show_all (); 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)); 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); notebook.set_size_request (400, 400);
_box->pack_start (notebook, true, true, 6); table.attach (notebook, 0, 3, n, n + 1);
_box->pack_start (reset_button, false, false); ++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_opacity_control (true);
color_dialog.get_colorsel()->set_has_palette (true); color_dialog.get_colorsel()->set_has_palette (true);
@ -164,8 +162,6 @@ ColorThemeManager::ColorThemeManager ()
setup_modifiers (); setup_modifiers ();
UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &ColorThemeManager::colors_changed)); UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &ColorThemeManager::colors_changed));
_box->show_all ();
} }

View file

@ -39,7 +39,7 @@ namespace ArdourCanvas {
class ArdourDialog; class ArdourDialog;
class ColorThemeManager : public OptionEditorPageBox class ColorThemeManager : public OptionEditorMiniPage
{ {
public: public:
ColorThemeManager(); ColorThemeManager();

View file

@ -91,6 +91,8 @@ OptionEditorComponent::set_note (string const & n)
_note = n; _note = n;
} }
/*--------------------------*/
OptionEditorHeading::OptionEditorHeading (string const & h) OptionEditorHeading::OptionEditorHeading (string const & h)
{ {
std::stringstream s; std::stringstream s;
@ -99,6 +101,8 @@ OptionEditorHeading::OptionEditorHeading (string const & h)
_label->set_use_markup (true); _label->set_use_markup (true);
} }
/*--------------------------*/
void void
OptionEditorHeading::add_to_page (OptionEditorPage* p) OptionEditorHeading::add_to_page (OptionEditorPage* p)
{ {
@ -114,50 +118,19 @@ OptionEditorHeading::add_to_page (OptionEditorPage* p)
maybe_add_note (p, n + 2); maybe_add_note (p, n + 2);
} }
void /*--------------------------*/
OptionEditorBox::add_to_page (OptionEditorPage* p)
{
add_widget_to_page (p, _box);
}
void void
OptionEditorPageBox::add_to_page (OptionEditorPage* p) OptionEditorBlank::add_to_page (OptionEditorPage* p)
{ {
int const n = p->table.property_n_rows(); int const n = p->table.property_n_rows();
int m = n + 2; p->table.resize (n + 1, 3);
if (!_note.empty ()) { p->table.attach (_dummy, 2, 3, n, n + 1, FILL | EXPAND, SHRINK, 0, 0);
++m; _dummy.set_size_request (-1, 1);
} _dummy.show ();
_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);
} }
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<string> g, char s) RcConfigDisplay::RcConfigDisplay (string const & i, string const & n, sigc::slot<string> g, char s)
: _get (g) : _get (g)
@ -198,6 +171,33 @@ RcConfigDisplay::add_to_page (OptionEditorPage *p)
p->table.attach (*_info, 2, 3, n, n + 1, FILL | EXPAND); 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<bool> g, sigc::slot<bool, bool> s) BoolOption::BoolOption (string const & i, string const & n, sigc::slot<bool> g, sigc::slot<bool, bool> s)
: Option (i, n), : Option (i, n),
@ -232,6 +232,8 @@ BoolOption::toggled ()
} }
} }
/*--------------------------*/
RouteDisplayBoolOption::RouteDisplayBoolOption (string const & i, string const & n, sigc::slot<bool> g, sigc::slot<bool, bool> s) RouteDisplayBoolOption::RouteDisplayBoolOption (string const & i, string const & n, sigc::slot<bool> g, sigc::slot<bool, bool> s)
: BoolOption (i, n, g, s) : BoolOption (i, n, g, s)
{ {
@ -244,6 +246,8 @@ RouteDisplayBoolOption::toggled ()
BoolOption::toggled (); BoolOption::toggled ();
} }
/*--------------------------*/
EntryOption::EntryOption (string const & i, string const & n, sigc::slot<string> g, sigc::slot<bool, string> s) EntryOption::EntryOption (string const & i, string const & n, sigc::slot<string> g, sigc::slot<bool, string> s)
: Option (i, n), : Option (i, n),
_get (g), _get (g),
@ -299,6 +303,123 @@ EntryOption::focus_out (GdkEventFocus*)
return true; return true;
} }
/*--------------------------*/
HSliderOption::HSliderOption (
std::string const& i,
std::string const& n,
sigc::slot<float> g,
sigc::slot<bool, float> 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<std::string> g,
sigc::slot<bool, std::string> 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<std::string>& strings) {
_combo->clear_items ();
for (std::vector<std::string>::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. /** Construct a BoolComboOption.
* @param i id * @param i id
* @param n User-visible name. * @param n User-visible name.
@ -351,7 +472,7 @@ BoolComboOption::set_sensitive (bool yn)
_combo->set_sensitive (yn); _combo->set_sensitive (yn);
} }
/*--------------------------*/
FaderOption::FaderOption (string const & i, string const & n, sigc::slot<gain_t> g, sigc::slot<bool, gain_t> s) FaderOption::FaderOption (string const & i, string const & n, sigc::slot<gain_t> g, sigc::slot<bool, gain_t> s)
: Option (i, n) : Option (i, n)
@ -430,6 +551,8 @@ FaderOption::add_to_page (OptionEditorPage* p)
add_widgets_to_page (p, &_label, &_box); add_widgets_to_page (p, &_label, &_box);
} }
/*--------------------------*/
ClockOption::ClockOption (string const & i, string const & n, sigc::slot<std::string> g, sigc::slot<bool, std::string> s) ClockOption::ClockOption (string const & i, string const & n, sigc::slot<std::string> g, sigc::slot<bool, std::string> s)
: Option (i, n) : Option (i, n)
, _clock (X_("timecode-offset"), true, X_(""), true, false, true, false) , _clock (X_("timecode-offset"), true, X_(""), true, false, true, false)
@ -478,6 +601,8 @@ ClockOption::set_session (Session* s)
_clock.set_session (s); _clock.set_session (s);
} }
/*--------------------------*/
OptionEditorPage::OptionEditorPage () OptionEditorPage::OptionEditorPage ()
: table (1, 3) : table (1, 3)
{ {
@ -500,6 +625,23 @@ OptionEditorPage::init ()
table.set_col_spacing (0, 32); 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. /** Construct an OptionEditor.
* @param o Configuration to edit. * @param o Configuration to edit.
* @param t Title for the dialog. * @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<string> g, sigc::slot<bool, string> s) DirectoryOption::DirectoryOption (string const & i, string const & n, sigc::slot<string> g, sigc::slot<bool, string> s)
: Option (i, n) : 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)); _file_chooser.signal_selection_changed().connect (sigc::mem_fun (*this, &DirectoryOption::selection_changed));
} }
void void
DirectoryOption::set_state_from_config () DirectoryOption::set_state_from_config ()
{ {

View file

@ -14,7 +14,6 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef __gtk_ardour_option_editor_h__ #ifndef __gtk_ardour_option_editor_h__
@ -77,7 +76,7 @@ public:
void set_note (std::string const &); void set_note (std::string const &);
virtual Gtk::Widget& tip_widget() = 0; virtual Gtk::Widget& tip_widget() = 0;
protected: protected:
void maybe_add_note (OptionEditorPage *, int); void maybe_add_note (OptionEditorPage *, int);
@ -95,39 +94,26 @@ public:
void set_state_from_config () {} void set_state_from_config () {}
void add_to_page (OptionEditorPage *); void add_to_page (OptionEditorPage *);
Gtk::Widget& tip_widget() { return *_label; } Gtk::Widget& tip_widget() { return *_label; }
private: private:
Gtk::Label* _label; ///< the label used for the heading Gtk::Label* _label; ///< the label used for the heading
}; };
/** A component which provides a box into which a subclass can put arbitrary widgets */ /** Expanding layout helper to push elements to the left on a single column page */
class OptionEditorBox : public OptionEditorComponent class OptionEditorBlank : public OptionEditorComponent
{ {
public: public:
OptionEditorBlank () {}
/** Construct an OpenEditorBox */ void parameter_changed (std::string const &) {}
OptionEditorBox () void set_state_from_config () {}
{ void add_to_page (OptionEditorPage *);
_box = Gtk::manage (new Gtk::VBox);
_box->set_spacing (4);
}
void parameter_changed (std::string const &) = 0; Gtk::Widget& tip_widget() { return _dummy; }
void set_state_from_config () = 0;
virtual void add_to_page (OptionEditorPage *);
Gtk::Widget& tip_widget() { return *_box->children().front().get_widget(); } private:
Gtk::EventBox _dummy;
protected:
Gtk::VBox* _box; ///< constituent box for subclasses to add widgets to
};
class OptionEditorPageBox : public OptionEditorBox
{
public:
virtual void add_to_page (OptionEditorPage *);
}; };
class RcConfigDisplay : public OptionEditorComponent class RcConfigDisplay : public OptionEditorComponent
@ -192,7 +178,6 @@ public:
} }
protected: protected:
std::string _id; std::string _id;
std::string _name; std::string _name;
}; };
@ -201,7 +186,6 @@ protected:
class BoolOption : public Option class BoolOption : public Option
{ {
public: public:
BoolOption (std::string const &, std::string const &, sigc::slot<bool>, sigc::slot<bool, bool>); BoolOption (std::string const &, std::string const &, sigc::slot<bool>, sigc::slot<bool, bool>);
void set_state_from_config (); void set_state_from_config ();
void add_to_page (OptionEditorPage*); void add_to_page (OptionEditorPage*);
@ -213,7 +197,6 @@ public:
Gtk::Widget& tip_widget() { return *_button; } Gtk::Widget& tip_widget() { return *_button; }
protected: protected:
virtual void toggled (); virtual void toggled ();
sigc::slot<bool> _get; ///< slot to get the configuration variable's value sigc::slot<bool> _get; ///< slot to get the configuration variable's value
@ -226,6 +209,7 @@ class RouteDisplayBoolOption : public BoolOption
{ {
public: public:
RouteDisplayBoolOption (std::string const &, std::string const &, sigc::slot<bool>, sigc::slot<bool, bool>); RouteDisplayBoolOption (std::string const &, std::string const &, sigc::slot<bool>, sigc::slot<bool, bool>);
protected: protected:
virtual void toggled (); virtual void toggled ();
}; };
@ -251,7 +235,6 @@ private:
class EntryOption : public Option class EntryOption : public Option
{ {
public: public:
EntryOption (std::string const &, std::string const &, sigc::slot<std::string>, sigc::slot<bool, std::string>); EntryOption (std::string const &, std::string const &, sigc::slot<std::string>, sigc::slot<bool, std::string>);
void set_state_from_config (); void set_state_from_config ();
void add_to_page (OptionEditorPage*); void add_to_page (OptionEditorPage*);
@ -261,7 +244,6 @@ public:
Gtk::Widget& tip_widget() { return *_entry; } Gtk::Widget& tip_widget() { return *_entry; }
private: private:
void activated (); void activated ();
bool focus_out (GdkEventFocus*); bool focus_out (GdkEventFocus*);
void filter_text (const Glib::ustring&, int*); void filter_text (const Glib::ustring&, int*);
@ -281,7 +263,6 @@ template <class T>
class ComboOption : public Option class ComboOption : public Option
{ {
public: public:
/** Construct an ComboOption. /** Construct an ComboOption.
* @param i id * @param i id
* @param n User-visible name. * @param n User-visible name.
@ -294,9 +275,9 @@ public:
sigc::slot<T> g, sigc::slot<T> g,
sigc::slot<bool, T> s sigc::slot<bool, T> s
) )
: Option (i, n), : Option (i, n)
_get (g), , _get (g)
_set (s) , _set (s)
{ {
_label = Gtk::manage (new Gtk::Label (n + ":")); _label = Gtk::manage (new Gtk::Label (n + ":"));
_label->set_alignment (0, 0.5); _label->set_alignment (0, 0.5);
@ -304,7 +285,8 @@ public:
_combo->signal_changed().connect (sigc::mem_fun (*this, &ComboOption::changed)); _combo->signal_changed().connect (sigc::mem_fun (*this, &ComboOption::changed));
} }
void set_state_from_config () { void set_state_from_config ()
{
uint32_t r = 0; uint32_t r = 0;
while (r < _options.size() && _get () != _options[r]) { while (r < _options.size() && _get () != _options[r]) {
++r; ++r;
@ -324,31 +306,33 @@ public:
* @param e Enumeration. * @param e Enumeration.
* @param o User-visible name for this value. * @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); _options.push_back (e);
_combo->append_text (o); _combo->append_text (o);
} }
void clear () { void clear ()
{
_combo->clear_items(); _combo->clear_items();
_options.clear (); _options.clear ();
} }
void changed () { void changed ()
{
uint32_t const r = _combo->get_active_row_number (); uint32_t const r = _combo->get_active_row_number ();
if (r < _options.size()) { if (r < _options.size()) {
_set (_options[r]); _set (_options[r]);
} }
} }
void set_sensitive (bool yn)
void set_sensitive (bool yn) { {
_combo->set_sensitive (yn); _combo->set_sensitive (yn);
} }
Gtk::Widget& tip_widget() { return *_combo; } Gtk::Widget& tip_widget() { return *_combo; }
private: private:
sigc::slot<T> _get; sigc::slot<T> _get;
sigc::slot<bool, T> _set; sigc::slot<bool, T> _set;
Gtk::Label* _label; Gtk::Label* _label;
@ -362,79 +346,43 @@ private:
class HSliderOption : public Option class HSliderOption : public Option
{ {
public: 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 ( HSliderOption (
std::string const & i, std::string const& i,
std::string const & n, std::string const& n,
Gtk::Adjustment &adj sigc::slot<float> g,
) sigc::slot<bool, float> s,
: Option (i, n) double lower, double upper,
{ double step_increment = 1,
_label = Gtk::manage (new Gtk::Label (n + ":")); double page_increment = 10,
_label->set_alignment (0, 0.5); double mult = 1.0,
_hscale = Gtk::manage (new Gtk::HScale(adj)); bool logarithmic = false
_adj = NULL; );
}
HSliderOption ( void set_state_from_config ();
std::string const & i, virtual void changed ();
std::string const & n, void add_to_page (OptionEditorPage* p);
Gtk::Adjustment *adj, void set_sensitive (bool yn);
sigc::slot<float> g,
sigc::slot<bool, float> 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 () { Gtk::Widget& tip_widget() { return _hscale; }
if (_adj) _adj->set_value (_get()); Gtk::HScale& scale() { return _hscale; }
}
void changed () { protected:
if (_adj) _set (_adj->get_value ());
}
void add_to_page (OptionEditorPage* p)
{
add_widgets_to_page (p, _label, _hscale);
}
void set_sensitive (bool yn) {
_hscale->set_sensitive (yn);
}
Gtk::Widget& tip_widget() { return *_hscale; }
Gtk::HScale& scale() { return *_hscale; }
private:
sigc::slot<float> _get; sigc::slot<float> _get;
sigc::slot<bool, float> _set; sigc::slot<bool, float> _set;
Gtk::Label* _label; Gtk::Adjustment _adj;
Gtk::HScale* _hscale; Gtk::HScale _hscale;
Gtk::Adjustment* _adj; Gtk::Label _label;
double _mult;
bool _log;
}; };
/** Component which provides the UI to handle an enumerated option using a GTK ComboBox. /** Component which provides the UI to handle an enumerated option using a GTK ComboBox.
* The template parameter is the enumeration. * The template parameter is the enumeration.
*/ */
class ComboStringOption : public Option class ComboStringOption : public Option
{ {
public: public:
/** Construct an ComboOption. /** Construct an ComboOption.
* @param i id * @param i id
* @param n User-visible name. * @param n User-visible name.
@ -446,53 +394,25 @@ public:
std::string const & n, std::string const & n,
sigc::slot<std::string> g, sigc::slot<std::string> g,
sigc::slot<bool, std::string> s sigc::slot<bool, std::string> 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 () { void set_state_from_config ();
_combo->set_active_text (_get()); void add_to_page (OptionEditorPage* p);
}
void add_to_page (OptionEditorPage* p)
{
add_widgets_to_page (p, _label, _combo);
}
/** Set the allowed strings for this option /** Set the allowed strings for this option
* @param strings a vector of allowed strings * @param strings a vector of allowed strings
*/ */
void set_popdown_strings (const std::vector<std::string>& strings) { void set_popdown_strings (const std::vector<std::string>& strings);
_combo->clear_items ();
for (std::vector<std::string>::const_iterator i = strings.begin(); i != strings.end(); ++i) {
_combo->append_text (*i);
}
}
void clear () { void clear ();
_combo->clear_items(); void changed ();
} void set_sensitive (bool yn);
void changed () { Gtk::Widget& tip_widget() { return *_combo; }
_set (_combo->get_active_text ());
}
void set_sensitive (bool yn) {
_combo->set_sensitive (yn);
}
Gtk::Widget& tip_widget() { return *_combo; }
private: private:
sigc::slot<std::string> _get; sigc::slot<std::string> _get;
sigc::slot<bool, std::string> _set; sigc::slot<bool, std::string> _set;
Gtk::Label* _label; Gtk::Label* _label;
Gtk::ComboBoxText* _combo; Gtk::ComboBoxText* _combo;
}; };
@ -504,7 +424,6 @@ private:
class BoolComboOption : public Option class BoolComboOption : public Option
{ {
public: public:
BoolComboOption ( BoolComboOption (
std::string const &, std::string const &,
std::string const &, std::string const &,
@ -519,10 +438,9 @@ public:
void changed (); void changed ();
void set_sensitive (bool); void set_sensitive (bool);
Gtk::Widget& tip_widget() { return *_combo; } Gtk::Widget& tip_widget() { return *_combo; }
private: private:
sigc::slot<bool> _get; sigc::slot<bool> _get;
sigc::slot<bool, bool> _set; sigc::slot<bool, bool> _set;
Gtk::Label* _label; Gtk::Label* _label;
@ -530,7 +448,6 @@ private:
}; };
/** Component which provides the UI to handle an numeric option using a GTK SpinButton */ /** Component which provides the UI to handle an numeric option using a GTK SpinButton */
template <class T> template <class T>
class SpinOption : public Option class SpinOption : public Option
@ -562,10 +479,10 @@ public:
float scale = 1, float scale = 1,
unsigned digits = 0 unsigned digits = 0
) )
: Option (i, n), : Option (i, n)
_get (g), , _get (g)
_set (s), , _set (s)
_scale (scale) , _scale (scale)
{ {
_label = Gtk::manage (new Gtk::Label (n + ":")); _label = Gtk::manage (new Gtk::Label (n + ":"));
_label->set_alignment (0, 0.5); _label->set_alignment (0, 0.5);
@ -600,7 +517,7 @@ public:
_set (static_cast<T> (_spin->get_value ()) * _scale); _set (static_cast<T> (_spin->get_value ()) * _scale);
} }
Gtk::Widget& tip_widget() { return *_spin; } Gtk::Widget& tip_widget() { return *_spin; }
private: private:
sigc::slot<T> _get; sigc::slot<T> _get;
@ -619,7 +536,7 @@ public:
void set_state_from_config (); void set_state_from_config ();
void add_to_page (OptionEditorPage *); void add_to_page (OptionEditorPage *);
Gtk::Widget& tip_widget() { return *_db_slider; } Gtk::Widget& tip_widget() { return *_db_slider; }
private: private:
void db_changed (); void db_changed ();
@ -644,8 +561,8 @@ public:
void add_to_page (OptionEditorPage *); void add_to_page (OptionEditorPage *);
void set_session (ARDOUR::Session *); void set_session (ARDOUR::Session *);
Gtk::Widget& tip_widget() { return _clock; } Gtk::Widget& tip_widget() { return _clock; }
AudioClock& clock() { return _clock; } AudioClock& clock() { return _clock; }
private: private:
void save_clock_time (); void save_clock_time ();
@ -664,7 +581,7 @@ public:
void set_state_from_config (); void set_state_from_config ();
void add_to_page (OptionEditorPage *); void add_to_page (OptionEditorPage *);
Gtk::Widget& tip_widget() { return _file_chooser; } Gtk::Widget& tip_widget() { return _file_chooser; }
private: private:
void selection_changed (); void selection_changed ();
@ -692,6 +609,22 @@ private:
void init (); 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 */ /** The OptionEditor dialog base class */
class OptionEditor : virtual public sigc::trackable class OptionEditor : virtual public sigc::trackable
{ {
@ -713,14 +646,14 @@ protected:
class OptionColumns : public Gtk::TreeModel::ColumnRecord class OptionColumns : public Gtk::TreeModel::ColumnRecord
{ {
public: public:
Gtk::TreeModelColumn<std::string> name; Gtk::TreeModelColumn<std::string> name;
Gtk::TreeModelColumn<Gtk::Widget*> widget; Gtk::TreeModelColumn<Gtk::Widget*> widget;
OptionColumns() { OptionColumns() {
add (name); add (name);
add (widget); add (widget);
} }
}; };
OptionColumns option_columns; OptionColumns option_columns;

View file

@ -77,7 +77,7 @@ using namespace PBD;
using namespace ARDOUR; using namespace ARDOUR;
using namespace ARDOUR_UI_UTILS; using namespace ARDOUR_UI_UTILS;
class ClickOptions : public OptionEditorPageBox, public OptionEditorPage class ClickOptions : public OptionEditorMiniPage
{ {
public: public:
ClickOptions (RCConfiguration* c) ClickOptions (RCConfiguration* c)
@ -123,8 +123,6 @@ public:
fo->add_to_page (this); fo->add_to_page (this);
fo->set_state_from_config (); 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_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)); _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; Button _click_emphasis_browse_button;
}; };
class UndoOptions : public OptionEditorBox class UndoOptions : public OptionEditorComponent
{ {
public: public:
UndoOptions (RCConfiguration* c) : UndoOptions (RCConfiguration* c) :
@ -249,24 +247,11 @@ public:
_limit_undo_button (_("Limit undo history to")), _limit_undo_button (_("Limit undo history to")),
_save_undo_button (_("Save undo history of")) _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_range (0, 512);
_limit_undo_spin.set_increments (1, 10); _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_range (0, 512);
_save_undo_spin.set_increments (1, 10); _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_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)); _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 ()); _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: private:
RCConfiguration* _rc_config; RCConfiguration* _rc_config;
CheckButton _limit_undo_button; CheckButton _limit_undo_button;
@ -331,7 +344,6 @@ private:
}; };
static const struct { static const struct {
const char *name; const char *name;
guint modifier; guint modifier;
@ -377,7 +389,7 @@ static const struct {
}; };
class KeyboardOptions : public OptionEditorBox class KeyboardOptions : public OptionEditorMiniPage
{ {
public: public:
KeyboardOptions () : KeyboardOptions () :
@ -407,8 +419,7 @@ public:
} }
} }
Table* t = manage (new Table (5, 11)); Table* t = &table;
t->set_spacings (4);
int row = 0; int row = 0;
int col = 0; int col = 0;
@ -426,14 +437,15 @@ public:
_keyboard_layout_selector.set_active_text (Keyboard::current_binding_name()); _keyboard_layout_selector.set_active_text (Keyboard::current_binding_name());
_keyboard_layout_selector.signal_changed().connect (sigc::mem_fun (*this, &KeyboardOptions::bindings_changed)); _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 (*l, col, col + 2, row, row + 1, FILL | EXPAND, FILL);
t->attach (_keyboard_layout_selector, col + 1, col + 2, row, row + 1, FILL | EXPAND, FILL); t->attach (_keyboard_layout_selector, col + 2, col + 3, row, row + 1, FILL | EXPAND, FILL);
++row; ++row;
col = 0; col = 0;
l = manage (left_aligned_label (_("When Clicking:"))); l = manage (left_aligned_label (string_compose ("<b>%1</b>", _("When Clicking:"))));
l->set_name ("OptionEditorHeading"); l->set_name ("OptionEditorHeading");
l->set_use_markup (true);
t->attach (*l, col, col + 2, row, row + 1, FILL | EXPAND, FILL); t->attach (*l, col, col + 2, row, row + 1, FILL | EXPAND, FILL);
++row; ++row;
@ -517,8 +529,9 @@ public:
++row; ++row;
l = manage (left_aligned_label (_("When Beginning a Drag:"))); l = manage (left_aligned_label (string_compose ("<b>%1</b>", _("When Beginning a Drag:"))));
l->set_name ("OptionEditorHeading"); l->set_name ("OptionEditorHeading");
l->set_use_markup (true);
t->attach (*l, 0, 2, row, row + 1, FILL | EXPAND, FILL); t->attach (*l, 0, 2, row, row + 1, FILL | EXPAND, FILL);
++row; ++row;
@ -601,8 +614,9 @@ public:
++row; ++row;
l = manage (left_aligned_label (_("When Beginning a Trim:"))); l = manage (left_aligned_label (string_compose ("<b>%1</b>", _("When Beginning a Trim:"))));
l->set_name ("OptionEditorHeading"); l->set_name ("OptionEditorHeading");
l->set_use_markup (true);
t->attach (*l, 0, 2, row, row + 1, FILL | EXPAND, FILL); t->attach (*l, 0, 2, row, row + 1, FILL | EXPAND, FILL);
++row; ++row;
@ -696,8 +710,9 @@ public:
++row; ++row;
l = manage (left_aligned_label (_("While Dragging:"))); l = manage (left_aligned_label (string_compose ("<b>%1</b>", _("While Dragging:"))));
l->set_name ("OptionEditorHeading"); l->set_name ("OptionEditorHeading");
l->set_use_markup (true);
t->attach (*l, 0, 2, row, row + 1, FILL | EXPAND, FILL); t->attach (*l, 0, 2, row, row + 1, FILL | EXPAND, FILL);
++row; ++row;
@ -754,8 +769,9 @@ public:
++row; ++row;
l = manage (left_aligned_label (_("While Trimming:"))); l = manage (left_aligned_label (string_compose ("<b>%1</b>", _("While Trimming:"))));
l->set_name ("OptionEditorHeading"); l->set_name ("OptionEditorHeading");
l->set_use_markup (true);
t->attach (*l, 0, 2, row, row + 1, FILL | EXPAND, FILL); t->attach (*l, 0, 2, row, row + 1, FILL | EXPAND, FILL);
++row; ++row;
@ -782,8 +798,9 @@ public:
++row; ++row;
l = manage (left_aligned_label (_("While Dragging Control Points:"))); l = manage (left_aligned_label (string_compose ("<b>%1</b>", _("While Dragging Control Points:"))));
l->set_name ("OptionEditorHeading"); l->set_name ("OptionEditorHeading");
l->set_use_markup (true);
t->attach (*l, 0, 2, row, row + 1, FILL | EXPAND, FILL); t->attach (*l, 0, 2, row, row + 1, FILL | EXPAND, FILL);
++row; ++row;
@ -808,8 +825,6 @@ public:
t->attach (*l, col, col + 1, row, row + 1, FILL | EXPAND, FILL); 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); 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 &) void parameter_changed (string const &)
@ -822,6 +837,13 @@ public:
/* XXX: these aren't really config options... */ /* 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: private:
void bindings_changed () void bindings_changed ()
@ -1034,155 +1056,82 @@ private:
}; };
class FontScalingOptions : public OptionEditorBox class FontScalingOptions : public HSliderOption
{ {
public: public:
FontScalingOptions () : FontScalingOptions ()
_dpi_adjustment (100, 50, 250, 1, 5), : HSliderOption ("font-scale", _("GUI and Font scaling"),
_dpi_slider (_dpi_adjustment) 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.); const std::string dflt = _("100%");
Label* l = manage (new Label (_("GUI and Font scaling:")));
l->set_name ("OptionsLabel");
const std::string dflt = _("Default");
const std::string empty = X_(""); // despite gtk-doc saying so, NULL does not work as reference const std::string empty = X_(""); // despite gtk-doc saying so, NULL does not work as reference
_dpi_slider.set_name("FontScaleSlider"); _hscale.set_name("FontScaleSlider");
_dpi_slider.set_update_policy (UPDATE_DISCONTINUOUS); _hscale.set_draw_value(false);
_dpi_slider.set_draw_value(false); _hscale.add_mark(50, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(50, Gtk::POS_TOP, empty); _hscale.add_mark(60, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(60, Gtk::POS_TOP, empty); _hscale.add_mark(70, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(70, Gtk::POS_TOP, empty); _hscale.add_mark(80, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(80, Gtk::POS_TOP, empty); _hscale.add_mark(90, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(90, Gtk::POS_TOP, empty); _hscale.add_mark(100, Gtk::POS_TOP, dflt);
_dpi_slider.add_mark(100, Gtk::POS_TOP, dflt); _hscale.add_mark(125, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(125, Gtk::POS_TOP, empty); _hscale.add_mark(150, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(150, Gtk::POS_TOP, empty); _hscale.add_mark(175, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(175, Gtk::POS_TOP, empty); _hscale.add_mark(200, Gtk::POS_TOP, empty);
_dpi_slider.add_mark(200, Gtk::POS_TOP, empty); _hscale.add_mark(250, 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);
set_note (_("Adjusting the scale requires an application restart to re-layout.")); 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) void changed ()
{ {
if (p == "font-scale") { HSliderOption::changed ();
_dpi_adjustment.set_value (UIConfiguration::instance().get_font_scale() / 1024.);
}
}
void set_state_from_config ()
{
parameter_changed ("font-scale");
}
private:
void dpi_changed ()
{
UIConfiguration::instance().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 */
UIConfiguration::instance().reset_dpi (); UIConfiguration::instance().reset_dpi ();
} }
Adjustment _dpi_adjustment;
HScale _dpi_slider;
}; };
class VstTimeOutSliderOption : public OptionEditorBox class VstTimeOutSliderOption : public HSliderOption
{ {
public: public:
VstTimeOutSliderOption (RCConfiguration* c) VstTimeOutSliderOption (RCConfiguration* c)
: _rc_config (c) : HSliderOption ("vst-scan-timeout", _("Scan Time Out"),
, _timeout_adjustment (0, 0, 3000, 50, 50) sigc::mem_fun (*c, &RCConfiguration::get_vst_scan_timeout),
, _timeout_slider (_timeout_adjustment) sigc::mem_fun (*c, &RCConfiguration::set_vst_scan_timeout),
0, 3000, 50, 50)
{ {
_timeout_slider.set_digits (0); _label.set_alignment (1.0, 0.5); // match buttons below
_timeout_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &VstTimeOutSliderOption::timeout_changed)); _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"));
_timeout_slider.set_draw_value(false); Gtkmm2ext::UI::instance()->set_tip(_hscale,
_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,
_("Specify the default timeout for plugin instantiation. Plugins that require more time to load will be blacklisted. A value of 0 disables the timeout.")); _("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 OptionEditorComponent
class ClipLevelOptions : public OptionEditorBox
{ {
public: public:
ClipLevelOptions () ClipLevelOptions ()
: _clip_level_adjustment (-.5, -50.0, 0.0, 0.1, 1.0) /* units of dB */ : _clip_level_adjustment (-.5, -50.0, 0.0, 0.1, 1.0) /* units of dB */
, _clip_level_slider (_clip_level_adjustment) , _clip_level_slider (_clip_level_adjustment)
, _label (_("Waveform Clip Level (dBFS):"))
{ {
_label.set_name ("OptionsLabel");
_clip_level_adjustment.set_value (UIConfiguration::instance().get_waveform_clip_level ()); _clip_level_adjustment.set_value (UIConfiguration::instance().get_waveform_clip_level ());
Label* l = manage (new Label (_("Waveform Clip Level (dBFS):")));
l->set_name ("OptionsLabel");
_clip_level_slider.set_update_policy (UPDATE_DISCONTINUOUS); _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)); _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"); 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: private:
void clip_level_changed () void clip_level_changed ()
@ -1210,110 +1167,87 @@ private:
Adjustment _clip_level_adjustment; Adjustment _clip_level_adjustment;
HScale _clip_level_slider; HScale _clip_level_slider;
Label _label;
}; };
class BufferingOptions : public OptionEditorBox class BufferingOptions : public OptionEditorComponent
{ {
public: public:
BufferingOptions (RCConfiguration* c) BufferingOptions (RCConfiguration* c)
: _rc_config (c) : _rc_config (c)
, _playback_adjustment (5, 1, 60, 1, 4) , _label (_("Preset:"))
, _capture_adjustment (5, 1, 60, 1, 4) , _playback ("playback-buffer-seconds", _("Playback (seconds of buffering)"),
, _playback_slider (_playback_adjustment) sigc::mem_fun (*_rc_config, &RCConfiguration::get_audio_playback_buffer_seconds),
, _capture_slider (_capture_adjustment) sigc::mem_fun (*_rc_config, &RCConfiguration::set_audio_playback_buffer_seconds),
{ 1, 60, 1, 4)
vector<string> presets; , _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<string> presets;
/* these must match the order of the enums for BufferingPreset */ /* 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)"));
presets.push_back (_("Small sessions (4-16 tracks)")); set_popdown_strings (_buffering_presets_combo, presets);
presets.push_back (_("Medium sessions (16-64 tracks)")); _buffering_presets_combo.signal_changed().connect (sigc::mem_fun (*this, &BufferingOptions::preset_changed));
presets.push_back (_("Large sessions (64+ tracks)"));
presets.push_back (_("Custom (set by sliders below)"));
set_popdown_strings (_buffering_presets_combo, presets); _label.set_name ("OptionsLabel");
_label.set_alignment (0, 0.5);
}
Label* l = manage (new Label (_("Preset:"))); void
l->set_name ("OptionsLabel"); add_to_page (OptionEditorPage* p)
HBox* h = manage (new HBox); {
h->set_spacing (12); add_widgets_to_page (p, &_label, &_buffering_presets_combo);
h->pack_start (*l, false, false); _playback.add_to_page (p);
h->pack_start (_buffering_presets_combo, true, true); _capture.add_to_page (p);
_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);
_capture_adjustment.set_value (_rc_config->get_audio_capture_buffer_seconds());
l = manage (new Label (_("Recording (seconds of buffering):")));
l->set_name ("OptionsLabel");
_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);
_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 parameter_changed (string const & p) void parameter_changed (string const & p)
{ {
if (p == "buffering-preset") { if (p == "buffering-preset") {
switch (_rc_config->get_buffering_preset()) { switch (_rc_config->get_buffering_preset()) {
case Small: case Small:
_playback_slider.set_sensitive (false); _playback.set_sensitive (false);
_capture_slider.set_sensitive (false); _capture.set_sensitive (false);
_buffering_presets_combo.set_active (0); _buffering_presets_combo.set_active (0);
break; break;
case Medium: case Medium:
_playback_slider.set_sensitive (false); _playback.set_sensitive (false);
_capture_slider.set_sensitive (false); _capture.set_sensitive (false);
_buffering_presets_combo.set_active (1); _buffering_presets_combo.set_active (1);
break; break;
case Large: case Large:
_playback_slider.set_sensitive (false); _playback.set_sensitive (false);
_capture_slider.set_sensitive (false); _capture.set_sensitive (false);
_buffering_presets_combo.set_active (2); _buffering_presets_combo.set_active (2);
break; break;
case Custom: case Custom:
_playback_slider.set_sensitive (true); _playback.set_sensitive (true);
_capture_slider.set_sensitive (true); _capture.set_sensitive (true);
_buffering_presets_combo.set_active (3); _buffering_presets_combo.set_active (3);
break; break;
} }
} }
_playback.parameter_changed (p);
if (p == "playback-buffer-seconds") { _capture.parameter_changed (p);
_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());
}
} }
void set_state_from_config () void set_state_from_config ()
{ {
parameter_changed ("buffering-preset"); parameter_changed ("buffering-preset");
parameter_changed ("playback-buffer-seconds"); _playback.set_state_from_config();
parameter_changed ("capture-buffer-seconds"); _capture.set_state_from_config();
} }
Gtk::Widget& tip_widget() { return _buffering_presets_combo; }
private: private:
void preset_changed () 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; RCConfiguration* _rc_config;
Adjustment _playback_adjustment; Label _label;
Adjustment _capture_adjustment; HSliderOption _playback;
HScale _playback_slider; HSliderOption _capture;
HScale _capture_slider; ComboBoxText _buffering_presets_combo;
ComboBoxText _buffering_presets_combo;
}; };
class ControlSurfacesOptions : public OptionEditorPageBox class ControlSurfacesOptions : public OptionEditorMiniPage
{ {
public: public:
ControlSurfacesOptions () ControlSurfacesOptions ()
@ -1372,15 +1295,8 @@ class ControlSurfacesOptions : public OptionEditorPageBox
_view.get_column(0)->set_expand (true); _view.get_column(0)->set_expand (true);
_view.append_column_editable (_("Enable"), _model.enabled); _view.append_column_editable (_("Enable"), _model.enabled);
Label* l = manage (new Label (string_compose ("<b>%1</b>", _("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); Gtk::HBox* edit_box = manage (new Gtk::HBox);
edit_box->set_spacing(3); edit_box->set_spacing(3);
_box->pack_start (*edit_box, false, false);
edit_box->show (); edit_box->show ();
Label* label = manage (new Label); Label* label = manage (new Label);
@ -1394,6 +1310,11 @@ class ControlSurfacesOptions : public OptionEditorPageBox
edit_button->set_sensitive (false); edit_button->set_sensitive (false);
edit_button->show (); 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 (); ControlProtocolManager& m = ControlProtocolManager::instance ();
m.ProtocolStatusChange.connect (protocol_status_connection, MISSING_INVALIDATOR, m.ProtocolStatusChange.connect (protocol_status_connection, MISSING_INVALIDATOR,
boost::bind (&ControlSurfacesOptions::protocol_status_changed, this, _1), gui_context()); boost::bind (&ControlSurfacesOptions::protocol_status_changed, this, _1), gui_context());
@ -1551,7 +1472,7 @@ class ControlSurfacesOptions : public OptionEditorPageBox
Gtk::Button* edit_button; Gtk::Button* edit_button;
}; };
class VideoTimelineOptions : public OptionEditorPageBox, public OptionEditorPage class VideoTimelineOptions : public OptionEditorMiniPage
{ {
public: public:
VideoTimelineOptions (RCConfiguration* c) VideoTimelineOptions (RCConfiguration* c)
@ -1562,48 +1483,51 @@ class VideoTimelineOptions : public OptionEditorPageBox, public OptionEditorPage
, _xjadeo_browse_button (_("Browse...")) , _xjadeo_browse_button (_("Browse..."))
{ {
Table* t = &table; Table* t = &table;
int n = table.property_n_rows();
Label* l = manage (new Label (string_compose ("<b>%1</b>", _("Video Server")))); t->attach (_show_video_export_info_button, 1, 4, n, n + 1);
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);
_show_video_export_info_button.signal_toggled().connect (sigc::mem_fun (*this, &VideoTimelineOptions::show_video_export_info_toggled)); _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, Gtkmm2ext::UI::instance()->set_tip (_show_video_export_info_button,
_("<b>When enabled</b> an information window with details is displayed before the video-export dialog.")); _("<b>When enabled</b> 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)); _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, Gtkmm2ext::UI::instance()->set_tip (_show_video_server_dialog_button,
_("<b>When enabled</b> the video server is never launched automatically without confirmation")); _("<b>When enabled</b> 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)); _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, Gtkmm2ext::UI::instance()->set_tip (_video_advanced_setup_button,
_("<b>When enabled</b> you can speficify a custom video-server URL and docroot. - Do not enable this option unless you know what you are doing.")); _("<b>When enabled</b> 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); l->set_alignment (0, 0.5);
t->attach (*l, 1, 2, 4, 5, FILL); t->attach (*l, 1, 2, n, n + 1, FILL);
t->attach (_video_server_url_entry, 2, 4, 4, 5, FILL); t->attach (_video_server_url_entry, 2, 4, n, n + 1, FILL);
Gtkmm2ext::UI::instance()->set_tip (_video_server_url_entry, 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")); _("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 = manage (new Label (_("Video Folder:")));
l->set_alignment (0, 0.5); l->set_alignment (0, 0.5);
t->attach (*l, 1, 2, 5, 6, FILL); t->attach (*l, 1, 2, n, n + 1, FILL);
t->attach (_video_server_docroot_entry, 2, 4, 5, 6); t->attach (_video_server_docroot_entry, 2, 4, n, n + 1);
Gtkmm2ext::UI::instance()->set_tip (_video_server_docroot_entry, 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.")); _("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 ("")); 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 ("<b>%1</b>", _("Video Monitor")))); l = manage (new Label (string_compose ("<b>%1</b>", _("Video Monitor"))));
l->set_use_markup (true); l->set_use_markup (true);
l->set_alignment (0, 0.5); 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:"), l = manage (new Label (string_compose (_("Custom Path to Video Monitor (%1) - leave empty for default:"),
#ifdef __APPLE__ #ifdef __APPLE__
@ -1615,10 +1539,12 @@ class VideoTimelineOptions : public OptionEditorPageBox, public OptionEditorPage
#endif #endif
))); )));
l->set_alignment (0, 0.5); l->set_alignment (0, 0.5);
t->attach (*l, 1, 4, 8, 9, FILL); t->attach (*l, 1, 4, n, n + 1, FILL);
t->attach (_custom_xjadeo_path, 2, 3, 9, 10, EXPAND|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.")); 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_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)); _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 // xjadeo-path is a UIConfig parameter
UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &VideoTimelineOptions::parameter_changed)); UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &VideoTimelineOptions::parameter_changed));
_box->pack_start (*t, true, true);
} }
void server_url_changed () void server_url_changed ()
@ -1857,7 +1781,7 @@ private:
}; };
class MidiPortOptions : public OptionEditorPageBox, public sigc::trackable class MidiPortOptions : public OptionEditorMiniPage, public sigc::trackable
{ {
public: public:
MidiPortOptions() { 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_output_view, false);
setup_midi_port_view (midi_input_view, true); setup_midi_port_view (midi_input_view, true);
OptionEditorHeading* h = new OptionEditorHeading (_("MIDI Inputs"));
_box->pack_start (*manage (new Label("")), false, false); h->add_to_page (this);
input_label.set_markup (string_compose ("<span size=\"large\" weight=\"bold\">%1</span>", _("MIDI Inputs")));
_box->pack_start (input_label, false, false);
Gtk::ScrolledWindow* scroller = manage (new Gtk::ScrolledWindow); Gtk::ScrolledWindow* scroller = manage (new Gtk::ScrolledWindow);
scroller->add (midi_input_view); scroller->add (midi_input_view);
scroller->set_policy (POLICY_NEVER, POLICY_AUTOMATIC); scroller->set_policy (POLICY_NEVER, POLICY_AUTOMATIC);
scroller->set_size_request (-1, 180); scroller->set_size_request (-1, 180);
_box->pack_start (*scroller, false, false);
_box->pack_start (*manage (new Label("")), false, false); int n = table.property_n_rows();
output_label.set_markup (string_compose ("<span size=\"large\" weight=\"bold\">%1</span>", _("MIDI Outputs"))); table.attach (*scroller, 0, 3, n, n + 1, FILL | EXPAND);
_box->pack_start (output_label, false, false);
h = new OptionEditorHeading (_("MIDI Outputs"));
h->add_to_page (this);
scroller = manage (new Gtk::ScrolledWindow); scroller = manage (new Gtk::ScrolledWindow);
scroller->add (midi_output_view); scroller->add (midi_output_view);
scroller->set_policy (POLICY_NEVER, POLICY_AUTOMATIC); scroller->set_policy (POLICY_NEVER, POLICY_AUTOMATIC);
scroller->set_size_request (-1, 180); 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_output_view.show ();
midi_input_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&) {} void parameter_changed (string const&) {}
@ -2241,7 +2166,6 @@ RCOptionEditor::RCOptionEditor ()
)); ));
add_option (_("Misc/Click"), new OptionEditorHeading (_("Click"))); add_option (_("Misc/Click"), new OptionEditorHeading (_("Click")));
add_option (_("Misc/Click"), new ClickOptions (_rc_config)); add_option (_("Misc/Click"), new ClickOptions (_rc_config));
add_option (_("Misc"), new OptionEditorHeading (_("Automation"))); add_option (_("Misc"), new OptionEditorHeading (_("Automation")));
@ -2493,10 +2417,11 @@ RCOptionEditor::RCOptionEditor ()
string_compose (_("<b>When enabled</b> %1 will continue to send LTC information even when the transport (playhead) is not moving"), PROGRAM_NAME)); string_compose (_("<b>When enabled</b> %1 will continue to send LTC information even when the transport (playhead) is not moving"), PROGRAM_NAME));
add_option (_("Transport/Sync"), _ltc_send_continuously); add_option (_("Transport/Sync"), _ltc_send_continuously);
_ltc_volume_adjustment = new Gtk::Adjustment(-18, -50, 0, .5, 5); _ltc_volume_slider = new HSliderOption("ltcvol", _("LTC generator level"),
_ltc_volume_adjustment->set_value (20 * log10(_rc_config->get_ltc_output_volume())); sigc::mem_fun (*_rc_config, &RCConfiguration::get_ltc_output_volume),
_ltc_volume_adjustment->signal_value_changed().connect (sigc::mem_fun (*this, &RCOptionEditor::ltc_generator_volume_changed)); sigc::mem_fun (*_rc_config, &RCConfiguration::set_ltc_output_volume),
_ltc_volume_slider = new HSliderOption("ltcvol", _("LTC generator level"), *_ltc_volume_adjustment); -50, 0, .5, 5,
.05, true);
Gtkmm2ext::UI::instance()->set_tip Gtkmm2ext::UI::instance()->set_tip
(_ltc_volume_slider->tip_widget(), (_ltc_volume_slider->tip_widget(),
@ -2622,8 +2547,6 @@ if (!Profile->get_mixbus()) {
add_option (_("Editor"), fadeshape); add_option (_("Editor"), fadeshape);
#if 1
bco = new BoolComboOption ( bco = new BoolComboOption (
"use-overlap-equivalency", "use-overlap-equivalency",
_("Regions in edit groups are edited together"), _("Regions in edit groups are edited together"),
@ -2635,7 +2558,6 @@ if (!Profile->get_mixbus()) {
add_option (_("Editor"), bco); add_option (_("Editor"), bco);
#endif
ComboOption<LayerModel>* lm = new ComboOption<LayerModel> ( ComboOption<LayerModel>* lm = new ComboOption<LayerModel> (
"layer-model", "layer-model",
_("Layering model"), _("Layering model"),
@ -3053,6 +2975,7 @@ if (!ARDOUR::Profile->get_mixbus()) {
)); ));
add_option (_("MIDI/Ports"), new MidiPortOptions ()); add_option (_("MIDI/Ports"), new MidiPortOptions ());
add_option (_("MIDI/Ports"), new OptionEditorBlank ());
add_option (_("MIDI/Sync"), new OptionEditorHeading (_("MIDI Clock"))); add_option (_("MIDI/Sync"), new OptionEditorHeading (_("MIDI Clock")));
@ -3150,9 +3073,11 @@ if (!ARDOUR::Profile->get_mixbus()) {
/* Control Surfaces */ /* Control Surfaces */
add_option (_("Control Surfaces"), new OptionEditorHeading (_("Control Surfaces")));
add_option (_("Control Surfaces"), new ControlSurfacesOptions ()); add_option (_("Control Surfaces"), new ControlSurfacesOptions ());
/* VIDEO Timeline */ /* VIDEO Timeline */
add_option (_("Video"), new OptionEditorHeading (_("Video Server")));
add_option (_("Video"), new VideoTimelineOptions (_rc_config)); add_option (_("Video"), new VideoTimelineOptions (_rc_config));
#if (defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT || defined MACVST_SUPPORT || defined AUDIOUNIT_SUPPORT) #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) #if (defined WINDOWS_VST_SUPPORT || defined MACVST_SUPPORT || defined LXVST_SUPPORT)
add_option (_("Plugins/VST"), new OptionEditorHeading (_("VST"))); add_option (_("Plugins/VST"), new OptionEditorHeading (_("VST")));
#if 0
add_option (_("Plugins/VST"), add_option (_("Plugins/VST"),
new RcActionButton (_("Scan for Plugins"), new RcActionButton (_("Scan for Plugins"),
sigc::mem_fun (*this, &RCOptionEditor::plugin_scan_refresh))); sigc::mem_fun (*this, &RCOptionEditor::plugin_scan_refresh)));
#endif
#if (defined AUDIOUNIT_SUPPORT && defined MACVST_SUPPORT) #if (defined AUDIOUNIT_SUPPORT && defined MACVST_SUPPORT)
bo = new BoolOption ( bo = new BoolOption (
@ -3268,7 +3195,7 @@ if (!ARDOUR::Profile->get_mixbus()) {
new RcActionButton (_("Edit"), new RcActionButton (_("Edit"),
sigc::mem_fun (*this, &RCOptionEditor::edit_vst_path), sigc::mem_fun (*this, &RCOptionEditor::edit_vst_path),
_("Windows VST Path:"))); _("Windows VST Path:")));
add_option (_("Plugins"), add_option (_("Plugins/VST"),
new RcConfigDisplay ( new RcConfigDisplay (
"plugin-path-vst", "plugin-path-vst",
_("Path:"), _("Path:"),
@ -3279,9 +3206,11 @@ if (!ARDOUR::Profile->get_mixbus()) {
#ifdef AUDIOUNIT_SUPPORT #ifdef AUDIOUNIT_SUPPORT
add_option (_("Plugins/Audio Unit"), new OptionEditorHeading (_("Audio Unit"))); add_option (_("Plugins/Audio Unit"), new OptionEditorHeading (_("Audio Unit")));
#if 0
add_option (_("Plugins/Audio Unit"), add_option (_("Plugins/Audio Unit"),
new RcActionButton (_("Scan for Plugins"), new RcActionButton (_("Scan for Plugins"),
sigc::mem_fun (*this, &RCOptionEditor::plugin_scan_refresh))); sigc::mem_fun (*this, &RCOptionEditor::plugin_scan_refresh)));
#endif
bo = new BoolOption ( bo = new BoolOption (
"discover-audio-units", "discover-audio-units",
@ -3353,6 +3282,7 @@ if (!ARDOUR::Profile->get_mixbus()) {
_("<b>When enabled</b> show a dialog to select instrument channel configuration before adding a multichannel plugin.")); _("<b>When enabled</b> show a dialog to select instrument channel configuration before adding a multichannel plugin."));
#endif #endif
add_option (_("Plugins"), new OptionEditorBlank ());
/* INTERFACE */ /* INTERFACE */
#if (defined OPTIONAL_CAIRO_IMAGE_SURFACE || defined CAIRO_SUPPORTS_FORCE_BUGGY_GRADIENTS_ENVIRONMENT_VARIABLE) #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)); 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); add_option (S_("Preferences|GUI"), bgo);
#endif #endif
add_option (S_("Preferences|GUI"), new OptionEditorHeading (_("Graphical User Interface"))); add_option (S_("Preferences|GUI"), new OptionEditorHeading (_("Graphical User Interface")));
add_option (S_("Preferences|GUI"), add_option (S_("Preferences|GUI"),
new BoolOption ( new BoolOption (
@ -3425,7 +3354,6 @@ if (!ARDOUR::Profile->get_mixbus()) {
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_super_rapid_clock_update) sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_super_rapid_clock_update)
)); ));
#ifndef __APPLE__ #ifndef __APPLE__
/* font scaling does nothing with GDK/Quartz */ /* font scaling does nothing with GDK/Quartz */
add_option (S_("Preferences|GUI"), new FontScalingOptions ()); add_option (S_("Preferences|GUI"), new FontScalingOptions ());
@ -3433,32 +3361,30 @@ if (!ARDOUR::Profile->get_mixbus()) {
/* Image cache size */ /* 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",
HSliderOption *sics = new HSliderOption("waveform-cache-size", _("Waveform image cache size (megabytes)"),
_("Waveform image cache size (megabytes)"), sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_waveform_cache_size),
ics, sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_waveform_cache_size),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_waveform_cache_size), 1, 1024, 10 /* 1 MB to 1GB in steps of 10MB */
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_waveform_cache_size)
); );
sics->scale().set_digits (0); sics->scale().set_digits (0);
Gtkmm2ext::UI::instance()->set_tip Gtkmm2ext::UI::instance()->set_tip (
(sics->tip_widget(), sics->tip_widget(),
_("Increasing the cache size uses more memory to store waveform images, which can improve graphical performance.")); _("Increasing the cache size uses more memory to store waveform images, which can improve graphical performance."));
add_option (S_("Preferences|GUI"), sics); add_option (S_("Preferences|GUI"), sics);
if (!ARDOUR::Profile->get_mixbus()) { if (!ARDOUR::Profile->get_mixbus()) {
/* Lock GUI timeout */ /* Lock GUI timeout */
Gtk::Adjustment *lts = manage (new Gtk::Adjustment(0, 0, 1000, 1, 10));
HSliderOption *slts = new HSliderOption("lock-gui-after-seconds", HSliderOption *slts = new HSliderOption("lock-gui-after-seconds",
_("Lock timeout (seconds)"), _("Lock timeout (seconds)"),
lts,
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_lock_gui_after_seconds), 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); slts->scale().set_digits (0);
Gtkmm2ext::UI::instance()->set_tip Gtkmm2ext::UI::instance()->set_tip (
(slts->tip_widget(), slts->tip_widget(),
_("Lock GUI after this many idle seconds (zero to never lock)")); _("Lock GUI after this many idle seconds (zero to never lock)"));
add_option (S_("Preferences|GUI"), slts); add_option (S_("Preferences|GUI"), slts);
} // !mixbus } // !mixbus
@ -3494,7 +3420,6 @@ if (!ARDOUR::Profile->get_mixbus()) {
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
OptionEditorHeading* i18n_head = new OptionEditorHeading (_("Internationalization")); 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); add_option (_("GUI/Translation"), i18n_head);
@ -3505,6 +3430,8 @@ if (!ARDOUR::Profile->get_mixbus()) {
sigc::ptr_fun (ARDOUR::set_translations_enabled) 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); add_option (_("GUI/Translation"), bo);
_l10n = new ComboOption<ARDOUR::LocaleMode> ( _l10n = new ComboOption<ARDOUR::LocaleMode> (
@ -3569,6 +3496,7 @@ if (!ARDOUR::Profile->get_mixbus()) {
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_action_table_columns) sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_action_table_columns)
) )
); );
add_option (_("GUI/Toolbar"), new OptionEditorBlank ());
add_option (S_("Preferences|Metering"), new OptionEditorHeading (_("Metering"))); add_option (S_("Preferences|Metering"), new OptionEditorHeading (_("Metering")));
@ -3649,15 +3577,6 @@ if (!ARDOUR::Profile->get_mixbus()) {
add_option (S_("Preferences|Metering"), mvu); 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<MeterType>* mtm = new ComboOption<MeterType> ( ComboOption<MeterType>* mtm = new ComboOption<MeterType> (
"meter-type-master", "meter-type-master",
_("Default Meter Type for Master Bus"), _("Default Meter Type for Master Bus"),
@ -3704,10 +3623,16 @@ if (!ARDOUR::Profile->get_mixbus()) {
add_option (S_("Preferences|Metering"), mtt); 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 Gtkmm2ext::UI::instance()->set_tip (
(mpks->tip_widget(), mpks->tip_widget(),
_("Specify the audio signal level in dBFS at and above which the meter-peak indicator will flash red.")); _("Specify the audio signal level in dBFS at and above which the meter-peak indicator will flash red."));
add_option (S_("Preferences|Metering"), mpks); add_option (S_("Preferences|Metering"), mpks);
@ -3753,6 +3678,7 @@ if (!ARDOUR::Profile->get_mixbus()) {
add_option (_("Theme"), new OptionEditorHeading (_("Theme"))); add_option (_("Theme"), new OptionEditorHeading (_("Theme")));
add_page (_("Theme"), *tm); add_page (_("Theme"), *tm);
add_option (_("Theme/Colors"), new OptionEditorHeading (_("Colors")));
add_option (_("Theme/Colors"), new ColorThemeManager); add_option (_("Theme/Colors"), new ColorThemeManager);
Widget::show_all (); Widget::show_all ();
@ -3770,6 +3696,8 @@ if (!ARDOUR::Profile->get_mixbus()) {
*/ */
Tabbable::set_state (*node, Stateful::loading_state_version); Tabbable::set_state (*node, Stateful::loading_state_version);
} }
set_current_page (_("Misc"));
} }
void 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 () { void RCOptionEditor::plugin_scan_refresh () {
PluginManager::instance().refresh(); PluginManager::instance().refresh();
} }

View file

@ -386,6 +386,7 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
btn->signal_clicked().connect (sigc::mem_fun (*this, &SessionOptionEditor::save_defaults)); btn->signal_clicked().connect (sigc::mem_fun (*this, &SessionOptionEditor::save_defaults));
add_option (_("Misc"), new FooOption (btn)); add_option (_("Misc"), new FooOption (btn));
set_current_page (_("Timecode"));
} }
void void