summaryrefslogtreecommitdiff
path: root/gtk2_ardour/group_tabs.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-08-31 20:46:16 +0000
committerCarl Hetherington <carl@carlh.net>2011-08-31 20:46:16 +0000
commite3692bf3dab4dc7d9a80ca79f98830cc7f1c0793 (patch)
tree03740304e02f509e327132d32314b024bb52b286 /gtk2_ardour/group_tabs.cc
parent9f1b50cc3e953473240949abf083e0124fcae2af (diff)
Another try at fixing #4301.
git-svn-id: svn://localhost/ardour2/branches/3.0@10045 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/group_tabs.cc')
-rw-r--r--gtk2_ardour/group_tabs.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/gtk2_ardour/group_tabs.cc b/gtk2_ardour/group_tabs.cc
index 4f194235e2..8deec1d70a 100644
--- a/gtk2_ardour/group_tabs.cc
+++ b/gtk2_ardour/group_tabs.cc
@@ -104,6 +104,7 @@ GroupTabs::on_button_press_event (GdkEventButton* ev)
} else {
_dragging_new_tab = false;
+ _initial_dragging_routes = routes_for_tab (t);
}
_dragging = t;
@@ -204,13 +205,15 @@ GroupTabs::on_button_release_event (GdkEventButton* ev)
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 contained in the tab we are dragging ... */
- if ((*i)->route_group() != _dragging->group) {
- /* and it's not in the dragged tab's group either */
- _dragging->group->remove (*i);
- }
- } else {
+ bool const was_in_tab = find (
+ _initial_dragging_routes.begin(), _initial_dragging_routes.end(), *i
+ ) != _initial_dragging_routes.end ();
+
+ bool const now_in_tab = find (routes.begin(), routes.end(), *i) != routes.end();
+
+ if (was_in_tab && !now_in_tab) {
+ _dragging->group->remove (*i);
+ } else if (!was_in_tab && now_in_tab) {
_dragging->group->add (*i);
}
}
@@ -222,6 +225,7 @@ GroupTabs::on_button_release_event (GdkEventButton* ev)
}
_dragging = 0;
+ _initial_dragging_routes.clear ();
return true;
}