Move RDF-based preset stuff into LadspaPlugin, to make way for a set of evil hacks...
[ardour.git] / gtk2_ardour / rc_option_editor.cc
1 #ifdef WAF_BUILD
2 #include "gtk2ardour-config.h"
3 #endif
4
5 #include <gtkmm/liststore.h>
6 #include <gtkmm/stock.h>
7 #include <gtkmm/scale.h>
8 #include <gtkmm2ext/utils.h>
9 #include <gtkmm2ext/slider_controller.h>
10
11 #include "pbd/fpu.h"
12 #include "pbd/cpus.h"
13
14 #include "midi++/manager.h"
15
16 #include "ardour/audioengine.h"
17 #include "ardour/dB.h"
18 #include "ardour/rc_configuration.h"
19 #include "ardour/control_protocol_manager.h"
20 #include "control_protocol/control_protocol.h"
21
22 #include "gui_thread.h"
23 #include "midi_tracer.h"
24 #include "rc_option_editor.h"
25 #include "utils.h"
26 #include "midi_port_dialog.h"
27 #include "sfdb_ui.h"
28 #include "keyboard.h"
29 #include "i18n.h"
30
31 using namespace std;
32 using namespace Gtk;
33 using namespace Gtkmm2ext;
34 using namespace PBD;
35 using namespace ARDOUR;
36
37 class ClickOptions : public OptionEditorBox
38 {
39 public:
40         ClickOptions (RCConfiguration* c, ArdourDialog* p)
41                 : _rc_config (c),
42                   _parent (p)
43         {
44                 Table* t = manage (new Table (2, 3));
45                 t->set_spacings (4);
46
47                 Label* l = manage (new Label (_("Click audio file:")));
48                 l->set_alignment (0, 0.5);
49                 t->attach (*l, 0, 1, 0, 1, FILL);
50                 t->attach (_click_path_entry, 1, 2, 0, 1, FILL);
51                 Button* b = manage (new Button (_("Browse...")));
52                 b->signal_clicked().connect (sigc::mem_fun (*this, &ClickOptions::click_browse_clicked));
53                 t->attach (*b, 2, 3, 0, 1, FILL);
54
55                 l = manage (new Label (_("Click emphasis audio file:")));
56                 l->set_alignment (0, 0.5);
57                 t->attach (*l, 0, 1, 1, 2, FILL);
58                 t->attach (_click_emphasis_path_entry, 1, 2, 1, 2, FILL);
59                 b = manage (new Button (_("Browse...")));
60                 b->signal_clicked().connect (sigc::mem_fun (*this, &ClickOptions::click_emphasis_browse_clicked));
61                 t->attach (*b, 2, 3, 1, 2, FILL);
62
63                 _box->pack_start (*t, false, false);
64         }
65
66         void parameter_changed (string const & p)
67         {
68                 if (p == "click-sound") {
69                         _click_path_entry.set_text (_rc_config->get_click_sound());
70                 } else if (p == "click-emphasis-sound") {
71                         _click_emphasis_path_entry.set_text (_rc_config->get_click_emphasis_sound());
72                 }
73         }
74
75         void set_state_from_config ()
76         {
77                 parameter_changed ("click-sound");
78                 parameter_changed ("click-emphasis-sound");
79         }
80
81 private:
82
83         void click_browse_clicked ()
84         {
85                 SoundFileChooser sfdb (*_parent, _("Choose Click"));
86
87                 sfdb.show_all ();
88                 sfdb.present ();
89
90                 if (sfdb.run () == RESPONSE_OK) {
91                         click_chosen (sfdb.get_filename());
92                 }
93         }
94
95         void click_chosen (string const & path)
96         {
97                 _click_path_entry.set_text (path);
98                 _rc_config->set_click_sound (path);
99         }
100
101         void click_emphasis_browse_clicked ()
102         {
103                 SoundFileChooser sfdb (*_parent, _("Choose Click Emphasis"));
104
105                 sfdb.show_all ();
106                 sfdb.present ();
107
108                 if (sfdb.run () == RESPONSE_OK) {
109                         click_emphasis_chosen (sfdb.get_filename());
110                 }
111         }
112
113         void click_emphasis_chosen (string const & path)
114         {
115                 _click_emphasis_path_entry.set_text (path);
116                 _rc_config->set_click_emphasis_sound (path);
117         }
118
119         RCConfiguration* _rc_config;
120         ArdourDialog* _parent;
121         Entry _click_path_entry;
122         Entry _click_emphasis_path_entry;
123 };
124
125 class UndoOptions : public OptionEditorBox
126 {
127 public:
128         UndoOptions (RCConfiguration* c) :
129                 _rc_config (c),
130                 _limit_undo_button (_("Limit undo history to")),
131                 _save_undo_button (_("Save undo history of"))
132         {
133                 Table* t = new Table (2, 3);
134                 t->set_spacings (4);
135
136                 t->attach (_limit_undo_button, 0, 1, 0, 1, FILL);
137                 _limit_undo_spin.set_range (0, 512);
138                 _limit_undo_spin.set_increments (1, 10);
139                 t->attach (_limit_undo_spin, 1, 2, 0, 1, FILL | EXPAND);
140                 Label* l = manage (new Label (_("commands")));
141                 l->set_alignment (0, 0.5);
142                 t->attach (*l, 2, 3, 0, 1);
143
144                 t->attach (_save_undo_button, 0, 1, 1, 2, FILL);
145                 _save_undo_spin.set_range (0, 512);
146                 _save_undo_spin.set_increments (1, 10);
147                 t->attach (_save_undo_spin, 1, 2, 1, 2, FILL | EXPAND);
148                 l = manage (new Label (_("commands")));
149                 l->set_alignment (0, 0.5);
150                 t->attach (*l, 2, 3, 1, 2);
151
152                 _box->pack_start (*t);
153
154                 _limit_undo_button.signal_toggled().connect (sigc::mem_fun (*this, &UndoOptions::limit_undo_toggled));
155                 _limit_undo_spin.signal_value_changed().connect (sigc::mem_fun (*this, &UndoOptions::limit_undo_changed));
156                 _save_undo_button.signal_toggled().connect (sigc::mem_fun (*this, &UndoOptions::save_undo_toggled));
157                 _save_undo_spin.signal_value_changed().connect (sigc::mem_fun (*this, &UndoOptions::save_undo_changed));
158         }
159
160         void parameter_changed (string const & p)
161         {
162                 if (p == "history-depth") {
163                         int32_t const d = _rc_config->get_history_depth();
164                         _limit_undo_button.set_active (d != 0);
165                         _limit_undo_spin.set_sensitive (d != 0);
166                         _limit_undo_spin.set_value (d);
167                 } else if (p == "save-history") {
168                         bool const x = _rc_config->get_save_history ();
169                         _save_undo_button.set_active (x);
170                         _save_undo_spin.set_sensitive (x);
171                 } else if (p == "save-history-depth") {
172                         _save_undo_spin.set_value (_rc_config->get_saved_history_depth());
173                 }
174         }
175
176         void set_state_from_config ()
177         {
178                 parameter_changed ("save-history");
179                 parameter_changed ("history-depth");
180                 parameter_changed ("save-history-depth");
181         }
182
183         void limit_undo_toggled ()
184         {
185                 bool const x = _limit_undo_button.get_active ();
186                 _limit_undo_spin.set_sensitive (x);
187                 int32_t const n = x ? 16 : 0;
188                 _limit_undo_spin.set_value (n);
189                 _rc_config->set_history_depth (n);
190         }
191
192         void limit_undo_changed ()
193         {
194                 _rc_config->set_history_depth (_limit_undo_spin.get_value_as_int ());
195         }
196
197         void save_undo_toggled ()
198         {
199                 bool const x = _save_undo_button.get_active ();
200                 _rc_config->set_save_history (x);
201         }
202
203         void save_undo_changed ()
204         {
205                 _rc_config->set_saved_history_depth (_save_undo_spin.get_value_as_int ());
206         }
207
208 private:
209         RCConfiguration* _rc_config;
210         CheckButton _limit_undo_button;
211         SpinButton _limit_undo_spin;
212         CheckButton _save_undo_button;
213         SpinButton _save_undo_spin;
214 };
215
216
217
218 static const struct {
219     const char *name;
220     guint modifier;
221 } modifiers[] = {
222
223         { "Unmodified", 0 },
224
225 #ifdef GTKOSX
226
227         /* Command = Meta
228            Option/Alt = Mod1
229         */
230         { "Shift", GDK_SHIFT_MASK },
231         { "Command", GDK_META_MASK },
232         { "Control", GDK_CONTROL_MASK },
233         { "Option", GDK_MOD1_MASK },
234         { "Command-Shift", GDK_META_MASK|GDK_SHIFT_MASK },
235         { "Command-Option", GDK_MOD1_MASK|GDK_META_MASK },
236         { "Shift-Option", GDK_SHIFT_MASK|GDK_MOD1_MASK },
237         { "Shift-Command-Option", GDK_MOD5_MASK|GDK_SHIFT_MASK|GDK_META_MASK },
238
239 #else
240         { "Shift", GDK_SHIFT_MASK },
241         { "Control", GDK_CONTROL_MASK },
242         { "Alt (Mod1)", GDK_MOD1_MASK },
243         { "Control-Shift", GDK_CONTROL_MASK|GDK_SHIFT_MASK },
244         { "Control-Alt", GDK_CONTROL_MASK|GDK_MOD1_MASK },
245         { "Shift-Alt", GDK_SHIFT_MASK|GDK_MOD1_MASK },
246         { "Control-Shift-Alt", GDK_CONTROL_MASK|GDK_SHIFT_MASK|GDK_MOD1_MASK },
247         { "Mod2", GDK_MOD2_MASK },
248         { "Mod3", GDK_MOD3_MASK },
249         { "Mod4", GDK_MOD4_MASK },
250         { "Mod5", GDK_MOD5_MASK },
251 #endif
252         { 0, 0 }
253 };
254
255
256 class KeyboardOptions : public OptionEditorBox
257 {
258 public:
259         KeyboardOptions () :
260                   _delete_button_adjustment (3, 1, 12),
261                   _delete_button_spin (_delete_button_adjustment),
262                   _edit_button_adjustment (3, 1, 5),
263                   _edit_button_spin (_edit_button_adjustment)
264
265         {
266                 /* internationalize and prepare for use with combos */
267
268                 vector<string> dumb;
269                 for (int i = 0; modifiers[i].name; ++i) {
270                         dumb.push_back (_(modifiers[i].name));
271                 }
272
273                 set_popdown_strings (_edit_modifier_combo, dumb);
274                 _edit_modifier_combo.signal_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::edit_modifier_chosen));
275
276                 for (int x = 0; modifiers[x].name; ++x) {
277                         if (modifiers[x].modifier == Keyboard::edit_modifier ()) {
278                                 _edit_modifier_combo.set_active_text (_(modifiers[x].name));
279                                 break;
280                         }
281                 }
282
283                 Table* t = manage (new Table (4, 4));
284                 t->set_spacings (4);
285
286                 Label* l = manage (new Label (_("Edit using:")));
287                 l->set_name ("OptionsLabel");
288                 l->set_alignment (0, 0.5);
289
290                 t->attach (*l, 0, 1, 0, 1, FILL | EXPAND, FILL);
291                 t->attach (_edit_modifier_combo, 1, 2, 0, 1, FILL | EXPAND, FILL);
292
293                 l = manage (new Label (_("+ button")));
294                 l->set_name ("OptionsLabel");
295
296                 t->attach (*l, 3, 4, 0, 1, FILL | EXPAND, FILL);
297                 t->attach (_edit_button_spin, 4, 5, 0, 1, FILL | EXPAND, FILL);
298
299                 _edit_button_spin.set_name ("OptionsEntry");
300                 _edit_button_adjustment.set_value (Keyboard::edit_button());
301                 _edit_button_adjustment.signal_value_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::edit_button_changed));
302
303                 set_popdown_strings (_delete_modifier_combo, dumb);
304                 _delete_modifier_combo.signal_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::delete_modifier_chosen));
305
306                 for (int x = 0; modifiers[x].name; ++x) {
307                         if (modifiers[x].modifier == Keyboard::delete_modifier ()) {
308                                 _delete_modifier_combo.set_active_text (_(modifiers[x].name));
309                                 break;
310                         }
311                 }
312
313                 l = manage (new Label (_("Delete using:")));
314                 l->set_name ("OptionsLabel");
315                 l->set_alignment (0, 0.5);
316
317                 t->attach (*l, 0, 1, 1, 2, FILL | EXPAND, FILL);
318                 t->attach (_delete_modifier_combo, 1, 2, 1, 2, FILL | EXPAND, FILL);
319
320                 l = manage (new Label (_("+ button")));
321                 l->set_name ("OptionsLabel");
322
323                 t->attach (*l, 3, 4, 1, 2, FILL | EXPAND, FILL);
324                 t->attach (_delete_button_spin, 4, 5, 1, 2, FILL | EXPAND, FILL);
325
326                 _delete_button_spin.set_name ("OptionsEntry");
327                 _delete_button_adjustment.set_value (Keyboard::delete_button());
328                 _delete_button_adjustment.signal_value_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::delete_button_changed));
329
330                 set_popdown_strings (_snap_modifier_combo, dumb);
331                 _snap_modifier_combo.signal_changed().connect (sigc::mem_fun(*this, &KeyboardOptions::snap_modifier_chosen));
332
333                 for (int x = 0; modifiers[x].name; ++x) {
334                         if (modifiers[x].modifier == (guint) Keyboard::snap_modifier ()) {
335                                 _snap_modifier_combo.set_active_text (_(modifiers[x].name));
336                                 break;
337                         }
338                 }
339
340                 l = manage (new Label (_("Toggle snap using:")));
341                 l->set_name ("OptionsLabel");
342                 l->set_alignment (0, 0.5);
343
344                 t->attach (*l, 0, 1, 2, 3, FILL | EXPAND, FILL);
345                 t->attach (_snap_modifier_combo, 1, 2, 2, 3, FILL | EXPAND, FILL);
346
347                 vector<string> strs;
348
349                 for (map<string,string>::iterator bf = Keyboard::binding_files.begin(); bf != Keyboard::binding_files.end(); ++bf) {
350                         strs.push_back (bf->first);
351                 }
352
353                 set_popdown_strings (_keyboard_layout_selector, strs);
354                 _keyboard_layout_selector.set_active_text (Keyboard::current_binding_name());
355                 _keyboard_layout_selector.signal_changed().connect (sigc::mem_fun (*this, &KeyboardOptions::bindings_changed));
356
357                 l = manage (new Label (_("Keyboard layout:")));
358                 l->set_name ("OptionsLabel");
359                 l->set_alignment (0, 0.5);
360
361                 t->attach (*l, 0, 1, 3, 4, FILL | EXPAND, FILL);
362                 t->attach (_keyboard_layout_selector, 1, 2, 3, 4, FILL | EXPAND, FILL);
363
364                 _box->pack_start (*t, false, false);
365         }
366
367         void parameter_changed (string const &)
368         {
369                 /* XXX: these aren't really config options... */
370         }
371
372         void set_state_from_config ()
373         {
374                 /* XXX: these aren't really config options... */
375         }
376
377 private:
378
379         void bindings_changed ()
380         {
381                 string const txt = _keyboard_layout_selector.get_active_text();
382
383                 /* XXX: config...?  for all this keyboard stuff */
384
385                 for (map<string,string>::iterator i = Keyboard::binding_files.begin(); i != Keyboard::binding_files.end(); ++i) {
386                         if (txt == i->first) {
387                                 if (Keyboard::load_keybindings (i->second)) {
388                                         Keyboard::save_keybindings ();
389                                 }
390                         }
391                 }
392         }
393
394         void edit_modifier_chosen ()
395         {
396                 string const txt = _edit_modifier_combo.get_active_text();
397
398                 for (int i = 0; modifiers[i].name; ++i) {
399                         if (txt == _(modifiers[i].name)) {
400                                 Keyboard::set_edit_modifier (modifiers[i].modifier);
401                                 break;
402                         }
403                 }
404         }
405
406         void delete_modifier_chosen ()
407         {
408                 string const txt = _delete_modifier_combo.get_active_text();
409
410                 for (int i = 0; modifiers[i].name; ++i) {
411                         if (txt == _(modifiers[i].name)) {
412                                 Keyboard::set_delete_modifier (modifiers[i].modifier);
413                                 break;
414                         }
415                 }
416         }
417
418         void snap_modifier_chosen ()
419         {
420                 string const txt = _snap_modifier_combo.get_active_text();
421
422                 for (int i = 0; modifiers[i].name; ++i) {
423                         if (txt == _(modifiers[i].name)) {
424                                 Keyboard::set_snap_modifier (modifiers[i].modifier);
425                                 break;
426                         }
427                 }
428         }
429
430         void delete_button_changed ()
431         {
432                 Keyboard::set_delete_button (_delete_button_spin.get_value_as_int());
433         }
434
435         void edit_button_changed ()
436         {
437                 Keyboard::set_edit_button (_edit_button_spin.get_value_as_int());
438         }
439
440         ComboBoxText _keyboard_layout_selector;
441         ComboBoxText _edit_modifier_combo;
442         ComboBoxText _delete_modifier_combo;
443         ComboBoxText _snap_modifier_combo;
444         Adjustment _delete_button_adjustment;
445         SpinButton _delete_button_spin;
446         Adjustment _edit_button_adjustment;
447         SpinButton _edit_button_spin;
448 };
449
450 class FontScalingOptions : public OptionEditorBox
451 {
452 public:
453         FontScalingOptions (RCConfiguration* c) :
454                 _rc_config (c),
455                 _dpi_adjustment (50, 50, 250, 1, 10),
456                 _dpi_slider (_dpi_adjustment)
457         {
458                 _dpi_adjustment.set_value (_rc_config->get_font_scale () / 1024);
459
460                 Label* l = manage (new Label (_("Font scaling:")));
461                 l->set_name ("OptionsLabel");
462
463                 _dpi_slider.set_update_policy (UPDATE_DISCONTINUOUS);
464                 HBox* h = manage (new HBox);
465                 h->set_spacing (4);
466                 h->pack_start (*l, false, false);
467                 h->pack_start (_dpi_slider, true, true);
468
469                 _box->pack_start (*h, false, false);
470
471                 _dpi_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &FontScalingOptions::dpi_changed));
472         }
473
474         void parameter_changed (string const & p)
475         {
476                 if (p == "font-scale") {
477                         _dpi_adjustment.set_value (_rc_config->get_font_scale() / 1024);
478                 }
479         }
480
481         void set_state_from_config ()
482         {
483                 parameter_changed ("font-scale");
484         }
485
486 private:
487
488         void dpi_changed ()
489         {
490                 _rc_config->set_font_scale ((long) floor (_dpi_adjustment.get_value() * 1024));
491                 /* XXX: should be triggered from the parameter changed signal */
492                 reset_dpi ();
493         }
494
495         RCConfiguration* _rc_config;
496         Adjustment _dpi_adjustment;
497         HScale _dpi_slider;
498 };
499
500 class BufferingOptions : public OptionEditorBox
501 {
502 public:
503         BufferingOptions (RCConfiguration* c) 
504                 : _rc_config (c)
505                 , _playback_adjustment (5, 1, 60, 1, 4)
506                 , _capture_adjustment (5, 1, 60, 1, 4)
507                 , _playback_slider (_playback_adjustment)
508                 , _capture_slider (_capture_adjustment)
509         {
510                 _playback_adjustment.set_value (_rc_config->get_audio_playback_buffer_seconds());
511
512                 Label* l = manage (new Label (_("Playback (seconds of buffering):")));
513                 l->set_name ("OptionsLabel");
514
515                 _playback_slider.set_update_policy (UPDATE_DISCONTINUOUS);
516                 HBox* h = manage (new HBox);
517                 h->set_spacing (4);
518                 h->pack_start (*l, false, false);
519                 h->pack_start (_playback_slider, true, true);
520
521                 _box->pack_start (*h, false, false);
522                 
523                 _capture_adjustment.set_value (_rc_config->get_audio_capture_buffer_seconds());
524
525                 l = manage (new Label (_("Recording (seconds of buffering):")));
526                 l->set_name ("OptionsLabel");
527
528                 _capture_slider.set_update_policy (UPDATE_DISCONTINUOUS);
529                 h = manage (new HBox);
530                 h->set_spacing (4);
531                 h->pack_start (*l, false, false);
532                 h->pack_start (_capture_slider, true, true);
533
534                 _box->pack_start (*h, false, false);
535                 
536                 _capture_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &BufferingOptions::capture_changed));
537                 _playback_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &BufferingOptions::playback_changed));
538         }
539
540         void parameter_changed (string const & p)
541         {
542                 if (p == "playback-buffer-seconds") {
543                         _playback_adjustment.set_value (_rc_config->get_audio_playback_buffer_seconds());
544                 } else if (p == "capture-buffer-seconds") {
545                         _capture_adjustment.set_value (_rc_config->get_audio_capture_buffer_seconds());
546                 }
547         }
548
549         void set_state_from_config ()
550         {
551                 parameter_changed ("playback-buffer-seconds");
552                 parameter_changed ("capture-buffer-seconds");
553         }
554
555 private:
556
557         void playback_changed ()
558         {
559                 _rc_config->set_audio_playback_buffer_seconds ((long) _playback_adjustment.get_value());
560         }
561
562         void capture_changed ()
563         {
564                 _rc_config->set_audio_capture_buffer_seconds ((long) _capture_adjustment.get_value());
565         }
566
567         RCConfiguration* _rc_config;
568         Adjustment _playback_adjustment;
569         Adjustment _capture_adjustment;
570         HScale _playback_slider;
571         HScale _capture_slider;
572 };
573
574 class ControlSurfacesOptions : public OptionEditorBox
575 {
576 public:
577         ControlSurfacesOptions (ArdourDialog& parent)
578                 : _parent (parent)
579         {
580                 _store = ListStore::create (_model);
581                 _view.set_model (_store);
582                 _view.append_column (_("Name"), _model.name);
583                 _view.get_column(0)->set_resizable (true);
584                 _view.get_column(0)->set_expand (true);
585                 _view.append_column_editable (_("Enabled"), _model.enabled);
586                 _view.append_column_editable (_("Feedback"), _model.feedback);
587
588                 _box->pack_start (_view, false, false);
589
590                 Label* label = manage (new Label);
591                 label->set_markup (string_compose (X_("<i>%1</i>"), _("Double-click on a name to edit settings for an enabled protocol")));
592
593                 _box->pack_start (*label, false, false);
594                 label->show ();
595                 
596                 _store->signal_row_changed().connect (sigc::mem_fun (*this, &ControlSurfacesOptions::model_changed));
597                 _view.signal_button_press_event().connect_notify (sigc::mem_fun(*this, &ControlSurfacesOptions::edit_clicked));
598         }
599
600         void parameter_changed (std::string const &)
601         {
602
603         }
604
605         void set_state_from_config ()
606         {
607                 _store->clear ();
608
609                 ControlProtocolManager& m = ControlProtocolManager::instance ();
610                 for (list<ControlProtocolInfo*>::iterator i = m.control_protocol_info.begin(); i != m.control_protocol_info.end(); ++i) {
611
612                         if (!(*i)->mandatory) {
613                                 TreeModel::Row r = *_store->append ();
614                                 r[_model.name] = (*i)->name;
615                                 r[_model.enabled] = ((*i)->protocol || (*i)->requested);
616                                 r[_model.feedback] = ((*i)->protocol && (*i)->protocol->get_feedback ());
617                                 r[_model.protocol_info] = *i;
618                         }
619                 }
620         }
621
622 private:
623
624         void model_changed (TreeModel::Path const &, TreeModel::iterator const & i)
625         {
626                 TreeModel::Row r = *i;
627
628                 ControlProtocolInfo* cpi = r[_model.protocol_info];
629                 if (!cpi) {
630                         return;
631                 }
632
633                 bool const was_enabled = (cpi->protocol != 0);
634                 bool const is_enabled = r[_model.enabled];
635
636                 if (was_enabled != is_enabled) {
637                         if (!was_enabled) {
638                                 ControlProtocolManager::instance().instantiate (*cpi);
639                         } else {
640                                 ControlProtocolManager::instance().teardown (*cpi);
641                         }
642                 }
643
644                 bool const was_feedback = (cpi->protocol && cpi->protocol->get_feedback ());
645                 bool const is_feedback = r[_model.feedback];
646
647                 if (was_feedback != is_feedback && cpi->protocol) {
648                         cpi->protocol->set_feedback (is_feedback);
649                 }
650         }
651
652         void edit_clicked (GdkEventButton* ev)
653         {
654                 if (ev->type != GDK_2BUTTON_PRESS) {
655                         return;
656                 }
657
658                 std::string name;
659                 ControlProtocolInfo* cpi;
660                 TreeModel::Row row;
661                 
662                 row = *(_view.get_selection()->get_selected());
663
664                 Window* win = row[_model.editor];
665                 if (win && !win->is_visible()) {
666                         win->present (); 
667                 } else {
668                         cpi = row[_model.protocol_info];
669                         
670                         if (cpi && cpi->protocol && cpi->protocol->has_editor ()) {
671                                 Box* box = (Box*) cpi->protocol->get_gui ();
672                                 if (box) {
673                                         string title = row[_model.name];
674                                         ArdourDialog* win = new ArdourDialog (_parent, title);
675                                         win->get_vbox()->pack_start (*box, false, false);
676                                         box->show ();
677                                         win->present ();
678                                         row[_model.editor] = win;
679                                 }
680                         }
681                 }
682         }
683
684         class ControlSurfacesModelColumns : public TreeModelColumnRecord
685         {
686         public:
687
688                 ControlSurfacesModelColumns ()
689                 {
690                         add (name);
691                         add (enabled);
692                         add (feedback);
693                         add (protocol_info);
694                         add (editor);
695                 }
696
697                 TreeModelColumn<string> name;
698                 TreeModelColumn<bool> enabled;
699                 TreeModelColumn<bool> feedback;
700                 TreeModelColumn<ControlProtocolInfo*> protocol_info;
701                 TreeModelColumn<Gtk::Window*> editor;
702         };
703
704         Glib::RefPtr<ListStore> _store;
705         ControlSurfacesModelColumns _model;
706         TreeView _view;
707         Gtk::Window& _parent;
708 };
709
710
711 RCOptionEditor::RCOptionEditor ()
712         : OptionEditor (Config, string_compose (_("%1 Preferences"), PROGRAM_NAME))
713         , _rc_config (Config)
714 {
715         /* MISC */
716
717         uint32_t hwcpus = hardware_concurrency ();
718
719         if (hwcpus > 1) {
720                 add_option (_("Misc"), new OptionEditorHeading (_("DSP CPU Utilization")));
721                 
722                 ComboOption<int32_t>* procs = new ComboOption<int32_t> (
723                         "processor-usage",
724                         _("Signal processing uses"),
725                         sigc::mem_fun (*_rc_config, &RCConfiguration::get_processor_usage),
726                         sigc::mem_fun (*_rc_config, &RCConfiguration::set_processor_usage)
727                         );
728                 
729                 procs->add (-1, _("all but one processor"));
730                 procs->add (0, _("all available processors"));
731                 
732                 for (uint32_t i = 2; i < hwcpus; ++i) {
733                         procs->add (1, string_compose (_("%1 processors"), i));
734                 }
735                 
736                 add_option (_("Misc"), procs);
737         }
738
739         add_option (_("Misc"), new OptionEditorHeading (_("Metering")));
740
741         ComboOption<float>* mht = new ComboOption<float> (
742                 "meter-hold",
743                 _("Meter hold time"),
744                 sigc::mem_fun (*_rc_config, &RCConfiguration::get_meter_hold),
745                 sigc::mem_fun (*_rc_config, &RCConfiguration::set_meter_hold)
746                 );
747
748         mht->add (MeterHoldOff, _("off"));
749         mht->add (MeterHoldShort, _("short"));
750         mht->add (MeterHoldMedium, _("medium"));
751         mht->add (MeterHoldLong, _("long"));
752
753         add_option (_("Misc"), mht);
754
755         ComboOption<float>* mfo = new ComboOption<float> (
756                 "meter-falloff",
757                 _("Meter fall-off"),
758                 sigc::mem_fun (*_rc_config, &RCConfiguration::get_meter_falloff),
759                 sigc::mem_fun (*_rc_config, &RCConfiguration::set_meter_falloff)
760                 );
761
762         mfo->add (METER_FALLOFF_OFF, _("off"));
763         mfo->add (METER_FALLOFF_SLOWEST, _("slowest"));
764         mfo->add (METER_FALLOFF_SLOW, _("slow"));
765         mfo->add (METER_FALLOFF_MEDIUM, _("medium"));
766         mfo->add (METER_FALLOFF_FAST, _("fast"));
767         mfo->add (METER_FALLOFF_FASTER, _("faster"));
768         mfo->add (METER_FALLOFF_FASTEST, _("fastest"));
769
770         add_option (_("Misc"), mfo);
771
772         add_option (_("Misc"), new OptionEditorHeading (_("Undo")));
773
774         add_option (_("Misc"), new UndoOptions (_rc_config));
775
776         add_option (_("Misc"), new OptionEditorHeading (_("Misc")));
777
778 #ifndef GTKOSX
779         /* font scaling does nothing with GDK/Quartz */
780         add_option (_("Misc"), new FontScalingOptions (_rc_config));
781 #endif
782
783         add_option (_("Misc"),
784              new BoolOption (
785                      "verify-remove-last-capture",
786                      _("Verify removal of last capture"),
787                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_verify_remove_last_capture),
788                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_verify_remove_last_capture)
789                      ));
790
791         add_option (_("Misc"),
792              new BoolOption (
793                      "periodic-safety-backups",
794                      _("Make periodic backups of the session file"),
795                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_periodic_safety_backups),
796                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_periodic_safety_backups)
797                      ));
798
799         add_option (_("Misc"),
800              new BoolOption (
801                      "sync-all-route-ordering",
802                      _("Syncronise editor and mixer track order"),
803                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_sync_all_route_ordering),
804                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_sync_all_route_ordering)
805                      ));
806
807         add_option (_("Misc"),
808              new BoolOption (
809                      "only-copy-imported-files",
810                      _("Always copy imported files"),
811                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_only_copy_imported_files),
812                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_only_copy_imported_files)
813                      ));
814
815         add_option (_("Misc"),
816              new BoolOption (
817                      "default-narrow_ms",
818                      _("Use narrow mixer strips"),
819                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_default_narrow_ms),
820                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_default_narrow_ms)
821                      ));
822
823         add_option (_("Misc"),
824              new BoolOption (
825                      "name-new-markers",
826                      _("Name new markers"),
827                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_name_new_markers),
828                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_name_new_markers)
829                      ));
830
831         add_option (_("Misc"), new OptionEditorHeading (_("Click")));
832         
833         add_option (_("Misc"), new ClickOptions (_rc_config, this));
834
835         /* TRANSPORT */
836
837         add_option (_("Transport"),
838              new BoolOption (
839                      "latched-record-enable",
840                      _("Keep record-enable engaged on stop"),
841                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_latched_record_enable),
842                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_latched_record_enable)
843                      ));
844
845         add_option (_("Transport"),
846              new BoolOption (
847                      "stop-recording-on-xrun",
848                      _("Stop recording when an xrun occurs"),
849                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_stop_recording_on_xrun),
850                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_stop_recording_on_xrun)
851                      ));
852
853         add_option (_("Transport"),
854              new BoolOption (
855                      "create-xrun-marker",
856                      _("Create markers where xruns occur"),
857                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_create_xrun_marker),
858                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_create_xrun_marker)
859                      ));
860
861         add_option (_("Transport"),
862              new BoolOption (
863                      "stop-at-session-end",
864                      _("Stop at the end of the session"),
865                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_stop_at_session_end),
866                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_stop_at_session_end)
867                      ));
868
869         add_option (_("Transport"),
870              new BoolOption (
871                      "seamless-loop",
872                      _("Do seamless looping (not possible when slaved to MTC, JACK etc)"),
873                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_seamless_loop),
874                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_seamless_loop)
875                      ));
876
877         add_option (_("Transport"),
878              new BoolOption (
879                      "primary-clock-delta-edit-cursor",
880                      _("Primary clock delta to edit cursor"),
881                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_primary_clock_delta_edit_cursor),
882                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_primary_clock_delta_edit_cursor)
883                      ));
884
885         add_option (_("Transport"),
886              new BoolOption (
887                      "secondary-clock-delta-edit-cursor",
888                      _("Secondary clock delta to edit cursor"),
889                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_secondary_clock_delta_edit_cursor),
890                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_secondary_clock_delta_edit_cursor)
891                      ));
892
893         add_option (_("Transport"),
894              new BoolOption (
895                      "disable-disarm-during-roll",
896                      _("Disable per-track record disarm while rolling"),
897                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_disable_disarm_during_roll),
898                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_disable_disarm_during_roll)
899                      ));
900
901         add_option (_("Transport"),
902              new BoolOption (
903                      "quieten_at_speed",
904                      _("12dB gain reduction during fast-forward and fast-rewind"),
905                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_quieten_at_speed),
906                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_quieten_at_speed)
907                      ));
908
909         /* EDITOR */
910
911         add_option (_("Editor"),
912              new BoolOption (
913                      "link-region-and-track-selection",
914                      _("Link selection of regions and tracks"),
915                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_link_region_and_track_selection),
916                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_link_region_and_track_selection)
917                      ));
918
919         add_option (_("Editor"),
920              new BoolOption (
921                      "automation-follows-regions",
922                      _("Move relevant automation when audio regions are moved"),
923                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_automation_follows_regions),
924                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_automation_follows_regions)
925                      ));
926
927         add_option (_("Editor"),
928              new BoolOption (
929                      "show-track-meters",
930                      _("Show meters on tracks in the editor"),
931                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_show_track_meters),
932                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_show_track_meters)
933                      ));
934
935         add_option (_("Editor"),
936              new BoolOption (
937                      "use-overlap-equivalency",
938                      _("Use overlap equivalency for regions"),
939                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_use_overlap_equivalency),
940                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_use_overlap_equivalency)
941                      ));
942
943         add_option (_("Editor"),
944              new BoolOption (
945                      "rubberbanding-snaps-to-grid",
946                      _("Make rubberband selection rectangle snap to the grid"),
947                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_rubberbanding_snaps_to_grid),
948                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_rubberbanding_snaps_to_grid)
949                      ));
950
951         add_option (_("Editor"),
952              new BoolOption (
953                      "show-waveforms",
954                      _("Show waveforms in regions"),
955                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_show_waveforms),
956                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_show_waveforms)
957                      ));
958
959         ComboOption<WaveformScale>* wfs = new ComboOption<WaveformScale> (
960                 "waveform-scale",
961                 _("Waveform scale"),
962                 sigc::mem_fun (*_rc_config, &RCConfiguration::get_waveform_scale),
963                 sigc::mem_fun (*_rc_config, &RCConfiguration::set_waveform_scale)
964                 );
965
966         wfs->add (Linear, _("linear"));
967         wfs->add (Logarithmic, _("logarithmic"));
968
969         add_option (_("Editor"), wfs);
970
971         ComboOption<WaveformShape>* wfsh = new ComboOption<WaveformShape> (
972                 "waveform-shape",
973                 _("Waveform shape"),
974                 sigc::mem_fun (*_rc_config, &RCConfiguration::get_waveform_shape),
975                 sigc::mem_fun (*_rc_config, &RCConfiguration::set_waveform_shape)
976                 );
977
978         wfsh->add (Traditional, _("traditional"));
979         wfsh->add (Rectified, _("rectified"));
980
981         add_option (_("Editor"), wfsh);
982
983         add_option (_("Editor"),
984              new BoolOption (
985                      "show-waveforms-while-recording",
986                      _("Show waveforms for audio while it is being recorded"),
987                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_show_waveforms_while_recording),
988                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_show_waveforms_while_recording)
989                      ));
990
991         /* AUDIO */
992
993         add_option (_("Audio"), new OptionEditorHeading (_("Buffering")));
994
995         add_option (_("Audio"), new BufferingOptions (_rc_config));
996
997         add_option (_("Audio"), new OptionEditorHeading (_("Monitoring")));
998
999         add_option (_("Audio"),
1000              new BoolOption (
1001                      "use-monitor-bus",
1002                      _("Use a monitor bus (allows AFL/PFL and more control)"),
1003                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_use_monitor_bus),
1004                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_use_monitor_bus)
1005                      ));
1006
1007         ComboOption<MonitorModel>* mm = new ComboOption<MonitorModel> (
1008                 "monitoring-model",
1009                 _("Monitoring handled by"),
1010                 sigc::mem_fun (*_rc_config, &RCConfiguration::get_monitoring_model),
1011                 sigc::mem_fun (*_rc_config, &RCConfiguration::set_monitoring_model)
1012                 );
1013
1014 #ifndef __APPLE__
1015         /* no JACK monitoring on CoreAudio */
1016         if (AudioEngine::instance()->can_request_hardware_monitoring()) {
1017                 mm->add (HardwareMonitoring, _("JACK"));
1018         }
1019 #endif
1020         mm->add (SoftwareMonitoring, _("ardour"));
1021         mm->add (ExternalMonitoring, _("audio hardware"));
1022
1023         add_option (_("Audio"), mm);
1024
1025         add_option (_("Audio"),
1026              new BoolOption (
1027                      "tape-machine-mode",
1028                      _("Tape machine mode"),
1029                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_tape_machine_mode),
1030                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_tape_machine_mode)
1031                      ));
1032
1033         add_option (_("Audio"), new OptionEditorHeading (_("Connection of tracks and busses")));
1034
1035         add_option (_("Audio"),
1036                     new BoolOption (
1037                             "auto-connect-standard-busses",
1038                             _("Auto-connect master/monitor busses"),
1039                             sigc::mem_fun (*_rc_config, &RCConfiguration::get_auto_connect_standard_busses),
1040                             sigc::mem_fun (*_rc_config, &RCConfiguration::set_auto_connect_standard_busses)
1041                             ));
1042
1043         ComboOption<AutoConnectOption>* iac = new ComboOption<AutoConnectOption> (
1044                 "input-auto-connect",
1045                 _("Connect track inputs"),
1046                 sigc::mem_fun (*_rc_config, &RCConfiguration::get_input_auto_connect),
1047                 sigc::mem_fun (*_rc_config, &RCConfiguration::set_input_auto_connect)
1048                 );
1049
1050         iac->add (AutoConnectPhysical, _("automatically to physical inputs"));
1051         iac->add (ManualConnect, _("manually"));
1052
1053         add_option (_("Audio"), iac);
1054
1055         ComboOption<AutoConnectOption>* oac = new ComboOption<AutoConnectOption> (
1056                 "output-auto-connect",
1057                 _("Connect track and bus outputs"),
1058                 sigc::mem_fun (*_rc_config, &RCConfiguration::get_output_auto_connect),
1059                 sigc::mem_fun (*_rc_config, &RCConfiguration::set_output_auto_connect)
1060                 );
1061
1062         oac->add (AutoConnectPhysical, _("automatically to physical outputs"));
1063         oac->add (AutoConnectMaster, _("automatically to master bus"));
1064         oac->add (ManualConnect, _("manually"));
1065
1066         add_option (_("Audio"), oac);
1067
1068         add_option (_("Audio"), new OptionEditorHeading (_("Denormals")));
1069
1070         add_option (_("Audio"),
1071              new BoolOption (
1072                      "denormal-protection",
1073                      _("Use DC bias to protect against denormals"),
1074                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_denormal_protection),
1075                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_denormal_protection)
1076                      ));
1077
1078         ComboOption<DenormalModel>* dm = new ComboOption<DenormalModel> (
1079                 "denormal-model",
1080                 _("Processor handling"),
1081                 sigc::mem_fun (*_rc_config, &RCConfiguration::get_denormal_model),
1082                 sigc::mem_fun (*_rc_config, &RCConfiguration::set_denormal_model)
1083                 );
1084
1085         dm->add (DenormalNone, _("no processor handling"));
1086
1087         FPU fpu;
1088
1089         if (fpu.has_flush_to_zero()) {
1090                 dm->add (DenormalFTZ, _("use FlushToZero"));
1091         }
1092
1093         if (fpu.has_denormals_are_zero()) {
1094                 dm->add (DenormalDAZ, _("use DenormalsAreZero"));
1095         }
1096
1097         if (fpu.has_flush_to_zero() && fpu.has_denormals_are_zero()) {
1098                 dm->add (DenormalFTZDAZ, _("use FlushToZero and DenormalsAreZerO"));
1099         }
1100
1101         add_option (_("Audio"), dm);
1102
1103         add_option (_("Audio"), new OptionEditorHeading (_("Plugins")));
1104
1105         add_option (_("Audio"),
1106              new BoolOption (
1107                      "plugins-stop-with-transport",
1108                      _("Stop plugins when the transport is stopped"),
1109                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_plugins_stop_with_transport),
1110                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_plugins_stop_with_transport)
1111                      ));
1112
1113         add_option (_("Audio"),
1114              new BoolOption (
1115                      "do-not-record-plugins",
1116                      _("Disable plugins during recording"),
1117                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_do_not_record_plugins),
1118                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_do_not_record_plugins)
1119                      ));
1120
1121         add_option (_("Audio"),
1122              new BoolOption (
1123                      "new-plugins-active",
1124                      _("Make new plugins active"),
1125                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_new_plugins_active),
1126                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_new_plugins_active)
1127                      ));
1128
1129         add_option (_("Audio"),
1130              new BoolOption (
1131                      "auto-analyse-audio",
1132                      _("Enable automatic analysis of audio"),
1133                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_auto_analyse_audio),
1134                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_auto_analyse_audio)
1135                      ));
1136
1137         add_option (_("Audio"),
1138              new BoolOption (
1139                      "replicate-missing-region-channels",
1140                      _("Replicate missing region channels"),
1141                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_replicate_missing_region_channels),
1142                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_replicate_missing_region_channels)
1143                      ));
1144
1145         /* SOLO AND MUTE */
1146
1147         add_option (_("Solo / mute"),
1148              new FaderOption (
1149                      "solo-mute-gain",
1150                      _("Solo mute cut (dB)"),
1151                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_solo_mute_gain),
1152                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_solo_mute_gain)
1153                      ));
1154                      
1155         add_option (_("Solo / mute"),
1156              new BoolOption (
1157                      "solo-control-is-listen-control",
1158                      _("Solo controls are Listen controls"),
1159                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_solo_control_is_listen_control),
1160                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_solo_control_is_listen_control)
1161                      ));
1162
1163         ComboOption<ListenPosition>* lp = new ComboOption<ListenPosition> (
1164                 "listen-position",
1165                 _("Listen Position"),
1166                 sigc::mem_fun (*_rc_config, &RCConfiguration::get_listen_position),
1167                 sigc::mem_fun (*_rc_config, &RCConfiguration::set_listen_position)
1168                 );
1169
1170         lp->add (AfterFaderListen, _("after-fader listen"));
1171         lp->add (PreFaderListen, _("pre-fader listen"));
1172
1173         add_option (_("Solo / mute"), lp);
1174
1175         add_option (_("Solo / mute"),
1176              new BoolOption (
1177                      "exclusive-solo",
1178                      _("Exclusive solo"),
1179                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_exclusive_solo),
1180                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_exclusive_solo)
1181                      ));
1182
1183         add_option (_("Solo / mute"),
1184              new BoolOption (
1185                      "show-solo-mutes",
1186                      _("Show solo muting"),
1187                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_show_solo_mutes),
1188                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_show_solo_mutes)
1189                      ));
1190
1191         add_option (_("Solo / mute"),
1192              new BoolOption (
1193                      "solo-mute-override",
1194                      _("Soloing overrides muting"),
1195                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_solo_mute_override),
1196                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_solo_mute_override)
1197                      ));
1198
1199         add_option (_("Solo / mute"), new OptionEditorHeading (_("Default track / bus muting options")));
1200         
1201         add_option (_("Solo / mute"),
1202              new BoolOption (
1203                      "mute-affects-pre-fader",
1204                      _("Mute affects pre-fader sends"),
1205                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_mute_affects_pre_fader),
1206                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_mute_affects_pre_fader)
1207                      ));
1208
1209         add_option (_("Solo / mute"),
1210              new BoolOption (
1211                      "mute-affects-post-fader",
1212                      _("Mute affects post-fader sends"),
1213                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_mute_affects_post_fader),
1214                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_mute_affects_post_fader)
1215                      ));
1216         
1217         add_option (_("Solo / mute"),
1218              new BoolOption (
1219                      "mute-affects-control-outs",
1220                      _("Mute affects control outputs"),
1221                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_mute_affects_control_outs),
1222                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_mute_affects_control_outs)
1223                      ));
1224         
1225         add_option (_("Solo / mute"),
1226              new BoolOption (
1227                      "mute-affects-main-outs",
1228                      _("Mute affects main outputs"),
1229                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_mute_affects_main_outs),
1230                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_mute_affects_main_outs)
1231                      ));
1232
1233         add_option (_("MIDI control"),
1234                     new BoolOption (
1235                             "send-midi-clock",
1236                             _("Send MIDI Clock"),
1237                             sigc::mem_fun (*_rc_config, &RCConfiguration::get_send_midi_clock),
1238                             sigc::mem_fun (*_rc_config, &RCConfiguration::set_send_midi_clock)
1239                             ));
1240
1241         add_option (_("MIDI control"),
1242                     new BoolOption (
1243                             "send-mtc",
1244                             _("Send MIDI Time Code"),
1245                             sigc::mem_fun (*_rc_config, &RCConfiguration::get_send_mtc),
1246                             sigc::mem_fun (*_rc_config, &RCConfiguration::set_send_mtc)
1247                             ));
1248
1249         add_option (_("MIDI control"),
1250                     new BoolOption (
1251                             "mmc-control",
1252                             _("Obey MIDI Machine Control commands"),
1253                             sigc::mem_fun (*_rc_config, &RCConfiguration::get_mmc_control),
1254                             sigc::mem_fun (*_rc_config, &RCConfiguration::set_mmc_control)
1255                             ));
1256
1257
1258         add_option (_("MIDI control"),
1259                     new BoolOption (
1260                             "send-mmc",
1261                             _("Send MIDI Machine Control commands"),
1262                             sigc::mem_fun (*_rc_config, &RCConfiguration::get_send_mmc),
1263                             sigc::mem_fun (*_rc_config, &RCConfiguration::set_send_mmc)
1264                             ));
1265
1266         add_option (_("MIDI control"),
1267                     new BoolOption (
1268                             "midi-feedback",
1269                             _("Send MIDI control feedback"),
1270                             sigc::mem_fun (*_rc_config, &RCConfiguration::get_midi_feedback),
1271                             sigc::mem_fun (*_rc_config, &RCConfiguration::set_midi_feedback)
1272                             ));
1273
1274         add_option (_("MIDI control"),
1275              new SpinOption<uint8_t> (
1276                      "mmc-receive-device-id",
1277                      _("Inbound MMC device ID"),
1278                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_mmc_receive_device_id),
1279                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_mmc_receive_device_id),
1280                      0, 128, 1, 10
1281                      ));
1282
1283         add_option (_("MIDI control"),
1284              new SpinOption<uint8_t> (
1285                      "mmc-send-device-id",
1286                      _("Outbound MMC device ID"),
1287                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_mmc_send_device_id),
1288                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_mmc_send_device_id),
1289                      0, 128, 1, 10
1290                      ));
1291
1292         add_option (_("MIDI control"),
1293              new SpinOption<int32_t> (
1294                      "initial-program-change",
1295                      _("Initial program change"),
1296                      sigc::mem_fun (*_rc_config, &RCConfiguration::get_initial_program_change),
1297                      sigc::mem_fun (*_rc_config, &RCConfiguration::set_initial_program_change),
1298                      -1, 65536, 1, 10
1299                      ));
1300
1301         /* CONTROL SURFACES */
1302
1303         add_option (_("Control surfaces"), new ControlSurfacesOptions (*this));
1304
1305         ComboOption<RemoteModel>* rm = new ComboOption<RemoteModel> (
1306                 "remote-model",
1307                 _("Control surface remote ID"),
1308                 sigc::mem_fun (*_rc_config, &RCConfiguration::get_remote_model),
1309                 sigc::mem_fun (*_rc_config, &RCConfiguration::set_remote_model)
1310                 );
1311
1312         rm->add (UserOrdered, _("assigned by user"));
1313         rm->add (MixerOrdered, _("follows order of mixer"));
1314         rm->add (EditorOrdered, _("follows order of editor"));
1315
1316         add_option (_("Control surfaces"), rm);
1317
1318         /* KEYBOARD */
1319
1320         add_option (_("Keyboard"), new KeyboardOptions);
1321 }
1322
1323