From fde56cc730cc4d0fad1bccd19f9ebdae90ce0deb Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 4 Jan 2011 01:03:36 +0000 Subject: [PATCH] Unselect regions on tracks when the tracks are hidden. Fixes #3653. git-svn-id: svn://localhost/ardour2/branches/3.0@8426 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/selection.cc | 16 ++++++++++++++++ gtk2_ardour/selection.h | 2 ++ gtk2_ardour/time_axis_view.cc | 3 ++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc index b135593a62..fa0df40336 100644 --- a/gtk2_ardour/selection.cc +++ b/gtk2_ardour/selection.cc @@ -1163,3 +1163,19 @@ Selection::set_state (XMLNode const & node, int) return 0; } + +void +Selection::remove_regions (TimeAxisView* t) +{ + RegionSelection::iterator i = regions.begin(); + while (i != regions.end ()) { + RegionSelection::iterator tmp = i; + ++tmp; + + if (&(*i)->get_time_axis_view() == t) { + remove (*i); + } + + i = tmp; + } +} diff --git a/gtk2_ardour/selection.h b/gtk2_ardour/selection.h index 0a73ae275e..c9d3e9b759 100644 --- a/gtk2_ardour/selection.h +++ b/gtk2_ardour/selection.h @@ -174,6 +174,8 @@ class Selection : public sigc::trackable, public PBD::ScopedConnectionList void remove (const std::list&); void remove (Marker*); + void remove_regions (TimeAxisView *); + void replace (uint32_t time_index, framepos_t start, framepos_t end); void clear_regions(); diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index a206b1a231..6dc1382c3d 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -372,8 +372,9 @@ TimeAxisView::hide () } /* if its hidden, it cannot be selected */ - _editor.get_selection().remove (this); + /* and neither can its regions */ + _editor.get_selection().remove_regions (this); Hiding (); }