Merged with trunk R1705.
[ardour.git] / libs / surfaces / mackie / scripts / generate-button-handlers-cc.erb
1 <%#
2         Copyright (C) 2006,2007 John Anderson
3
4         This program is free software; you can redistribute it and/or modify
5         it under the terms of the GNU General Public License as published by
6         the Free Software Foundation; either version 2 of the License, or
7         (at your option) any later version.
8
9         This program is distributed in the hope that it will be useful,
10         but WITHOUT ANY WARRANTY; without even the implied warranty of
11         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12         GNU General Public License for more details.
13
14         You should have received a copy of the GNU General Public License
15         along with this program; if not, write to the Free Software
16         Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 -%>
18 <%-
19 require 'controls.rb'
20
21 sf = Surface.new
22 sf.parse( File.open "mackie-controls.csv" )
23 buttons = sf.controls.find_all{|x| x.class == Button && x.group.class != Strip}
24 -%>
25 /*
26         Generated by scripts/generate-button-handlers.erb
27 */
28 #include "mackie_button_handler.h"
29 #include "controls.h"
30
31 #include <iostream>
32
33 using namespace std;
34 using namespace Mackie;
35
36 LedState MackieButtonHandler::default_button_press( Button & button )
37 {
38         cout << "press: " << button << endl;
39         return on;
40 }
41 LedState MackieButtonHandler::default_button_release( Button & button )
42 {
43         cout << "release: " << button << endl;
44         return off;
45 }
46
47 <%-
48 buttons.each do |button|
49 %>
50 LedState MackieButtonHandler::<%=button.name%>_press( Button & button )
51 {
52         return default_button_press( button );
53 }
54
55 LedState MackieButtonHandler::<%=button.name%>_release( Button & button )
56 {
57         return default_button_release( button );
58 }
59 <% end %>