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