fc7af8c4502d54f78b34045b9c3b4bbbe697f5e1
[ardour.git] / libs / ardour / ardour / session_configuration.h
1 /*
2     Copyright (C) 2009 Paul Davis
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
20 #ifndef __ardour_session_configuration_h__
21 #define __ardour_session_configuration_h__
22
23 #include "ardour/configuration.h"
24
25 namespace ARDOUR {
26
27 class SessionConfiguration : public Configuration
28 {
29 public:
30         SessionConfiguration ();
31
32         void map_parameters (sigc::slot<void, std::string>);
33         int set_state (XMLNode const &);
34         XMLNode& get_state ();
35         XMLNode& get_variables ();
36         void set_variables (XMLNode const &);
37
38         /* define accessor methods */
39
40 #undef  CONFIG_VARIABLE
41 #undef  CONFIG_VARIABLE_SPECIAL
42 #define CONFIG_VARIABLE(Type,var,name,value) \
43         Type get_##var () const { return var.get(); } \
44         bool set_##var (Type val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret;  }
45 #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) \
46         Type get_##var () const { return var.get(); } \
47         bool set_##var (Type val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
48 #include "ardour/session_configuration_vars.h"
49 #undef  CONFIG_VARIABLE
50 #undef  CONFIG_VARIABLE_SPECIAL
51
52   private:
53
54         /* declare variables */
55
56 #undef  CONFIG_VARIABLE
57 #undef  CONFIG_VARIABLE_SPECIAL
58 #define CONFIG_VARIABLE(Type,var,name,value) ConfigVariable<Type> var;
59 #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) ConfigVariableWithMutation<Type> var;
60 #include "ardour/session_configuration_vars.h"
61 #undef  CONFIG_VARIABLE
62 #undef  CONFIG_VARIABLE_SPECIAL
63
64         int foo;
65 };
66
67 }
68
69 #endif