From 8e59a26ccf13de93ac681d761bad09cd6bcf0c90 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 22 Dec 2009 01:10:25 +0000 Subject: Add remove all and disconnect all to port matrix menu. Hide bundles whose channels are already represented by other, larger bundles. git-svn-id: svn://localhost/ardour2/branches/3.0@6381 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/port_matrix.cc | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'gtk2_ardour/port_matrix.cc') diff --git a/gtk2_ardour/port_matrix.cc b/gtk2_ardour/port_matrix.cc index 33115432e6..247d750534 100644 --- a/gtk2_ardour/port_matrix.cc +++ b/gtk2_ardour/port_matrix.cc @@ -411,6 +411,12 @@ PortMatrix::popup_menu (BundleChannel column, BundleChannel row, uint32_t t) if (bc[dim].channel != -1) { add_remove_option (sub, w, bc[dim].channel); } else { + + snprintf (buf, sizeof (buf), _("Remove all")); + sub.push_back ( + MenuElem (buf, sigc::bind (sigc::mem_fun (*this, &PortMatrix::remove_all_channels), w)) + ); + for (uint32_t i = 0; i < bc[dim].bundle->nchannels(); ++i) { add_remove_option (sub, w, i); } @@ -424,9 +430,15 @@ PortMatrix::popup_menu (BundleChannel column, BundleChannel row, uint32_t t) ); } else { + if (bc[dim].channel != -1) { add_disassociate_option (sub, w, dim, bc[dim].channel); } else { + snprintf (buf, sizeof (buf), _("%s all"), disassociation_verb().c_str()); + sub.push_back ( + MenuElem (buf, sigc::bind (sigc::mem_fun (*this, &PortMatrix::disassociate_all_on_bundle), w, dim)) + ); + for (uint32_t i = 0; i < bc[dim].bundle->nchannels(); ++i) { add_disassociate_option (sub, w, dim, i); } @@ -476,6 +488,19 @@ PortMatrix::rename_channel_proxy (boost::weak_ptr b, uint32_t c) rename_channel (BundleChannel (sb, c)); } +void +PortMatrix::disassociate_all_on_bundle (boost::weak_ptr bundle, int dim) +{ + boost::shared_ptr sb = bundle.lock (); + if (!sb) { + return; + } + + for (uint32_t i = 0; i < sb->nchannels(); ++i) { + disassociate_all_on_channel (bundle, i, dim); + } +} + void PortMatrix::disassociate_all_on_channel (boost::weak_ptr bundle, uint32_t channel, int dim) { @@ -620,6 +645,19 @@ PortMatrix::remove_channel (ARDOUR::BundleChannel b) } } +void +PortMatrix::remove_all_channels (boost::weak_ptr w) +{ + boost::shared_ptr b = w.lock (); + if (!b) { + return; + } + + for (uint32_t i = 0; i < b->nchannels(); ++i) { + remove_channel (ARDOUR::BundleChannel (b, i)); + } +} + void PortMatrix::add_channel_proxy (boost::weak_ptr w) { -- cgit v1.2.3