Allow multiple bundles with the same ports in the bundle editor, otherwise sometimes important bundles can be incorrectly hidden.

git-svn-id: svn://localhost/ardour2/branches/3.0@6087 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-11-14 23:08:17 +00:00
parent bb9647abfe
commit 53838fc350
6 changed files with 40 additions and 25 deletions

View file

@ -52,7 +52,12 @@ BundleEditorMatrix::setup_ports (int dim)
_ports[OURS].add_group (_port_group); _ports[OURS].add_group (_port_group);
} else { } else {
_ports[OTHER].suspend_signals (); _ports[OTHER].suspend_signals ();
_ports[OTHER].gather (_session, _bundle->ports_are_inputs());
/* when we gather, allow the matrix to contain bundles with duplicate port sets,
otherwise in some cases the basic system IO ports may be hidden, making
the bundle editor useless */
_ports[OTHER].gather (_session, _bundle->ports_are_inputs(), true);
_ports[OTHER].remove_bundle (_bundle); _ports[OTHER].remove_bundle (_bundle);
_ports[OTHER].resume_signals (); _ports[OTHER].resume_signals ();
} }

View file

@ -41,7 +41,7 @@ void
GlobalPortMatrix::setup_ports (int dim) GlobalPortMatrix::setup_ports (int dim)
{ {
_ports[dim].suspend_signals (); _ports[dim].suspend_signals ();
_ports[dim].gather (_session, dim == IN); _ports[dim].gather (_session, dim == IN, false);
_ports[dim].resume_signals (); _ports[dim].resume_signals ();
} }

View file

@ -70,7 +70,7 @@ IOSelector::setup_ports (int dim)
if (dim == _other) { if (dim == _other) {
_ports[_other].gather (_session, _find_inputs_for_io_outputs); _ports[_other].gather (_session, _find_inputs_for_io_outputs, false);
} else { } else {

View file

@ -50,19 +50,24 @@ PortGroup::PortGroup (std::string const & n)
} }
/** Add a bundle to a group.
* @param b Bundle.
* @param allow_dups true to allow the group to contain more than one bundle with the same port, otherwise false.
*/
void void
PortGroup::add_bundle (boost::shared_ptr<Bundle> b) PortGroup::add_bundle (boost::shared_ptr<Bundle> b, bool allow_dups)
{ {
add_bundle_internal (b, boost::shared_ptr<IO> (), false, Gdk::Color ()); add_bundle_internal (b, boost::shared_ptr<IO> (), false, Gdk::Color (), allow_dups);
} }
/** Add a bundle to a group. /** Add a bundle to a group.
* @param b Bundle. * @param b Bundle.
* @param io IO whose ports are in the bundle.
*/ */
void void
PortGroup::add_bundle (boost::shared_ptr<Bundle> b, boost::shared_ptr<IO> io) PortGroup::add_bundle (boost::shared_ptr<Bundle> b, boost::shared_ptr<IO> io)
{ {
add_bundle_internal (b, io, false, Gdk::Color ()); add_bundle_internal (b, io, false, Gdk::Color (), false);
} }
/** Add a bundle to a group. /** Add a bundle to a group.
@ -72,23 +77,26 @@ PortGroup::add_bundle (boost::shared_ptr<Bundle> b, boost::shared_ptr<IO> io)
void void
PortGroup::add_bundle (boost::shared_ptr<Bundle> b, boost::shared_ptr<IO> io, Gdk::Color c) PortGroup::add_bundle (boost::shared_ptr<Bundle> b, boost::shared_ptr<IO> io, Gdk::Color c)
{ {
add_bundle_internal (b, io, true, c); add_bundle_internal (b, io, true, c, false);
} }
void void
PortGroup::add_bundle_internal (boost::shared_ptr<Bundle> b, boost::shared_ptr<IO> io, bool has_colour, Gdk::Color colour) 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()); assert (b.get());
/* don't add this bundle if we already have one with the same ports */ if (!allow_dups) {
BundleList::iterator i = _bundles.begin (); /* don't add this bundle if we already have one with the same ports */
while (i != _bundles.end() && b->has_same_ports (i->bundle) == false) {
++i; BundleList::iterator i = _bundles.begin ();
} while (i != _bundles.end() && b->has_same_ports (i->bundle) == false) {
++i;
if (i != _bundles.end ()) { }
return;
if (i != _bundles.end ()) {
return;
}
} }
BundleRecord r; BundleRecord r;
@ -228,7 +236,7 @@ PortGroupList::maybe_add_processor_to_bundle (boost::weak_ptr<Processor> wp, boo
/** Gather bundles from around the system and put them in this PortGroupList */ /** Gather bundles from around the system and put them in this PortGroupList */
void void
PortGroupList::gather (ARDOUR::Session& session, bool inputs) PortGroupList::gather (ARDOUR::Session& session, bool inputs, bool allow_dups)
{ {
clear (); clear ();
@ -296,13 +304,13 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs)
for (BundleList::iterator i = b->begin(); i != b->end(); ++i) { for (BundleList::iterator i = b->begin(); i != b->end(); ++i) {
if (boost::dynamic_pointer_cast<UserBundle> (*i) && (*i)->ports_are_inputs() == inputs && (*i)->type() == _type) { if (boost::dynamic_pointer_cast<UserBundle> (*i) && (*i)->ports_are_inputs() == inputs && (*i)->type() == _type) {
system->add_bundle (*i); system->add_bundle (*i, allow_dups);
} }
} }
for (BundleList::iterator i = b->begin(); i != b->end(); ++i) { for (BundleList::iterator i = b->begin(); i != b->end(); ++i) {
if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0 && (*i)->ports_are_inputs() == inputs && (*i)->type() == _type) { if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0 && (*i)->ports_are_inputs() == inputs && (*i)->type() == _type) {
system->add_bundle (*i); system->add_bundle (*i, allow_dups);
} }
} }

View file

@ -49,7 +49,7 @@ class PortGroup : public sigc::trackable
public: public:
PortGroup (std::string const & n); PortGroup (std::string const & n);
void add_bundle (boost::shared_ptr<ARDOUR::Bundle>); void add_bundle (boost::shared_ptr<ARDOUR::Bundle>, bool allow_dups = false);
void add_bundle (boost::shared_ptr<ARDOUR::Bundle>, boost::shared_ptr<ARDOUR::IO> io); void add_bundle (boost::shared_ptr<ARDOUR::Bundle>, boost::shared_ptr<ARDOUR::IO> io);
void add_bundle (boost::shared_ptr<ARDOUR::Bundle>, boost::shared_ptr<ARDOUR::IO>, Gdk::Color); void add_bundle (boost::shared_ptr<ARDOUR::Bundle>, boost::shared_ptr<ARDOUR::IO>, Gdk::Color);
void remove_bundle (boost::shared_ptr<ARDOUR::Bundle>); void remove_bundle (boost::shared_ptr<ARDOUR::Bundle>);
@ -76,7 +76,9 @@ public:
struct BundleRecord { struct BundleRecord {
boost::shared_ptr<ARDOUR::Bundle> bundle; boost::shared_ptr<ARDOUR::Bundle> bundle;
boost::shared_ptr<ARDOUR::IO> io; /** IO whose ports are in the bundle, or 0. This is so that we can do things like adding
ports to the IO from matrix editor menus. */
boost::shared_ptr<ARDOUR::IO> io;
Gdk::Color colour; Gdk::Color colour;
bool has_colour; bool has_colour;
sigc::connection changed_connection; sigc::connection changed_connection;
@ -90,7 +92,7 @@ public:
private: private:
void bundle_changed (ARDOUR::Bundle::Change); void bundle_changed (ARDOUR::Bundle::Change);
void add_bundle_internal (boost::shared_ptr<ARDOUR::Bundle>, boost::shared_ptr<ARDOUR::IO>, bool, Gdk::Color); void add_bundle_internal (boost::shared_ptr<ARDOUR::Bundle>, boost::shared_ptr<ARDOUR::IO>, bool, Gdk::Color, bool);
BundleList _bundles; BundleList _bundles;
bool _visible; ///< true if the group is visible in the UI bool _visible; ///< true if the group is visible in the UI
@ -106,7 +108,7 @@ class PortGroupList : public sigc::trackable
void add_group (boost::shared_ptr<PortGroup>); void add_group (boost::shared_ptr<PortGroup>);
void set_type (ARDOUR::DataType); void set_type (ARDOUR::DataType);
void gather (ARDOUR::Session &, bool); void gather (ARDOUR::Session &, bool, bool);
PortGroup::BundleList const & bundles () const; PortGroup::BundleList const & bundles () const;
void clear (); void clear ();
void remove_bundle (boost::shared_ptr<ARDOUR::Bundle>); void remove_bundle (boost::shared_ptr<ARDOUR::Bundle>);

View file

@ -32,7 +32,7 @@ public:
_port_group->add_bundle (_session.click_io()->bundle()); _port_group->add_bundle (_session.click_io()->bundle());
_port_group->add_bundle (_session.the_auditioner()->output()->bundle()); _port_group->add_bundle (_session.the_auditioner()->output()->bundle());
} else { } else {
_ports[OTHER].gather (_session, true); _ports[OTHER].gather (_session, true, false);
} }
} }