+ /* finish drag */
+ RouteList routes = routes_for_tab (_dragging);
+
+ if (!routes.empty()) {
+ if (_dragging_new_tab) {
+ RouteGroup* g = new_route_group ();
+ if (g) {
+ for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
+ g->add (*i);
+ }
+ }
+ } else {
+ boost::shared_ptr<RouteList> r = _session->get_routes ();
+ for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
+
+ if (find (routes.begin(), routes.end(), *i) == routes.end()) {
+ /* this route is not on the list of those that should be in _dragging's group */
+ if ((*i)->route_group() == _dragging->group) {
+ _dragging->group->remove (*i);
+ }
+ } else {
+ _dragging->group->add (*i);
+ }
+ }
+ }
+ }
+