turn on all buttons that be envisaged as useful in ardour (for now); add support...
[ardour.git] / libs / surfaces / push2 / buttons.cc
1 #include "ardour/session.h"
2
3 #include "push2.h"
4
5 using namespace ArdourSurface;
6
7 void
8 Push2::button_play ()
9 {
10         if (session->transport_rolling ()) {
11                 transport_stop ();
12         } else {
13                 transport_play ();
14         }
15 }
16
17 void
18 Push2::button_recenable ()
19 {
20         rec_enable_toggle ();
21 }
22
23 void
24 Push2::button_up ()
25 {
26         scroll_up_1_track ();
27 }
28
29 void
30 Push2::button_down ()
31 {
32         scroll_dn_1_track ();
33 }
34
35 void
36 Push2::button_right ()
37 {
38         ScrollTimeline (0.75);
39 }
40
41 void
42 Push2::button_left ()
43 {
44         ScrollTimeline (-0.75);
45 }
46
47 void
48 Push2::button_repeat ()
49 {
50         loop_toggle ();
51 }
52
53 void
54 Push2::button_metronome ()
55 {
56         toggle_click ();
57 }
58
59 void
60 Push2::button_solo ()
61 {
62         cancel_all_solo ();
63 }
64
65 void
66 Push2::button_new ()
67 {
68         access_action ("Editor/start-range-from-playhead");
69
70         id_button_map[New]->set_color (LED::White);
71         id_button_map[New]->set_state (LED::NoTransition);
72         write (id_button_map[New]->state_msg());
73
74         /* blink the button for the other half of this operation */
75
76         id_button_map[FixedLength]->set_color (LED::White);
77         id_button_map[FixedLength]->set_state (LED::Blinking4th);
78         write (id_button_map[FixedLength]->state_msg());
79 }
80
81
82 void
83 Push2::button_fixed_length ()
84 {
85         access_action ("Editor/finish-range-from-playhead");
86
87         /* turn off both buttons for this operation */
88
89         id_button_map[New]->set_color (LED::Black);
90         id_button_map[New]->set_state (LED::NoTransition);
91         write (id_button_map[New]->state_msg());
92         id_button_map[FixedLength]->set_color (LED::Black);
93         id_button_map[FixedLength]->set_state (LED::NoTransition);
94         write (id_button_map[FixedLength]->state_msg());
95 }