mackie: fix behaviour of clear solo button
[ardour.git] / libs / surfaces / mackie / mcp_buttons.cc
1 /*
2         Copyright (C) 2006,2007 John Anderson
3         Copyright (C) 2012 Paul Davis
4
5         This program is free software; you can redistribute it and/or modify
6         it under the terms of the GNU General Public License as published by
7         the Free Software Foundation; either version 2 of the License, or
8         (at your option) any later version.
9
10         This program is distributed in the hope that it will be useful,
11         but WITHOUT ANY WARRANTY; without even the implied warranty of
12         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13         GNU General Public License for more details.
14
15         You should have received a copy of the GNU General Public License
16         along with this program; if not, write to the Free Software
17         Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include <algorithm>
21
22 #include "pbd/memento_command.h"
23
24 #include "ardour/debug.h"
25 #include "ardour/profile.h"
26 #include "ardour/session.h"
27 #include "ardour/route.h"
28 #include "ardour/location.h"
29 #include "ardour/rc_configuration.h"
30
31 #include "mackie_control_protocol.h"
32 #include "surface.h"
33 #include "fader.h"
34
35 #include "i18n.h"
36
37 /* handlers for all buttons, broken into a separate file to avoid clutter in
38  * mackie_control_protocol.cc
39  */
40
41 using std::string;
42 using namespace ARDOUR;
43 using namespace PBD;
44 using namespace ArdourSurface;
45 using namespace Mackie;
46
47 LedState
48 MackieControlProtocol::shift_press (Button &)
49 {
50         _modifier_state |= MODIFIER_SHIFT;
51         return on;
52 }
53 LedState
54 MackieControlProtocol::shift_release (Button &)
55 {
56         _modifier_state &= ~MODIFIER_SHIFT;
57         return off;
58 }
59 LedState
60 MackieControlProtocol::option_press (Button &)
61 {
62         _modifier_state |= MODIFIER_OPTION;
63         return on;
64 }
65 LedState
66 MackieControlProtocol::option_release (Button &)
67 {
68         _modifier_state &= ~MODIFIER_OPTION;
69         return off;
70 }
71 LedState
72 MackieControlProtocol::control_press (Button &)
73 {
74         _modifier_state |= MODIFIER_CONTROL;
75         DEBUG_TRACE (DEBUG::MackieControl, string_compose ("CONTROL Press: modifier state now set to %1\n", _modifier_state));
76         return on;
77 }
78 LedState
79 MackieControlProtocol::control_release (Button &)
80 {
81         _modifier_state &= ~MODIFIER_CONTROL;
82         DEBUG_TRACE (DEBUG::MackieControl, string_compose ("CONTROL Release: modifier state now set to %1\n", _modifier_state));
83         return off;
84 }
85 LedState
86 MackieControlProtocol::cmd_alt_press (Button &)
87 {
88         _modifier_state |= MODIFIER_CMDALT;
89         return on;
90 }
91 LedState
92 MackieControlProtocol::cmd_alt_release (Button &)
93 {
94         _modifier_state &= ~MODIFIER_CMDALT;
95         return off;
96 }
97
98 LedState
99 MackieControlProtocol::left_press (Button &)
100 {
101         if (_subview_mode != None) {
102                 return none;
103         }
104
105         Sorted sorted = get_sorted_stripables();
106         uint32_t strip_cnt = n_strips ();
107
108         DEBUG_TRACE (DEBUG::MackieControl, string_compose ("bank left with current initial = %1 nstrips = %2 tracks/busses = %3\n",
109                                                            _current_initial_bank, strip_cnt, sorted.size()));
110         if (_current_initial_bank > 0) {
111                 (void) switch_banks ((_current_initial_bank - 1) / strip_cnt * strip_cnt);
112         } else {
113                 (void) switch_banks (0);
114         }
115
116
117         return on;
118 }
119
120 LedState
121 MackieControlProtocol::left_release (Button &)
122 {
123         return none;
124 }
125
126 LedState
127 MackieControlProtocol::right_press (Button &)
128 {
129         if (_subview_mode != None) {
130                 return none;
131         }
132
133         Sorted sorted = get_sorted_stripables();
134         uint32_t strip_cnt = n_strips();
135         uint32_t route_cnt = sorted.size();
136         uint32_t max_bank = route_cnt / strip_cnt * strip_cnt;
137
138
139         DEBUG_TRACE (DEBUG::MackieControl, string_compose ("bank right with current initial = %1 nstrips = %2 tracks/busses = %3\n",
140                                                            _current_initial_bank, strip_cnt, route_cnt));
141
142         if (_current_initial_bank < max_bank) {
143                 uint32_t new_initial = (_current_initial_bank / strip_cnt * strip_cnt) + strip_cnt;
144                 (void) switch_banks (new_initial);
145         }
146
147         return none;
148 }
149
150 LedState
151 MackieControlProtocol::right_release (Button &)
152 {
153         return none;
154 }
155
156 LedState
157 MackieControlProtocol::cursor_left_press (Button& )
158 {
159         if (zoom_mode()) {
160
161                 if (main_modifier_state() & MODIFIER_OPTION) {
162                         /* reset selected tracks to default vertical zoom */
163                 } else {
164                         ZoomOut (); /* EMIT SIGNAL */
165                 }
166         } else {
167                 float page_fraction;
168                 if (main_modifier_state() == MODIFIER_CONTROL) {
169                         page_fraction = 1.0;
170                 } else if (main_modifier_state() == MODIFIER_OPTION) {
171                         page_fraction = 0.1;
172                 } else if (main_modifier_state() == MODIFIER_SHIFT) {
173                         page_fraction = 2.0;
174                 } else {
175                         page_fraction = 0.25;
176                 }
177
178                 ScrollTimeline (-page_fraction);
179         }
180
181         return off;
182 }
183
184 LedState
185 MackieControlProtocol::cursor_left_release (Button&)
186 {
187         return off;
188 }
189
190 LedState
191 MackieControlProtocol::cursor_right_press (Button& )
192 {
193         if (zoom_mode()) {
194
195                 if (main_modifier_state() & MODIFIER_OPTION) {
196                         /* reset selected tracks to default vertical zoom */
197                 } else {
198                         ZoomIn (); /* EMIT SIGNAL */
199                 }
200         } else {
201                 float page_fraction;
202                 if (main_modifier_state() == MODIFIER_CONTROL) {
203                         page_fraction = 1.0;
204                 } else if (main_modifier_state() == MODIFIER_OPTION) {
205                         page_fraction = 0.1;
206                 } else if (main_modifier_state() == MODIFIER_SHIFT) {
207                         page_fraction = 2.0;
208                 } else {
209                         page_fraction = 0.25;
210                 }
211
212                 ScrollTimeline (page_fraction);
213         }
214
215         return off;
216 }
217
218 LedState
219 MackieControlProtocol::cursor_right_release (Button&)
220 {
221         return off;
222 }
223
224 LedState
225 MackieControlProtocol::cursor_up_press (Button&)
226 {
227         if (zoom_mode()) {
228
229                 if (main_modifier_state() & MODIFIER_CONTROL) {
230                         VerticalZoomInSelected (); /* EMIT SIGNAL */
231                 } else {
232                         VerticalZoomInAll (); /* EMIT SIGNAL */
233                 }
234         } else {
235                 access_action ("Editor/select-prev-route");
236         }
237         return off;
238 }
239
240 LedState
241 MackieControlProtocol::cursor_up_release (Button&)
242 {
243         return off;
244 }
245
246 LedState
247 MackieControlProtocol::cursor_down_press (Button&)
248 {
249         if (zoom_mode()) {
250                 if (main_modifier_state() & MODIFIER_OPTION) {
251                         VerticalZoomOutSelected (); /* EMIT SIGNAL */
252                 } else {
253                         VerticalZoomOutAll (); /* EMIT SIGNAL */
254                 }
255         } else {
256                 access_action ("Editor/select-next-route");
257         }
258         return off;
259 }
260
261 LedState
262 MackieControlProtocol::cursor_down_release (Button&)
263 {
264         return off;
265 }
266
267 LedState
268 MackieControlProtocol::channel_left_press (Button &)
269 {
270         if (_subview_mode != None) {
271                 return none;
272         }
273         Sorted sorted = get_sorted_stripables();
274         if (sorted.size() > n_strips()) {
275                 prev_track();
276                 return on;
277         } else {
278                 return flashing;
279         }
280 }
281
282 LedState
283 MackieControlProtocol::channel_left_release (Button &)
284 {
285         return off;
286 }
287
288 LedState
289 MackieControlProtocol::channel_right_press (Button &)
290 {
291         if (_subview_mode != None) {
292                 return none;
293         }
294         Sorted sorted = get_sorted_stripables();
295         if (sorted.size() > n_strips()) {
296                 next_track();
297                 return on;
298         } else {
299                 return flashing;
300         }
301 }
302
303 LedState
304 MackieControlProtocol::channel_right_release (Button &)
305 {
306         return off;
307 }
308
309 Mackie::LedState
310 MackieControlProtocol::zoom_press (Mackie::Button &)
311 {
312         return none;
313 }
314
315 Mackie::LedState
316 MackieControlProtocol::zoom_release (Mackie::Button &)
317 {
318         if (_modifier_state & MODIFIER_ZOOM) {
319                 _modifier_state &= ~MODIFIER_ZOOM;
320         } else {
321                 _modifier_state |= MODIFIER_ZOOM;
322         }
323
324         return (zoom_mode() ? on : off);
325 }
326
327 Mackie::LedState
328 MackieControlProtocol::scrub_press (Mackie::Button &)
329 {
330         if (!surfaces.empty()) {
331                 // surfaces.front()->next_jog_mode ();
332                 _master_surface->next_jog_mode ();
333         }
334         return none;
335 }
336
337 Mackie::LedState
338 MackieControlProtocol::scrub_release (Mackie::Button &)
339 {
340         return none;
341 }
342
343 LedState
344 MackieControlProtocol::undo_press (Button&)
345 {
346         if (main_modifier_state() == MODIFIER_SHIFT) {
347                 redo();
348         } else {
349                 undo ();
350         }
351         return none;
352 }
353
354 LedState
355 MackieControlProtocol::undo_release (Button&)
356 {
357         return none;
358 }
359
360 LedState
361 MackieControlProtocol::drop_press (Button &)
362 {
363         if (main_modifier_state() == MODIFIER_SHIFT) {
364                 toggle_punch_in();
365                 return none;
366         } else {
367                 access_action ("Editor/start-range-from-playhead");
368         }
369         return none;
370 }
371
372 LedState
373 MackieControlProtocol::drop_release (Button &)
374 {
375         return none;
376 }
377
378 LedState
379 MackieControlProtocol::save_press (Button &)
380 {
381         if (main_modifier_state() == MODIFIER_SHIFT) {
382                 quick_snapshot_switch();
383         } else {
384                 save_state ();
385         }
386
387         return none;
388 }
389
390 LedState
391 MackieControlProtocol::save_release (Button &)
392 {
393         return none;
394 }
395
396 LedState
397 MackieControlProtocol::timecode_beats_press (Button &)
398 {
399         switch (_timecode_type) {
400         case ARDOUR::AnyTime::BBT:
401                 _timecode_type = ARDOUR::AnyTime::Timecode;
402                 break;
403         case ARDOUR::AnyTime::Timecode:
404                 _timecode_type = ARDOUR::AnyTime::BBT;
405                 break;
406         default:
407                 return off;
408         }
409
410         update_timecode_beats_led();
411
412         return on;
413 }
414
415 LedState
416 MackieControlProtocol::timecode_beats_release (Button &)
417 {
418         return off;
419 }
420
421 /////////////////////////////////////
422 // Functions
423 /////////////////////////////////////
424 LedState
425 MackieControlProtocol::marker_press (Button &)
426 {
427         if (main_modifier_state() & MODIFIER_SHIFT) {
428                 access_action ("Editor/remove-location-from-playhead");
429                 return off;
430         } else {
431                 _modifier_state |= MODIFIER_MARKER;
432                 marker_modifier_consumed_by_button = false;
433                 return on;
434         }
435 }
436
437 LedState
438 MackieControlProtocol::marker_release (Button &)
439 {
440         _modifier_state &= ~MODIFIER_MARKER;
441
442         if (main_modifier_state() & MODIFIER_SHIFT)
443                 return off;   //if shift was held, we already did the action
444
445         if (marker_modifier_consumed_by_button) {
446                 /* marker was used a modifier for some other button(s), so do
447                    nothing
448                 */
449                 return off;
450         }
451
452         string markername;
453
454         /* Don't add another mark if one exists within 1/100th of a second of
455          * the current position and we're not rolling.
456          */
457
458         framepos_t where = session->audible_frame();
459
460         if (session->transport_stopped() && session->locations()->mark_at (where, session->frame_rate() / 100.0)) {
461                 return off;
462         }
463
464         session->locations()->next_available_name (markername,"marker");
465         add_marker (markername);
466
467         return off;
468 }
469
470 /////////////////////////////////////
471 // Transport Buttons
472 /////////////////////////////////////
473
474 LedState
475 MackieControlProtocol::stop_press (Button &)
476 {
477         transport_stop ();
478
479         if (main_modifier_state() == MODIFIER_SHIFT) {
480                 session->midi_panic();
481         }
482
483         return on;
484 }
485
486 LedState
487 MackieControlProtocol::stop_release (Button &)
488 {
489         return session->transport_stopped();
490 }
491
492 LedState
493 MackieControlProtocol::play_press (Button &)
494 {
495         /* if we're already rolling at normal speed, and we're pressed
496            again, jump back to where we started last time
497         */
498
499         transport_play (session->transport_speed() == 1.0);
500         return none;
501 }
502
503 LedState
504 MackieControlProtocol::play_release (Button &)
505 {
506         return none;
507 }
508
509 LedState
510 MackieControlProtocol::record_press (Button &)
511 {
512         rec_enable_toggle ();
513         return none;
514 }
515
516 LedState
517 MackieControlProtocol::record_release (Button &)
518 {
519         return none;
520 }
521
522 LedState
523 MackieControlProtocol::rewind_press (Button &)
524 {
525         if (modifier_state() & MODIFIER_MARKER) {
526                 prev_marker ();
527         } else if (modifier_state() & MODIFIER_NUDGE) {
528                 access_action ("Editor/nudge-playhead-backward");
529         } else if (main_modifier_state() & MODIFIER_SHIFT) {
530                 goto_start ();
531         } else {
532                 rewind ();
533         }
534         return none;
535 }
536
537 LedState
538 MackieControlProtocol::rewind_release (Button &)
539 {
540         return none;
541 }
542
543 LedState
544 MackieControlProtocol::ffwd_press (Button &)
545 {
546         if (modifier_state() & MODIFIER_MARKER) {
547                 next_marker ();
548         } else if (modifier_state() & MODIFIER_NUDGE) {
549                 access_action ("Editor/nudge-playhead-forward");
550         } else if (main_modifier_state() & MODIFIER_SHIFT) {
551                 goto_end();
552         } else {
553                 ffwd ();
554         }
555         return none;
556 }
557
558 LedState
559 MackieControlProtocol::ffwd_release (Button &)
560 {
561         return none;
562 }
563
564 LedState
565 MackieControlProtocol::loop_press (Button &)
566 {
567         if (main_modifier_state() & MODIFIER_SHIFT) {
568                 access_action ("Editor/set-loop-from-edit-range");
569                 return off;
570         } else {
571                 bool was_on = session->get_play_loop();
572                 session->request_play_loop (!was_on);
573                 return was_on ? off : on;
574         }
575 }
576
577 LedState
578 MackieControlProtocol::loop_release (Button &)
579 {
580         return none;
581 }
582
583 LedState
584 MackieControlProtocol::enter_press (Button &)
585 {
586         if (main_modifier_state() & MODIFIER_SHIFT) {
587                 access_action ("Transport/ToggleFollowEdits");
588         } else {
589                 access_action ("Editor/select-all-tracks");
590         }
591         return none;
592 }
593
594 LedState
595 MackieControlProtocol::enter_release (Button &)
596 {
597         return none;
598 }
599
600 LedState
601 MackieControlProtocol::bank_release (Button& b, uint32_t basic_bank_num)
602 {
603         if (_subview_mode != None) {
604                 return none;
605         }
606
607         uint32_t bank_num = basic_bank_num;
608
609         if (b.long_press_count() > 0) {
610                 bank_num = 8 + basic_bank_num;
611         }
612
613         (void) switch_banks (n_strips() * bank_num);
614
615         return on;
616 }
617
618 LedState
619 MackieControlProtocol::F1_press (Button &b)
620 {
621         return off;
622 }
623 LedState
624 MackieControlProtocol::F1_release (Button &b)
625 {
626         return bank_release (b, 0);
627 }
628 LedState
629 MackieControlProtocol::F2_press (Button &)
630 {
631         return off;
632 }
633 LedState
634 MackieControlProtocol::F2_release (Button &b)
635 {
636         return bank_release (b, 1);
637 }
638 LedState
639 MackieControlProtocol::F3_press (Button &)
640 {
641         return off;
642 }
643 LedState
644 MackieControlProtocol::F3_release (Button &b)
645 {
646         return bank_release (b, 2);
647 }
648 LedState
649 MackieControlProtocol::F4_press (Button &)
650 {
651         return off;
652 }
653 LedState
654 MackieControlProtocol::F4_release (Button &b)
655 {
656         return bank_release (b, 3);
657 }
658 LedState
659 MackieControlProtocol::F5_press (Button &)
660 {
661         return off;
662 }
663 LedState
664 MackieControlProtocol::F5_release (Button &)
665 {
666         return off;
667 }
668 LedState
669 MackieControlProtocol::F6_press (Button &)
670 {
671         return off;
672 }
673 LedState
674 MackieControlProtocol::F6_release (Button &)
675 {
676         return off;
677 }
678 LedState
679 MackieControlProtocol::F7_press (Button &)
680 {
681         return off;
682 }
683 LedState
684 MackieControlProtocol::F7_release (Button &)
685 {
686         return off;
687 }
688 LedState
689 MackieControlProtocol::F8_press (Button &)
690 {
691         CloseDialog (); /* EMIT SIGNAL */
692         return off;
693 }
694 LedState
695 MackieControlProtocol::F8_release (Button &)
696 {
697         return off;
698 }
699
700 /* UNIMPLEMENTED */
701
702 LedState
703 MackieControlProtocol::pan_press (Button &)
704 {
705         /* XXX eventually pan may have its own subview mode */
706         set_subview_mode (MackieControlProtocol::None, boost::shared_ptr<Stripable>());
707         return none;
708 }
709 LedState
710 MackieControlProtocol::pan_release (Button &)
711 {
712         return none;
713 }
714 LedState
715 MackieControlProtocol::plugin_press (Button &)
716 {
717         return off;
718 }
719 LedState
720 MackieControlProtocol::plugin_release (Button &)
721 {
722         // Do not do this yet, since it does nothing
723         // set_view_mode (Plugins);
724         return none; /* LED state set by set_view_mode */
725 }
726 LedState
727 MackieControlProtocol::eq_press (Button &)
728 {
729         set_subview_mode (EQ, first_selected_stripable ());
730         return none; /* led state handled by set_subview_mode() */
731
732 }
733 LedState
734 MackieControlProtocol::eq_release (Button &)
735 {
736         return none;
737 }
738 LedState
739 MackieControlProtocol::dyn_press (Button &)
740 {
741         set_subview_mode (Dynamics, first_selected_stripable ());
742         return none; /* led state handled by set_subview_mode() */
743 }
744
745 LedState
746 MackieControlProtocol::dyn_release (Button &)
747 {
748         return none;
749 }
750 LedState
751 MackieControlProtocol::flip_press (Button &)
752 {
753         if (subview_mode() == MackieControlProtocol::Sends) {
754                 if (_flip_mode != Normal) {
755                         set_flip_mode (Normal);
756                 } else {
757                         set_flip_mode (Mirror);
758                 }
759                 return ((_flip_mode != Normal) ? on : off);
760         }
761
762         return none;
763 }
764
765 LedState
766 MackieControlProtocol::flip_release (Button &)
767 {
768         return none;
769 }
770 LedState
771 MackieControlProtocol::name_value_press (Button &)
772 {
773         return off;
774 }
775 LedState
776 MackieControlProtocol::name_value_release (Button &)
777 {
778         return off;
779 }
780 LedState
781 MackieControlProtocol::touch_press (Button &)
782 {
783         return none;
784 }
785 LedState
786 MackieControlProtocol::touch_release (Button &)
787 {
788         set_automation_state (ARDOUR::Touch);
789         return none;
790 }
791 LedState
792 MackieControlProtocol::cancel_press (Button &)
793 {
794         if (main_modifier_state() & MODIFIER_SHIFT) {
795                 access_action ("Transport/ToggleExternalSync");
796         } else {
797                 access_action ("Main/Escape");
798         }
799         return none;
800 }
801 LedState
802 MackieControlProtocol::cancel_release (Button &)
803 {
804         return none;
805 }
806 LedState
807 MackieControlProtocol::user_a_press (Button &)
808 {
809         transport_play (session->transport_speed() == 1.0);
810         return off;
811 }
812 LedState
813 MackieControlProtocol::user_a_release (Button &)
814 {
815         return off;
816 }
817 LedState
818 MackieControlProtocol::user_b_press (Button &)
819 {
820         transport_stop();
821         return off;
822 }
823 LedState
824 MackieControlProtocol::user_b_release (Button &)
825 {
826         return off;
827 }
828
829 LedState
830 MackieControlProtocol::master_fader_touch_press (Mackie::Button &)
831 {
832         DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::master_fader_touch_press\n");
833
834         Fader* master_fader = _master_surface->master_fader();
835
836         boost::shared_ptr<AutomationControl> ac = master_fader->control ();
837
838         master_fader->set_in_use (true);
839         master_fader->start_touch (transport_frame());
840
841         return none;
842 }
843 LedState
844 MackieControlProtocol::master_fader_touch_release (Mackie::Button &)
845 {
846         DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::master_fader_touch_release\n");
847
848         Fader* master_fader = _master_surface->master_fader();
849
850         master_fader->set_in_use (false);
851         master_fader->stop_touch (transport_frame(), true);
852
853         return none;
854 }
855
856 Mackie::LedState
857 MackieControlProtocol::read_press (Mackie::Button&)
858 {
859         return none;
860 }
861
862 Mackie::LedState
863 MackieControlProtocol::read_release (Mackie::Button&)
864 {
865         set_automation_state (ARDOUR::Play);
866         return none;
867 }
868 Mackie::LedState
869 MackieControlProtocol::write_press (Mackie::Button&)
870 {
871         return none;
872 }
873 Mackie::LedState
874 MackieControlProtocol::write_release (Mackie::Button&)
875 {
876         set_automation_state (ARDOUR::Write);
877         return none;
878 }
879
880 Mackie::LedState
881 MackieControlProtocol::clearsolo_press (Mackie::Button&)
882 {
883         // clears all solos and listens (pfl/afl)
884
885         if (main_modifier_state() & MODIFIER_SHIFT) {
886                 access_action ("Editor/set-session-from-edit-range");
887                 return none;
888         }
889
890         if (session) {
891                 session->set_controls (route_list_to_control_list (session->get_routes(), &Stripable::solo_control), 0.0, Controllable::NoGroup);
892                 session->clear_all_solo_state (session->get_routes()); 
893         }
894         return none;
895 }
896
897 Mackie::LedState
898 MackieControlProtocol::clearsolo_release (Mackie::Button&)
899 {
900         //return session->soloing();
901         return none;
902 }
903
904 Mackie::LedState
905 MackieControlProtocol::track_press (Mackie::Button&)
906 {
907         set_subview_mode (TrackView, first_selected_stripable());
908         return none;
909 }
910 Mackie::LedState
911 MackieControlProtocol::track_release (Mackie::Button&)
912 {
913         return none;
914 }
915 Mackie::LedState
916 MackieControlProtocol::send_press (Mackie::Button&)
917 {
918         set_subview_mode (Sends, first_selected_stripable());
919         return none; /* led state handled by set_subview_mode() */
920 }
921 Mackie::LedState
922 MackieControlProtocol::send_release (Mackie::Button&)
923 {
924         return none;
925 }
926 Mackie::LedState
927 MackieControlProtocol::miditracks_press (Mackie::Button&)
928 {
929         return none;
930 }
931 Mackie::LedState
932 MackieControlProtocol::miditracks_release (Mackie::Button&)
933 {
934         set_view_mode (MidiTracks);
935         return none;
936 }
937 Mackie::LedState
938 MackieControlProtocol::inputs_press (Mackie::Button&)
939 {
940         return none;
941 }
942 Mackie::LedState
943 MackieControlProtocol::inputs_release (Mackie::Button&)
944 {
945         return none;
946 }
947 Mackie::LedState
948 MackieControlProtocol::audiotracks_press (Mackie::Button&)
949 {
950         return none;
951 }
952 Mackie::LedState
953 MackieControlProtocol::audiotracks_release (Mackie::Button&)
954 {
955         set_view_mode (AudioTracks);
956         return none;
957 }
958 Mackie::LedState
959 MackieControlProtocol::audioinstruments_press (Mackie::Button& b)
960 {
961         return none;
962 }
963
964 Mackie::LedState
965 MackieControlProtocol::audioinstruments_release (Mackie::Button& b)
966 {
967         return none;
968
969 }
970 Mackie::LedState
971 MackieControlProtocol::aux_press (Mackie::Button&)
972 {
973         return none;
974 }
975 Mackie::LedState
976 MackieControlProtocol::aux_release (Mackie::Button&)
977 {
978         set_view_mode (Auxes);
979         return none;
980 }
981 Mackie::LedState
982 MackieControlProtocol::busses_press (Mackie::Button&)
983 {
984         return none;
985 }
986 Mackie::LedState
987 MackieControlProtocol::busses_release (Mackie::Button&)
988 {
989         set_view_mode (Busses);
990         return none;
991 }
992 Mackie::LedState
993 MackieControlProtocol::outputs_press (Mackie::Button&)
994 {
995         return none;
996 }
997 Mackie::LedState
998 MackieControlProtocol::outputs_release (Mackie::Button&)
999 {
1000         set_view_mode (Hidden);
1001         return none;
1002 }
1003 Mackie::LedState
1004 MackieControlProtocol::user_press (Mackie::Button&)
1005 {
1006         return none;
1007 }
1008 Mackie::LedState
1009 MackieControlProtocol::user_release (Mackie::Button&)
1010 {
1011         set_view_mode (Selected);
1012         return none;
1013 }
1014 Mackie::LedState
1015 MackieControlProtocol::trim_press (Mackie::Button&)
1016 {
1017         return none;
1018 }
1019 Mackie::LedState
1020 MackieControlProtocol::trim_release (Mackie::Button&)
1021 {
1022         return none;
1023 }
1024 Mackie::LedState
1025 MackieControlProtocol::latch_press (Mackie::Button&)
1026 {
1027         return none;
1028 }
1029 Mackie::LedState
1030 MackieControlProtocol::latch_release (Mackie::Button&)
1031 {
1032         return none;
1033 }
1034 Mackie::LedState
1035 MackieControlProtocol::grp_press (Mackie::Button&)
1036 {
1037         return none;
1038 }
1039 Mackie::LedState
1040 MackieControlProtocol::grp_release (Mackie::Button&)
1041 {
1042         /* There is no "Off" button for automation,
1043            so we use Group for this purpose.
1044         */
1045         set_automation_state (Off);
1046         return none;
1047 }
1048 Mackie::LedState
1049 MackieControlProtocol::nudge_press (Mackie::Button&)
1050 {
1051         _modifier_state |= MODIFIER_NUDGE;
1052         nudge_modifier_consumed_by_button = false;
1053         return on;
1054 }
1055 Mackie::LedState
1056 MackieControlProtocol::nudge_release (Mackie::Button&)
1057 {
1058         _modifier_state &= ~MODIFIER_NUDGE;
1059
1060         /* XXX these action names are stupid, because the action can affect
1061          * regions, markers or the playhead depending on selection state.
1062          */
1063
1064         if (main_modifier_state() & MODIFIER_SHIFT) {
1065                 access_action ("Region/nudge-backward");
1066         } else {
1067                 access_action ("Region/nudge-forward");
1068         }
1069
1070         return off;
1071 }
1072 Mackie::LedState
1073 MackieControlProtocol::replace_press (Mackie::Button&)
1074 {
1075         if (main_modifier_state() == MODIFIER_SHIFT) {
1076                 toggle_punch_out();
1077                 return none;
1078         } else {
1079                 access_action ("Editor/finish-range-from-playhead");
1080         }
1081         return none;
1082 }
1083 Mackie::LedState
1084 MackieControlProtocol::replace_release (Mackie::Button&)
1085 {
1086         return none;
1087 }
1088 Mackie::LedState
1089 MackieControlProtocol::click_press (Mackie::Button&)
1090 {
1091         if (main_modifier_state() & MODIFIER_SHIFT) {
1092                 access_action ("Editor/set-punch-from-edit-range");
1093                 return off;
1094         } else {
1095                 bool state = !Config->get_clicking();
1096                 Config->set_clicking (state);
1097                 return state;
1098         }
1099 }
1100 Mackie::LedState
1101 MackieControlProtocol::click_release (Mackie::Button&)
1102 {
1103         return none;
1104 }
1105 Mackie::LedState
1106 MackieControlProtocol::view_press (Mackie::Button&)
1107 {
1108         set_view_mode (Mixer);
1109         return none;
1110 }
1111 Mackie::LedState
1112 MackieControlProtocol::view_release (Mackie::Button&)
1113 {
1114         return none;
1115 }