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