+PortGroup::add_bundle (boost::shared_ptr<Bundle> b, boost::shared_ptr<IO> io)
+{
+ add_bundle_internal (b, io, false, Gdk::Color (), false);
+}
+
+/** Add a bundle to a group.
+ * @param b Bundle.
+ * @param c Colour to represent the bundle with.
+ */
+void
+PortGroup::add_bundle (boost::shared_ptr<Bundle> b, boost::shared_ptr<IO> io, Gdk::Color c)
+{
+ add_bundle_internal (b, io, true, c, false);
+}
+
+PortGroup::BundleRecord::BundleRecord (boost::shared_ptr<ARDOUR::Bundle> b, boost::shared_ptr<ARDOUR::IO> iop, Gdk::Color c, bool has_c)
+ : bundle (b)
+ , io (iop)
+ , colour (c)
+ , has_colour (has_c)
+{
+}
+
+void
+PortGroup::add_bundle_internal (boost::shared_ptr<Bundle> b, boost::shared_ptr<IO> io, bool has_colour, Gdk::Color colour, bool allow_dups)
+{
+ assert (b.get());
+
+ if (!allow_dups) {
+
+ /* don't add this bundle if we already have one with the same ports */
+
+ BundleList::iterator i = _bundles.begin ();
+ while (i != _bundles.end() && b->has_same_ports ((*i)->bundle) == false) {
+ ++i;
+ }
+
+ if (i != _bundles.end ()) {
+ return;
+ }
+ }
+
+ BundleRecord* br = new BundleRecord (b, io, colour, has_colour);
+ b->Changed.connect (br->changed_connection, boost::bind (&PortGroup::bundle_changed, this, _1));
+ _bundles.push_back (br);
+
+ Changed ();
+}
+
+void
+PortGroup::remove_bundle (boost::shared_ptr<Bundle> b)