summaryrefslogtreecommitdiff
path: root/gtk2_ardour/gui_object.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-07-11 20:32:33 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-07-11 20:32:33 +0000
commit6dc74f8c871752b05eb7def894bd44e38d76c3f4 (patch)
tree58f1b847c5771b32b1e078d378631348855c1345 /gtk2_ardour/gui_object.cc
parent58a3d6c72030a90c54e5582b75ed520536749504 (diff)
clean up GUIObjectState API, and use bools when setting "visible" property rather than string (not that it matters); don't unconditionally set visible to true unless a non-hidden track/bus has no visibility property already
git-svn-id: svn://localhost/ardour2/branches/3.0@9843 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/gui_object.cc')
-rw-r--r--gtk2_ardour/gui_object.cc39
1 files changed, 34 insertions, 5 deletions
diff --git a/gtk2_ardour/gui_object.cc b/gtk2_ardour/gui_object.cc
index 857ee3a770..fda1e0b29e 100644
--- a/gtk2_ardour/gui_object.cc
+++ b/gtk2_ardour/gui_object.cc
@@ -49,11 +49,6 @@ class gos_string_vistor : public boost::static_visitor<> {
void operator() (const int64_t& i) {
stream << i;
}
-#if 0
- void operator() (const double& d) {
- stream << std::setprecision (12) << d;
- }
-#endif
void operator() (const std::string& s) {
stream << s;
@@ -63,6 +58,40 @@ class gos_string_vistor : public boost::static_visitor<> {
std::ostream& stream;
};
+std::string
+GUIObjectState::get_string (const std::string& id, const std::string& prop_name, bool* empty)
+{
+ StringPropertyMap::iterator i = _property_maps.find (id);
+
+ if (i == _property_maps.end()) {
+ if (empty) {
+ *empty = true;
+ }
+ return string();
+ }
+
+ const PropertyMap& pmap (i->second);
+ PropertyMap::const_iterator p = pmap.find (prop_name);
+
+ if (p == pmap.end()) {
+ if (empty) {
+ *empty = true;
+ }
+ return string();
+ }
+
+ std::stringstream ss;
+ gos_string_vistor gsv (ss);
+
+ boost::apply_visitor (gsv, p->second);
+
+ if (empty) {
+ *empty = false;
+ }
+
+ return ss.str ();
+}
+
XMLNode&
GUIObjectState::get_state () const
{