2 Copyright (C) 2006,2007 John Anderson
3 Copyright (C) 2012 Paul Davis
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.
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.
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.
24 #include "control_group.h"
26 using namespace Mackie;
29 Button::factory (Surface& surface, Button::ID bid, int id, const std::string& name, Group& group)
31 Button* b = new Button (bid, id, name, group);
32 /* store button with the device-specific ID */
33 surface.buttons[id] = b;
34 surface.controls.push_back (b);
40 Button::name_to_id (const std::string& name)
42 if (!g_strcasecmp (name.c_str(), "IO")) { return IO; }
43 if (!g_strcasecmp (name.c_str(), "Sends")) { return Sends; }
44 if (!g_strcasecmp (name.c_str(), "Pan")) { return Pan; }
45 if (!g_strcasecmp (name.c_str(), "Plugin")) { return Plugin; }
46 if (!g_strcasecmp (name.c_str(), "Eq")) { return Eq; }
47 if (!g_strcasecmp (name.c_str(), "Dyn")) { return Dyn; }
48 if (!g_strcasecmp (name.c_str(), "Left")) { return Left; }
49 if (!g_strcasecmp (name.c_str(), "Right")) { return Right; }
50 if (!g_strcasecmp (name.c_str(), "ChannelLeft")) { return ChannelLeft; }
51 if (!g_strcasecmp (name.c_str(), "ChannelRight")) { return ChannelRight; }
52 if (!g_strcasecmp (name.c_str(), "Flip")) { return Flip; }
53 if (!g_strcasecmp (name.c_str(), "Edit")) { return Edit; }
54 if (!g_strcasecmp (name.c_str(), "NameValue")) { return NameValue; }
55 if (!g_strcasecmp (name.c_str(), "TimecodeBeats")) { return TimecodeBeats; }
56 if (!g_strcasecmp (name.c_str(), "F1")) { return F1; }
57 if (!g_strcasecmp (name.c_str(), "F2")) { return F2; }
58 if (!g_strcasecmp (name.c_str(), "F3")) { return F3; }
59 if (!g_strcasecmp (name.c_str(), "F4")) { return F4; }
60 if (!g_strcasecmp (name.c_str(), "F5")) { return F5; }
61 if (!g_strcasecmp (name.c_str(), "F6")) { return F6; }
62 if (!g_strcasecmp (name.c_str(), "F7")) { return F7; }
63 if (!g_strcasecmp (name.c_str(), "F8")) { return F8; }
64 if (!g_strcasecmp (name.c_str(), "F9")) { return F9; }
65 if (!g_strcasecmp (name.c_str(), "F10")) { return F10; }
66 if (!g_strcasecmp (name.c_str(), "F11")) { return F11; }
67 if (!g_strcasecmp (name.c_str(), "F12")) { return F12; }
68 if (!g_strcasecmp (name.c_str(), "F13")) { return F13; }
69 if (!g_strcasecmp (name.c_str(), "F14")) { return F14; }
70 if (!g_strcasecmp (name.c_str(), "F15")) { return F15; }
71 if (!g_strcasecmp (name.c_str(), "F16")) { return F16; }
72 if (!g_strcasecmp (name.c_str(), "Shift")) { return Shift; }
73 if (!g_strcasecmp (name.c_str(), "Option")) { return Option; }
74 if (!g_strcasecmp (name.c_str(), "Ctrl")) { return Ctrl; }
75 if (!g_strcasecmp (name.c_str(), "CmdAlt")) { return CmdAlt; }
76 if (!g_strcasecmp (name.c_str(), "On")) { return On; }
77 if (!g_strcasecmp (name.c_str(), "RecReady")) { return RecReady; }
78 if (!g_strcasecmp (name.c_str(), "Undo")) { return Undo; }
79 if (!g_strcasecmp (name.c_str(), "Save")) { return Save; }
80 if (!g_strcasecmp (name.c_str(), "Touch")) { return Touch; }
81 if (!g_strcasecmp (name.c_str(), "Redo")) { return Redo; }
82 if (!g_strcasecmp (name.c_str(), "Marker")) { return Marker; }
83 if (!g_strcasecmp (name.c_str(), "Enter")) { return Enter; }
84 if (!g_strcasecmp (name.c_str(), "Cancel")) { return Cancel; }
85 if (!g_strcasecmp (name.c_str(), "Mixer")) { return Mixer; }
86 if (!g_strcasecmp (name.c_str(), "FrmLeft")) { return FrmLeft; }
87 if (!g_strcasecmp (name.c_str(), "FrmRight")) { return FrmRight; }
88 if (!g_strcasecmp (name.c_str(), "Loop")) { return Loop; }
89 if (!g_strcasecmp (name.c_str(), "PunchIn")) { return PunchIn; }
90 if (!g_strcasecmp (name.c_str(), "PunchOut")) { return PunchOut; }
91 if (!g_strcasecmp (name.c_str(), "Home")) { return Home; }
92 if (!g_strcasecmp (name.c_str(), "End")) { return End; }
93 if (!g_strcasecmp (name.c_str(), "Rewind")) { return Rewind; }
94 if (!g_strcasecmp (name.c_str(), "Ffwd")) { return Ffwd; }
95 if (!g_strcasecmp (name.c_str(), "Stop")) { return Stop; }
96 if (!g_strcasecmp (name.c_str(), "Play")) { return Play; }
97 if (!g_strcasecmp (name.c_str(), "Record")) { return Record; }
98 if (!g_strcasecmp (name.c_str(), "CursorUp")) { return CursorUp; }
99 if (!g_strcasecmp (name.c_str(), "CursorDown")) { return CursorDown; }
100 if (!g_strcasecmp (name.c_str(), "CursorLeft")) { return CursorLeft; }
101 if (!g_strcasecmp (name.c_str(), "CursorRight")) { return CursorRight; }
102 if (!g_strcasecmp (name.c_str(), "Zoom")) { return Zoom; }
103 if (!g_strcasecmp (name.c_str(), "Scrub")) { return Scrub; }
104 if (!g_strcasecmp (name.c_str(), "UserA")) { return UserA; }
105 if (!g_strcasecmp (name.c_str(), "UserB")) { return UserB; }
106 if (!g_strcasecmp (name.c_str(), "Snapshot")) { return Snapshot; }
107 if (!g_strcasecmp (name.c_str(), "Read")) { return Read; }
108 if (!g_strcasecmp (name.c_str(), "Write")) { return Write; }
109 if (!g_strcasecmp (name.c_str(), "FdrGroup")) { return FdrGroup; }
110 if (!g_strcasecmp (name.c_str(), "ClearSolo")) { return ClearSolo; }
111 if (!g_strcasecmp (name.c_str(), "Track")) { return Track; }
112 if (!g_strcasecmp (name.c_str(), "Send")) { return Send; }
113 if (!g_strcasecmp (name.c_str(), "MidiTracks")) { return MidiTracks; }
114 if (!g_strcasecmp (name.c_str(), "Inputs")) { return Inputs; }
115 if (!g_strcasecmp (name.c_str(), "AudioTracks")) { return AudioTracks; }
116 if (!g_strcasecmp (name.c_str(), "AudioInstruments")) { return AudioInstruments; }
117 if (!g_strcasecmp (name.c_str(), "Aux")) { return Aux; }
118 if (!g_strcasecmp (name.c_str(), "Busses")) { return Busses; }
119 if (!g_strcasecmp (name.c_str(), "Outputs")) { return Outputs; }
120 if (!g_strcasecmp (name.c_str(), "User")) { return User; }
121 if (!g_strcasecmp (name.c_str(), "Trim")) { return Trim; }
122 if (!g_strcasecmp (name.c_str(), "Latch")) { return Latch; }
123 if (!g_strcasecmp (name.c_str(), "Grp")) { return Grp; }
124 if (!g_strcasecmp (name.c_str(), "Nudge")) { return Nudge; }
125 if (!g_strcasecmp (name.c_str(), "Drop")) { return Drop; }
126 if (!g_strcasecmp (name.c_str(), "Replace")) { return Replace; }
127 if (!g_strcasecmp (name.c_str(), "Click")) { return Click; }
128 if (!g_strcasecmp (name.c_str(), "View")) { return View; }
132 if (!g_strcasecmp (name.c_str(), "RecEnable")) { return RecEnable; }
133 if (!g_strcasecmp (name.c_str(), "Solo")) { return Solo; }
134 if (!g_strcasecmp (name.c_str(), "Mute")) { return Mute; }
135 if (!g_strcasecmp (name.c_str(), "Select")) { return Select; }
136 if (!g_strcasecmp (name.c_str(), "VSelect")) { return VSelect; }
137 if (!g_strcasecmp (name.c_str(), "FaderTouch")) { return FaderTouch; }
143 Button::id_to_name (Button::ID id)
145 if (id == IO) { return "IO"; }
146 if (id == Sends) { return "Sends"; }
147 if (id == Pan) { return "Pan"; }
148 if (id == Plugin) { return "Plugin"; }
149 if (id == Eq) { return "Eq"; }
150 if (id == Dyn) { return "Dyn"; }
151 if (id == Left) { return "Bank Left"; }
152 if (id == Right) { return "Bank Right"; }
153 if (id == ChannelLeft) { return "Channel Left"; }
154 if (id == ChannelRight) { return "Channel Right"; }
155 if (id == Flip) { return "Flip"; }
156 if (id == Edit) { return "Edit"; }
157 if (id == NameValue) { return "Name/Value"; }
158 if (id == TimecodeBeats) { return "Timecode/Beats"; }
159 if (id == F1) { return "F1"; }
160 if (id == F2) { return "F2"; }
161 if (id == F3) { return "F3"; }
162 if (id == F4) { return "F4"; }
163 if (id == F5) { return "F5"; }
164 if (id == F6) { return "F6"; }
165 if (id == F7) { return "F7"; }
166 if (id == F8) { return "F8"; }
167 if (id == F9) { return "F9"; }
168 if (id == F10) { return "F10"; }
169 if (id == F11) { return "F11"; }
170 if (id == F12) { return "F12"; }
171 if (id == F13) { return "F13"; }
172 if (id == F14) { return "F14"; }
173 if (id == F15) { return "F15"; }
174 if (id == F16) { return "F16"; }
175 if (id == Shift) { return "Shift"; }
176 if (id == Option) { return "Option"; }
177 if (id == Ctrl) { return "Ctrl"; }
178 if (id == CmdAlt) { return "CmdAlt"; }
179 if (id == On) { return "On"; }
180 if (id == RecReady) { return "Record"; }
181 if (id == Undo) { return "Undo"; }
182 if (id == Save) { return "Save"; }
183 if (id == Touch) { return "Touch"; }
184 if (id == Redo) { return "Redo"; }
185 if (id == Marker) { return "Marker"; }
186 if (id == Enter) { return "Enter"; }
187 if (id == Cancel) { return "Cancel"; }
188 if (id == Mixer) { return "Mixer"; }
189 if (id == FrmLeft) { return "Frm Left"; }
190 if (id == FrmRight) { return "Frm Right"; }
191 if (id == Loop) { return "Loop"; }
192 if (id == PunchIn) { return "Punch In"; }
193 if (id == PunchOut) { return "Punch Out"; }
194 if (id == Home) { return "Home"; }
195 if (id == End) { return "End"; }
196 if (id == Rewind) { return "Rewind"; }
197 if (id == Ffwd) { return "FFwd"; }
198 if (id == Stop) { return "Stop"; }
199 if (id == Play) { return "Play"; }
200 if (id == Record) { return "Record"; }
201 if (id == CursorUp) { return "Cursor Up"; }
202 if (id == CursorDown) { return "Cursor Down"; }
203 if (id == CursorLeft) { return "Cursor Left"; }
204 if (id == CursorRight) { return "Cursor Right"; }
205 if (id == Zoom) { return "Zoom"; }
206 if (id == Scrub) { return "Scrub"; }
207 if (id == UserA) { return "User A"; }
208 if (id == UserB) { return "User B"; }
209 if (id == Snapshot) { return "Snapshot"; }
210 if (id == Read) { return "Read"; }
211 if (id == Write) { return "Write"; }
212 if (id == FdrGroup) { return "Fader Group"; }
213 if (id == ClearSolo) { return "Clear Solo"; }
214 if (id == Track) { return "Track"; }
215 if (id == Send) { return "Send"; }
216 if (id == MidiTracks) { return "Midi Tracks"; }
217 if (id == Inputs) { return "Inputs"; }
218 if (id == AudioTracks) { return "Audio Tracks"; }
219 if (id == AudioInstruments) { return "Audio Instruments"; }
220 if (id == Aux) { return "Aux"; }
221 if (id == Busses) { return "Busses"; }
222 if (id == Outputs) { return "Outputs"; }
223 if (id == User) { return "User"; }
224 if (id == Trim) { return "Trim"; }
225 if (id == Latch) { return "Latch"; }
226 if (id == Grp) { return "Group"; }
227 if (id == Nudge) { return "Nudge"; }
228 if (id == Drop) { return "Drop"; }
229 if (id == Replace) { return "Replace"; }
230 if (id == Click) { return "Click"; }
231 if (id == View) { return "View"; }
233 if (id == RecEnable) { return "Record Enable"; }
234 if (id == Solo) { return "Solo"; }
235 if (id == Mute) { return "Mute"; }
236 if (id == Select) { return "Select"; }
237 if (id == VSelect) { return "V-Pot"; }
238 if (id == FaderTouch) { return "Fader Touch"; }