Don't add auditioner and click to MIDI connection port matrices.
[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 (_("MTC:")));
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 (_("MIDI clock:")));
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 (_("MMC:")));
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 (_("MIDI parameter control:")));
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 #ifdef GTKOSX
483
484         /* Command = Meta
485            Option/Alt = Mod1
486         */
487
488         { "Shift", GDK_SHIFT_MASK },
489         { "Command", GDK_META_MASK },
490         { "Control", GDK_CONTROL_MASK },
491         { "Option", GDK_MOD1_MASK },
492         { "Command-Shift", GDK_MOD1_MASK|GDK_SHIFT_MASK },
493         { "Command-Option", GDK_MOD1_MASK|GDK_MOD5_MASK },
494         { "Shift-Option", GDK_SHIFT_MASK|GDK_MOD5_MASK },
495         { "Shift-Command-Option", GDK_MOD5_MASK|GDK_SHIFT_MASK|GDK_MOD1_MASK },
496
497 #else
498         { "Shift", GDK_SHIFT_MASK },
499         { "Control", GDK_CONTROL_MASK },
500         { "Alt (Mod1)", GDK_MOD1_MASK },
501         { "Control-Shift", GDK_CONTROL_MASK|GDK_SHIFT_MASK },
502         { "Control-Alt", GDK_CONTROL_MASK|GDK_MOD1_MASK },
503         { "Shift-Alt", GDK_SHIFT_MASK|GDK_MOD1_MASK },
504         { "Control-Shift-Alt", GDK_CONTROL_MASK|GDK_SHIFT_MASK|GDK_MOD1_MASK },
505         { "Mod2", GDK_MOD2_MASK },
506         { "Mod3", GDK_MOD3_MASK },
507         { "Mod4", GDK_MOD4_MASK },
508         { "Mod5", GDK_MOD5_MASK },
509 #endif
510         { 0, 0 }
511 };
512
513
514 class KeyboardOptions : public OptionEditorBox
515 {
516 public:
517         KeyboardOptions () :
518                   _delete_button_adjustment (3, 1, 5),
519                   _delete_button_spin (_delete_button_adjustment),
520                   _edit_button_adjustment (3, 1, 5),
521                   _edit_button_spin (_edit_button_adjustment)
522                 
523         {
524                 /* internationalize and prepare for use with combos */
525
526                 vector<string> dumb;
527                 for (int i = 0; modifiers[i].name; ++i) {
528                         dumb.push_back (_(modifiers[i].name));
529                 }
530
531                 set_popdown_strings (_edit_modifier_combo, dumb);
532                 _edit_modifier_combo.signal_changed().connect (mem_fun(*this, &KeyboardOptions::edit_modifier_chosen));
533
534                 for (int x = 0; modifiers[x].name; ++x) {
535                         if (modifiers[x].modifier == Keyboard::edit_modifier ()) {
536                                 _edit_modifier_combo.set_active_text (_(modifiers[x].name));
537                                 break;
538                         }
539                 }
540
541                 Table* t = manage (new Table (4, 4));
542                 t->set_spacings (4);
543
544                 Label* l = manage (new Label (_("Edit using:")));
545                 l->set_name ("OptionsLabel");
546                 l->set_alignment (1.0, 0.5);
547
548                 t->attach (*l, 0, 1, 0, 1, FILL | EXPAND, FILL);
549                 t->attach (_edit_modifier_combo, 1, 2, 0, 1, FILL | EXPAND, FILL);
550
551                 l = manage (new Label (_("+ button")));
552                 l->set_name ("OptionsLabel");
553
554                 t->attach (*l, 3, 4, 0, 1, FILL | EXPAND, FILL);
555                 t->attach (_edit_button_spin, 4, 5, 0, 1, FILL | EXPAND, FILL);
556
557                 _edit_button_spin.set_name ("OptionsEntry");
558                 _edit_button_adjustment.set_value (Keyboard::edit_button());
559                 _edit_button_adjustment.signal_value_changed().connect (mem_fun(*this, &KeyboardOptions::edit_button_changed));
560
561                 set_popdown_strings (_delete_modifier_combo, dumb);
562                 _delete_modifier_combo.signal_changed().connect (mem_fun(*this, &KeyboardOptions::delete_modifier_chosen));
563
564                 for (int x = 0; modifiers[x].name; ++x) {
565                         if (modifiers[x].modifier == Keyboard::delete_modifier ()) {
566                                 _delete_modifier_combo.set_active_text (_(modifiers[x].name));
567                                 break;
568                         }
569                 }
570
571                 l = manage (new Label (_("Delete using:")));
572                 l->set_name ("OptionsLabel");
573                 l->set_alignment (1.0, 0.5);
574
575                 t->attach (*l, 0, 1, 1, 2, FILL | EXPAND, FILL);
576                 t->attach (_delete_modifier_combo, 1, 2, 1, 2, FILL | EXPAND, FILL);
577
578                 l = manage (new Label (_("+ button")));
579                 l->set_name ("OptionsLabel");
580
581                 t->attach (*l, 3, 4, 1, 2, FILL | EXPAND, FILL);
582                 t->attach (_delete_button_spin, 4, 5, 1, 2, FILL | EXPAND, FILL);
583
584                 _delete_button_spin.set_name ("OptionsEntry");
585                 _delete_button_adjustment.set_value (Keyboard::delete_button());
586                 _delete_button_adjustment.signal_value_changed().connect (mem_fun(*this, &KeyboardOptions::delete_button_changed));
587
588                 set_popdown_strings (_snap_modifier_combo, dumb);
589                 _snap_modifier_combo.signal_changed().connect (mem_fun(*this, &KeyboardOptions::snap_modifier_chosen));
590
591                 for (int x = 0; modifiers[x].name; ++x) {
592                         if (modifiers[x].modifier == (guint) Keyboard::snap_modifier ()) {
593                                 _snap_modifier_combo.set_active_text (_(modifiers[x].name));
594                                 break;
595                         }
596                 }
597
598                 l = manage (new Label (_("Ignore snap using:")));
599                 l->set_name ("OptionsLabel");
600                 l->set_alignment (1.0, 0.5);
601
602                 t->attach (*l, 0, 1, 2, 3, FILL | EXPAND, FILL);
603                 t->attach (_snap_modifier_combo, 1, 2, 2, 3, FILL | EXPAND, FILL);
604
605                 vector<string> strs;
606
607                 for (map<string,string>::iterator bf = Keyboard::binding_files.begin(); bf != Keyboard::binding_files.end(); ++bf) {
608                         strs.push_back (bf->first);
609                 }
610
611                 set_popdown_strings (_keyboard_layout_selector, strs);
612                 _keyboard_layout_selector.set_active_text (Keyboard::current_binding_name());
613                 _keyboard_layout_selector.signal_changed().connect (mem_fun (*this, &KeyboardOptions::bindings_changed));
614
615                 l = manage (new Label (_("Keyboard layout:")));
616                 l->set_name ("OptionsLabel");
617                 l->set_alignment (1.0, 0.5);
618
619                 t->attach (*l, 0, 1, 3, 4, FILL | EXPAND, FILL);
620                 t->attach (_keyboard_layout_selector, 1, 2, 3, 4, FILL | EXPAND, FILL);
621
622                 _box->pack_start (*t, false, false);
623         }
624
625         void parameter_changed (string const &)
626         {
627                 /* XXX: these aren't really config options... */
628         }
629
630         void set_state_from_config ()
631         {
632                 /* XXX: these aren't really config options... */
633         }
634
635 private:
636
637         void bindings_changed ()
638         {
639                 string const txt = _keyboard_layout_selector.get_active_text();
640
641                 /* XXX: config...?  for all this keyboard stuff */
642                 
643                 for (map<string,string>::iterator i = Keyboard::binding_files.begin(); i != Keyboard::binding_files.end(); ++i) {
644                         if (txt == i->first) {
645                                 if (Keyboard::load_keybindings (i->second)) {
646                                         Keyboard::save_keybindings ();
647                                 }
648                         }
649                 }
650         }
651
652         void edit_modifier_chosen ()
653         {
654                 string const txt = _edit_modifier_combo.get_active_text();
655                 
656                 for (int i = 0; modifiers[i].name; ++i) {
657                         if (txt == _(modifiers[i].name)) {
658                                 Keyboard::set_edit_modifier (modifiers[i].modifier);
659                                 break;
660                         }
661                 }
662         }
663
664         void delete_modifier_chosen ()
665         {
666                 string const txt = _delete_modifier_combo.get_active_text();
667                 
668                 for (int i = 0; modifiers[i].name; ++i) {
669                         if (txt == _(modifiers[i].name)) {
670                                 Keyboard::set_delete_modifier (modifiers[i].modifier);
671                                 break;
672                         }
673                 }
674         }
675         
676         void snap_modifier_chosen ()
677         {
678                 string const txt = _snap_modifier_combo.get_active_text();
679                 
680                 for (int i = 0; modifiers[i].name; ++i) {
681                         if (txt == _(modifiers[i].name)) {
682                                 Keyboard::set_snap_modifier (modifiers[i].modifier);
683                                 break;
684                         }
685                 }
686         }
687
688         void delete_button_changed ()
689         {
690                 Keyboard::set_delete_button (_delete_button_spin.get_value_as_int());
691         }
692
693         void edit_button_changed ()
694         {
695                 Keyboard::set_edit_button (_edit_button_spin.get_value_as_int());
696         }
697         
698         ComboBoxText _keyboard_layout_selector;
699         ComboBoxText _edit_modifier_combo;
700         ComboBoxText _delete_modifier_combo;
701         ComboBoxText _snap_modifier_combo;
702         Adjustment _delete_button_adjustment;
703         SpinButton _delete_button_spin;
704         Adjustment _edit_button_adjustment;
705         SpinButton _edit_button_spin;
706 };
707
708 class FontScalingOptions : public OptionEditorBox
709 {
710 public:
711         FontScalingOptions (RCConfiguration* c) :
712                 _rc_config (c),
713                 _dpi_adjustment (50, 50, 250, 1, 10),
714                 _dpi_slider (_dpi_adjustment)
715         {
716                 _dpi_adjustment.set_value (_rc_config->get_font_scale () / 1024);
717
718                 Label* l = manage (new Label (_("Font scaling:")));
719                 l->set_name ("OptionsLabel");
720
721                 _dpi_slider.set_update_policy (UPDATE_DISCONTINUOUS);
722                 HBox* h = manage (new HBox);
723                 h->set_spacing (4);
724                 h->pack_start (*l, false, false);
725                 h->pack_start (_dpi_slider, true, true);
726
727                 _box->pack_start (*h, false, false);
728
729                 _dpi_adjustment.signal_value_changed().connect (mem_fun (*this, &FontScalingOptions::dpi_changed));
730         }
731
732         void parameter_changed (string const & p)
733         {
734                 if (p == "font-scale") {
735                         _dpi_adjustment.set_value (_rc_config->get_font_scale() / 1024);
736                 }
737         }
738
739         void set_state_from_config ()
740         {
741                 parameter_changed ("font-scale");
742         }
743         
744 private:
745         
746         void dpi_changed ()
747         {
748                 _rc_config->set_font_scale ((long) floor (_dpi_adjustment.get_value() * 1024));
749                 /* XXX: should be triggered from the parameter changed signal */
750                 reset_dpi ();
751         }
752
753         RCConfiguration* _rc_config;
754         Adjustment _dpi_adjustment;
755         HScale _dpi_slider;
756 };
757
758 class SoloMuteOptions : public OptionEditorBox
759 {
760 public:
761         SoloMuteOptions (RCConfiguration* c) :
762                 _rc_config (c),
763                 // 0.781787 is the value needed for gain to be set to 0.
764                 _db_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1)
765
766         {
767                 if ((pix = ::get_icon ("fader_belt_h")) == 0) {
768                         throw failed_constructor();
769                 }
770
771                 _db_slider = manage (new HSliderController (pix,
772                                                             &_db_adjustment,
773                                                             false));
774
775
776                 parameter_changed ("solo-mute-gain");
777                 
778                 Label* l = manage (new Label (_("Solo mute cut (dB):")));
779                 l->set_name ("OptionsLabel");
780
781                 HBox* h = manage (new HBox);
782                 h->set_spacing (4);
783                 h->pack_start (*l, false, false);
784                 h->pack_start (*_db_slider, false, false);
785                 h->pack_start (_db_display, false, false);
786
787                 set_size_request_to_display_given_text (_db_display, "-99.0", 12, 12);
788                 
789                 _box->pack_start (*h, false, false);
790
791                 _db_adjustment.signal_value_changed().connect (mem_fun (*this, &SoloMuteOptions::db_changed));
792         }
793
794         void parameter_changed (string const & p)
795         {
796                 if (p == "solo-mute-gain") {
797                         gain_t val = _rc_config->get_solo_mute_gain();
798
799                         _db_adjustment.set_value (gain_to_slider_position (val));
800
801                         char buf[16];
802
803                         if (val == 0.0) {
804                                 snprintf (buf, sizeof (buf), "-inf");
805                         } else {
806                                 snprintf (buf, sizeof (buf), "%.2f", coefficient_to_dB (val));
807                         }
808
809                         _db_display.set_text (buf);
810                 }
811         }
812
813         void set_state_from_config ()
814         {
815                 parameter_changed ("solo-mute-gain");
816         }
817         
818 private:
819         
820         void db_changed ()
821         {
822                 _rc_config->set_solo_mute_gain (slider_position_to_gain (_db_adjustment.get_value()));
823         }
824
825         RCConfiguration* _rc_config;
826         Adjustment _db_adjustment;
827         Gtkmm2ext::HSliderController* _db_slider;
828         Glib::RefPtr<Gdk::Pixbuf> pix;
829         Entry _db_display;
830 };
831
832
833 class ControlSurfacesOptions : public OptionEditorBox
834 {
835 public:
836         ControlSurfacesOptions ()
837         {
838                 _store = ListStore::create (_model);
839                 _view.set_model (_store);
840                 _view.append_column (_("Name"), _model.name);
841                 _view.get_column(0)->set_resizable (true);
842                 _view.get_column(0)->set_expand (true);
843                 _view.append_column_editable (_("Enabled"), _model.enabled);
844                 _view.append_column_editable (_("Feedback"), _model.feedback);
845
846                 _box->pack_start (_view, false, false);
847
848                 _store->signal_row_changed().connect (mem_fun (*this, &ControlSurfacesOptions::model_changed));
849         }
850
851         void parameter_changed (std::string const &)
852         {
853
854         }
855
856         void set_state_from_config ()
857         {
858                 _store->clear ();
859                 
860                 ControlProtocolManager& m = ControlProtocolManager::instance ();
861                 for (list<ControlProtocolInfo*>::iterator i = m.control_protocol_info.begin(); i != m.control_protocol_info.end(); ++i) {
862
863                         if (!(*i)->mandatory) {
864                                 TreeModel::Row r = *_store->append ();
865                                 r[_model.name] = (*i)->name;
866                                 r[_model.enabled] = ((*i)->protocol || (*i)->requested);
867                                 r[_model.feedback] = ((*i)->protocol && (*i)->protocol->get_feedback ());
868                                 r[_model.protocol_info] = *i;
869                         }
870                 }
871         }
872
873 private:
874
875         void model_changed (TreeModel::Path const &, TreeModel::iterator const & i)
876         {
877                 TreeModel::Row r = *i;
878
879                 ControlProtocolInfo* cpi = r[_model.protocol_info];
880                 if (!cpi) {
881                         return;
882                 }
883
884                 bool const was_enabled = (cpi->protocol != 0);
885                 bool const is_enabled = r[_model.enabled];
886
887                 if (was_enabled != is_enabled) {
888                         if (!was_enabled) {
889                                 ControlProtocolManager::instance().instantiate (*cpi);
890                         } else {
891                                 ControlProtocolManager::instance().teardown (*cpi);
892                         }
893                 }
894
895                 bool const was_feedback = (cpi->protocol && cpi->protocol->get_feedback ());
896                 bool const is_feedback = r[_model.feedback];
897
898                 if (was_feedback != is_feedback && cpi->protocol) {
899                         cpi->protocol->set_feedback (is_feedback);
900                 }
901         }
902
903         class ControlSurfacesModelColumns : public TreeModelColumnRecord
904         {
905         public:
906                 
907                 ControlSurfacesModelColumns ()
908                 {
909                         add (name);
910                         add (enabled);
911                         add (feedback);
912                         add (protocol_info);
913                 }
914
915                 TreeModelColumn<string> name;
916                 TreeModelColumn<bool> enabled;
917                 TreeModelColumn<bool> feedback;
918                 TreeModelColumn<ControlProtocolInfo*> protocol_info;
919         };
920
921         Glib::RefPtr<ListStore> _store;
922         ControlSurfacesModelColumns _model;
923         TreeView _view;
924 };
925
926
927 RCOptionEditor::RCOptionEditor ()
928         : OptionEditor (Config, _("Ardour Preferences")),
929           _rc_config (Config)
930 {
931         /* MISC */
932
933         add_option (_("Misc"), new OptionEditorHeading (_("Metering")));
934         
935         ComboOption<float>* mht = new ComboOption<float> (
936                 "meter-hold",
937                 _("Meter hold time"),
938                 mem_fun (*_rc_config, &RCConfiguration::get_meter_hold),
939                 mem_fun (*_rc_config, &RCConfiguration::set_meter_hold)
940                 );
941
942         mht->add (MeterHoldOff, _("off"));
943         mht->add (MeterHoldShort, _("short"));
944         mht->add (MeterHoldMedium, _("medium"));
945         mht->add (MeterHoldLong, _("long"));
946         
947         add_option (_("Misc"), mht);
948
949         ComboOption<float>* mfo = new ComboOption<float> (
950                 "meter-falloff",
951                 _("Meter fall-off"),
952                 mem_fun (*_rc_config, &RCConfiguration::get_meter_falloff),
953                 mem_fun (*_rc_config, &RCConfiguration::set_meter_falloff)
954                 );
955
956         mfo->add (METER_FALLOFF_OFF, _("off"));
957         mfo->add (METER_FALLOFF_SLOWEST, _("slowest"));
958         mfo->add (METER_FALLOFF_SLOW, _("slow"));
959         mfo->add (METER_FALLOFF_MEDIUM, _("medium"));
960         mfo->add (METER_FALLOFF_FAST, _("fast"));
961         mfo->add (METER_FALLOFF_FASTER, _("faster"));
962         mfo->add (METER_FALLOFF_FASTEST, _("fastest"));
963
964         add_option (_("Misc"), mfo);
965
966         add_option (_("Misc"), new OptionEditorHeading (_("Undo")));
967         
968         add_option (_("Misc"), new UndoOptions (_rc_config));
969
970         add_option (_("Misc"), new OptionEditorHeading (_("Misc")));
971         
972 #ifndef GTKOSX
973         /* font scaling does nothing with GDK/Quartz */
974         add_option (_("Misc"), new FontScalingOptions (_rc_config));
975 #endif  
976
977         add_option (_("Misc"),
978              new BoolOption (
979                      "verify-remove-last-capture",
980                      _("Verify removal of last capture"),
981                      mem_fun (*_rc_config, &RCConfiguration::get_verify_remove_last_capture),
982                      mem_fun (*_rc_config, &RCConfiguration::set_verify_remove_last_capture)
983                      ));
984         
985         add_option (_("Misc"),
986              new BoolOption (
987                      "periodic-safety-backups",
988                      _("Make periodic backups of the session file"),
989                      mem_fun (*_rc_config, &RCConfiguration::get_periodic_safety_backups),
990                      mem_fun (*_rc_config, &RCConfiguration::set_periodic_safety_backups)
991                      ));
992
993         add_option (_("Misc"),
994              new BoolOption (
995                      "sync-all-route-ordering",
996                      _("Syncronise editor and mixer track order"),
997                      mem_fun (*_rc_config, &RCConfiguration::get_sync_all_route_ordering),
998                      mem_fun (*_rc_config, &RCConfiguration::set_sync_all_route_ordering)
999                      ));
1000
1001         add_option (_("Misc"),
1002              new BoolOption (
1003                      "only-copy-imported-files",
1004                      _("Always copy imported files"),
1005                      mem_fun (*_rc_config, &RCConfiguration::get_only_copy_imported_files),
1006                      mem_fun (*_rc_config, &RCConfiguration::set_only_copy_imported_files)
1007                      ));
1008
1009         add_option (_("Misc"),
1010              new BoolOption (
1011                      "default-narrow_ms",
1012                      _("Use narrow mixer strips"),
1013                      mem_fun (*_rc_config, &RCConfiguration::get_default_narrow_ms),
1014                      mem_fun (*_rc_config, &RCConfiguration::set_default_narrow_ms)
1015                      ));
1016
1017         add_option (_("Misc"),
1018              new BoolOption (
1019                      "name-new-markers",
1020                      _("Name new markers"),
1021                      mem_fun (*_rc_config, &RCConfiguration::get_name_new_markers),
1022                      mem_fun (*_rc_config, &RCConfiguration::set_name_new_markers)
1023                      ));
1024
1025         /* TRANSPORT */
1026
1027         add_option (_("Transport"),
1028              new BoolOption (
1029                      "latched-record-enable",
1030                      _("Keep record-enable engaged on stop"),
1031                      mem_fun (*_rc_config, &RCConfiguration::get_latched_record_enable),
1032                      mem_fun (*_rc_config, &RCConfiguration::set_latched_record_enable)
1033                      ));
1034
1035         add_option (_("Transport"),
1036              new BoolOption (
1037                      "stop-recording-on-xrun",
1038                      _("Stop recording when an xrun occurs"),
1039                      mem_fun (*_rc_config, &RCConfiguration::get_stop_recording_on_xrun),
1040                      mem_fun (*_rc_config, &RCConfiguration::set_stop_recording_on_xrun)
1041                      ));
1042
1043         add_option (_("Transport"),
1044              new BoolOption (
1045                      "create-xrun-marker",
1046                      _("Create markers where xruns occur"),
1047                      mem_fun (*_rc_config, &RCConfiguration::get_create_xrun_marker),
1048                      mem_fun (*_rc_config, &RCConfiguration::set_create_xrun_marker)
1049                      ));
1050
1051         add_option (_("Transport"),
1052              new BoolOption (
1053                      "stop-at-session-end",
1054                      _("Stop at the end of the session"),
1055                      mem_fun (*_rc_config, &RCConfiguration::get_stop_at_session_end),
1056                      mem_fun (*_rc_config, &RCConfiguration::set_stop_at_session_end)
1057                      ));
1058
1059         add_option (_("Transport"),
1060              new BoolOption (
1061                      "primary-clock-delta-edit-cursor",
1062                      _("Primary clock delta to edit cursor"),
1063                      mem_fun (*_rc_config, &RCConfiguration::get_primary_clock_delta_edit_cursor),
1064                      mem_fun (*_rc_config, &RCConfiguration::set_primary_clock_delta_edit_cursor)
1065                      ));
1066
1067         add_option (_("Transport"),
1068              new BoolOption (
1069                      "secondary-clock-delta-edit-cursor",
1070                      _("Secondary clock delta to edit cursor"),
1071                      mem_fun (*_rc_config, &RCConfiguration::get_secondary_clock_delta_edit_cursor),
1072                      mem_fun (*_rc_config, &RCConfiguration::set_secondary_clock_delta_edit_cursor)
1073                      ));
1074
1075         add_option (_("Transport"),
1076              new BoolOption (
1077                      "disable-disarm-during-roll",
1078                      _("Disable record disarm when transport is rolling"),
1079                      mem_fun (*_rc_config, &RCConfiguration::get_disable_disarm_during_roll),
1080                      mem_fun (*_rc_config, &RCConfiguration::set_disable_disarm_during_roll)
1081                      ));
1082
1083         /* EDITOR */
1084
1085         add_option (_("Editor"),
1086              new BoolOption (
1087                      "link-region-and-track-selection",
1088                      _("Link selection of regions and tracks"),
1089                      mem_fun (*_rc_config, &RCConfiguration::get_link_region_and_track_selection),
1090                      mem_fun (*_rc_config, &RCConfiguration::set_link_region_and_track_selection)
1091                      ));
1092
1093         add_option (_("Editor"),
1094              new BoolOption (
1095                      "automation-follows-regions",
1096                      _("Move relevant automation when regions are moved"),
1097                      mem_fun (*_rc_config, &RCConfiguration::get_automation_follows_regions),
1098                      mem_fun (*_rc_config, &RCConfiguration::set_automation_follows_regions)
1099                      ));
1100
1101         add_option (_("Editor"),
1102              new BoolOption (
1103                      "show-track-meters",
1104                      _("Show meters on tracks in the editor"),
1105                      mem_fun (*_rc_config, &RCConfiguration::get_show_track_meters),
1106                      mem_fun (*_rc_config, &RCConfiguration::set_show_track_meters)
1107                      ));
1108
1109         add_option (_("Editor"),
1110              new BoolOption (
1111                      "use-overlap-equivalency",
1112                      _("Use overlap equivalency for regions"),
1113                      mem_fun (*_rc_config, &RCConfiguration::get_use_overlap_equivalency),
1114                      mem_fun (*_rc_config, &RCConfiguration::set_use_overlap_equivalency)
1115                      ));
1116
1117         add_option (_("Editor"),
1118              new BoolOption (
1119                      "rubberbanding-snaps-to-grid",
1120                      _("Make rubberband selection rectangle snap to the grid"),
1121                      mem_fun (*_rc_config, &RCConfiguration::get_rubberbanding_snaps_to_grid),
1122                      mem_fun (*_rc_config, &RCConfiguration::set_rubberbanding_snaps_to_grid)
1123                      ));
1124
1125         add_option (_("Editor"),
1126              new BoolOption (
1127                      "show-waveforms",
1128                      _("Show waveforms in regions"),
1129                      mem_fun (*_rc_config, &RCConfiguration::get_show_waveforms),
1130                      mem_fun (*_rc_config, &RCConfiguration::set_show_waveforms)
1131                      ));
1132
1133         ComboOption<WaveformScale>* wfs = new ComboOption<WaveformScale> (
1134                 "waveform-scale",
1135                 _("Waveform scale"),
1136                 mem_fun (*_rc_config, &RCConfiguration::get_waveform_scale),
1137                 mem_fun (*_rc_config, &RCConfiguration::set_waveform_scale)
1138                 );
1139
1140         wfs->add (Linear, _("linear"));
1141         wfs->add (Logarithmic, _("logarithmic"));
1142
1143         add_option (_("Editor"), wfs);
1144         
1145         ComboOption<WaveformShape>* wfsh = new ComboOption<WaveformShape> (
1146                 "waveform-shape",
1147                 _("Waveform shape"),
1148                 mem_fun (*_rc_config, &RCConfiguration::get_waveform_shape),
1149                 mem_fun (*_rc_config, &RCConfiguration::set_waveform_shape)
1150                 );
1151
1152         wfsh->add (Traditional, _("traditional"));
1153         wfsh->add (Rectified, _("rectified"));
1154
1155         add_option (_("Editor"), wfsh);
1156
1157         /* AUDIO */
1158
1159         add_option (_("Audio"), new OptionEditorHeading (_("Solo")));
1160
1161
1162         add_option (_("Audio"), 
1163              new BoolOption (
1164                      "solo-control-is-listen-control",
1165                      _("Solo controls are Listen controls"),
1166                      mem_fun (*_rc_config, &RCConfiguration::get_solo_control_is_listen_control),
1167                      mem_fun (*_rc_config, &RCConfiguration::set_solo_control_is_listen_control)
1168                      ));
1169
1170         ComboOption<ListenPosition>* lp = new ComboOption<ListenPosition> (
1171                 "listen-position",
1172                 _("Listen Position"),
1173                 mem_fun (*_rc_config, &RCConfiguration::get_listen_position),
1174                 mem_fun (*_rc_config, &RCConfiguration::set_listen_position)
1175                 );
1176
1177         lp->add (AfterFaderListen, _("after-fader listen"));
1178         lp->add (PreFaderListen, _("pre-fader listen"));
1179
1180         add_option (_("Audio"), lp);
1181         add_option (_("Audio"), new SoloMuteOptions (_rc_config));
1182
1183         add_option (_("Audio"),
1184              new BoolOption (
1185                      "solo-latched",
1186                      _("Latched solo"),
1187                      mem_fun (*_rc_config, &RCConfiguration::get_solo_latched),
1188                      mem_fun (*_rc_config, &RCConfiguration::set_solo_latched)
1189                      ));
1190
1191         add_option (_("Audio"),
1192              new BoolOption (
1193                      "show-solo-mutes",
1194                      _("Show solo muting"),
1195                      mem_fun (*_rc_config, &RCConfiguration::get_show_solo_mutes),
1196                      mem_fun (*_rc_config, &RCConfiguration::set_show_solo_mutes)
1197                      ));
1198
1199         add_option (_("Audio"),
1200              new BoolOption (
1201                      "solo-mute-override",
1202                      _("Override muting"),
1203                      mem_fun (*_rc_config, &RCConfiguration::get_solo_mute_override),
1204                      mem_fun (*_rc_config, &RCConfiguration::set_solo_mute_override)
1205                      ));
1206
1207         add_option (_("Audio"), new OptionEditorHeading (_("Monitoring")));
1208
1209         ComboOption<MonitorModel>* mm = new ComboOption<MonitorModel> (
1210                 "monitoring-model",
1211                 _("Monitoring handled by"),
1212                 mem_fun (*_rc_config, &RCConfiguration::get_monitoring_model),
1213                 mem_fun (*_rc_config, &RCConfiguration::set_monitoring_model)
1214                 );
1215
1216         mm->add (HardwareMonitoring, _("JACK"));
1217         mm->add (SoftwareMonitoring, _("ardour"));
1218         mm->add (ExternalMonitoring, _("audio hardware"));
1219
1220         add_option (_("Audio"), mm);
1221
1222         add_option (_("Audio"),
1223              new BoolOption (
1224                      "tape-machine-mode",
1225                      _("Tape machine mode"),
1226                      mem_fun (*_rc_config, &RCConfiguration::get_tape_machine_mode),
1227                      mem_fun (*_rc_config, &RCConfiguration::set_tape_machine_mode)
1228                      ));
1229
1230         add_option (_("Audio"), new OptionEditorHeading (_("Connection of tracks and busses")));
1231
1232         add_option (_("Audio"),
1233                     new BoolOption (
1234                             "auto-connect-standard-busses",
1235                             _("Auto-connect master/monitor busses"),
1236                             mem_fun (*_rc_config, &RCConfiguration::get_auto_connect_standard_busses),
1237                             mem_fun (*_rc_config, &RCConfiguration::set_auto_connect_standard_busses)
1238                             ));
1239
1240         ComboOption<AutoConnectOption>* iac = new ComboOption<AutoConnectOption> (
1241                 "input-auto-connect",
1242                 _("Connect track and bus inputs"),
1243                 mem_fun (*_rc_config, &RCConfiguration::get_input_auto_connect),
1244                 mem_fun (*_rc_config, &RCConfiguration::set_input_auto_connect)
1245                 );
1246
1247         iac->add (AutoConnectPhysical, _("automatically to physical inputs"));
1248         iac->add (ManualConnect, _("manually"));
1249
1250         add_option (_("Audio"), iac);
1251
1252         ComboOption<AutoConnectOption>* oac = new ComboOption<AutoConnectOption> (
1253                 "output-auto-connect",
1254                 _("Connect track and bus outputs"),
1255                 mem_fun (*_rc_config, &RCConfiguration::get_output_auto_connect),
1256                 mem_fun (*_rc_config, &RCConfiguration::set_output_auto_connect)
1257                 );
1258
1259         oac->add (AutoConnectPhysical, _("automatically to physical outputs"));
1260         oac->add (AutoConnectMaster, _("automatically to master outputs"));
1261         oac->add (ManualConnect, _("manually"));
1262
1263         add_option (_("Audio"), oac);
1264
1265         add_option (_("Audio"), new OptionEditorHeading (_("Denormals")));
1266
1267         add_option (_("Audio"),
1268              new BoolOption (
1269                      "denormal-protection",
1270                      _("Use DC bias to protect against denormals"),
1271                      mem_fun (*_rc_config, &RCConfiguration::get_denormal_protection),
1272                      mem_fun (*_rc_config, &RCConfiguration::set_denormal_protection)
1273                      ));
1274
1275         ComboOption<DenormalModel>* dm = new ComboOption<DenormalModel> (
1276                 "denormal-model",
1277                 _("Processor handling"),
1278                 mem_fun (*_rc_config, &RCConfiguration::get_denormal_model),
1279                 mem_fun (*_rc_config, &RCConfiguration::set_denormal_model)
1280                 );
1281         
1282         dm->add (DenormalNone, _("no processor handling"));
1283         
1284         FPU fpu;
1285         
1286         if (fpu.has_flush_to_zero()) {
1287                 dm->add (DenormalFTZ, _("use FlushToZero"));
1288         }
1289         
1290         if (fpu.has_denormals_are_zero()) {
1291                 dm->add (DenormalDAZ, _("use DenormalsAreZero"));
1292         }
1293         
1294         if (fpu.has_flush_to_zero() && fpu.has_denormals_are_zero()) {
1295                 dm->add (DenormalFTZDAZ, _("use FlushToZero and DenormalsAreZerO"));
1296         }
1297         
1298         add_option (_("Audio"), dm);
1299
1300         add_option (_("Audio"), new OptionEditorHeading (_("Plugins")));
1301
1302         add_option (_("Audio"),
1303              new BoolOption (
1304                      "plugins-stop-with-transport",
1305                      _("Stop plugins when the transport is stopped"),
1306                      mem_fun (*_rc_config, &RCConfiguration::get_plugins_stop_with_transport),
1307                      mem_fun (*_rc_config, &RCConfiguration::set_plugins_stop_with_transport)
1308                      ));
1309
1310         add_option (_("Audio"),
1311              new BoolOption (
1312                      "do-not-record-plugins",
1313                      _("Disable plugins during recording"),
1314                      mem_fun (*_rc_config, &RCConfiguration::get_do_not_record_plugins),
1315                      mem_fun (*_rc_config, &RCConfiguration::set_do_not_record_plugins)
1316                      ));
1317
1318         add_option (_("Audio"),
1319              new BoolOption (
1320                      "new-plugins-active",
1321                      _("Make new plugins active"),
1322                      mem_fun (*_rc_config, &RCConfiguration::get_new_plugins_active),
1323                      mem_fun (*_rc_config, &RCConfiguration::set_new_plugins_active)
1324                      ));
1325
1326         add_option (_("Audio"),
1327              new BoolOption (
1328                      "auto-analyse-audio",
1329                      _("Enable automatic analysis of audio"),
1330                      mem_fun (*_rc_config, &RCConfiguration::get_auto_analyse_audio),
1331                      mem_fun (*_rc_config, &RCConfiguration::set_auto_analyse_audio)
1332                      ));
1333
1334         /* MIDI CONTROL */
1335
1336         add_option (_("MIDI control"), new MIDIPorts (_rc_config));
1337
1338         add_option (_("MIDI control"),
1339              new SpinOption<uint8_t> (
1340                      "mmc-receive-device-id",
1341                      _("Inbound MMC device ID"),
1342                      mem_fun (*_rc_config, &RCConfiguration::get_mmc_receive_device_id),
1343                      mem_fun (*_rc_config, &RCConfiguration::set_mmc_receive_device_id),
1344                      0, 128, 1, 10
1345                      ));
1346
1347         add_option (_("MIDI control"),
1348              new SpinOption<uint8_t> (
1349                      "mmc-send-device-id",
1350                      _("Outbound MMC device ID"),
1351                      mem_fun (*_rc_config, &RCConfiguration::get_mmc_send_device_id),
1352                      mem_fun (*_rc_config, &RCConfiguration::set_mmc_send_device_id),
1353                      0, 128, 1, 10
1354                      ));
1355
1356         add_option (_("MIDI control"),
1357              new SpinOption<int32_t> (
1358                      "initial-program-change",
1359                      _("Initial program change"),
1360                      mem_fun (*_rc_config, &RCConfiguration::get_initial_program_change),
1361                      mem_fun (*_rc_config, &RCConfiguration::set_initial_program_change),
1362                      -1, 65536, 1, 10
1363                      ));
1364
1365         /* CONTROL SURFACES */
1366
1367         add_option (_("Control surfaces"), new ControlSurfacesOptions);
1368
1369         ComboOption<RemoteModel>* rm = new ComboOption<RemoteModel> (
1370                 "remote-model",
1371                 _("Control surface remote ID"),
1372                 mem_fun (*_rc_config, &RCConfiguration::get_remote_model),
1373                 mem_fun (*_rc_config, &RCConfiguration::set_remote_model)
1374                 );
1375
1376         rm->add (UserOrdered, _("assigned by user"));
1377         rm->add (MixerOrdered, _("follows order of mixer"));
1378         rm->add (EditorOrdered, _("follows order of editor"));
1379
1380         add_option (_("Control surfaces"), rm);
1381
1382         /* CLICK */
1383
1384         add_option (_("Click"), new ClickOptions (_rc_config, this));
1385
1386         /* KEYBOARD */
1387
1388         add_option (_("Keyboard"), new KeyboardOptions);
1389 }
1390
1391