Move a couple of methods into editor.cc, where they seem to be more at home than...
[ardour.git] / libs / ardour / route_group.cc
index d7ac672f9a54f3a8b5bac1da7c21fd17cc8526d4..e1d43f4cd6a72401d2ac8eccddc943cb3b34db2c 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <algorithm>
 
-#include <sigc++/bind.h>
 
 #include "pbd/error.h"
 #include "pbd/enumwriter.h"
@@ -38,7 +37,6 @@
 #include "i18n.h"
 
 using namespace ARDOUR;
-using namespace sigc;
 using namespace std;
 
 RouteGroup::RouteGroup (Session& s, const string &n, Flag f, Property p)
@@ -70,15 +68,22 @@ RouteGroup::set_name (string str)
        FlagsChanged (0); /* EMIT SIGNAL */
 }
 
+/** Add a route to a group.  Adding a route which is already in the group is allowed; nothing will happen.
+ *  @param r Route to add.
+ */
 int
 RouteGroup::add (boost::shared_ptr<Route> r)
 {
+       if (find (routes->begin(), routes->end(), r) != routes->end()) {
+               return 0;
+       }
+       
        r->leave_route_group ();
 
        routes->push_back (r);
 
        r->join_route_group (this);
-       r->GoingAway.connect (sigc::bind (mem_fun (*this, &RouteGroup::remove_when_going_away), boost::weak_ptr<Route> (r)));
+       r->DropReferences.connect_same_thread (*this, boost::bind (&RouteGroup::remove_when_going_away, this, boost::weak_ptr<Route> (r)));
        
        _session.set_dirty ();
        changed (); /* EMIT SIGNAL */