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