Ardour  9.0-pre0-582-g084a23a80d
us2400/device_profile.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Ben Loftis <ben@harrisonconsoles.com>
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 along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef __ardour_us2400_control_protocol_device_profile_h__
20 #define __ardour_us2400_control_protocol_device_profile_h__
21 
22 #include <iostream>
23 #include <stdint.h>
24 #include <string>
25 #include <map>
26 
27 #include "button.h"
28 
29 class XMLNode;
30 
31 namespace ArdourSurface {
32 
33 namespace US2400 {
34 
36 {
37  public:
38  DeviceProfile (const std::string& name = "");
40 
41  std::string get_button_action (Button::ID, int modifier_state) const;
42  void set_button_action (Button::ID, int modifier_state, const std::string&);
43 
44  std::string name() const;
45  void set_path (const std::string&);
46 
47  static void reload_device_profiles ();
48  static std::map<std::string,DeviceProfile> device_profiles;
49  static std::string name_when_edited (std::string const& name);
50  static const std::string default_profile_name;
51 
52  private:
53  struct ButtonActions {
54  std::string plain;
55  std::string control;
56  std::string shift;
57  std::string option;
58  std::string cmdalt;
59  std::string shiftcontrol;
60  };
61 
62  typedef std::map<Button::ID,ButtonActions> ButtonActionMap;
63 
64  std::string _name;
65  std::string _path;
67  bool edited;
68 
69  static const std::string edited_indicator;
70 
71  int set_state (const XMLNode&, int version);
72  XMLNode& get_state () const;
73 
74  void save ();
75 };
76 
77 }
78 }
79 
80 #endif /* __ardour_us2400_control_protocol_device_profile_h__ */
static std::string name_when_edited(std::string const &name)
std::string get_button_action(Button::ID, int modifier_state) const
void set_path(const std::string &)
DeviceProfile(const std::string &name="")
static const std::string default_profile_name
void set_button_action(Button::ID, int modifier_state, const std::string &)
std::map< Button::ID, ButtonActions > ButtonActionMap
int set_state(const XMLNode &, int version)
static std::map< std::string, DeviceProfile > device_profiles
Definition: xml++.h:114
DebugBits US2400