summaryrefslogtreecommitdiff
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
parent9f1b50cc3e953473240949abf083e0124fcae2af (diff)
Another try at fixing #4301.
git-svn-id: svn://localhost/ardour2/branches/3.0@10045 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/group_tabs.cc18
-rw-r--r--gtk2_ardour/group_tabs.h2
2 files changed, 13 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;
}
diff --git a/gtk2_ardour/group_tabs.h b/gtk2_ardour/group_tabs.h
index ed4a24709f..eaf03f6a22 100644
--- a/gtk2_ardour/group_tabs.h
+++ b/gtk2_ardour/group_tabs.h
@@ -113,6 +113,8 @@ private:
Gtk::Menu* _menu;
std::list<Tab> _tabs; ///< current list of tabs
Tab* _dragging; ///< tab being dragged, or 0
+ /** routes that were in the tab that is being dragged when the drag started */
+ ARDOUR::RouteList _initial_dragging_routes;
bool _dragging_new_tab; ///< true if we're dragging a new tab
bool _drag_moved; ///< true if there has been movement during any current drag
double _drag_fixed; ///< the position of the fixed end of the tab being dragged