2 Copyright (C) 2009 Paul Davis
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.
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.
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.
20 #include "ardour/types.h"
21 #include "ardour/utils.h"
22 #include "ardour/session_configuration.h"
25 using namespace ARDOUR;
28 SessionConfiguration::SessionConfiguration ()
30 /* construct variables */
31 #undef CONFIG_VARIABLE
32 #undef CONFIG_VARIABLE_SPECIAL
33 #define CONFIG_VARIABLE(Type,var,name,value) var (name,value),
34 #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) var (name,value,mutator),
35 #include "ardour/session_configuration_vars.h"
36 #undef CONFIG_VARIABLE
37 #undef CONFIG_VARIABLE_SPECIAL
44 SessionConfiguration::get_state ()
47 LocaleGuard lg (X_("POSIX"));
49 root = new XMLNode ("Ardour");
50 root->add_child_nocopy (get_variables ());
57 SessionConfiguration::get_variables ()
60 LocaleGuard lg (X_("POSIX"));
62 node = new XMLNode ("Config");
64 #undef CONFIG_VARIABLE
65 #undef CONFIG_VARIABLE_SPECIAL
66 #define CONFIG_VARIABLE(type,var,Name,value) \
67 var.add_to_node (*node);
68 #define CONFIG_VARIABLE_SPECIAL(type,var,Name,value,mutator) \
69 var.add_to_node (*node);
70 #include "ardour/session_configuration_vars.h"
71 #undef CONFIG_VARIABLE
72 #undef CONFIG_VARIABLE_SPECIAL
79 SessionConfiguration::set_state (XMLNode const& root, int /*version*/)
81 if (root.name() != "Ardour") {
85 for (XMLNodeConstIterator i = root.children().begin(); i != root.children().end(); ++i) {
86 if ((*i)->name() == "Config") {
95 SessionConfiguration::set_variables (const XMLNode& node)
97 #undef CONFIG_VARIABLE
98 #undef CONFIG_VARIABLE_SPECIAL
99 #define CONFIG_VARIABLE(type,var,name,value) \
100 if (var.set_from_node (node)) { \
101 ParameterChanged (name); \
103 #define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) \
104 if (var.set_from_node (node)) { \
105 ParameterChanged (name); \
108 #include "ardour/session_configuration_vars.h"
109 #undef CONFIG_VARIABLE
110 #undef CONFIG_VARIABLE_SPECIAL
114 SessionConfiguration::map_parameters (boost::function<void (std::string)>& functor)
116 #undef CONFIG_VARIABLE
117 #undef CONFIG_VARIABLE_SPECIAL
118 #define CONFIG_VARIABLE(type,var,name,value) functor (name);
119 #define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) functor (name);
120 #include "ardour/session_configuration_vars.h"
121 #undef CONFIG_VARIABLE
122 #undef CONFIG_VARIABLE_SPECIAL