summaryrefslogtreecommitdiff
path: root/gtk2_ardour/port_group.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-07-20 00:22:09 +0000
committerCarl Hetherington <carl@carlh.net>2009-07-20 00:22:09 +0000
commit23f86529fd2c4d06285671d55f695438e9cb58ac (patch)
tree0c2c96da31a4353d5cc97e95e248ea9970f86201 /gtk2_ardour/port_group.cc
parentde58b257ae2444e224543a5da8003e7c717fa5bc (diff)
Clean up handling of add/remove/rename channels in the port matrix. Hence make it possible to do these things for any bundle (give or take). Clean up port matrix context menu.
git-svn-id: svn://localhost/ardour2/branches/3.0@5393 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/port_group.cc')
-rw-r--r--gtk2_ardour/port_group.cc48
1 files changed, 44 insertions, 4 deletions
diff --git a/gtk2_ardour/port_group.cc b/gtk2_ardour/port_group.cc
index 544d0e527e..187cdef19a 100644
--- a/gtk2_ardour/port_group.cc
+++ b/gtk2_ardour/port_group.cc
@@ -50,16 +50,23 @@ PortGroup::PortGroup (std::string const & n)
}
+void
+PortGroup::add_bundle (boost::shared_ptr<Bundle> b)
+{
+ add_bundle (b, boost::shared_ptr<IO> ());
+}
+
/** Add a bundle to a group.
* @param b Bundle.
*/
void
-PortGroup::add_bundle (boost::shared_ptr<Bundle> b)
+PortGroup::add_bundle (boost::shared_ptr<Bundle> b, boost::shared_ptr<IO> io)
{
assert (b.get());
BundleRecord r;
r.bundle = b;
+ r.io = io;
r.has_colour = false;
r.changed_connection = b->Changed.connect (sigc::mem_fun (*this, &PortGroup::bundle_changed));
@@ -73,12 +80,13 @@ PortGroup::add_bundle (boost::shared_ptr<Bundle> b)
* @param c Colour to represent the group with.
*/
void
-PortGroup::add_bundle (boost::shared_ptr<Bundle> b, Gdk::Color c)
+PortGroup::add_bundle (boost::shared_ptr<Bundle> b, boost::shared_ptr<IO> io, Gdk::Color c)
{
assert (b.get());
BundleRecord r;
r.bundle = b;
+ r.io = io;
r.colour = c;
r.has_colour = true;
r.changed_connection = b->Changed.connect (sigc::mem_fun (*this, &PortGroup::bundle_changed));
@@ -157,6 +165,22 @@ PortGroup::total_channels () const
return n;
}
+boost::shared_ptr<IO>
+PortGroup::io_from_bundle (boost::shared_ptr<ARDOUR::Bundle> b) const
+{
+ BundleList::const_iterator i = _bundles.begin ();
+ while (i != _bundles.end() && i->bundle != b) {
+ ++i;
+ }
+
+ if (i == _bundles.end()) {
+ return boost::shared_ptr<IO> ();
+ }
+
+ return i->io;
+}
+
+
/** PortGroupList constructor.
*/
PortGroupList::PortGroupList ()
@@ -250,9 +274,9 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs)
TimeAxisView* tv = PublicEditor::instance().axis_view_from_route (i->get());
if (tv) {
- g->add_bundle (rb, tv->color ());
+ g->add_bundle (rb, io, tv->color ());
} else {
- g->add_bundle (rb);
+ g->add_bundle (rb, io);
}
}
}
@@ -493,6 +517,22 @@ PortGroupList::resume_signals ()
_signals_suspended = false;
}
+boost::shared_ptr<IO>
+PortGroupList::io_from_bundle (boost::shared_ptr<ARDOUR::Bundle> b) const
+{
+ List::const_iterator i = _groups.begin ();
+ while (i != _groups.end()) {
+ boost::shared_ptr<IO> io = (*i)->io_from_bundle (b);
+ if (io) {
+ return io;
+ }
+ ++i;
+ }
+
+ return boost::shared_ptr<IO> ();
+}
+
+
RouteBundle::RouteBundle (boost::shared_ptr<Bundle> r)
: _route (r)
{