13
0

Preserve region list selection state even if a region is selected which is not shown in the editor.

git-svn-id: svn://localhost/ardour2/branches/3.0@7802 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-09-18 23:31:39 +00:00
parent 9054c71fb8
commit 3defa8b521
4 changed files with 19 additions and 1 deletions

View File

@ -304,6 +304,8 @@ Editor::Editor ()
, _pending_locate_request (false) , _pending_locate_request (false)
, _pending_initial_locate (false) , _pending_initial_locate (false)
, _last_cut_copy_source_track (0) , _last_cut_copy_source_track (0)
, _block_region_list_update_if_empty (false)
{ {
constructed = false; constructed = false;

View File

@ -2047,6 +2047,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
*/ */
TimeAxisView* _last_cut_copy_source_track; TimeAxisView* _last_cut_copy_source_track;
/** true if the update of the region list's selection from the current Selection
should be blocked if the Selection is empty. See EditorRegions::selection_changed.
*/
bool _block_region_list_update_if_empty;
friend class Drag; friend class Drag;
friend class RegionDrag; friend class RegionDrag;
friend class RegionMoveDrag; friend class RegionMoveDrag;

View File

@ -377,6 +377,13 @@ EditorRegions::selection_changed ()
return; return;
} }
/* We may have selected a region which is not displayed in the Editor. If this happens, the
result will be no selected regions in the editor's Selection. Without the following line,
this `no-selection' will be mapped back to our list, meaning that the selection will
appear not to take.
*/
_editor->_block_region_list_update_if_empty = true;
if (_display.get_selection()->count_selected_rows() > 0) { if (_display.get_selection()->count_selected_rows() > 0) {
TreeIter iter; TreeIter iter;
@ -409,6 +416,8 @@ EditorRegions::selection_changed ()
} else { } else {
_editor->get_selection().clear_regions (); _editor->get_selection().clear_regions ();
} }
_editor->_block_region_list_update_if_empty = false;
} }
void void

View File

@ -957,7 +957,9 @@ Editor::region_selection_changed ()
_regions->block_change_connection (true); _regions->block_change_connection (true);
editor_regions_selection_changed_connection.block(true); editor_regions_selection_changed_connection.block(true);
if (!_block_region_list_update_if_empty || !selection->regions.empty()) {
_regions->unselect_all (); _regions->unselect_all ();
}
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
(*i)->set_selected_regionviews (selection->regions); (*i)->set_selected_regionviews (selection->regions);