summaryrefslogtreecommitdiff
path: root/gtk2_ardour/port_group.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-11-18 13:35:31 +0000
committerCarl Hetherington <carl@carlh.net>2009-11-18 13:35:31 +0000
commit73a0cd56f8bab790e0bbcf09b4f51e20175f4dc8 (patch)
tree4589913ad551505381b0a7ac0a0c5277ce67148e /gtk2_ardour/port_group.cc
parentef92349187b61349d2d5182f49f700183901f59e (diff)
Rework port matrix to use Gtk notebook tabs to select visible groups.
git-svn-id: svn://localhost/ardour2/branches/3.0@6117 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/port_group.cc')
-rw-r--r--gtk2_ardour/port_group.cc64
1 files changed, 49 insertions, 15 deletions
diff --git a/gtk2_ardour/port_group.cc b/gtk2_ardour/port_group.cc
index 938e82af0b..ab2c2a7b35 100644
--- a/gtk2_ardour/port_group.cc
+++ b/gtk2_ardour/port_group.cc
@@ -45,7 +45,7 @@ using namespace ARDOUR;
* @param n Name.
*/
PortGroup::PortGroup (std::string const & n)
- : name (n), _visible (true)
+ : name (n)
{
}
@@ -242,7 +242,9 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs, bool allow_dups)
boost::shared_ptr<PortGroup> bus (new PortGroup (_("Bus")));
boost::shared_ptr<PortGroup> track (new PortGroup (_("Track")));
- boost::shared_ptr<PortGroup> system (new PortGroup (_("System")));
+ boost::shared_ptr<PortGroup> system_mono (new PortGroup (_("System (mono)")));
+ boost::shared_ptr<PortGroup> system_stereo (new PortGroup (_("System (stereo)")));
+ boost::shared_ptr<PortGroup> system_other (new PortGroup (_("System (other)")));
boost::shared_ptr<PortGroup> ardour (new PortGroup (_("Ardour")));
boost::shared_ptr<PortGroup> other (new PortGroup (_("Other")));
@@ -304,13 +306,25 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs, bool allow_dups)
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, allow_dups);
+ if ((*i)->nchannels() == 1) {
+ system_mono->add_bundle (*i, allow_dups);
+ } else if ((*i)->nchannels() == 2) {
+ system_stereo->add_bundle (*i, allow_dups);
+ } else {
+ system_other->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, allow_dups);
+ if ((*i)->nchannels() == 1) {
+ system_mono->add_bundle (*i, allow_dups);
+ } else if ((*i)->nchannels() == 2) {
+ system_stereo->add_bundle (*i, allow_dups);
+ } else {
+ system_other->add_bundle (*i, allow_dups);
+ }
}
}
@@ -340,7 +354,13 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs, bool allow_dups)
std::string const p = ports[n];
- if (!system->has_port(p) && !bus->has_port(p) && !track->has_port(p) && !ardour->has_port(p) && !other->has_port(p)) {
+ if (!system_mono->has_port(p) &&
+ !system_stereo->has_port(p) &&
+ !system_other->has_port(p) &&
+ !bus->has_port(p) &&
+ !track->has_port(p) &&
+ !ardour->has_port(p) &&
+ !other->has_port(p)) {
if (port_has_prefix (p, "system:") ||
port_has_prefix (p, "alsa_pcm") ||
@@ -358,18 +378,27 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs, bool allow_dups)
}
if (!extra_system.empty()) {
- system->add_bundle (make_bundle_from_ports (extra_system, inputs));
+ boost::shared_ptr<Bundle> b = make_bundle_from_ports (extra_system, inputs);
+ if (b->nchannels() == 1) {
+ system_mono->add_bundle (b);
+ } else if (b->nchannels() == 2) {
+ system_stereo->add_bundle (b);
+ } else {
+ system_other->add_bundle (b);
+ }
}
if (!extra_other.empty()) {
other->add_bundle (make_bundle_from_ports (extra_other, inputs));
}
- add_group (system);
- add_group (bus);
- add_group (track);
- add_group (ardour);
- add_group (other);
+ add_group_if_not_empty (system_mono);
+ add_group_if_not_empty (system_stereo);
+ add_group_if_not_empty (system_other);
+ add_group_if_not_empty (bus);
+ add_group_if_not_empty (track);
+ add_group_if_not_empty (ardour);
+ add_group_if_not_empty (other);
emit_changed ();
}
@@ -471,19 +500,24 @@ PortGroupList::bundles () const
}
uint32_t
-PortGroupList::total_visible_channels () const
+PortGroupList::total_channels () const
{
uint32_t n = 0;
for (PortGroupList::List::const_iterator i = begin(); i != end(); ++i) {
- if ((*i)->visible()) {
- n += (*i)->total_channels ();
- }
+ n += (*i)->total_channels ();
}
return n;
}
+void
+PortGroupList::add_group_if_not_empty (boost::shared_ptr<PortGroup> g)
+{
+ if (!g->bundles().empty ()) {
+ add_group (g);
+ }
+}
void
PortGroupList::add_group (boost::shared_ptr<PortGroup> g)