diff options
author | Carl Hetherington <carl@carlh.net> | 2009-05-14 00:13:27 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2009-05-14 00:13:27 +0000 |
commit | 015fc7b39fab97cee1875231694adce43155ceb5 (patch) | |
tree | 76dded18cc9441e7325af999358ab3a3235cdb1e /gtk2_ardour/ui_config.h | |
parent | 0569107ddc0d2a8df6ca0a2c8cc16ebe8f3dee99 (diff) |
First stage of options rework.
- Split Configuration into RCConfiguration and SessionConfiguration;
the first for options which are saved to .rc files and the second
for options which are saved in a session file.
- Move some options from the old `master' Configuration object into
SessionConfiguration; this needs more refinement.
- Reflect many RCConfiguration options in an expanded Edit->Preferences
dialog; my intention is to remove the corresponding menu items
eventually.
git-svn-id: svn://localhost/ardour2/branches/3.0@5075 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/ui_config.h')
-rw-r--r-- | gtk2_ardour/ui_config.h | 54 |
1 files changed, 12 insertions, 42 deletions
diff --git a/gtk2_ardour/ui_config.h b/gtk2_ardour/ui_config.h index e3b7d26cd3..da1ebd3784 100644 --- a/gtk2_ardour/ui_config.h +++ b/gtk2_ardour/ui_config.h @@ -26,15 +26,14 @@ #include "pbd/stateful.h" #include "pbd/xml++.h" +#include "ardour/configuration_variable.h" template<class T> -class UIConfigVariable +class UIConfigVariable : public ARDOUR::ConfigVariableBase { public: - UIConfigVariable (std::string str) : _name (str) {} - UIConfigVariable (std::string str, T val) : _name (str), value(val) {} - - std::string name() const { return _name; } + UIConfigVariable (std::string str) : ARDOUR::ConfigVariableBase (str) {} + UIConfigVariable (std::string str, T val) : ARDOUR::ConfigVariableBase (str), value (val) {} bool set (T val) { if (val == value) { @@ -48,54 +47,25 @@ class UIConfigVariable return value; } - void add_to_node (XMLNode& node) { + std::string get_as_string () const { std::stringstream ss; ss << std::hex; ss.fill('0'); ss.width(8); ss << value; - XMLNode* child = new XMLNode ("Option"); - child->add_property ("name", _name); - child->add_property ("value", ss.str()); - node.add_child_nocopy (*child); + return ss.str (); } - - bool set_from_node (const XMLNode& node) { - - const XMLProperty* prop; - XMLNodeList nlist; - XMLNodeConstIterator niter; - XMLNode* child; - - nlist = node.children(); - - for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - - child = *niter; - - if (child->name() == "Option") { - if ((prop = child->property ("name")) != 0) { - if (prop->value() == _name) { - if ((prop = child->property ("value")) != 0) { - std::stringstream ss; - ss << std::hex; - ss << prop->value(); - ss >> value; - - return true; - } - } - } - } - } - return false; + + void set_from_string (std::string const & s) { + std::stringstream ss; + ss << std::hex; + ss << s; + ss >> value; } protected: T get_for_save() { return value; } - std::string _name; T value; - }; class UIConfiguration : public PBD::Stateful |