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"
23 #include "ardour/ardour.h"
26 using namespace ARDOUR
;
29 SessionConfiguration::SessionConfiguration ()
31 /* construct variables */
32 #undef CONFIG_VARIABLE
33 #undef CONFIG_VARIABLE_SPECIAL
34 #define CONFIG_VARIABLE(Type,var,name,value) var (name,value),
35 #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) var (name,value,mutator),
36 #include "ardour/session_configuration_vars.h"
37 #undef CONFIG_VARIABLE
38 #undef CONFIG_VARIABLE_SPECIAL
45 SessionConfiguration::get_state ()
48 LocaleGuard
lg (X_("POSIX"));
50 root
= new XMLNode ("Ardour");
51 root
->add_child_nocopy (get_variables ());
58 SessionConfiguration::get_variables ()
61 LocaleGuard
lg (X_("POSIX"));
63 node
= new XMLNode ("Config");
65 #undef CONFIG_VARIABLE
66 #undef CONFIG_VARIABLE_SPECIAL
67 #define CONFIG_VARIABLE(type,var,Name,value) \
68 var.add_to_node (*node);
69 #define CONFIG_VARIABLE_SPECIAL(type,var,Name,value,mutator) \
70 var.add_to_node (*node);
71 #include "ardour/session_configuration_vars.h"
72 #undef CONFIG_VARIABLE
73 #undef CONFIG_VARIABLE_SPECIAL
80 SessionConfiguration::set_state (XMLNode
const& root
, int /*version*/)
82 if (root
.name() != "Ardour") {
86 for (XMLNodeConstIterator i
= root
.children().begin(); i
!= root
.children().end(); ++i
) {
87 if ((*i
)->name() == "Config") {
96 SessionConfiguration::set_variables (const XMLNode
& node
)
98 #undef CONFIG_VARIABLE
99 #undef CONFIG_VARIABLE_SPECIAL
100 #define CONFIG_VARIABLE(type,var,name,value) \
101 if (var.set_from_node (node)) { \
102 ParameterChanged (name); \
104 #define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) \
105 if (var.set_from_node (node)) { \
106 ParameterChanged (name); \
109 #include "ardour/session_configuration_vars.h"
110 #undef CONFIG_VARIABLE
111 #undef CONFIG_VARIABLE_SPECIAL
115 SessionConfiguration::map_parameters (boost::function
<void (std::string
)>& functor
)
117 #undef CONFIG_VARIABLE
118 #undef CONFIG_VARIABLE_SPECIAL
119 #define CONFIG_VARIABLE(type,var,name,value) functor (name);
120 #define CONFIG_VARIABLE_SPECIAL(type,var,name,value,mutator) functor (name);
121 #include "ardour/session_configuration_vars.h"
122 #undef CONFIG_VARIABLE
123 #undef CONFIG_VARIABLE_SPECIAL