fixes for various bugs including dangling ref to route in session, opening sessions...
[ardour.git] / gtk2_ardour / ardour_ui_options.cc
1 /*
2     Copyright (C) 2005 Paul Davis 
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18     $Id$
19 */
20
21 #include <pbd/convert.h>
22
23 #include <gtkmm2ext/utils.h>
24
25 #include <ardour/configuration.h>
26 #include <ardour/session.h>
27 #include <ardour/audioengine.h>
28
29 #include "ardour_ui.h"
30 #include "actions.h"
31 #include "gui_thread.h"
32
33 #include "i18n.h"
34
35 using namespace Gtk;
36 using namespace Gtkmm2ext;
37 using namespace ARDOUR;
38 using namespace PBD;
39 using namespace sigc;
40
41 void
42 ARDOUR_UI::toggle_time_master ()
43 {
44         ActionManager::toggle_config_state ("Transport", "ToggleTimeMaster", &Configuration::set_jack_time_master, &Configuration::get_jack_time_master);
45 }
46
47 void
48 ARDOUR_UI::toggle_send_mtc ()
49 {
50         ActionManager::toggle_config_state ("options", "SendMTC", &Configuration::set_send_mtc, &Configuration::get_send_mtc);
51 }
52
53 void
54 ARDOUR_UI::toggle_send_mmc ()
55 {
56         ActionManager::toggle_config_state ("options", "SendMMC", &Configuration::set_send_mmc, &Configuration::get_send_mmc);
57 }
58
59 void
60 ARDOUR_UI::toggle_use_mmc ()
61 {
62         ActionManager::toggle_config_state ("options", "UseMMC", &Configuration::set_mmc_control, &Configuration::get_mmc_control);
63 }
64
65 void
66 ARDOUR_UI::toggle_use_midi_control ()
67 {
68         ActionManager::toggle_config_state ("options", "UseMIDIcontrol", &Configuration::set_midi_control, &Configuration::get_midi_control);
69 }
70
71 void
72 ARDOUR_UI::toggle_send_midi_feedback ()
73 {
74         ActionManager::toggle_config_state ("options", "SendMIDIfeedback", &Configuration::set_midi_feedback, &Configuration::get_midi_feedback);
75 }
76
77 void
78 ARDOUR_UI::set_native_file_header_format (HeaderFormat hf)
79 {
80         const char *action;
81
82         switch (hf) {
83         case BWF:
84                 action = X_("FileHeaderFormatBWF");
85                 break;
86         case WAVE:
87                 action = X_("FileHeaderFormatWAVE");
88                 break;
89         case WAVE64:
90                 action = X_("FileHeaderFormatWAVE64");
91                 break;
92         case iXML:
93                 action = X_("FileHeaderFormatiXML");
94                 break;
95         case RF64:
96                 action = X_("FileHeaderFormatRF64");
97                 break;
98         case CAF:
99                 action = X_("FileHeaderFormatCAF");
100                 break;
101         case AIFF:
102                 action = X_("FileHeaderFormatAIFF");
103                 break;
104         }
105
106         Glib::RefPtr<Action> act = ActionManager::get_action ("options", action);
107
108         if (act) {
109                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
110                 if (ract && ract->get_active() && Config->get_native_file_header_format() != hf) {
111                         Config->set_native_file_header_format (hf);
112                 }
113         }
114 }
115
116 void
117 ARDOUR_UI::set_native_file_data_format (SampleFormat sf)
118 {
119         const char* action;
120
121         switch (sf) {
122         case FormatFloat:
123                 action = X_("FileDataFormatFloat");
124                 break;
125         case FormatInt24:
126                 action = X_("FileDataFormat24bit");
127                 break;
128         }
129
130         Glib::RefPtr<Action> act = ActionManager::get_action ("options", action);
131
132         if (act) {
133                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
134                 if (ract && ract->get_active() && Config->get_native_file_data_format() != sf) {
135                         Config->set_native_file_data_format (sf);
136                 }
137         }
138 }
139
140 void
141 ARDOUR_UI::set_input_auto_connect (AutoConnectOption option)
142 {
143         const char* action;
144         
145         switch (option) {
146         case AutoConnectPhysical:
147                 action = X_("InputAutoConnectPhysical");
148                 break;
149         default:
150                 action = X_("InputAutoConnectManual");
151         }
152
153         Glib::RefPtr<Action> act = ActionManager::get_action ("options", action);
154
155         if (act) {
156                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
157
158                 if (ract && ract->get_active() && Config->get_input_auto_connect() != option) {
159                         Config->set_input_auto_connect (option);
160                 }
161         }
162 }
163
164 void
165 ARDOUR_UI::set_output_auto_connect (AutoConnectOption option)
166 {
167         const char* action;
168         
169         switch (option) {
170         case AutoConnectPhysical:
171                 action = X_("OutputAutoConnectPhysical");
172                 break;
173         case AutoConnectMaster:
174                 action = X_("OutputAutoConnectMaster");
175                 break;
176         default:
177                 action = X_("OutputAutoConnectManual");
178         }
179
180         Glib::RefPtr<Action> act = ActionManager::get_action ("options", action);
181
182         if (act) {
183                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
184
185                 if (ract && ract->get_active() && Config->get_output_auto_connect() != option) {
186                         Config->set_output_auto_connect (option);
187                 }
188         }
189 }
190
191 void
192 ARDOUR_UI::set_solo_model (SoloModel model)
193 {
194         const char* action = 0;
195
196         switch (model) {
197         case SoloBus:
198                 action = X_("SoloViaBus");
199                 break;
200                 
201         case InverseMute:
202                 action = X_("SoloInPlace");
203                 break;
204         default:
205                 fatal << string_compose (_("programming error: unknown solo model in ARDOUR_UI::set_solo_model: %1"), model) << endmsg;
206                 /*NOTREACHED*/
207         }
208
209         Glib::RefPtr<Action> act = ActionManager::get_action ("options", action);
210
211         if (act) {
212                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
213
214                 if (ract && ract->get_active() && Config->get_solo_model() != model) {
215                         Config->set_solo_model (model);
216                 }
217         }
218
219 }
220
221 void
222 ARDOUR_UI::set_monitor_model (MonitorModel model)
223 {
224         const char* action = 0;
225
226         switch (model) {
227         case HardwareMonitoring:
228                 action = X_("UseHardwareMonitoring");
229                 break;
230                 
231         case SoftwareMonitoring:
232                 action = X_("UseSoftwareMonitoring");
233                 break;
234         case ExternalMonitoring:
235                 action = X_("UseExternalMonitoring");
236                 break;
237
238         default:
239                 fatal << string_compose (_("programming error: unknown solo model in ARDOUR_UI::set_solo_model: %1"), model) << endmsg;
240                 /*NOTREACHED*/
241         }
242
243         Glib::RefPtr<Action> act = ActionManager::get_action ("options", action);
244
245         if (act) {
246                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
247
248                 if (ract && ract->get_active() && Config->get_monitoring_model() != model) {
249                         Config->set_monitoring_model (model);
250                 }
251         }
252
253 }
254
255 void
256 ARDOUR_UI::toggle_auto_input ()
257 {
258         ActionManager::toggle_config_state ("Transport", "ToggleAutoInput", &Configuration::set_auto_input, &Configuration::get_auto_input);
259 }
260
261 void
262 ARDOUR_UI::toggle_auto_play ()
263 {
264         ActionManager::toggle_config_state ("Transport", "ToggleAutoPlay", &Configuration::set_auto_play, &Configuration::get_auto_play);
265 }
266
267 void
268 ARDOUR_UI::toggle_auto_return ()
269 {
270         ActionManager::toggle_config_state ("Transport", "ToggleAutoReturn", &Configuration::set_auto_return, &Configuration::get_auto_return);
271 }
272
273 void
274 ARDOUR_UI::toggle_click ()
275 {
276         ActionManager::toggle_config_state ("Transport", "ToggleClick", &Configuration::set_clicking, &Configuration::get_clicking);
277 }
278
279 void
280 ARDOUR_UI::toggle_session_auto_loop ()
281 {
282         if (session) {
283                 if (Config->get_auto_loop()) {
284                         if (session->transport_rolling()) {
285                                 transport_roll();
286                         } else {
287                                 session->request_play_loop (false);
288                         }
289                 } else {
290                         session->request_play_loop (true);
291                 }
292         }
293 }
294
295 void
296 ARDOUR_UI::toggle_punch_in ()
297 {
298         ActionManager::toggle_config_state ("Transport", "TogglePunchIn", &Configuration::set_punch_in, &Configuration::get_punch_in);
299 }
300
301 void
302 ARDOUR_UI::toggle_punch_out ()
303 {
304         ActionManager::toggle_config_state ("Transport", "TogglePunchOut", &Configuration::set_punch_out, &Configuration::get_punch_out);
305 }
306
307 void
308 ARDOUR_UI::toggle_video_sync()
309 {
310         Glib::RefPtr<Action> act = ActionManager::get_action ("Transport", "ToggleVideoSync");
311         if (act) {
312                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
313                 Config->set_use_video_sync (tact->get_active());
314         }
315 }
316
317 void
318 ARDOUR_UI::toggle_editing_space()
319 {
320         Glib::RefPtr<Action> act = ActionManager::get_action ("Common", "ToggleMaximalEditor");
321         if (act) {
322                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
323                 if (tact->get_active()) {
324                         maximise_editing_space ();
325                 } else {
326                         restore_editing_space ();
327                 }
328         }
329 }
330
331 void
332 ARDOUR_UI::toggle_StopPluginsWithTransport()
333 {
334         ActionManager::toggle_config_state ("options", "StopPluginsWithTransport", &Configuration::set_plugins_stop_with_transport, &Configuration::get_plugins_stop_with_transport);
335 }
336
337 void
338 ARDOUR_UI::toggle_LatchedRecordEnable()
339 {
340         ActionManager::toggle_config_state ("options", "LatchedRecordEnable", &Configuration::set_latched_record_enable, &Configuration::get_latched_record_enable);
341 }
342
343 void
344 ARDOUR_UI::toggle_DoNotRunPluginsWhileRecording()
345 {
346         ActionManager::toggle_config_state ("options", "DoNotRunPluginsWhileRecording", &Configuration::set_do_not_record_plugins, &Configuration::get_do_not_record_plugins);
347 }
348
349 void
350 ARDOUR_UI::toggle_VerifyRemoveLastCapture()
351 {
352         ActionManager::toggle_config_state ("options", "VerifyRemoveLastCapture", &Configuration::set_verify_remove_last_capture, &Configuration::get_verify_remove_last_capture);
353 }
354
355 void
356 ARDOUR_UI::toggle_StopRecordingOnXrun()
357 {
358         ActionManager::toggle_config_state ("options", "StopRecordingOnXrun", &Configuration::set_stop_recording_on_xrun, &Configuration::get_stop_recording_on_xrun);
359 }
360
361 void
362 ARDOUR_UI::toggle_StopTransportAtEndOfSession()
363 {
364         ActionManager::toggle_config_state ("options", "StopTransportAtEndOfSession", &Configuration::set_stop_at_session_end, &Configuration::get_stop_at_session_end);
365 }
366
367 void
368 ARDOUR_UI::toggle_GainReduceFastTransport()
369 {
370         Glib::RefPtr<Action> act = ActionManager::get_action ("options", "GainReduceFastTransport");
371         if (act) {
372                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
373                 if (tact->get_active()) {
374                         Config->set_quieten_at_speed (0.251189); // -12dB reduction for ffwd or rewind
375                 } else {
376                         Config->set_quieten_at_speed (1.0); /* no change */
377                 }
378         }
379 }
380
381 void
382 ARDOUR_UI::toggle_LatchedSolo()
383 {
384         ActionManager::toggle_config_state ("options", "LatchedSolo", &Configuration::set_solo_latched, &Configuration::get_solo_latched);
385 }
386
387 void
388 ARDOUR_UI::mtc_port_changed ()
389 {
390         bool have_mtc;
391
392         if (session) {
393                 if (session->mtc_port()) {
394                         have_mtc = true;
395                 } else {
396                         have_mtc = false;
397                 }
398         } else {
399                 have_mtc = false;
400         }
401
402         positional_sync_strings.clear ();
403         positional_sync_strings.push_back (slave_source_to_string (None));
404         if (have_mtc) {
405                 positional_sync_strings.push_back (slave_source_to_string (MTC));
406         }
407         positional_sync_strings.push_back (slave_source_to_string (JACK));
408         
409         set_popdown_strings (sync_option_combo, positional_sync_strings);
410 }
411
412 void
413 ARDOUR_UI::setup_session_options ()
414 {
415         mtc_port_changed ();
416
417         Config->ParameterChanged.connect (mem_fun (*this, &ARDOUR_UI::parameter_changed));
418 }
419
420
421 void
422 ARDOUR_UI::map_solo_model ()
423 {
424         const char* on;
425
426         if (Config->get_solo_model() == InverseMute) {
427                 on = "SoloInPlace";
428         } else {
429                 on = "SoloViaBus";
430         }
431
432         Glib::RefPtr<Action> act = ActionManager::get_action ("options", on);
433         if (act) {
434                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
435
436                 if (tact && !tact->get_active()) {
437                         tact->set_active (true);
438                 }
439         }
440 }
441
442 void
443 ARDOUR_UI::map_monitor_model ()
444 {
445         const char* on = 0;
446
447         switch (Config->get_monitoring_model()) {
448         case HardwareMonitoring:
449                 on = X_("UseHardwareMonitoring");
450                 break;
451         case SoftwareMonitoring:
452                 on = X_("UseSoftwareMonitoring");
453                 break;
454         case ExternalMonitoring:
455                 on = X_("UseExternalMonitoring");
456                 break;
457         }
458
459         Glib::RefPtr<Action> act = ActionManager::get_action ("options", on);
460         if (act) {
461                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
462
463                 if (tact && !tact->get_active()) {
464                         tact->set_active (true);
465                 }
466         }
467 }
468
469 void
470 ARDOUR_UI::map_file_header_format ()
471 {
472         const char* action = 0;
473
474         switch (Config->get_native_file_header_format()) {
475         case BWF:
476                 action = X_("FileHeaderFormatBWF");
477                 break;
478
479         case WAVE:
480                 action = X_("FileHeaderFormatWAVE");
481                 break;
482
483         case WAVE64:
484                 action = X_("FileHeaderFormatWAVE64");
485                 break;
486
487         case iXML:
488                 action = X_("FileHeaderFormatiXML");
489                 break;
490
491         case RF64:
492                 action = X_("FileHeaderFormatRF64");
493                 break;
494
495         case CAF:
496                 action = X_("FileHeaderFormatCAF");
497                 break;
498
499         default:
500                 fatal << string_compose (_("programming error: unknown file header format passed to ARDOUR_UI::map_file_data_format: %1"), 
501                                          Config->get_native_file_header_format()) << endmsg;
502                 /*NOTREACHED*/
503         }
504
505
506         Glib::RefPtr<Action> act = ActionManager::get_action ("options", action);
507
508         if (act) {
509                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
510
511                 if (tact && !tact->get_active()) {
512                         tact->set_active (true);
513                 }
514         }
515 }
516
517 void
518 ARDOUR_UI::map_file_data_format ()
519 {
520         const char* action = 0;
521
522         switch (Config->get_native_file_data_format()) {
523         case FormatFloat:
524                 action = X_("FileDataFormatFloat");
525                 break;
526
527         case FormatInt24:
528                 action = X_("FileDataFormat24bit");
529                 break;
530
531         default:
532                 fatal << string_compose (_("programming error: unknown file data format passed to ARDOUR_UI::map_file_data_format: %1"), 
533                                          Config->get_native_file_data_format()) << endmsg;
534                 /*NOTREACHED*/
535         }
536
537
538         Glib::RefPtr<Action> act = ActionManager::get_action ("options", action);
539
540         if (act) {
541                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
542
543                 if (tact && !tact->get_active()) {
544                         tact->set_active (true);
545                 }
546         }
547 }
548
549 void
550 ARDOUR_UI::map_input_auto_connect ()
551 {
552         const char* on;
553
554         if (Config->get_input_auto_connect() == (AutoConnectOption) 0) {
555                 on = "InputAutoConnectManual";
556         } else {
557                 on = "InputAutoConnectPhysical";
558         }
559
560         Glib::RefPtr<Action> act = ActionManager::get_action ("options", on);
561         if (act) {
562                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
563
564                 if (tact && !tact->get_active()) {
565                         tact->set_active (true);
566                 }
567         }
568 }
569
570 void
571 ARDOUR_UI::map_output_auto_connect ()
572 {
573         const char* on;
574
575         if (Config->get_output_auto_connect() == (AutoConnectOption) 0) {
576                 on = "OutputAutoConnectManual";
577         } else if (Config->get_output_auto_connect() == AutoConnectPhysical) {
578                 on = "OutputAutoConnectPhysical";
579         } else {
580                 on = "OutputAutoConnectMaster";
581         }
582
583         Glib::RefPtr<Action> act = ActionManager::get_action ("options", on);
584         if (act) {
585                 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
586                 
587                 if (tact && !tact->get_active()) {
588                         tact->set_active (true);
589                 }
590         }
591 }
592
593 void
594 ARDOUR_UI::map_meter_falloff ()
595 {
596         const char* action = 0;
597
598         /* XXX hack alert. Fix this. Please */
599
600         float val = Config->get_meter_falloff ();
601         MeterFalloff code = (MeterFalloff) (floor (val));
602
603         switch (code) {
604         case MeterFalloffOff:
605                 action = X_("MeterFalloffOff");
606                 break;
607         case MeterFalloffSlowest:
608                 action = X_("MeterFalloffSlowest");
609                 break;
610         case MeterFalloffSlow:
611                 action = X_("MeterFalloffSlow");
612                 break;
613         case MeterFalloffMedium:
614                 action = X_("MeterFalloffMedium");
615                 break;
616         case MeterFalloffFast:
617                 action = X_("MeterFalloffFast");
618                 break;
619         case MeterFalloffFaster:
620                 action = X_("MeterFalloffFaster");
621                 break;
622         case MeterFalloffFastest:
623                 action = X_("MeterFalloffFastest");
624                 break;
625         }
626
627         Glib::RefPtr<Action> act = ActionManager::get_action (X_("options"), action);
628
629         if (act) {
630                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
631                 if (ract && !ract->get_active()) {
632                         ract->set_active (true);
633                 }
634         }
635 }
636
637 void
638 ARDOUR_UI::map_meter_hold ()
639 {
640         const char* action = 0;
641
642         /* XXX hack alert. Fix this. Please */
643
644         float val = Config->get_meter_hold ();
645         MeterHold code = (MeterHold) (floor (val));
646
647         switch (code) {
648         case MeterHoldOff:
649                 action = X_("MeterHoldOff");
650                 break;
651         case MeterHoldShort:
652                 action = X_("MeterHoldShort");
653                 break;
654         case MeterHoldMedium:
655                 action = X_("MeterHoldMedium");
656                 break;
657         case MeterHoldLong:
658                 action = X_("MeterHoldLong");
659                 break;
660         }
661
662         Glib::RefPtr<Action> act = ActionManager::get_action (X_("options"), action);
663
664         if (act) {
665                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
666                 if (ract && !ract->get_active()) {
667                         ract->set_active (true);
668                 }
669         }
670 }
671
672 void 
673 ARDOUR_UI::set_meter_hold (MeterHold val)
674 {
675         const char* action = 0;
676         float fval;
677
678         fval = meter_hold_to_float (val);
679
680         switch (val) {
681         case MeterHoldOff:
682                 action = X_("MeterHoldOff");
683                 break;
684         case MeterHoldShort:
685                 action = X_("MeterHoldShort");
686                 break;
687         case MeterHoldMedium:
688                 action = X_("MeterHoldMedium");
689                 break;
690         case MeterHoldLong:
691                 action = X_("MeterHoldLong");
692                 break;
693         }
694
695         Glib::RefPtr<Action> act = ActionManager::get_action (X_("options"), action);
696         
697         if (act) {
698                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
699                 if (ract && ract->get_active() && Config->get_meter_hold() != fval) {
700                         Config->set_meter_hold (fval);
701                 }
702         }
703 }
704
705 void
706 ARDOUR_UI::set_meter_falloff (MeterFalloff val)
707 {
708         const char* action = 0;
709         float fval;
710
711         fval = meter_falloff_to_float (val);
712
713         switch (val) {
714         case MeterFalloffOff:
715                 action = X_("MeterFalloffOff");
716                 break;
717         case MeterFalloffSlowest:
718                 action = X_("MeterFalloffSlowest");
719                 break;
720         case MeterFalloffSlow:
721                 action = X_("MeterFalloffSlow");
722                 break;
723         case MeterFalloffMedium:
724                 action = X_("MeterFalloffMedium");
725                 break;
726         case MeterFalloffFast:
727                 action = X_("MeterFalloffFast");
728                 break;
729         case MeterFalloffFaster:
730                 action = X_("MeterFalloffFaster");
731                 break;
732         case MeterFalloffFastest:
733                 action = X_("MeterFalloffFastest");
734                 break;
735         }
736
737         Glib::RefPtr<Action> act = ActionManager::get_action (X_("options"), action);
738
739         if (act) {
740                 Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
741                 if (ract && ract->get_active() && Config->get_meter_falloff () != fval) {
742                         Config->set_meter_falloff (fval);
743                 }
744         }
745 }
746
747 void
748 ARDOUR_UI::parameter_changed (const char* parameter_name)
749 {
750 #define PARAM_IS(x) (!strcmp (parameter_name, (x)))
751
752         if (PARAM_IS ("slave-source")) {
753
754                 sync_option_combo.set_active_text (slave_source_to_string (Config->get_slave_source()));
755
756         } else if (PARAM_IS ("send-mtc")) {
757
758                 ActionManager::map_some_state ("options", "SendMTC", &Configuration::get_send_mtc);
759
760         } else if (PARAM_IS ("send-mmc")) {
761
762                 ActionManager::map_some_state ("options", "SendMMC", &Configuration::get_send_mmc);
763
764         } else if (PARAM_IS ("mmc-control")) {
765                 ActionManager::map_some_state ("options", "UseMMC", &Configuration::get_mmc_control);
766         } else if (PARAM_IS ("midi-feedback")) {
767                 ActionManager::map_some_state ("options", "SendMIDIfeedback", &Configuration::get_midi_feedback);
768         } else if (PARAM_IS ("midi-control")) {
769                 ActionManager::map_some_state ("options", "UseMIDIcontrol", &Configuration::get_midi_control);
770         } else if (PARAM_IS ("do-not-record-plugins")) {
771                 ActionManager::map_some_state ("options", "DoNotRunPluginsWhileRecording", &Configuration::get_do_not_record_plugins);
772         } else if (PARAM_IS ("latched-record-enable")) {
773                 ActionManager::map_some_state ("options", "LatchedRecordEnable", &Configuration::get_latched_record_enable);
774         } else if (PARAM_IS ("solo-latched")) {
775                 ActionManager::map_some_state ("options", "LatchedSolo", &Configuration::get_solo_latched);
776         } else if (PARAM_IS ("solo-model")) {
777                 map_solo_model ();
778         } else if (PARAM_IS ("auto-play")) {
779                 ActionManager::map_some_state ("Transport", "ToggleAutoPlay", &Configuration::get_auto_play);
780         } else if (PARAM_IS ("auto-loop")) {
781                 ActionManager::map_some_state ("Transport", "Loop", &Configuration::get_auto_loop);
782         } else if (PARAM_IS ("auto-return")) {
783                 ActionManager::map_some_state ("Transport", "ToggleAutoReturn", &Configuration::get_auto_return);
784         } else if (PARAM_IS ("auto-input")) {
785                 ActionManager::map_some_state ("Transport", "ToggleAutoInput", &Configuration::get_auto_input);
786         } else if (PARAM_IS ("punch-out")) {
787                 ActionManager::map_some_state ("Transport", "TogglePunchOut", &Configuration::get_punch_out);
788         } else if (PARAM_IS ("punch-in")) {
789                 ActionManager::map_some_state ("Transport", "TogglePunchIn", &Configuration::get_punch_in);
790         } else if (PARAM_IS ("clicking")) {
791                 ActionManager::map_some_state ("Transport", "ToggleClick", &Configuration::get_clicking);
792         } else if (PARAM_IS ("jack-time-master")) {
793                 ActionManager::map_some_state ("Transport",  "ToggleTimeMaster", &Configuration::get_jack_time_master);
794         } else if (PARAM_IS ("plugins-stop-with-transport")) {
795                 ActionManager::map_some_state ("options",  "StopPluginsWithTransport", &Configuration::get_plugins_stop_with_transport);
796         } else if (PARAM_IS ("latched-record-enable")) {
797                 ActionManager::map_some_state ("options", "LatchedRecordEnable", &Configuration::get_latched_record_enable);
798         } else if (PARAM_IS ("verify-remove-last-capture")) {
799                 ActionManager::map_some_state ("options",  "VerifyRemoveLastCapture", &Configuration::get_verify_remove_last_capture);
800         } else if (PARAM_IS ("stop-recording-on-xrun")) {
801                 ActionManager::map_some_state ("options",  "StopRecordingOnXrun", &Configuration::get_stop_recording_on_xrun);
802         } else if (PARAM_IS ("stop-at-session-end")) {
803                 ActionManager::map_some_state ("options",  "StopTransportAtEndOfSession", &Configuration::get_stop_at_session_end);
804         } else if (PARAM_IS ("monitoring-model")) {
805                 map_monitor_model ();
806         } else if (PARAM_IS ("use-video-sync")) {
807                 ActionManager::map_some_state ("Transport",  "ToggleVideoSync", &Configuration::get_use_video_sync);
808         } else if (PARAM_IS ("quieten-at-speed")) {
809                 ActionManager::map_some_state ("options",  "GainReduceFastTransport", &Configuration::get_quieten_at_speed);
810         } else if (PARAM_IS ("shuttle-behaviour")) {
811
812                 switch (Config->get_shuttle_behaviour ()) {
813                 case Sprung:
814                         shuttle_style_button.set_active_text (_("sprung"));
815                         shuttle_fract = 0.0;
816                         shuttle_box.queue_draw ();
817                         if (session) {
818                                 if (session->transport_rolling()) {
819                                         shuttle_fract = SHUTTLE_FRACT_SPEED1;
820                                         session->request_transport_speed (1.0);
821                                 }
822                         }
823                         break;
824                 case Wheel:
825                         shuttle_style_button.set_active_text (_("wheel"));
826                         break;
827                 }
828
829         } else if (PARAM_IS ("shuttle-units")) {
830                 
831                 switch (Config->get_shuttle_units()) {
832                 case Percentage:
833                         shuttle_units_button.set_label("% ");
834                         break;
835                 case Semitones:
836                         shuttle_units_button.set_label(_("ST"));
837                         break;
838                 }
839         } else if (PARAM_IS ("input-auto-connect")) {
840                 map_input_auto_connect ();
841         } else if (PARAM_IS ("output-auto-connect")) {
842                 map_output_auto_connect ();
843         } else if (PARAM_IS ("native-file-header-format")) {
844                 map_file_header_format ();
845         } else if (PARAM_IS ("native-file-data-format")) {
846                 map_file_data_format ();
847         } else if (PARAM_IS ("meter-hold")) {
848                 map_meter_hold ();
849         } else if (PARAM_IS ("meter-falloff")) {
850                 map_meter_falloff ();
851         } else if (PARAM_IS ("verify-remove-last-capture")) {
852                 ActionManager::map_some_state ("options", "VerifyRemoveLastCapture", &Configuration::get_verify_remove_last_capture);
853         }
854
855 #undef PARAM_IS
856 }