Try to avoid adding system ports to the port matrix twice. Fix some whitespace problems.
authorCarl Hetherington <carl@carlh.net>
Sat, 24 Jan 2009 01:46:13 +0000 (01:46 +0000)
committerCarl Hetherington <carl@carlh.net>
Sat, 24 Jan 2009 01:46:13 +0000 (01:46 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@4437 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/port_group.cc
gtk2_ardour/port_matrix_grid.cc

index c47bda303058c0e9d8899afa8a2b6a98c2122295..70fd5a1b8418c3c049ca7ab65578b56f0fb89717 100644 (file)
@@ -178,7 +178,20 @@ PortGroupList::refresh ()
 
                        if (p.substr(0, strlen ("system:")) == "system:" || p.substr (0, strlen ("alsa_pcm:")) == "alsa_pcm:") {
                                /* system: or alsa_pcm: prefix */
-                               _system.add_port (p);
+
+                               /* see if this port is already in one of the system: bundles */
+                               std::vector<boost::shared_ptr<ARDOUR::Bundle> >::iterator i = _system.bundles.begin();
+                               while (i != _system.bundles.end()) {
+                                       if ((*i)->uses_port (p)) {
+                                               break;
+                                       }
+                                       ++i;
+                               }
+
+                               if (i == _system.bundles.end()) {
+                                       /* it's not already in there, so add it */
+                                       _system.add_port (p);
+                               }
                        } else {
                                if (p.substr(0, client_matching_string.length()) != client_matching_string) {
                                        /* other (non-ardour) prefix */
index 13e1dcf4c200fac8980fa6cfac5c1a8dc8c77c11..f63cd231d7a01f17bf9ed57aba6d7bc28851d538 100644 (file)
@@ -200,15 +200,15 @@ PortMatrixGrid::button_press (double x, double y, int b)
                PortMatrix::State const s = _port_matrix->get_state (
                        our_bundle, our_channel, other_bundle, other_channel
                        );
-                               
+
                if (s == PortMatrix::ASSOCIATED || s == PortMatrix::NOT_ASSOCIATED) {
 
                        bool const n = !(s == PortMatrix::ASSOCIATED);
                        
-               _port_matrix->set_state (
-                       our_bundle, our_channel, other_bundle, other_channel,
+                       _port_matrix->set_state (
+                               our_bundle, our_channel, other_bundle, other_channel,
                                n, 0
-                       );
+                               );
                }
 
                require_render ();