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 ArdourSurface;
27 using namespace Mackie;
30 Button::factory (Surface& surface, Button::ID bid, int id, const std::string& name, Group& group)
32 Button* b = new Button (bid, id, name, group);
33 /* store button with the device-specific ID */
34 surface.buttons[id] = b;
35 surface.controls.push_back (b);
41 Button::name_to_id (const std::string& name)
43 if (!g_ascii_strcasecmp (name.c_str(), "Track")) { return Track; }
44 if (!g_ascii_strcasecmp (name.c_str(), "Send")) { return Send; }
45 if (!g_ascii_strcasecmp (name.c_str(), "Pan")) { return Pan; }
46 if (!g_ascii_strcasecmp (name.c_str(), "Plugin")) { return Plugin; }
47 if (!g_ascii_strcasecmp (name.c_str(), "Eq")) { return Eq; }
48 if (!g_ascii_strcasecmp (name.c_str(), "Dyn")) { return Dyn; }
49 if (!g_ascii_strcasecmp (name.c_str(), "Bank Left")) { return Left; }
50 if (!g_ascii_strcasecmp (name.c_str(), "Bank Right")) { return Right; }
51 if (!g_ascii_strcasecmp (name.c_str(), "Channel Left")) { return ChannelLeft; }
52 if (!g_ascii_strcasecmp (name.c_str(), "Channel Right")) { return ChannelRight; }
53 if (!g_ascii_strcasecmp (name.c_str(), "Flip")) { return Flip; }
54 if (!g_ascii_strcasecmp (name.c_str(), "View")) { return View; }
55 if (!g_ascii_strcasecmp (name.c_str(), "Name/Value")) { return NameValue; }
56 if (!g_ascii_strcasecmp (name.c_str(), "Timecode/Beats")) { return TimecodeBeats; }
57 if (!g_ascii_strcasecmp (name.c_str(), "F1")) { return F1; }
58 if (!g_ascii_strcasecmp (name.c_str(), "F2")) { return F2; }
59 if (!g_ascii_strcasecmp (name.c_str(), "F3")) { return F3; }
60 if (!g_ascii_strcasecmp (name.c_str(), "F4")) { return F4; }
61 if (!g_ascii_strcasecmp (name.c_str(), "F5")) { return F5; }
62 if (!g_ascii_strcasecmp (name.c_str(), "F6")) { return F6; }
63 if (!g_ascii_strcasecmp (name.c_str(), "F7")) { return F7; }
64 if (!g_ascii_strcasecmp (name.c_str(), "F8")) { return F8; }
65 if (!g_ascii_strcasecmp (name.c_str(), "Midi Tracks")) { return MidiTracks; }
66 if (!g_ascii_strcasecmp (name.c_str(), "Inputs")) { return Inputs; }
67 if (!g_ascii_strcasecmp (name.c_str(), "Audio Tracks")) { return AudioTracks; }
68 if (!g_ascii_strcasecmp (name.c_str(), "Audio Instruments")) { return AudioInstruments; }
69 if (!g_ascii_strcasecmp (name.c_str(), "Aux")) { return Aux; }
70 if (!g_ascii_strcasecmp (name.c_str(), "Busses")) { return Busses; }
71 if (!g_ascii_strcasecmp (name.c_str(), "Outputs")) { return Outputs; }
72 if (!g_ascii_strcasecmp (name.c_str(), "User")) { return User; }
73 if (!g_ascii_strcasecmp (name.c_str(), "Shift")) { return Shift; }
74 if (!g_ascii_strcasecmp (name.c_str(), "Option")) { return Option; }
75 if (!g_ascii_strcasecmp (name.c_str(), "Ctrl")) { return Ctrl; }
76 if (!g_ascii_strcasecmp (name.c_str(), "CmdAlt")) { return CmdAlt; }
77 if (!g_ascii_strcasecmp (name.c_str(), "Read")) { return Read; }
78 if (!g_ascii_strcasecmp (name.c_str(), "Write")) { return Write; }
79 if (!g_ascii_strcasecmp (name.c_str(), "Trim")) { return Trim; }
80 if (!g_ascii_strcasecmp (name.c_str(), "Touch")) { return Touch; }
81 if (!g_ascii_strcasecmp (name.c_str(), "Latch")) { return Latch; }
82 if (!g_ascii_strcasecmp (name.c_str(), "Group")) { return Grp; }
83 if (!g_ascii_strcasecmp (name.c_str(), "Save")) { return Save; }
84 if (!g_ascii_strcasecmp (name.c_str(), "Undo")) { return Undo; }
85 if (!g_ascii_strcasecmp (name.c_str(), "Cancel")) { return Cancel; }
86 if (!g_ascii_strcasecmp (name.c_str(), "Enter")) { return Enter; }
87 if (!g_ascii_strcasecmp (name.c_str(), "Marker")) { return Marker; }
88 if (!g_ascii_strcasecmp (name.c_str(), "Nudge")) { return Nudge; }
89 if (!g_ascii_strcasecmp (name.c_str(), "Loop")) { return Loop; }
90 if (!g_ascii_strcasecmp (name.c_str(), "Drop")) { return Drop; }
91 if (!g_ascii_strcasecmp (name.c_str(), "Replace")) { return Replace; }
92 if (!g_ascii_strcasecmp (name.c_str(), "Click")) { return Click; }
93 if (!g_ascii_strcasecmp (name.c_str(), "Clear Solo")) { return ClearSolo; }
94 if (!g_ascii_strcasecmp (name.c_str(), "Rewind")) { return Rewind; }
95 if (!g_ascii_strcasecmp (name.c_str(), "Ffwd")) { return Ffwd; }
96 if (!g_ascii_strcasecmp (name.c_str(), "Stop")) { return Stop; }
97 if (!g_ascii_strcasecmp (name.c_str(), "Play")) { return Play; }
98 if (!g_ascii_strcasecmp (name.c_str(), "Record")) { return Record; }
99 if (!g_ascii_strcasecmp (name.c_str(), "Cursor Up")) { return CursorUp; }
100 if (!g_ascii_strcasecmp (name.c_str(), "Cursor Down")) { return CursorDown; }
101 if (!g_ascii_strcasecmp (name.c_str(), "Cursor Left")) { return CursorLeft; }
102 if (!g_ascii_strcasecmp (name.c_str(), "Cursor Right")) { return CursorRight; }
103 if (!g_ascii_strcasecmp (name.c_str(), "Zoom")) { return Zoom; }
104 if (!g_ascii_strcasecmp (name.c_str(), "Scrub")) { return Scrub; }
105 if (!g_ascii_strcasecmp (name.c_str(), "User A")) { return UserA; }
106 if (!g_ascii_strcasecmp (name.c_str(), "User B")) { return UserB; }
110 if (!g_ascii_strcasecmp (name.c_str(), "Record Enable")) { return RecEnable; }
111 if (!g_ascii_strcasecmp (name.c_str(), "Solo")) { return Solo; }
112 if (!g_ascii_strcasecmp (name.c_str(), "Mute")) { return Mute; }
113 if (!g_ascii_strcasecmp (name.c_str(), "Select")) { return Select; }
114 if (!g_ascii_strcasecmp (name.c_str(), "V-Pot")) { return VSelect; }
115 if (!g_ascii_strcasecmp (name.c_str(), "Fader Touch")) { return FaderTouch; }
117 /* Master Fader button */
119 if (!g_ascii_strcasecmp (name.c_str(), "Master Fader Touch")) { return MasterFaderTouch; }
125 Button::id_to_name (Button::ID id)
127 if (id == Track) { return "Track"; }
128 if (id == Send) { return "Send"; }
129 if (id == Pan) { return "Pan"; }
130 if (id == Plugin) { return "Plugin"; }
131 if (id == Eq) { return "Eq"; }
132 if (id == Dyn) { return "Dyn"; }
133 if (id == Left) { return "Bank Left"; }
134 if (id == Right) { return "Bank Right"; }
135 if (id == ChannelLeft) { return "Channel Left"; }
136 if (id == ChannelRight) { return "Channel Right"; }
137 if (id == Flip) { return "Flip"; }
138 if (id == View) { return "View"; }
139 if (id == NameValue) { return "Name/Value"; }
140 if (id == TimecodeBeats) { return "Timecode/Beats"; }
141 if (id == F1) { return "F1"; }
142 if (id == F2) { return "F2"; }
143 if (id == F3) { return "F3"; }
144 if (id == F4) { return "F4"; }
145 if (id == F5) { return "F5"; }
146 if (id == F6) { return "F6"; }
147 if (id == F7) { return "F7"; }
148 if (id == F8) { return "F8"; }
149 if (id == MidiTracks) { return "Midi Tracks"; }
150 if (id == Inputs) { return "Inputs"; }
151 if (id == AudioTracks) { return "Audio Tracks"; }
152 if (id == AudioInstruments) { return "Audio Instruments"; }
153 if (id == Aux) { return "Aux"; }
154 if (id == Busses) { return "Busses"; }
155 if (id == Outputs) { return "Outputs"; }
156 if (id == User) { return "User"; }
157 if (id == Shift) { return "Shift"; }
158 if (id == Option) { return "Option"; }
159 if (id == Ctrl) { return "Ctrl"; }
160 if (id == CmdAlt) { return "CmdAlt"; }
161 if (id == Read) { return "Read"; }
162 if (id == Write) { return "Write"; }
163 if (id == Trim) { return "Trim"; }
164 if (id == Touch) { return "Touch"; }
165 if (id == Latch) { return "Latch"; }
166 if (id == Grp) { return "Group"; }
167 if (id == Save) { return "Save"; }
168 if (id == Undo) { return "Undo"; }
169 if (id == Cancel) { return "Cancel"; }
170 if (id == Enter) { return "Enter"; }
171 if (id == Marker) { return "Marker"; }
172 if (id == Nudge) { return "Nudge"; }
173 if (id == Loop) { return "Loop"; }
174 if (id == Drop) { return "Drop"; }
175 if (id == Replace) { return "Replace"; }
176 if (id == Click) { return "Click"; }
177 if (id == ClearSolo) { return "Clear Solo"; }
178 if (id == Rewind) { return "Rewind"; }
179 if (id == Ffwd) { return "FFwd"; }
180 if (id == Stop) { return "Stop"; }
181 if (id == Play) { return "Play"; }
182 if (id == Record) { return "Record"; }
183 if (id == CursorUp) { return "Cursor Up"; }
184 if (id == CursorDown) { return "Cursor Down"; }
185 if (id == CursorLeft) { return "Cursor Left"; }
186 if (id == CursorRight) { return "Cursor Right"; }
187 if (id == Zoom) { return "Zoom"; }
188 if (id == Scrub) { return "Scrub"; }
189 if (id == UserA) { return "User A"; }
190 if (id == UserB) { return "User B"; }
192 if (id == RecEnable) { return "Record Enable"; }
193 if (id == Solo) { return "Solo"; }
194 if (id == Mute) { return "Mute"; }
195 if (id == Select) { return "Select"; }
196 if (id == VSelect) { return "V-Pot"; }
197 if (id == FaderTouch) { return "Fader Touch"; }
199 if (id == MasterFaderTouch) { return "Master Fader Touch"; }