summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/bundle_manager.cc7
-rw-r--r--gtk2_ardour/global_port_matrix.cc2
-rw-r--r--gtk2_ardour/io_selector.cc2
-rw-r--r--gtk2_ardour/port_group.cc42
-rw-r--r--gtk2_ardour/port_group.h10
-rw-r--r--gtk2_ardour/session_option_editor.cc2
6 files changed, 40 insertions, 25 deletions
diff --git a/gtk2_ardour/bundle_manager.cc b/gtk2_ardour/bundle_manager.cc
index c5981f0552..0eb3d56698 100644
--- a/gtk2_ardour/bundle_manager.cc
+++ b/gtk2_ardour/bundle_manager.cc
@@ -52,7 +52,12 @@ BundleEditorMatrix::setup_ports (int dim)
_ports[OURS].add_group (_port_group);
} else {
_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].resume_signals ();
}
diff --git a/gtk2_ardour/global_port_matrix.cc b/gtk2_ardour/global_port_matrix.cc
index b3738dbcaa..0f107452a5 100644
--- a/gtk2_ardour/global_port_matrix.cc
+++ b/gtk2_ardour/global_port_matrix.cc
@@ -41,7 +41,7 @@ void
GlobalPortMatrix::setup_ports (int dim)
{
_ports[dim].suspend_signals ();
- _ports[dim].gather (_session, dim == IN);
+ _ports[dim].gather (_session, dim == IN, false);
_ports[dim].resume_signals ();
}
diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc
index 519445f12a..68cd1c8408 100644
--- a/gtk2_ardour/io_selector.cc
+++ b/gtk2_ardour/io_selector.cc
@@ -70,7 +70,7 @@ IOSelector::setup_ports (int dim)
if (dim == _other) {
- _ports[_other].gather (_session, _find_inputs_for_io_outputs);
+ _ports[_other].gather (_session, _find_inputs_for_io_outputs, false);
} else {
diff --git a/gtk2_ardour/port_group.cc b/gtk2_ardour/port_group.cc
index fceb143d34..8d10be23c8 100644
--- a/gtk2_ardour/port_group.cc
+++ b/gtk2_ardour/port_group.cc
@@ -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
-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.
* @param b Bundle.
+ * @param io IO whose ports are in the bundle.
*/
void
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.
@@ -72,23 +77,26 @@ PortGroup::add_bundle (boost::shared_ptr<Bundle> b, boost::shared_ptr<IO> io)
void
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
-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());
- /* 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;
+ 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 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 */
void
-PortGroupList::gather (ARDOUR::Session& session, bool inputs)
+PortGroupList::gather (ARDOUR::Session& session, bool inputs, bool allow_dups)
{
clear ();
@@ -296,13 +304,13 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs)
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) {
- system->add_bundle (*i);
+ system->add_bundle (*i, allow_dups);
}
}
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) {
- system->add_bundle (*i);
+ system->add_bundle (*i, allow_dups);
}
}
diff --git a/gtk2_ardour/port_group.h b/gtk2_ardour/port_group.h
index e382a7f7c6..27698ddbb0 100644
--- a/gtk2_ardour/port_group.h
+++ b/gtk2_ardour/port_group.h
@@ -49,7 +49,7 @@ class PortGroup : public sigc::trackable
public:
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>, Gdk::Color);
void remove_bundle (boost::shared_ptr<ARDOUR::Bundle>);
@@ -76,7 +76,9 @@ public:
struct BundleRecord {
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;
bool has_colour;
sigc::connection changed_connection;
@@ -90,7 +92,7 @@ public:
private:
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;
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 set_type (ARDOUR::DataType);
- void gather (ARDOUR::Session &, bool);
+ void gather (ARDOUR::Session &, bool, bool);
PortGroup::BundleList const & bundles () const;
void clear ();
void remove_bundle (boost::shared_ptr<ARDOUR::Bundle>);
diff --git a/gtk2_ardour/session_option_editor.cc b/gtk2_ardour/session_option_editor.cc
index f8f060684f..49d24a124f 100644
--- a/gtk2_ardour/session_option_editor.cc
+++ b/gtk2_ardour/session_option_editor.cc
@@ -32,7 +32,7 @@ public:
_port_group->add_bundle (_session.click_io()->bundle());
_port_group->add_bundle (_session.the_auditioner()->output()->bundle());
} else {
- _ports[OTHER].gather (_session, true);
+ _ports[OTHER].gather (_session, true, false);
}
}