fix thinko that causes near duplicate menu items in group context menu when not in...
[ardour.git] / gtk2_ardour / port_group.cc
index 2691b46a7b8239d085f56e8e135a0702e9cc397a..093e307f9c8db4ab91c8ba6b352af987c0626583 100644 (file)
@@ -43,7 +43,7 @@
 #include "time_axis_view.h"
 #include "public_editor.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace Gtk;
@@ -375,10 +375,7 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
        /* Sort RouteIOs by the routes' editor order keys */
        route_ios.sort (RouteIOsComparator ());
 
-       /* 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.
-       */
+       /* Now put the bundles that belong to these sorted RouteIOs into the PortGroup. */
 
        for (list<RouteIOs>::iterator i = route_ios.begin(); i != route_ios.end(); ++i) {
                TimeAxisView* tv = PublicEditor::instance().axis_view_from_stripable (i->route);
@@ -392,10 +389,14 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
                }
 
                for (list<boost::shared_ptr<IO> >::iterator j = i->ios.begin(); j != i->ios.end(); ++j) {
-                       if (tv) {
-                               g->add_bundle ((*j)->bundle(), *j, tv->color ());
-                       } else {
-                               g->add_bundle ((*j)->bundle(), *j);
+                       /* Only add the bundle if there is at least one port
+                        * with a type that's been asked for */
+                       if (type == DataType::NIL || (*j)->bundle()->nchannels().n(type) > 0) {
+                               if (tv) {
+                                       g->add_bundle ((*j)->bundle(), *j, tv->color ());
+                               } else {
+                                       g->add_bundle ((*j)->bundle(), *j);
+                               }
                        }
                }
        }
@@ -548,10 +549,11 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
                                    we excluded them earlier.
                                 */
 
-                                string lp = p;
+                                string lp = p, monitor = _("Monitor");
                                 boost::to_lower (lp);
+                                boost::to_lower (monitor);
 
-                                if ((lp.find (N_(":monitor")) != string::npos) &&
+                                if ((lp.find (monitor) != string::npos) &&
                                     (lp.find (lpn) != string::npos)) {
                                         ++s;
                                         continue;
@@ -567,9 +569,9 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
                                if (ph) {
                                        DataType t (AudioEngine::instance()->port_engine().port_data_type (ph));
                                        if (t != DataType::NIL) {
-                                               if (port_has_prefix (p, N_("system:")) ||
-                                                   port_has_prefix (p, N_("alsa_pcm:")) ||
-                                                   port_has_prefix (p, N_("alsa_midi:"))) {
+                                               if (port_has_prefix (p, X_("system:")) ||
+                                                   port_has_prefix (p, X_("alsa_pcm:")) ||
+                                                   port_has_prefix (p, X_("alsa_midi:"))) {
                                                        extra_system[t].push_back (p);
                                                } else if (port_has_prefix (p, lpnc)) {
                                                        /* Hide scene ports from non-Tracks Live builds */
@@ -633,9 +635,7 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
        }
 
        add_group_if_not_empty (other);
-       if (type != DataType::MIDI) {
-               add_group_if_not_empty (bus);
-       }
+       add_group_if_not_empty (bus);
        add_group_if_not_empty (track);
        add_group_if_not_empty (program);
        add_group_if_not_empty (system);