summaryrefslogtreecommitdiff
path: root/gtk2_ardour/port_matrix.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-12-14 16:44:20 +0000
committerCarl Hetherington <carl@carlh.net>2009-12-14 16:44:20 +0000
commitda762129f19c28aff64f833b6ec09fba946faef6 (patch)
tree9f85b36735e42c257226bbb09432741d957f0613 /gtk2_ardour/port_matrix.cc
parent383b24cc48e542d83fca90d4263f800b33d69402 (diff)
Offer all of a bundle's ports for disconnection / removal when opening a menu over a bundle's name in the port matrix.
git-svn-id: svn://localhost/ardour2/branches/3.0@6365 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/port_matrix.cc')
-rw-r--r--gtk2_ardour/port_matrix.cc64
1 files changed, 48 insertions, 16 deletions
diff --git a/gtk2_ardour/port_matrix.cc b/gtk2_ardour/port_matrix.cc
index 1b07e80bf3..b9285de7c7 100644
--- a/gtk2_ardour/port_matrix.cc
+++ b/gtk2_ardour/port_matrix.cc
@@ -414,29 +414,31 @@ PortMatrix::popup_menu (BundleChannel column, BundleChannel row, uint32_t t)
}
if (can_remove_channels (bc[dim].bundle)) {
- snprintf (buf, sizeof (buf), _("Remove '%s'"), bc[dim].bundle->channel_name (bc[dim].channel).c_str());
- sub.push_back (
- MenuElem (
- buf,
- sigc::bind (sigc::mem_fun (*this, &PortMatrix::remove_channel_proxy), w, bc[dim].channel)
- )
- );
+ if (bc[dim].channel != -1) {
+ add_remove_option (sub, w, bc[dim].channel);
+ } else {
+ for (uint32_t i = 0; i < bc[dim].bundle->nchannels(); ++i) {
+ add_remove_option (sub, w, i);
+ }
+ }
}
if (_show_only_bundles || bc[dim].bundle->nchannels() <= 1) {
snprintf (buf, sizeof (buf), _("%s all"), disassociation_verb().c_str());
- } else {
- snprintf (
- buf, sizeof (buf), _("%s all from '%s'"),
- disassociation_verb().c_str(),
- bc[dim].bundle->channel_name (bc[dim].channel).c_str()
+ sub.push_back (
+ MenuElem (buf, sigc::bind (sigc::mem_fun (*this, &PortMatrix::disassociate_all_on_channel), w, bc[dim].channel, dim))
);
+
+ } else {
+ if (bc[dim].channel != -1) {
+ add_disassociate_option (sub, w, dim, bc[dim].channel);
+ } else {
+ for (uint32_t i = 0; i < bc[dim].bundle->nchannels(); ++i) {
+ add_disassociate_option (sub, w, dim, i);
+ }
+ }
}
- sub.push_back (
- MenuElem (buf, sigc::bind (sigc::mem_fun (*this, &PortMatrix::disassociate_all_on_channel), w, bc[dim].channel, dim))
- );
-
items.push_back (MenuElem (bc[dim].bundle->name().c_str(), *m));
need_separator = true;
}
@@ -761,3 +763,33 @@ PortMatrix::visible_ports (int d) const
return *j;
}
+
+void
+PortMatrix::add_remove_option (Menu_Helpers::MenuList& m, boost::weak_ptr<Bundle> w, int c)
+{
+ using namespace Menu_Helpers;
+
+ boost::shared_ptr<Bundle> b = w.lock ();
+ if (!b) {
+ return;
+ }
+
+ char buf [64];
+ snprintf (buf, sizeof (buf), _("Remove '%s'"), b->channel_name (c).c_str());
+ m.push_back (MenuElem (buf, sigc::bind (sigc::mem_fun (*this, &PortMatrix::remove_channel_proxy), w, c)));
+}
+
+void
+PortMatrix::add_disassociate_option (Menu_Helpers::MenuList& m, boost::weak_ptr<Bundle> w, int d, int c)
+{
+ using namespace Menu_Helpers;
+
+ boost::shared_ptr<Bundle> b = w.lock ();
+ if (!b) {
+ return;
+ }
+
+ char buf [64];
+ snprintf (buf, sizeof (buf), _("%s all from '%s'"), disassociation_verb().c_str(), b->channel_name (c).c_str());
+ m.push_back (MenuElem (buf, sigc::bind (sigc::mem_fun (*this, &PortMatrix::disassociate_all_on_channel), w, c, d)));
+}