2 Copyright (C) 1999-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/configuration.h"
22 using namespace ARDOUR;
26 Configuration::Configuration ()
30 Configuration::~Configuration ()
34 bool ConfigVariableBase::show_stores = false;
37 ConfigVariableBase::add_to_node (XMLNode& node)
39 std::string const v = get_as_string ();
40 show_stored_value (v);
41 XMLNode* child = new XMLNode ("Option");
42 child->add_property ("name", _name);
43 child->add_property ("value", v);
44 node.add_child_nocopy (*child);
48 ConfigVariableBase::set_from_node (XMLNode const & node)
50 if (node.name() == "Config" || node.name() == "Canvas" || node.name() == "UI") {
54 const XMLProperty* prop;
56 XMLNodeConstIterator niter;
59 nlist = node.children();
61 for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
65 if (child->name() == "Option") {
66 if ((prop = child->property ("name")) != 0) {
67 if (prop->value() == _name) {
68 if ((prop = child->property ("value")) != 0) {
69 set_from_string (prop->value());
77 } else if (node.name() == "Options") {
82 XMLNodeConstIterator oiter;
84 const XMLProperty* opt_prop;
86 olist = node.children();
88 for (oiter = olist.begin(); oiter != olist.end(); ++oiter) {
92 if (option->name() == _name) {
93 if ((opt_prop = option->property ("val")) != 0) {
94 set_from_string (opt_prop->value());
106 ConfigVariableBase::set_show_stored_values (bool yn)
112 ConfigVariableBase::show_stored_value (const string& str)
115 cerr << "Config variable " << _name << " stored as " << str << endl;
120 ConfigVariableBase::notify ()
122 // placeholder for any debugging desired when a config variable is modified
126 ConfigVariableBase::miss ()
128 // placeholder for any debugging desired when a config variable
129 // is set but to the same value as it already has