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