fix missing negation from previous MCP commit
[ardour.git] / libs / surfaces / mackie / button.h
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 #ifndef __ardour_mackie_control_protocol_button_h__
21 #define __ardour_mackie_control_protocol_button_h__
22
23 #include "controls.h"
24 #include "led.h"
25
26 namespace Mackie {
27
28 class Surface;
29
30 class Button : public Control
31 {
32 public:
33 /* These values uniquely identify each possible button that an MCP device may
34    send. Each DeviceInfo object contains its own set of button definitions that
35    define what device ID will be sent for each button, and there is no reason
36    for them to be the same.  */
37
38         enum ID {
39                 /* Global Buttons */
40                 
41                 IO,
42                 Sends,
43                 Pan,
44                 Plugin,
45                 Eq,
46                 Dyn,
47                 Left,
48                 Right,
49                 ChannelLeft,
50                 ChannelRight,
51                 Flip,
52                 Edit,
53                 NameValue,
54                 TimecodeBeats,
55                 F1,
56                 F2,
57                 F3,
58                 F4,
59                 F5,
60                 F6,
61                 F7,
62                 F8,
63                 F9,
64                 F10,
65                 F11,
66                 F12,
67                 F13,
68                 F14,
69                 F15,
70                 F16,
71                 Shift,
72                 Option,
73                 Ctrl,
74                 CmdAlt,
75                 On,
76                 RecReady,
77                 Undo,
78                 Save,
79                 Touch,
80                 Redo,
81                 Marker,
82                 Enter,
83                 Cancel,
84                 Mixer,
85                 FrmLeft,
86                 FrmRight,
87                 Loop,
88                 PunchIn,
89                 PunchOut,
90                 Home,
91                 End,
92                 Rewind,
93                 Ffwd,
94                 Stop,
95                 Play,
96                 Record,
97                 CursorUp,
98                 CursorDown,
99                 CursorLeft,
100                 CursorRight,
101                 Zoom,
102                 Scrub,
103                 UserA,
104                 UserB,
105                 Snapshot,
106                 Read,
107                 Write,
108                 FdrGroup,
109                 ClearSolo,
110                 Track,
111                 Send,
112                 MidiTracks,
113                 Inputs,
114                 AudioTracks,
115                 AudioInstruments,
116                 Aux,
117                 Busses,
118                 Outputs,
119                 User,
120                 Trim,
121                 Latch,
122                 Grp,
123                 Nudge,
124                 Drop,
125                 Replace,
126                 Click,
127                 View,
128
129                 FinalGlobalButton,
130
131                 /* Strip buttons */
132                 
133                 RecEnable,
134                 Solo,
135                 Mute,
136                 Select,
137                 VSelect,
138                 FaderTouch,
139         };
140
141
142         Button (ID bid, int did, std::string name, Group & group)
143                 : Control (did, name, group)
144                 , _bid (bid)
145                 , _led  (did, name + "_led", group) {}
146         
147         MidiByteArray zero() { return _led.zero (); }
148         MidiByteArray set_state (LedState ls) { return _led.set_state (ls); }
149         
150         ID bid() const { return _bid; }
151         
152         static Control* factory (Surface& surface, Button::ID bid, int id, const std::string&, Group& group);
153         static int name_to_id (const std::string& name);
154         static std::string id_to_name (Button::ID);
155
156 private:
157         ID  _bid; /* device independent button ID */
158         Led _led;
159 };
160
161 }
162
163 #endif