2 Copyright (C) 2000-2007 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 #ifndef __ardour_ui_configuration_h__
21 #define __ardour_ui_configuration_h__
27 #include <pbd/stateful.h>
28 #include <pbd/xml++.h>
31 class UIConfigVariable
34 UIConfigVariable (std::string str) : _name (str) {}
35 UIConfigVariable (std::string str, T val) : _name (str), value(val) {}
37 std::string name() const { return _name; }
51 void add_to_node (XMLNode& node) {
57 XMLNode* child = new XMLNode ("Option");
58 child->add_property ("name", _name);
59 child->add_property ("value", ss.str());
60 node.add_child_nocopy (*child);
63 bool set_from_node (const XMLNode& node) {
65 const XMLProperty* prop;
67 XMLNodeConstIterator niter;
70 nlist = node.children();
72 for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
76 if (child->name() == "Option") {
77 if ((prop = child->property ("name")) != 0) {
78 if (prop->value() == _name) {
79 if ((prop = child->property ("value")) != 0) {
95 T get_for_save() { return value; }
101 class UIConfiguration : public PBD::Stateful
107 std::vector<UIConfigVariable<uint32_t> *> canvas_colors;
111 int load_defaults ();
113 int set_state (const XMLNode&);
114 XMLNode& get_state (void);
115 XMLNode& get_variables (std::string);
116 void set_variables (const XMLNode&);
117 void pack_canvasvars ();
119 sigc::signal<void,const char*> ParameterChanged;
121 #undef UI_CONFIG_VARIABLE
122 #undef CANVAS_VARIABLE
123 #define UI_CONFIG_VARIABLE(Type,var,name,val) UIConfigVariable<Type> var;
124 #define CANVAS_VARIABLE(var,name) UIConfigVariable<uint32_t> var;
125 #include "ui_config_vars.h"
126 #include "canvas_vars.h"
127 #undef UI_CONFIG_VARIABLE
128 #undef CANVAS_VARIABLE
135 #endif /* __ardour_ui_configuration_h__ */