summaryrefslogtreecommitdiff
path: root/gtk2_ardour/visibility_group.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-04-29 10:33:05 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-05-31 15:30:42 -0400
commitba4464dc3ccf8dbe2c1641b2a49f58e513804b25 (patch)
treeac55bcc49a7d5af2361f80ed14ff464984ae3083 /gtk2_ardour/visibility_group.cc
parentf485cfa324717f57b9f820f43f1b53307b96a8b9 (diff)
show/hide VCA assign buttons depending on VCA existence
Diffstat (limited to 'gtk2_ardour/visibility_group.cc')
-rw-r--r--gtk2_ardour/visibility_group.cc49
1 files changed, 49 insertions, 0 deletions
diff --git a/gtk2_ardour/visibility_group.cc b/gtk2_ardour/visibility_group.cc
index 46a941d0fc..9a59e613eb 100644
--- a/gtk2_ardour/visibility_group.cc
+++ b/gtk2_ardour/visibility_group.cc
@@ -21,7 +21,10 @@
#include <gtkmm/menu.h>
#include <gtkmm/menushell.h>
#include <gtkmm/treeview.h>
+
+#include "pbd/strsplit.h"
#include "pbd/xml++.h"
+
#include "visibility_group.h"
#include "i18n.h"
@@ -168,6 +171,52 @@ VisibilityGroup::set_state (string v)
}
string
+VisibilityGroup::remove_element (std::string const& from, std::string const& element)
+{
+ std::vector<string> s;
+ std::string ret;
+
+ split (from, s, ',');
+ for (std::vector<string>::const_iterator i = s.begin(); i != s.end(); ++i) {
+ if ((*i) == element) {
+ continue;
+ }
+ if (!ret.empty()) {
+ ret += ',';
+ }
+ ret += *i;
+ }
+
+ return ret;
+}
+
+string
+VisibilityGroup::add_element (std::string const& from, std::string const& element)
+{
+ std::vector<string> s;
+ std::string ret;
+
+ split (from, s, ',');
+
+ for (std::vector<string>::const_iterator i = s.begin(); i != s.end(); ++i) {
+ if ((*i) == element) {
+ /* already present, just return the original */
+ return from;
+ }
+ }
+
+ ret = from;
+
+ if (!ret.empty()) {
+ ret += ',';
+ }
+
+ ret += element;
+
+ return ret;
+}
+
+string
VisibilityGroup::get_state_name () const
{
return _xml_property_name;