mackie: strengthen 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         gui_invoke ("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         gui_invoke ("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         gui_invoke ("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         if (main_modifier_state() & MODIFIER_SHIFT) {
350                 Redo(); /* EMIT SIGNAL */
351         } else {
352                 Undo(); /* EMIT SIGNAL */
353         }
354         return off;
355 }
356
357 LedState
358 MackieControlProtocol::undo_release (Button&)
359 {
360         return off;
361 }
362
363 LedState
364 MackieControlProtocol::drop_press (Button &)
365 {
366         gui_invoke ("Editor/start-range-from-playhead");
367         update_global_button (Button::Replace, flashing);
368         return on;
369 }
370
371 LedState
372 MackieControlProtocol::drop_release (Button &)
373 {
374         return none;
375 }
376
377 LedState
378 MackieControlProtocol::save_press (Button &)
379 {
380         session->save_state ("");
381         return on;
382 }
383
384 LedState
385 MackieControlProtocol::save_release (Button &)
386 {
387         return off;
388 }
389
390 LedState
391 MackieControlProtocol::timecode_beats_press (Button &)
392 {
393         switch (_timecode_type) {
394         case ARDOUR::AnyTime::BBT:
395                 _timecode_type = ARDOUR::AnyTime::Timecode;
396                 break;
397         case ARDOUR::AnyTime::Timecode:
398                 _timecode_type = ARDOUR::AnyTime::BBT;
399                 break;
400         default:
401                 return off;
402         }
403
404         update_timecode_beats_led();
405
406         return on;
407 }
408
409 LedState
410 MackieControlProtocol::timecode_beats_release (Button &)
411 {
412         return off;
413 }
414
415 /////////////////////////////////////
416 // Functions
417 /////////////////////////////////////
418 LedState
419 MackieControlProtocol::marker_press (Button &)
420 {
421         _modifier_state |= MODIFIER_MARKER;
422         marker_modifier_consumed_by_button = false;
423         return on;
424 }
425
426 LedState
427 MackieControlProtocol::marker_release (Button &)
428 {
429         if (marker_modifier_consumed_by_button) {
430                 /* marker was used a modifier for some other button(s), so do
431                    nothing
432                 */
433                 return off;
434         }
435
436         string markername;
437
438         _modifier_state &= ~MODIFIER_MARKER;
439
440         /* Don't add another mark if one exists within 1/100th of a second of
441          * the current position and we're not rolling.
442          */
443
444         framepos_t where = session->audible_frame();
445
446         if (session->transport_stopped() && session->locations()->mark_at (where, session->frame_rate() / 100.0)) {
447                 return off;
448         }
449
450         session->locations()->next_available_name (markername,"marker");
451         add_marker (markername);
452
453         return off;
454 }
455
456 /////////////////////////////////////
457 // Transport Buttons
458 /////////////////////////////////////
459
460 LedState
461 MackieControlProtocol::stop_press (Button &)
462 {
463         transport_stop ();
464
465         if (main_modifier_state() == MODIFIER_SHIFT) {
466                 session->midi_panic();
467         }
468
469         return on;
470 }
471
472 LedState
473 MackieControlProtocol::stop_release (Button &)
474 {
475         return session->transport_stopped();
476 }
477
478 LedState
479 MackieControlProtocol::play_press (Button &)
480 {
481         /* if we're already rolling at normal speed, and we're pressed
482            again, jump back to where we started last time
483         */
484
485         transport_play (session->transport_speed() == 1.0);
486         return none;
487 }
488
489 LedState
490 MackieControlProtocol::play_release (Button &)
491 {
492         return none;
493 }
494
495 LedState
496 MackieControlProtocol::record_press (Button &)
497 {
498         rec_enable_toggle ();
499         return none;
500 }
501
502 LedState
503 MackieControlProtocol::record_release (Button &)
504 {
505         return none;
506 }
507
508 LedState
509 MackieControlProtocol::rewind_press (Button &)
510 {
511         if (modifier_state() & MODIFIER_MARKER) {
512                 prev_marker ();
513         } else if (modifier_state() & MODIFIER_NUDGE) {
514                 gui_invoke ("Editor/nudge-playhead-backward");
515         } else if (main_modifier_state() == MODIFIER_SHIFT) {
516                 goto_start ();
517         } else {
518                 rewind ();
519         }
520         return none;
521 }
522
523 LedState
524 MackieControlProtocol::rewind_release (Button &)
525 {
526         return none;
527 }
528
529 LedState
530 MackieControlProtocol::ffwd_press (Button &)
531 {
532         if (modifier_state() & MODIFIER_MARKER) {
533                 next_marker ();
534         } else if (modifier_state() & MODIFIER_NUDGE) {
535                 gui_invoke ("Editor/nudge-playhead-forward");
536         } else if (main_modifier_state() == MODIFIER_SHIFT) {
537                 goto_end();
538         } else {
539                 ffwd ();
540         }
541         return none;
542 }
543
544 LedState
545 MackieControlProtocol::ffwd_release (Button &)
546 {
547         return none;
548 }
549
550 LedState
551 MackieControlProtocol::loop_press (Button &)
552 {
553         bool was_on = session->get_play_loop();
554         session->request_play_loop (!was_on);
555         return was_on ? off : on;
556 }
557
558 LedState
559 MackieControlProtocol::loop_release (Button &)
560 {
561         return none;
562 }
563
564 LedState
565 MackieControlProtocol::clicking_press (Button &)
566 {
567         bool state = !Config->get_clicking();
568         Config->set_clicking (state);
569         return state;
570 }
571
572 LedState
573 MackieControlProtocol::clicking_release (Button &)
574 {
575         return Config->get_clicking();
576 }
577
578 LedState
579 MackieControlProtocol::enter_press (Button &)
580 {
581         Enter(); /* EMIT SIGNAL */
582         return off;
583 }
584
585 LedState
586 MackieControlProtocol::enter_release (Button &)
587 {
588         return off;
589 }
590
591 LedState
592 MackieControlProtocol::bank_release (Button& b, uint32_t basic_bank_num)
593 {
594         if (_subview_mode != None) {
595                 return none;
596         }
597
598         uint32_t bank_num = basic_bank_num;
599
600         if (b.long_press_count() > 0) {
601                 bank_num = 8 + basic_bank_num;
602         }
603
604         (void) switch_banks (n_strips() * bank_num);
605
606         return on;
607 }
608
609 LedState
610 MackieControlProtocol::F1_press (Button &b)
611 {
612         return off;
613 }
614 LedState
615 MackieControlProtocol::F1_release (Button &b)
616 {
617         return bank_release (b, 0);
618 }
619 LedState
620 MackieControlProtocol::F2_press (Button &)
621 {
622         return off;
623 }
624 LedState
625 MackieControlProtocol::F2_release (Button &b)
626 {
627         return bank_release (b, 1);
628 }
629 LedState
630 MackieControlProtocol::F3_press (Button &)
631 {
632         return off;
633 }
634 LedState
635 MackieControlProtocol::F3_release (Button &b)
636 {
637         return bank_release (b, 2);
638 }
639 LedState
640 MackieControlProtocol::F4_press (Button &)
641 {
642         return off;
643 }
644 LedState
645 MackieControlProtocol::F4_release (Button &b)
646 {
647         return bank_release (b, 3);
648 }
649 LedState
650 MackieControlProtocol::F5_press (Button &)
651 {
652         return off;
653 }
654 LedState
655 MackieControlProtocol::F5_release (Button &)
656 {
657         return off;
658 }
659 LedState
660 MackieControlProtocol::F6_press (Button &)
661 {
662         return off;
663 }
664 LedState
665 MackieControlProtocol::F6_release (Button &)
666 {
667         return off;
668 }
669 LedState
670 MackieControlProtocol::F7_press (Button &)
671 {
672         return off;
673 }
674 LedState
675 MackieControlProtocol::F7_release (Button &)
676 {
677         return off;
678 }
679 LedState
680 MackieControlProtocol::F8_press (Button &)
681 {
682         CloseDialog (); /* EMIT SIGNAL */
683         return off;
684 }
685 LedState
686 MackieControlProtocol::F8_release (Button &)
687 {
688         return off;
689 }
690
691 /* UNIMPLEMENTED */
692
693 LedState
694 MackieControlProtocol::pan_press (Button &)
695 {
696         set_pot_mode (Pan);
697         return none;
698 }
699 LedState
700 MackieControlProtocol::pan_release (Button &)
701 {
702         return none;
703 }
704 LedState
705 MackieControlProtocol::plugin_press (Button &)
706 {
707         return off;
708 }
709 LedState
710 MackieControlProtocol::plugin_release (Button &)
711 {
712         // Do not do this yet, since it does nothing
713         // set_view_mode (Plugins);
714         return none; /* LED state set by set_view_mode */
715 }
716 LedState
717 MackieControlProtocol::eq_press (Button &)
718 {
719         boost::shared_ptr<Route> r = first_selected_route ();
720         set_subview_mode (EQ, r);
721         return none; /* led state handled by set_subview_mode() */
722
723 }
724 LedState
725 MackieControlProtocol::eq_release (Button &)
726 {
727         return none;
728 }
729 LedState
730 MackieControlProtocol::dyn_press (Button &)
731 {
732         boost::shared_ptr<Route> r = first_selected_route ();
733         set_subview_mode (Dynamics, r);
734         return none; /* led state handled by set_subview_mode() */
735 }
736
737 LedState
738 MackieControlProtocol::dyn_release (Button &)
739 {
740         return none;
741 }
742 LedState
743 MackieControlProtocol::flip_press (Button &)
744 {
745         if (_flip_mode != Normal) {
746                 set_flip_mode (Normal);
747         } else {
748                 set_flip_mode (Mirror);
749         }
750         return ((_flip_mode != Normal) ? on : off);
751 }
752 LedState
753 MackieControlProtocol::flip_release (Button &)
754 {
755         return none;
756 }
757 LedState
758 MackieControlProtocol::name_value_press (Button &)
759 {
760         return off;
761 }
762 LedState
763 MackieControlProtocol::name_value_release (Button &)
764 {
765         return off;
766 }
767 LedState
768 MackieControlProtocol::touch_press (Button &)
769 {
770         return none;
771 }
772 LedState
773 MackieControlProtocol::touch_release (Button &)
774 {
775         set_automation_state (ARDOUR::Touch);
776         return none;
777 }
778 LedState
779 MackieControlProtocol::cancel_press (Button &)
780 {
781         return off;
782 }
783 LedState
784 MackieControlProtocol::cancel_release (Button &)
785 {
786         return off;
787 }
788 LedState
789 MackieControlProtocol::user_a_press (Button &)
790 {
791         transport_play (session->transport_speed() == 1.0);
792         return off;
793 }
794 LedState
795 MackieControlProtocol::user_a_release (Button &)
796 {
797         return off;
798 }
799 LedState
800 MackieControlProtocol::user_b_press (Button &)
801 {
802         transport_stop();
803         return off;
804 }
805 LedState
806 MackieControlProtocol::user_b_release (Button &)
807 {
808         return off;
809 }
810
811 LedState
812 MackieControlProtocol::master_fader_touch_press (Mackie::Button &)
813 {
814         DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::master_fader_touch_press\n");
815
816         Fader* master_fader = _master_surface->master_fader();
817
818         boost::shared_ptr<AutomationControl> ac = master_fader->control ();
819
820         master_fader->set_in_use (true);
821         master_fader->start_touch (transport_frame());
822
823         return none;
824 }
825 LedState
826 MackieControlProtocol::master_fader_touch_release (Mackie::Button &)
827 {
828         DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::master_fader_touch_release\n");
829
830         Fader* master_fader = _master_surface->master_fader();
831
832         master_fader->set_in_use (false);
833         master_fader->stop_touch (transport_frame(), true);
834
835         return none;
836 }
837
838 Mackie::LedState
839 MackieControlProtocol::read_press (Mackie::Button&)
840 {
841         return none;
842 }
843
844 Mackie::LedState
845 MackieControlProtocol::read_release (Mackie::Button&)
846 {
847         set_automation_state (ARDOUR::Play);
848         return none;
849 }
850 Mackie::LedState
851 MackieControlProtocol::write_press (Mackie::Button&)
852 {
853         return none;
854 }
855 Mackie::LedState
856 MackieControlProtocol::write_release (Mackie::Button&)
857 {
858         set_automation_state (ARDOUR::Write);
859         return none;
860 }
861
862 Mackie::LedState
863 MackieControlProtocol::clearsolo_press (Mackie::Button&)
864 {
865         // clears all solos and listens (pfl/afl)
866
867         if (session) {
868                 if (session->soloing()) {
869                         session->set_solo (session->get_routes(), false);
870                 } else if (session->listening()) {
871                         session->set_listen (session->get_routes(), false);
872                 }
873
874                 session->clear_all_solo_state (session->get_routes()); // safeguard, ideally this won't do anything, check the log-window
875         }
876         return none;
877 }
878
879 Mackie::LedState
880 MackieControlProtocol::clearsolo_release (Mackie::Button&)
881 {
882         //return session->soloing();
883         return none;
884 }
885
886 Mackie::LedState
887 MackieControlProtocol::track_press (Mackie::Button&)
888 {
889         set_pot_mode (Trim);
890         return none;
891 }
892 Mackie::LedState
893 MackieControlProtocol::track_release (Mackie::Button&)
894 {
895         return none;
896 }
897 Mackie::LedState
898 MackieControlProtocol::send_press (Mackie::Button&)
899 {
900         boost::shared_ptr<Route> r = first_selected_route ();
901         set_subview_mode (Sends, r);
902         return none; /* led state handled by set_subview_mode() */
903 }
904 Mackie::LedState
905 MackieControlProtocol::send_release (Mackie::Button&)
906 {
907         return none;
908 }
909 Mackie::LedState
910 MackieControlProtocol::miditracks_press (Mackie::Button&)
911 {
912         return none;
913 }
914 Mackie::LedState
915 MackieControlProtocol::miditracks_release (Mackie::Button&)
916 {
917         set_view_mode (MidiTracks);
918         return none;
919 }
920 Mackie::LedState
921 MackieControlProtocol::inputs_press (Mackie::Button&)
922 {
923         return none;
924 }
925 Mackie::LedState
926 MackieControlProtocol::inputs_release (Mackie::Button&)
927 {
928         return none;
929 }
930 Mackie::LedState
931 MackieControlProtocol::audiotracks_press (Mackie::Button&)
932 {
933         return none;
934 }
935 Mackie::LedState
936 MackieControlProtocol::audiotracks_release (Mackie::Button&)
937 {
938         set_view_mode (AudioTracks);
939         return none;
940 }
941 Mackie::LedState
942 MackieControlProtocol::audioinstruments_press (Mackie::Button& b)
943 {
944         return none;
945 }
946
947 Mackie::LedState
948 MackieControlProtocol::audioinstruments_release (Mackie::Button& b)
949 {
950         return none;
951
952 }
953 Mackie::LedState
954 MackieControlProtocol::aux_press (Mackie::Button&)
955 {
956         return none;
957 }
958 Mackie::LedState
959 MackieControlProtocol::aux_release (Mackie::Button&)
960 {
961         set_view_mode (Auxes);
962         return none;
963 }
964 Mackie::LedState
965 MackieControlProtocol::busses_press (Mackie::Button&)
966 {
967         return none;
968 }
969 Mackie::LedState
970 MackieControlProtocol::busses_release (Mackie::Button&)
971 {
972         set_view_mode (Busses);
973         return none;
974 }
975 Mackie::LedState
976 MackieControlProtocol::outputs_press (Mackie::Button&)
977 {
978         return none;
979 }
980 Mackie::LedState
981 MackieControlProtocol::outputs_release (Mackie::Button&)
982 {
983         set_view_mode (Hidden);
984         return none;
985 }
986 Mackie::LedState
987 MackieControlProtocol::user_press (Mackie::Button&)
988 {
989         return none;
990 }
991 Mackie::LedState
992 MackieControlProtocol::user_release (Mackie::Button&)
993 {
994         set_view_mode (Selected);
995         return none;
996 }
997 Mackie::LedState
998 MackieControlProtocol::trim_press (Mackie::Button&)
999 {
1000         return none;
1001 }
1002 Mackie::LedState
1003 MackieControlProtocol::trim_release (Mackie::Button&)
1004 {
1005         return none;
1006 }
1007 Mackie::LedState
1008 MackieControlProtocol::latch_press (Mackie::Button&)
1009 {
1010         return none;
1011 }
1012 Mackie::LedState
1013 MackieControlProtocol::latch_release (Mackie::Button&)
1014 {
1015         return none;
1016 }
1017 Mackie::LedState
1018 MackieControlProtocol::grp_press (Mackie::Button&)
1019 {
1020         return none;
1021 }
1022 Mackie::LedState
1023 MackieControlProtocol::grp_release (Mackie::Button&)
1024 {
1025         /* There is no "Off" button for automation,
1026            so we use Group for this purpose.
1027         */
1028         set_automation_state (Off);
1029         return none;
1030 }
1031 Mackie::LedState
1032 MackieControlProtocol::nudge_press (Mackie::Button&)
1033 {
1034         _modifier_state |= MODIFIER_NUDGE;
1035         nudge_modifier_consumed_by_button = false;
1036         return on;
1037 }
1038 Mackie::LedState
1039 MackieControlProtocol::nudge_release (Mackie::Button&)
1040 {
1041         _modifier_state &= ~MODIFIER_NUDGE;
1042
1043         /* XXX these action names are stupid, because the action can affect
1044          * regions, markers or the playhead depending on selection state. 
1045          */
1046
1047         if (main_modifier_state() & MODIFIER_SHIFT) {
1048                 gui_invoke ("Region/nudge-backward");
1049         } else {
1050                 gui_invoke ("Region/nudge-forward");
1051         }
1052
1053         return off;
1054 }
1055 Mackie::LedState
1056 MackieControlProtocol::replace_press (Mackie::Button&)
1057 {
1058         gui_invoke ("Editor/finish-range-from-playhead");
1059         update_global_button (Button::Drop, off);
1060         return off;
1061 }
1062 Mackie::LedState
1063 MackieControlProtocol::replace_release (Mackie::Button&)
1064 {
1065         return none;
1066 }
1067 Mackie::LedState
1068 MackieControlProtocol::click_press (Mackie::Button&)
1069 {
1070         return none;
1071 }
1072 Mackie::LedState
1073 MackieControlProtocol::click_release (Mackie::Button&)
1074 {
1075         return none;
1076 }
1077 Mackie::LedState
1078 MackieControlProtocol::view_press (Mackie::Button&)
1079 {
1080         set_view_mode (Mixer);
1081         return none;
1082 }
1083 Mackie::LedState
1084 MackieControlProtocol::view_release (Mackie::Button&)
1085 {
1086         return none;
1087 }