Don't display empty tabs in the port matrix.
git-svn-id: svn://localhost/ardour2/branches/3.0@7521 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -311,8 +311,8 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Gather bundles from around the system and put them in this PortGroupList.
|
/** Gather ports from around the system and put them in this PortGroupList.
|
||||||
* @param type Type of bundles to collect, or NIL for all types.
|
* @param type Type of ports to collect, or NIL for all types.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inputs, bool allow_dups)
|
PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inputs, bool allow_dups)
|
||||||
@@ -356,7 +356,11 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
|
|||||||
/* Sort RouteIOs by the routes' editor order keys */
|
/* Sort RouteIOs by the routes' editor order keys */
|
||||||
route_ios.sort (RouteIOsComparator ());
|
route_ios.sort (RouteIOsComparator ());
|
||||||
|
|
||||||
/* Now put the bundles that belong to these sorted RouteIOs into the PortGroup */
|
/* Now put the bundles that belong to these sorted RouteIOs into the PortGroup.
|
||||||
|
Note that if the RouteIO's bundles are multi-type, we may make new Bundles
|
||||||
|
with only the ports of one type.
|
||||||
|
*/
|
||||||
|
|
||||||
for (list<RouteIOs>::iterator i = route_ios.begin(); i != route_ios.end(); ++i) {
|
for (list<RouteIOs>::iterator i = route_ios.begin(); i != route_ios.end(); ++i) {
|
||||||
TimeAxisView* tv = PublicEditor::instance().axis_view_from_route (i->route);
|
TimeAxisView* tv = PublicEditor::instance().axis_view_from_route (i->route);
|
||||||
|
|
||||||
@@ -367,12 +371,15 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
|
|||||||
} else {
|
} else {
|
||||||
g = bus;
|
g = bus;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (list<boost::shared_ptr<IO> >::iterator j = i->ios.begin(); j != i->ios.end(); ++j) {
|
for (list<boost::shared_ptr<IO> >::iterator j = i->ios.begin(); j != i->ios.end(); ++j) {
|
||||||
if (tv) {
|
boost::shared_ptr<Bundle> b = bundle_for_type ((*j)->bundle(), type);
|
||||||
g->add_bundle ((*j)->bundle(), *j, tv->color ());
|
if (b) {
|
||||||
} else {
|
if (tv) {
|
||||||
g->add_bundle ((*j)->bundle(), *j);
|
g->add_bundle (b, *j, tv->color ());
|
||||||
|
} else {
|
||||||
|
g->add_bundle (b, *j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -385,21 +392,34 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
|
|||||||
|
|
||||||
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) {
|
if (boost::dynamic_pointer_cast<UserBundle> (*i) && (*i)->ports_are_inputs() == inputs) {
|
||||||
system->add_bundle (*i, allow_dups);
|
boost::shared_ptr<Bundle> b = bundle_for_type (*i, type);
|
||||||
|
if (b) {
|
||||||
|
system->add_bundle (b, 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) {
|
if (boost::dynamic_pointer_cast<UserBundle> (*i) == 0 && (*i)->ports_are_inputs() == inputs) {
|
||||||
system->add_bundle (*i, allow_dups);
|
boost::shared_ptr<Bundle> b = bundle_for_type (*i, type);
|
||||||
|
if (b) {
|
||||||
|
system->add_bundle (b, allow_dups);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ardour stuff */
|
/* Ardour stuff */
|
||||||
|
|
||||||
if (!inputs && (type == DataType::AUDIO || type == DataType::NIL)) {
|
if (!inputs) {
|
||||||
ardour->add_bundle (session->the_auditioner()->output()->bundle());
|
boost::shared_ptr<Bundle> b = bundle_for_type (session->the_auditioner()->output()->bundle(), type);
|
||||||
ardour->add_bundle (session->click_io()->bundle());
|
if (b) {
|
||||||
|
ardour->add_bundle (b);
|
||||||
|
}
|
||||||
|
|
||||||
|
b = bundle_for_type (session->click_io()->bundle(), type);
|
||||||
|
if (b) {
|
||||||
|
ardour->add_bundle (b);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now find all other ports that we haven't thought of yet */
|
/* Now find all other ports that we haven't thought of yet */
|
||||||
@@ -461,13 +481,21 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
|
|||||||
|
|
||||||
for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
|
for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
|
||||||
if (!extra_system[*i].empty()) {
|
if (!extra_system[*i].empty()) {
|
||||||
system->add_bundle (make_bundle_from_ports (extra_system[*i], *i, inputs));
|
boost::shared_ptr<Bundle> b = make_bundle_from_ports (extra_system[*i], *i, inputs);
|
||||||
|
boost::shared_ptr<Bundle> bt = bundle_for_type (b, type);
|
||||||
|
if (bt) {
|
||||||
|
system->add_bundle (bt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
|
for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
|
||||||
if (!extra_other[*i].empty()) {
|
if (!extra_other[*i].empty()) {
|
||||||
other->add_bundle (make_bundle_from_ports (extra_other[*i], *i, inputs));
|
boost::shared_ptr<Bundle> b = make_bundle_from_ports (extra_other[*i], *i, inputs);
|
||||||
|
boost::shared_ptr<Bundle> bt = bundle_for_type (b, type);
|
||||||
|
if (bt) {
|
||||||
|
other->add_bundle (bt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -682,3 +710,30 @@ PortGroupList::empty () const
|
|||||||
return (i == _groups.end());
|
return (i == _groups.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Take a bundle, and either return it, if it contains only ports of type \a t,
|
||||||
|
* or return a new bundle with those ports from \a b which are of type \a t.
|
||||||
|
* Note that t == NIL is taken to mean "all types".
|
||||||
|
*/
|
||||||
|
boost::shared_ptr<Bundle>
|
||||||
|
PortGroupList::bundle_for_type (boost::shared_ptr<Bundle> b, DataType t) const
|
||||||
|
{
|
||||||
|
/* We are asked for a bundle with all types, so that's easy */
|
||||||
|
if (t == DataType::NIL) {
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b->nchannels().get(t) == b->nchannels().n_total()) {
|
||||||
|
/* All channels on b are of the correct type, so just return b */
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We must build a new bundle */
|
||||||
|
boost::shared_ptr<Bundle> n;
|
||||||
|
for (uint32_t i = 0; i < b->nchannels().n_total(); ++i) {
|
||||||
|
if (b->channel_type(i) == t) {
|
||||||
|
n->add_channel (b->channel_name (i), t, b->channel_ports (i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ class PortGroupList : public sigc::trackable
|
|||||||
void maybe_add_processor_to_list (
|
void maybe_add_processor_to_list (
|
||||||
boost::weak_ptr<ARDOUR::Processor>, std::list<boost::shared_ptr<ARDOUR::IO> > *, bool, std::set<boost::shared_ptr<ARDOUR::IO> > &
|
boost::weak_ptr<ARDOUR::Processor>, std::list<boost::shared_ptr<ARDOUR::IO> > *, bool, std::set<boost::shared_ptr<ARDOUR::IO> > &
|
||||||
);
|
);
|
||||||
|
boost::shared_ptr<ARDOUR::Bundle> bundle_for_type (boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::DataType) const;
|
||||||
|
|
||||||
mutable PortGroup::BundleList _bundles;
|
mutable PortGroup::BundleList _bundles;
|
||||||
List _groups;
|
List _groups;
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ class Bundle : public PBD::ScopedConnectionList
|
|||||||
|
|
||||||
struct Channel {
|
struct Channel {
|
||||||
Channel (std::string n, DataType t) : name (n), type (t) {}
|
Channel (std::string n, DataType t) : name (n), type (t) {}
|
||||||
|
Channel (std::string n, DataType t, PortList p) : name (n), type (t), ports (p) {}
|
||||||
|
|
||||||
bool operator== (Channel const &o) const {
|
bool operator== (Channel const &o) const {
|
||||||
return name == o.name && type == o.type && ports == o.ports;
|
return name == o.name && type == o.type && ports == o.ports;
|
||||||
@@ -76,6 +77,7 @@ class Bundle : public PBD::ScopedConnectionList
|
|||||||
PortList const & channel_ports (uint32_t) const;
|
PortList const & channel_ports (uint32_t) const;
|
||||||
|
|
||||||
void add_channel (std::string const &, DataType);
|
void add_channel (std::string const &, DataType);
|
||||||
|
void add_channel (std::string const &, DataType, PortList);
|
||||||
std::string channel_name (uint32_t) const;
|
std::string channel_name (uint32_t) const;
|
||||||
DataType channel_type (uint32_t) const;
|
DataType channel_type (uint32_t) const;
|
||||||
void set_channel_name (uint32_t, std::string const &);
|
void set_channel_name (uint32_t, std::string const &);
|
||||||
|
|||||||
@@ -165,6 +165,18 @@ Bundle::add_channel (std::string const & n, DataType t)
|
|||||||
emit_changed (ConfigurationChanged);
|
emit_changed (ConfigurationChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @param n Channel name */
|
||||||
|
void
|
||||||
|
Bundle::add_channel (std::string const & n, DataType t, PortList p)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
Glib::Mutex::Lock lm (_channel_mutex);
|
||||||
|
_channel.push_back (Channel (n, t, p));
|
||||||
|
}
|
||||||
|
|
||||||
|
emit_changed (ConfigurationChanged);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Bundle::port_attached_to_channel (uint32_t ch, std::string portname)
|
Bundle::port_attached_to_channel (uint32_t ch, std::string portname)
|
||||||
{
|
{
|
||||||
@@ -471,3 +483,4 @@ Bundle::channel_type (uint32_t c) const
|
|||||||
Glib::Mutex::Lock lm (_channel_mutex);
|
Glib::Mutex::Lock lm (_channel_mutex);
|
||||||
return _channel[c].type;
|
return _channel[c].type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user