1 #include <gtkmm/liststore.h>
2 #include <gtkmm/stock.h>
3 #include <gtkmm/scale.h>
4 #include <gtkmm2ext/utils.h>
5 #include <gtkmm2ext/slider_controller.h>
7 #include "midi++/manager.h"
8 #include "midi++/factory.h"
10 #include "ardour/rc_configuration.h"
11 #include "ardour/control_protocol_manager.h"
12 #include "control_protocol/control_protocol.h"
14 #include "gui_thread.h"
15 #include "rc_option_editor.h"
17 #include "midi_port_dialog.h"
24 using namespace Gtkmm2ext;
26 using namespace ARDOUR;
28 class MIDIPorts : public OptionEditorBox
31 MIDIPorts (RCConfiguration* c, list<ComboOption<string>* > const & o)
33 _add_port_button (Stock::ADD),
36 _store = ListStore::create (_model);
37 _view.set_model (_store);
38 _view.append_column (_("Name"), _model.name);
39 _view.get_column(0)->set_resizable (true);
40 _view.get_column(0)->set_expand (true);
41 _view.append_column_editable (_("Online"), _model.online);
42 _view.append_column_editable (_("Trace input"), _model.trace_input);
43 _view.append_column_editable (_("Trace output"), _model.trace_output);
45 HBox* h = manage (new HBox);
47 h->pack_start (_view, true, true);
49 VBox* v = manage (new VBox);
51 v->pack_start (_add_port_button, false, false);
52 h->pack_start (*v, false, false);
54 _box->pack_start (*h);
58 _store->signal_row_changed().connect (sigc::mem_fun (*this, &MIDIPorts::model_changed));
60 _add_port_button.signal_clicked().connect (sigc::mem_fun (*this, &MIDIPorts::add_port_clicked));
63 void parameter_changed (string const &) {}
64 void set_state_from_config () {}
68 void model_changed (TreeModel::Path const &, TreeModel::iterator const & i)
70 TreeModel::Row r = *i;
72 MIDI::Port* port = r[_model.port];
79 if (r[_model.online] == port->input()->offline()) {
80 port->input()->set_offline (!r[_model.online]);
83 if (r[_model.trace_input] != port->input()->tracing()) {
84 port->input()->trace (r[_model.trace_input], &cerr, string (port->name()) + _(" input: "));
90 if (r[_model.trace_output] != port->output()->tracing()) {
91 port->output()->trace (r[_model.trace_output], &cerr, string (port->name()) + _(" output: "));
97 void setup_ports_combo (ComboOption<string>* c)
100 MIDI::Manager::PortList const & ports = MIDI::Manager::instance()->get_midi_ports ();
101 for (MIDI::Manager::PortList::const_iterator i = ports.begin(); i != ports.end(); ++i) {
102 c->add ((*i)->name(), (*i)->name());
106 void ports_changed ()
108 /* XXX: why is this coming from here? */
109 MIDI::Manager::PortList const & ports = MIDI::Manager::instance()->get_midi_ports ();
112 port_connections.drop_connections ();
114 for (MIDI::Manager::PortList::const_iterator i = ports.begin(); i != ports.end(); ++i) {
116 TreeModel::Row r = *_store->append ();
118 r[_model.name] = (*i)->name();
121 r[_model.online] = !(*i)->input()->offline();
122 (*i)->input()->OfflineStatusChanged.connect (port_connections, boost::bind (&MIDIPorts::port_offline_changed, this, (*i)), gui_context());
123 r[_model.trace_input] = (*i)->input()->tracing();
126 if ((*i)->output()) {
127 r[_model.trace_output] = (*i)->output()->tracing();
130 r[_model.port] = (*i);
133 for (list<ComboOption<string>* >::iterator i = _port_combos.begin(); i != _port_combos.end(); ++i) {
134 setup_ports_combo (*i);
138 void port_offline_changed (MIDI::Port* p)
144 for (TreeModel::Children::iterator i = _store->children().begin(); i != _store->children().end(); ++i) {
145 if ((*i)[_model.port] == p) {
146 (*i)[_model.online] = !p->input()->offline();
151 void add_port_clicked ()
153 MidiPortDialog dialog;
155 dialog.set_position (WIN_POS_MOUSE);
159 int const r = dialog.run ();
162 case RESPONSE_ACCEPT:
169 Glib::ustring const mode = dialog.port_mode_combo.get_active_text ();
172 if (mode == _("input")) {
174 } else if (mode == (_("output"))) {
180 XMLNode node (X_("MIDI-port"));
182 node.add_property ("tag", dialog.port_name.get_text());
183 node.add_property ("device", X_("ardour")); // XXX this can't be right for all types
184 node.add_property ("type", MIDI::PortFactory::default_port_type());
185 node.add_property ("mode", smod);
187 if (MIDI::Manager::instance()->add_port (node) != 0) {
188 cerr << " there are now " << MIDI::Manager::instance()->nports() << endl;
193 class MIDIModelColumns : public TreeModelColumnRecord
205 TreeModelColumn<string> name;
206 TreeModelColumn<bool> online;
207 TreeModelColumn<bool> trace_input;
208 TreeModelColumn<bool> trace_output;
209 TreeModelColumn<MIDI::Port*> port;
212 RCConfiguration* _rc_config;
213 Glib::RefPtr<ListStore> _store;
214 MIDIModelColumns _model;
216 Button _add_port_button;
217 ComboBoxText _mtc_combo;
218 ComboBoxText _midi_clock_combo;
219 ComboBoxText _mmc_combo;
220 ComboBoxText _mpc_combo;
221 list<ComboOption<string>* > _port_combos;
222 PBD::ScopedConnectionList port_connections;
226 class ClickOptions : public OptionEditorBox
229 ClickOptions (RCConfiguration* c, ArdourDialog* p)
233 Table* t = manage (new Table (2, 3));
236 Label* l = manage (new Label (_("Click audio file:")));
237 l->set_alignment (0, 0.5);
238 t->attach (*l, 0, 1, 0, 1, FILL);
239 t->attach (_click_path_entry, 1, 2, 0, 1, FILL);
240 Button* b = manage (new Button (_("Browse...")));
241 b->signal_clicked().connect (sigc::mem_fun (*this, &ClickOptions::click_browse_clicked));
242 t->attach (*b, 2, 3, 0, 1, FILL);
244 l = manage (new Label (_("Click emphasis audio file:")));
245 l->set_alignment (0, 0.5);
246 t->attach (*l, 0, 1, 1, 2, FILL);
247 t->attach (_click_emphasis_path_entry, 1, 2, 1, 2, FILL);
248 b = manage (new Button (_("Browse...")));
249 b->signal_clicked().connect (sigc::mem_fun (*this, &ClickOptions::click_emphasis_browse_clicked));
250 t->attach (*b, 2, 3, 1, 2, FILL);
252 _box->pack_start (*t, false, false);
255 void parameter_changed (string const & p)
257 if (p == "click-sound") {
258 _click_path_entry.set_text (_rc_config->get_click_sound());
259 } else if (p == "click-emphasis-sound") {
260 _click_emphasis_path_entry.set_text (_rc_config->get_click_emphasis_sound());
264 void set_state_from_config ()
266 parameter_changed ("click-sound");
267 parameter_changed ("click-emphasis-sound");
272 void click_browse_clicked ()
274 SoundFileChooser sfdb (*_parent, _("Choose Click"));
279 if (sfdb.run () == RESPONSE_OK) {
280 click_chosen (sfdb.get_filename());
284 void click_chosen (string const & path)
286 _click_path_entry.set_text (path);
287 _rc_config->set_click_sound (path);
290 void click_emphasis_browse_clicked ()
292 SoundFileChooser sfdb (*_parent, _("Choose Click Emphasis"));
297 if (sfdb.run () == RESPONSE_OK) {
298 click_emphasis_chosen (sfdb.get_filename());
302 void click_emphasis_chosen (string const & path)
304 _click_emphasis_path_entry.set_text (path);
305 _rc_config->set_click_emphasis_sound (path);
308 RCConfiguration* _rc_config;
309 ArdourDialog* _parent;
310 Entry _click_path_entry;
311 Entry _click_emphasis_path_entry;
314 class UndoOptions : public OptionEditorBox
317 UndoOptions (RCConfiguration* c) :
319 _limit_undo_button (_("Limit undo history to")),
320 _save_undo_button (_("Save undo history of"))
322 Table* t = new Table (2, 3);
325 t->attach (_limit_undo_button, 0, 1, 0, 1, FILL);
326 _limit_undo_spin.set_range (0, 512);
327 _limit_undo_spin.set_increments (1, 10);
328 t->attach (_limit_undo_spin, 1, 2, 0, 1, FILL | EXPAND);
329 Label* l = manage (new Label (_("commands")));
330 l->set_alignment (0, 0.5);
331 t->attach (*l, 2, 3, 0, 1);
333 t->attach (_save_undo_button, 0, 1, 1, 2, FILL);
334 _save_undo_spin.set_range (0, 512);
335 _save_undo_spin.set_increments (1, 10);
336 t->attach (_save_undo_spin, 1, 2, 1, 2, FILL | EXPAND);
337 l = manage (new Label (_("commands")));
338 l->set_alignment (0, 0.5);
339 t->attach (*l, 2, 3, 1, 2);
341 _box->pack_start (*t);
343 _limit_undo_button.signal_toggled().connect (sigc::mem_fun (*this, &UndoOptions::limit_undo_toggled));
344 _limit_undo_spin.signal_value_changed().connect (sigc::mem_fun (*this, &UndoOptions::limit_undo_changed));
345 _save_undo_button.signal_toggled().connect (sigc::mem_fun (*this, &UndoOptions::save_undo_toggled));
346 _save_undo_spin.signal_value_changed().connect (sigc::mem_fun (*this, &UndoOptions::save_undo_changed));
349 void parameter_changed (string const & p)
351 if (p == "history-depth") {
352 int32_t const d = _rc_config->get_history_depth();
353 _limit_undo_button.set_active (d != 0);
354 _limit_undo_spin.set_sensitive (d != 0);
355 _limit_undo_spin.set_value (d);
356 } else if (p == "save-history") {
357 bool const x = _rc_config->get_save_history ();
358 _save_undo_button.set_active (x);
359 _save_undo_spin.set_sensitive (x);
360 } else if (p == "save-history-depth") {
361 _save_undo_spin.set_value (_rc_config->get_saved_history_depth());
365 void set_state_from_config ()
367 parameter_changed ("save-history");
368 parameter_changed ("history-depth");
369 parameter_changed ("save-history-depth");
372 void limit_undo_toggled ()
374 bool const x = _limit_undo_button.get_active ();
375 _limit_undo_spin.set_sensitive (x);
376 int32_t const n = x ? 16 : 0;
377 _limit_undo_spin.set_value (n);
378 _rc_config->set_history_depth (n);
381 void limit_undo_changed ()
383 _rc_config->set_history_depth (_limit_undo_spin.get_value_as_int ());
386 void save_undo_toggled ()
388 bool const x = _save_undo_button.get_active ();
389 _rc_config->set_save_history (x);
392 void save_undo_changed ()
394 _rc_config->set_saved_history_depth (_save_undo_spin.get_value_as_int ());
398 RCConfiguration* _rc_config;
399 CheckButton _limit_undo_button;
400 SpinButton _limit_undo_spin;
401 CheckButton _save_undo_button;
402 SpinButton _save_undo_spin;
407 static const struct {
419 { "Shift", GDK_SHIFT_MASK },
420 { "Command", GDK_META_MASK },
421 { "Control", GDK_CONTROL_MASK },
422 { "Option", GDK_MOD1_MASK },
423 { "Command-Shift", GDK_MOD1_MASK|GDK_SHIFT_MASK },
424 { "Command-Option", GDK_MOD1_MASK|GDK_MOD5_MASK },
425 { "Shift-Option", GDK_SHIFT_MASK|GDK_MOD5_MASK },
426 { "Shift-Command-Option", GDK_MOD5_MASK|GDK_SHIFT_MASK|GDK_MOD1_MASK },
429 { "Shift", GDK_SHIFT_MASK },
430 { "Control", GDK_CONTROL_MASK },
431 { "Alt (Mod1)", GDK_MOD1_MASK },
432 { "Control-Shift", GDK_CONTROL_MASK|GDK_SHIFT_MASK },
433 { "Control-Alt", GDK_CONTROL_MASK|GDK_MOD1_MASK },
434 { "Shift-Alt", GDK_SHIFT_MASK|GDK_MOD1_MASK },
435 { "Control-Shift-Alt", GDK_CONTROL_MASK|GDK_SHIFT_MASK|GDK_MOD1_MASK },
436 { "Mod2", GDK_MOD2_MASK },
437 { "Mod3", GDK_MOD3_MASK },
438 { "Mod4", GDK_MOD4_MASK },
439 { "Mod5", GDK_MOD5_MASK },
445 class KeyboardOptions : public OptionEditorBox
449 _delete_button_adjustment (3, 1, 12),
450 _delete_button_spin (_delete_button_adjustment),
451 _edit_button_adjustment (3, 1, 5),
452 _edit_button_spin (_edit_button_adjustment)
455 /* internationalize and prepare for use with combos */
458 for (int i = 0; modifiers[i].name; ++i) {
459 dumb.push_back (_(modifiers[i].name));
462 set_popdown_strings (_edit_modifier_combo, dumb);
463 _edit_modifier_combo.signal_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::edit_modifier_chosen));
465 for (int x = 0; modifiers[x].name; ++x) {
466 if (modifiers[x].modifier == Keyboard::edit_modifier ()) {
467 _edit_modifier_combo.set_active_text (_(modifiers[x].name));
472 Table* t = manage (new Table (4, 4));
475 Label* l = manage (new Label (_("Edit using:")));
476 l->set_name ("OptionsLabel");
477 l->set_alignment (0, 0.5);
479 t->attach (*l, 0, 1, 0, 1, FILL | EXPAND, FILL);
480 t->attach (_edit_modifier_combo, 1, 2, 0, 1, FILL | EXPAND, FILL);
482 l = manage (new Label (_("+ button")));
483 l->set_name ("OptionsLabel");
485 t->attach (*l, 3, 4, 0, 1, FILL | EXPAND, FILL);
486 t->attach (_edit_button_spin, 4, 5, 0, 1, FILL | EXPAND, FILL);
488 _edit_button_spin.set_name ("OptionsEntry");
489 _edit_button_adjustment.set_value (Keyboard::edit_button());
490 _edit_button_adjustment.signal_value_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::edit_button_changed));
492 set_popdown_strings (_delete_modifier_combo, dumb);
493 _delete_modifier_combo.signal_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::delete_modifier_chosen));
495 for (int x = 0; modifiers[x].name; ++x) {
496 if (modifiers[x].modifier == Keyboard::delete_modifier ()) {
497 _delete_modifier_combo.set_active_text (_(modifiers[x].name));
502 l = manage (new Label (_("Delete using:")));
503 l->set_name ("OptionsLabel");
504 l->set_alignment (0, 0.5);
506 t->attach (*l, 0, 1, 1, 2, FILL | EXPAND, FILL);
507 t->attach (_delete_modifier_combo, 1, 2, 1, 2, FILL | EXPAND, FILL);
509 l = manage (new Label (_("+ button")));
510 l->set_name ("OptionsLabel");
512 t->attach (*l, 3, 4, 1, 2, FILL | EXPAND, FILL);
513 t->attach (_delete_button_spin, 4, 5, 1, 2, FILL | EXPAND, FILL);
515 _delete_button_spin.set_name ("OptionsEntry");
516 _delete_button_adjustment.set_value (Keyboard::delete_button());
517 _delete_button_adjustment.signal_value_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::delete_button_changed));
519 set_popdown_strings (_snap_modifier_combo, dumb);
520 _snap_modifier_combo.signal_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::snap_modifier_chosen));
522 for (int x = 0; modifiers[x].name; ++x) {
523 if (modifiers[x].modifier == (guint) Keyboard::snap_modifier ()) {
524 _snap_modifier_combo.set_active_text (_(modifiers[x].name));
529 l = manage (new Label (_("Toggle snap using:")));
530 l->set_name ("OptionsLabel");
531 l->set_alignment (0, 0.5);
533 t->attach (*l, 0, 1, 2, 3, FILL | EXPAND, FILL);
534 t->attach (_snap_modifier_combo, 1, 2, 2, 3, FILL | EXPAND, FILL);
538 for (map<string,string>::iterator bf = Keyboard::binding_files.begin(); bf != Keyboard::binding_files.end(); ++bf) {
539 strs.push_back (bf->first);
542 set_popdown_strings (_keyboard_layout_selector, strs);
543 _keyboard_layout_selector.set_active_text (Keyboard::current_binding_name());
544 _keyboard_layout_selector.signal_changed().connect (sigc::mem_fun (*this, &KeyboardOptions::bindings_changed));
546 l = manage (new Label (_("Keyboard layout:")));
547 l->set_name ("OptionsLabel");
548 l->set_alignment (0, 0.5);
550 t->attach (*l, 0, 1, 3, 4, FILL | EXPAND, FILL);
551 t->attach (_keyboard_layout_selector, 1, 2, 3, 4, FILL | EXPAND, FILL);
553 _box->pack_start (*t, false, false);
556 void parameter_changed (string const &)
558 /* XXX: these aren't really config options... */
561 void set_state_from_config ()
563 /* XXX: these aren't really config options... */
568 void bindings_changed ()
570 string const txt = _keyboard_layout_selector.get_active_text();
572 /* XXX: config...? for all this keyboard stuff */
574 for (map<string,string>::iterator i = Keyboard::binding_files.begin(); i != Keyboard::binding_files.end(); ++i) {
575 if (txt == i->first) {
576 if (Keyboard::load_keybindings (i->second)) {
577 Keyboard::save_keybindings ();
583 void edit_modifier_chosen ()
585 string const txt = _edit_modifier_combo.get_active_text();
587 for (int i = 0; modifiers[i].name; ++i) {
588 if (txt == _(modifiers[i].name)) {
589 Keyboard::set_edit_modifier (modifiers[i].modifier);
595 void delete_modifier_chosen ()
597 string const txt = _delete_modifier_combo.get_active_text();
599 for (int i = 0; modifiers[i].name; ++i) {
600 if (txt == _(modifiers[i].name)) {
601 Keyboard::set_delete_modifier (modifiers[i].modifier);
607 void snap_modifier_chosen ()
609 string const txt = _snap_modifier_combo.get_active_text();
611 for (int i = 0; modifiers[i].name; ++i) {
612 if (txt == _(modifiers[i].name)) {
613 Keyboard::set_snap_modifier (modifiers[i].modifier);
619 void delete_button_changed ()
621 Keyboard::set_delete_button (_delete_button_spin.get_value_as_int());
624 void edit_button_changed ()
626 Keyboard::set_edit_button (_edit_button_spin.get_value_as_int());
629 ComboBoxText _keyboard_layout_selector;
630 ComboBoxText _edit_modifier_combo;
631 ComboBoxText _delete_modifier_combo;
632 ComboBoxText _snap_modifier_combo;
633 Adjustment _delete_button_adjustment;
634 SpinButton _delete_button_spin;
635 Adjustment _edit_button_adjustment;
636 SpinButton _edit_button_spin;
639 class FontScalingOptions : public OptionEditorBox
642 FontScalingOptions (RCConfiguration* c) :
644 _dpi_adjustment (50, 50, 250, 1, 10),
645 _dpi_slider (_dpi_adjustment)
647 _dpi_adjustment.set_value (_rc_config->get_font_scale () / 1024);
649 Label* l = manage (new Label (_("Font scaling:")));
650 l->set_name ("OptionsLabel");
652 _dpi_slider.set_update_policy (UPDATE_DISCONTINUOUS);
653 HBox* h = manage (new HBox);
655 h->pack_start (*l, false, false);
656 h->pack_start (_dpi_slider, true, true);
658 _box->pack_start (*h, false, false);
660 _dpi_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &FontScalingOptions::dpi_changed));
663 void parameter_changed (string const & p)
665 if (p == "font-scale") {
666 _dpi_adjustment.set_value (_rc_config->get_font_scale() / 1024);
670 void set_state_from_config ()
672 parameter_changed ("font-scale");
679 _rc_config->set_font_scale ((long) floor (_dpi_adjustment.get_value() * 1024));
680 /* XXX: should be triggered from the parameter changed signal */
684 RCConfiguration* _rc_config;
685 Adjustment _dpi_adjustment;
689 class SoloMuteOptions : public OptionEditorBox
692 SoloMuteOptions (RCConfiguration* c) :
694 // 0.781787 is the value needed for gain to be set to 0.
695 _db_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1)
698 if ((pix = ::get_icon ("fader_belt_h")) == 0) {
699 throw failed_constructor();
702 _db_slider = manage (new HSliderController (pix,
708 parameter_changed ("solo-mute-gain");
710 Label* l = manage (new Label (_("Solo mute cut (dB):")));
711 l->set_name ("OptionsLabel");
713 HBox* h = manage (new HBox);
715 h->pack_start (*l, false, false);
716 h->pack_start (*_db_slider, false, false);
717 h->pack_start (_db_display, false, false);
719 set_size_request_to_display_given_text (_db_display, "-99.0", 12, 12);
721 _box->pack_start (*h, false, false);
723 _db_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &SoloMuteOptions::db_changed));
726 void parameter_changed (string const & p)
728 if (p == "solo-mute-gain") {
729 gain_t val = _rc_config->get_solo_mute_gain();
731 _db_adjustment.set_value (gain_to_slider_position (val));
736 snprintf (buf, sizeof (buf), "-inf");
738 snprintf (buf, sizeof (buf), "%.2f", accurate_coefficient_to_dB (val));
741 _db_display.set_text (buf);
745 void set_state_from_config ()
747 parameter_changed ("solo-mute-gain");
754 _rc_config->set_solo_mute_gain (slider_position_to_gain (_db_adjustment.get_value()));
757 RCConfiguration* _rc_config;
758 Adjustment _db_adjustment;
759 Gtkmm2ext::HSliderController* _db_slider;
760 Glib::RefPtr<Gdk::Pixbuf> pix;
765 class ControlSurfacesOptions : public OptionEditorBox
768 ControlSurfacesOptions (ArdourDialog& parent)
771 _store = ListStore::create (_model);
772 _view.set_model (_store);
773 _view.append_column (_("Name"), _model.name);
774 _view.get_column(0)->set_resizable (true);
775 _view.get_column(0)->set_expand (true);
776 _view.append_column_editable (_("Enabled"), _model.enabled);
777 _view.append_column_editable (_("Feedback"), _model.feedback);
779 _box->pack_start (_view, false, false);
781 Label* label = manage (new Label (_("Double-click on a name to edit settings for an enabled protocol")));
783 _box->pack_start (*label, false, false);
786 _store->signal_row_changed().connect (sigc::mem_fun (*this, &ControlSurfacesOptions::model_changed));
787 _view.signal_button_press_event().connect_notify (sigc::mem_fun(*this, &ControlSurfacesOptions::edit_clicked));
790 void parameter_changed (std::string const &)
795 void set_state_from_config ()
799 ControlProtocolManager& m = ControlProtocolManager::instance ();
800 for (list<ControlProtocolInfo*>::iterator i = m.control_protocol_info.begin(); i != m.control_protocol_info.end(); ++i) {
802 if (!(*i)->mandatory) {
803 TreeModel::Row r = *_store->append ();
804 r[_model.name] = (*i)->name;
805 r[_model.enabled] = ((*i)->protocol || (*i)->requested);
806 r[_model.feedback] = ((*i)->protocol && (*i)->protocol->get_feedback ());
807 r[_model.protocol_info] = *i;
814 void model_changed (TreeModel::Path const &, TreeModel::iterator const & i)
816 TreeModel::Row r = *i;
818 ControlProtocolInfo* cpi = r[_model.protocol_info];
823 bool const was_enabled = (cpi->protocol != 0);
824 bool const is_enabled = r[_model.enabled];
826 if (was_enabled != is_enabled) {
828 ControlProtocolManager::instance().instantiate (*cpi);
830 ControlProtocolManager::instance().teardown (*cpi);
834 bool const was_feedback = (cpi->protocol && cpi->protocol->get_feedback ());
835 bool const is_feedback = r[_model.feedback];
837 if (was_feedback != is_feedback && cpi->protocol) {
838 cpi->protocol->set_feedback (is_feedback);
842 void edit_clicked (GdkEventButton* ev)
844 if (ev->type != GDK_2BUTTON_PRESS) {
849 ControlProtocolInfo* cpi;
852 row = *(_view.get_selection()->get_selected());
854 Window* win = row[_model.editor];
855 if (win && !win->is_visible()) {
858 cpi = row[_model.protocol_info];
860 if (cpi && cpi->protocol && cpi->protocol->has_editor ()) {
861 Box* box = (Box*) cpi->protocol->get_gui ();
863 string title = row[_model.name];
864 ArdourDialog* win = new ArdourDialog (_parent, title);
865 win->get_vbox()->pack_start (*box, false, false);
868 row[_model.editor] = win;
874 class ControlSurfacesModelColumns : public TreeModelColumnRecord
878 ControlSurfacesModelColumns ()
887 TreeModelColumn<string> name;
888 TreeModelColumn<bool> enabled;
889 TreeModelColumn<bool> feedback;
890 TreeModelColumn<ControlProtocolInfo*> protocol_info;
891 TreeModelColumn<Gtk::Window*> editor;
894 Glib::RefPtr<ListStore> _store;
895 ControlSurfacesModelColumns _model;
897 Gtk::Window& _parent;
901 RCOptionEditor::RCOptionEditor ()
902 : OptionEditor (Config, _("Ardour Preferences")),
907 add_option (_("Misc"), new OptionEditorHeading (_("Metering")));
909 ComboOption<float>* mht = new ComboOption<float> (
911 _("Meter hold time"),
912 sigc::mem_fun (*_rc_config, &RCConfiguration::get_meter_hold),
913 sigc::mem_fun (*_rc_config, &RCConfiguration::set_meter_hold)
916 mht->add (MeterHoldOff, _("off"));
917 mht->add (MeterHoldShort, _("short"));
918 mht->add (MeterHoldMedium, _("medium"));
919 mht->add (MeterHoldLong, _("long"));
921 add_option (_("Misc"), mht);
923 ComboOption<float>* mfo = new ComboOption<float> (
926 sigc::mem_fun (*_rc_config, &RCConfiguration::get_meter_falloff),
927 sigc::mem_fun (*_rc_config, &RCConfiguration::set_meter_falloff)
930 mfo->add (METER_FALLOFF_OFF, _("off"));
931 mfo->add (METER_FALLOFF_SLOWEST, _("slowest"));
932 mfo->add (METER_FALLOFF_SLOW, _("slow"));
933 mfo->add (METER_FALLOFF_MEDIUM, _("medium"));
934 mfo->add (METER_FALLOFF_FAST, _("fast"));
935 mfo->add (METER_FALLOFF_FASTER, _("faster"));
936 mfo->add (METER_FALLOFF_FASTEST, _("fastest"));
938 add_option (_("Misc"), mfo);
940 add_option (_("Misc"), new OptionEditorHeading (_("Undo")));
942 add_option (_("Misc"), new UndoOptions (_rc_config));
944 add_option (_("Misc"), new OptionEditorHeading (_("Misc")));
947 /* font scaling does nothing with GDK/Quartz */
948 add_option (_("Misc"), new FontScalingOptions (_rc_config));
951 add_option (_("Misc"),
953 "verify-remove-last-capture",
954 _("Verify removal of last capture"),
955 sigc::mem_fun (*_rc_config, &RCConfiguration::get_verify_remove_last_capture),
956 sigc::mem_fun (*_rc_config, &RCConfiguration::set_verify_remove_last_capture)
959 add_option (_("Misc"),
961 "periodic-safety-backups",
962 _("Make periodic backups of the session file"),
963 sigc::mem_fun (*_rc_config, &RCConfiguration::get_periodic_safety_backups),
964 sigc::mem_fun (*_rc_config, &RCConfiguration::set_periodic_safety_backups)
967 add_option (_("Misc"),
969 "sync-all-route-ordering",
970 _("Syncronise editor and mixer track order"),
971 sigc::mem_fun (*_rc_config, &RCConfiguration::get_sync_all_route_ordering),
972 sigc::mem_fun (*_rc_config, &RCConfiguration::set_sync_all_route_ordering)
975 add_option (_("Misc"),
977 "only-copy-imported-files",
978 _("Always copy imported files"),
979 sigc::mem_fun (*_rc_config, &RCConfiguration::get_only_copy_imported_files),
980 sigc::mem_fun (*_rc_config, &RCConfiguration::set_only_copy_imported_files)
983 add_option (_("Misc"),
986 _("Use narrow mixer strips"),
987 sigc::mem_fun (*_rc_config, &RCConfiguration::get_default_narrow_ms),
988 sigc::mem_fun (*_rc_config, &RCConfiguration::set_default_narrow_ms)
991 add_option (_("Misc"),
994 _("Name new markers"),
995 sigc::mem_fun (*_rc_config, &RCConfiguration::get_name_new_markers),
996 sigc::mem_fun (*_rc_config, &RCConfiguration::set_name_new_markers)
1001 add_option (_("Transport"),
1003 "latched-record-enable",
1004 _("Keep record-enable engaged on stop"),
1005 sigc::mem_fun (*_rc_config, &RCConfiguration::get_latched_record_enable),
1006 sigc::mem_fun (*_rc_config, &RCConfiguration::set_latched_record_enable)
1009 add_option (_("Transport"),
1011 "stop-recording-on-xrun",
1012 _("Stop recording when an xrun occurs"),
1013 sigc::mem_fun (*_rc_config, &RCConfiguration::get_stop_recording_on_xrun),
1014 sigc::mem_fun (*_rc_config, &RCConfiguration::set_stop_recording_on_xrun)
1017 add_option (_("Transport"),
1019 "create-xrun-marker",
1020 _("Create markers where xruns occur"),
1021 sigc::mem_fun (*_rc_config, &RCConfiguration::get_create_xrun_marker),
1022 sigc::mem_fun (*_rc_config, &RCConfiguration::set_create_xrun_marker)
1025 add_option (_("Transport"),
1027 "stop-at-session-end",
1028 _("Stop at the end of the session"),
1029 sigc::mem_fun (*_rc_config, &RCConfiguration::get_stop_at_session_end),
1030 sigc::mem_fun (*_rc_config, &RCConfiguration::set_stop_at_session_end)
1033 add_option (_("Transport"),
1035 "primary-clock-delta-edit-cursor",
1036 _("Primary clock delta to edit cursor"),
1037 sigc::mem_fun (*_rc_config, &RCConfiguration::get_primary_clock_delta_edit_cursor),
1038 sigc::mem_fun (*_rc_config, &RCConfiguration::set_primary_clock_delta_edit_cursor)
1041 add_option (_("Transport"),
1043 "secondary-clock-delta-edit-cursor",
1044 _("Secondary clock delta to edit cursor"),
1045 sigc::mem_fun (*_rc_config, &RCConfiguration::get_secondary_clock_delta_edit_cursor),
1046 sigc::mem_fun (*_rc_config, &RCConfiguration::set_secondary_clock_delta_edit_cursor)
1049 add_option (_("Transport"),
1051 "disable-disarm-during-roll",
1052 _("Disable per-track record disarm while rolling"),
1053 sigc::mem_fun (*_rc_config, &RCConfiguration::get_disable_disarm_during_roll),
1054 sigc::mem_fun (*_rc_config, &RCConfiguration::set_disable_disarm_during_roll)
1059 add_option (_("Editor"),
1061 "link-region-and-track-selection",
1062 _("Link selection of regions and tracks"),
1063 sigc::mem_fun (*_rc_config, &RCConfiguration::get_link_region_and_track_selection),
1064 sigc::mem_fun (*_rc_config, &RCConfiguration::set_link_region_and_track_selection)
1067 add_option (_("Editor"),
1069 "automation-follows-regions",
1070 _("Move relevant automation when regions are moved"),
1071 sigc::mem_fun (*_rc_config, &RCConfiguration::get_automation_follows_regions),
1072 sigc::mem_fun (*_rc_config, &RCConfiguration::set_automation_follows_regions)
1075 add_option (_("Editor"),
1077 "show-track-meters",
1078 _("Show meters on tracks in the editor"),
1079 sigc::mem_fun (*_rc_config, &RCConfiguration::get_show_track_meters),
1080 sigc::mem_fun (*_rc_config, &RCConfiguration::set_show_track_meters)
1083 add_option (_("Editor"),
1085 "use-overlap-equivalency",
1086 _("Use overlap equivalency for regions"),
1087 sigc::mem_fun (*_rc_config, &RCConfiguration::get_use_overlap_equivalency),
1088 sigc::mem_fun (*_rc_config, &RCConfiguration::set_use_overlap_equivalency)
1091 add_option (_("Editor"),
1093 "rubberbanding-snaps-to-grid",
1094 _("Make rubberband selection rectangle snap to the grid"),
1095 sigc::mem_fun (*_rc_config, &RCConfiguration::get_rubberbanding_snaps_to_grid),
1096 sigc::mem_fun (*_rc_config, &RCConfiguration::set_rubberbanding_snaps_to_grid)
1099 add_option (_("Editor"),
1102 _("Show waveforms in regions"),
1103 sigc::mem_fun (*_rc_config, &RCConfiguration::get_show_waveforms),
1104 sigc::mem_fun (*_rc_config, &RCConfiguration::set_show_waveforms)
1107 ComboOption<WaveformScale>* wfs = new ComboOption<WaveformScale> (
1109 _("Waveform scale"),
1110 sigc::mem_fun (*_rc_config, &RCConfiguration::get_waveform_scale),
1111 sigc::mem_fun (*_rc_config, &RCConfiguration::set_waveform_scale)
1114 wfs->add (Linear, _("linear"));
1115 wfs->add (Logarithmic, _("logarithmic"));
1117 add_option (_("Editor"), wfs);
1119 ComboOption<WaveformShape>* wfsh = new ComboOption<WaveformShape> (
1121 _("Waveform shape"),
1122 sigc::mem_fun (*_rc_config, &RCConfiguration::get_waveform_shape),
1123 sigc::mem_fun (*_rc_config, &RCConfiguration::set_waveform_shape)
1126 wfsh->add (Traditional, _("traditional"));
1127 wfsh->add (Rectified, _("rectified"));
1129 add_option (_("Editor"), wfsh);
1133 add_option (_("Audio"), new OptionEditorHeading (_("Solo")));
1136 add_option (_("Audio"),
1138 "solo-control-is-listen-control",
1139 _("Solo controls are Listen controls"),
1140 sigc::mem_fun (*_rc_config, &RCConfiguration::get_solo_control_is_listen_control),
1141 sigc::mem_fun (*_rc_config, &RCConfiguration::set_solo_control_is_listen_control)
1144 ComboOption<ListenPosition>* lp = new ComboOption<ListenPosition> (
1146 _("Listen Position"),
1147 sigc::mem_fun (*_rc_config, &RCConfiguration::get_listen_position),
1148 sigc::mem_fun (*_rc_config, &RCConfiguration::set_listen_position)
1151 lp->add (AfterFaderListen, _("after-fader listen"));
1152 lp->add (PreFaderListen, _("pre-fader listen"));
1154 add_option (_("Audio"), lp);
1155 add_option (_("Audio"), new SoloMuteOptions (_rc_config));
1157 add_option (_("Audio"),
1161 sigc::mem_fun (*_rc_config, &RCConfiguration::get_solo_latched),
1162 sigc::mem_fun (*_rc_config, &RCConfiguration::set_solo_latched)
1165 add_option (_("Audio"),
1168 _("Show solo muting"),
1169 sigc::mem_fun (*_rc_config, &RCConfiguration::get_show_solo_mutes),
1170 sigc::mem_fun (*_rc_config, &RCConfiguration::set_show_solo_mutes)
1173 add_option (_("Audio"),
1175 "solo-mute-override",
1176 _("Override muting"),
1177 sigc::mem_fun (*_rc_config, &RCConfiguration::get_solo_mute_override),
1178 sigc::mem_fun (*_rc_config, &RCConfiguration::set_solo_mute_override)
1181 add_option (_("Audio"), new OptionEditorHeading (_("Monitoring")));
1183 ComboOption<MonitorModel>* mm = new ComboOption<MonitorModel> (
1185 _("Monitoring handled by"),
1186 sigc::mem_fun (*_rc_config, &RCConfiguration::get_monitoring_model),
1187 sigc::mem_fun (*_rc_config, &RCConfiguration::set_monitoring_model)
1190 mm->add (HardwareMonitoring, _("JACK"));
1191 mm->add (SoftwareMonitoring, _("ardour"));
1192 mm->add (ExternalMonitoring, _("audio hardware"));
1194 add_option (_("Audio"), mm);
1196 add_option (_("Audio"),
1198 "tape-machine-mode",
1199 _("Tape machine mode"),
1200 sigc::mem_fun (*_rc_config, &RCConfiguration::get_tape_machine_mode),
1201 sigc::mem_fun (*_rc_config, &RCConfiguration::set_tape_machine_mode)
1204 add_option (_("Audio"), new OptionEditorHeading (_("Connection of tracks and busses")));
1206 add_option (_("Audio"),
1208 "auto-connect-standard-busses",
1209 _("Auto-connect master/monitor busses"),
1210 sigc::mem_fun (*_rc_config, &RCConfiguration::get_auto_connect_standard_busses),
1211 sigc::mem_fun (*_rc_config, &RCConfiguration::set_auto_connect_standard_busses)
1214 ComboOption<AutoConnectOption>* iac = new ComboOption<AutoConnectOption> (
1215 "input-auto-connect",
1216 _("Connect track and bus inputs"),
1217 sigc::mem_fun (*_rc_config, &RCConfiguration::get_input_auto_connect),
1218 sigc::mem_fun (*_rc_config, &RCConfiguration::set_input_auto_connect)
1221 iac->add (AutoConnectPhysical, _("automatically to physical inputs"));
1222 iac->add (ManualConnect, _("manually"));
1224 add_option (_("Audio"), iac);
1226 ComboOption<AutoConnectOption>* oac = new ComboOption<AutoConnectOption> (
1227 "output-auto-connect",
1228 _("Connect track and bus outputs"),
1229 sigc::mem_fun (*_rc_config, &RCConfiguration::get_output_auto_connect),
1230 sigc::mem_fun (*_rc_config, &RCConfiguration::set_output_auto_connect)
1233 oac->add (AutoConnectPhysical, _("automatically to physical outputs"));
1234 oac->add (AutoConnectMaster, _("automatically to master outputs"));
1235 oac->add (ManualConnect, _("manually"));
1237 add_option (_("Audio"), oac);
1239 add_option (_("Audio"), new OptionEditorHeading (_("Denormals")));
1241 add_option (_("Audio"),
1243 "denormal-protection",
1244 _("Use DC bias to protect against denormals"),
1245 sigc::mem_fun (*_rc_config, &RCConfiguration::get_denormal_protection),
1246 sigc::mem_fun (*_rc_config, &RCConfiguration::set_denormal_protection)
1249 ComboOption<DenormalModel>* dm = new ComboOption<DenormalModel> (
1251 _("Processor handling"),
1252 sigc::mem_fun (*_rc_config, &RCConfiguration::get_denormal_model),
1253 sigc::mem_fun (*_rc_config, &RCConfiguration::set_denormal_model)
1256 dm->add (DenormalNone, _("no processor handling"));
1260 if (fpu.has_flush_to_zero()) {
1261 dm->add (DenormalFTZ, _("use FlushToZero"));
1264 if (fpu.has_denormals_are_zero()) {
1265 dm->add (DenormalDAZ, _("use DenormalsAreZero"));
1268 if (fpu.has_flush_to_zero() && fpu.has_denormals_are_zero()) {
1269 dm->add (DenormalFTZDAZ, _("use FlushToZero and DenormalsAreZerO"));
1272 add_option (_("Audio"), dm);
1274 add_option (_("Audio"), new OptionEditorHeading (_("Plugins")));
1276 add_option (_("Audio"),
1278 "plugins-stop-with-transport",
1279 _("Stop plugins when the transport is stopped"),
1280 sigc::mem_fun (*_rc_config, &RCConfiguration::get_plugins_stop_with_transport),
1281 sigc::mem_fun (*_rc_config, &RCConfiguration::set_plugins_stop_with_transport)
1284 add_option (_("Audio"),
1286 "do-not-record-plugins",
1287 _("Disable plugins during recording"),
1288 sigc::mem_fun (*_rc_config, &RCConfiguration::get_do_not_record_plugins),
1289 sigc::mem_fun (*_rc_config, &RCConfiguration::set_do_not_record_plugins)
1292 add_option (_("Audio"),
1294 "new-plugins-active",
1295 _("Make new plugins active"),
1296 sigc::mem_fun (*_rc_config, &RCConfiguration::get_new_plugins_active),
1297 sigc::mem_fun (*_rc_config, &RCConfiguration::set_new_plugins_active)
1300 add_option (_("Audio"),
1302 "auto-analyse-audio",
1303 _("Enable automatic analysis of audio"),
1304 sigc::mem_fun (*_rc_config, &RCConfiguration::get_auto_analyse_audio),
1305 sigc::mem_fun (*_rc_config, &RCConfiguration::set_auto_analyse_audio)
1310 list<ComboOption<string>* > midi_combos;
1312 midi_combos.push_back (new ComboOption<string> (
1314 _("Send/Receive MTC via"),
1315 sigc::mem_fun (*_rc_config, &RCConfiguration::get_mtc_port_name),
1316 sigc::mem_fun (*_rc_config, &RCConfiguration::set_mtc_port_name)
1319 midi_combos.push_back (new ComboOption<string> (
1320 "midi-clock-port-name",
1321 _("Send/Receive MIDI clock via"),
1322 sigc::mem_fun (*_rc_config, &RCConfiguration::get_midi_clock_port_name),
1323 sigc::mem_fun (*_rc_config, &RCConfiguration::set_midi_clock_port_name)
1326 midi_combos.push_back (new ComboOption<string> (
1328 _("Send/Receive MMC via"),
1329 sigc::mem_fun (*_rc_config, &RCConfiguration::get_mmc_port_name),
1330 sigc::mem_fun (*_rc_config, &RCConfiguration::set_mmc_port_name)
1333 midi_combos.push_back (new ComboOption<string> (
1335 _("Send/Receive MIDI parameter control via"),
1336 sigc::mem_fun (*_rc_config, &RCConfiguration::get_midi_port_name),
1337 sigc::mem_fun (*_rc_config, &RCConfiguration::set_midi_port_name)
1340 add_option (_("MIDI control"), new MIDIPorts (_rc_config, midi_combos));
1342 for (list<ComboOption<string>* >::iterator i = midi_combos.begin(); i != midi_combos.end(); ++i) {
1343 add_option (_("MIDI control"), *i);
1346 add_option (_("MIDI control"),
1349 _("Obey MIDI Machine Control commands"),
1350 sigc::mem_fun (*_rc_config, &RCConfiguration::get_mmc_control),
1351 sigc::mem_fun (*_rc_config, &RCConfiguration::set_mmc_control)
1355 add_option (_("MIDI control"),
1358 _("Send MIDI Machine Control commands"),
1359 sigc::mem_fun (*_rc_config, &RCConfiguration::get_send_mmc),
1360 sigc::mem_fun (*_rc_config, &RCConfiguration::set_send_mmc)
1363 add_option (_("MIDI control"),
1366 _("Send MIDI control feedback"),
1367 sigc::mem_fun (*_rc_config, &RCConfiguration::get_midi_feedback),
1368 sigc::mem_fun (*_rc_config, &RCConfiguration::set_midi_feedback)
1371 add_option (_("MIDI control"),
1372 new SpinOption<uint8_t> (
1373 "mmc-receive-device-id",
1374 _("Inbound MMC device ID"),
1375 sigc::mem_fun (*_rc_config, &RCConfiguration::get_mmc_receive_device_id),
1376 sigc::mem_fun (*_rc_config, &RCConfiguration::set_mmc_receive_device_id),
1380 add_option (_("MIDI control"),
1381 new SpinOption<uint8_t> (
1382 "mmc-send-device-id",
1383 _("Outbound MMC device ID"),
1384 sigc::mem_fun (*_rc_config, &RCConfiguration::get_mmc_send_device_id),
1385 sigc::mem_fun (*_rc_config, &RCConfiguration::set_mmc_send_device_id),
1389 add_option (_("MIDI control"),
1390 new SpinOption<int32_t> (
1391 "initial-program-change",
1392 _("Initial program change"),
1393 sigc::mem_fun (*_rc_config, &RCConfiguration::get_initial_program_change),
1394 sigc::mem_fun (*_rc_config, &RCConfiguration::set_initial_program_change),
1398 /* CONTROL SURFACES */
1400 add_option (_("Control surfaces"), new ControlSurfacesOptions (*this));
1402 ComboOption<RemoteModel>* rm = new ComboOption<RemoteModel> (
1404 _("Control surface remote ID"),
1405 sigc::mem_fun (*_rc_config, &RCConfiguration::get_remote_model),
1406 sigc::mem_fun (*_rc_config, &RCConfiguration::set_remote_model)
1409 rm->add (UserOrdered, _("assigned by user"));
1410 rm->add (MixerOrdered, _("follows order of mixer"));
1411 rm->add (EditorOrdered, _("follows order of editor"));
1413 add_option (_("Control surfaces"), rm);
1417 add_option (_("Click"), new ClickOptions (_rc_config, this));
1421 add_option (_("Keyboard"), new KeyboardOptions);