13
0

Fix up confusion with relayering after movement drags in

overlaid mode.


git-svn-id: svn://localhost/ardour2/branches/3.0@11092 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-12-27 18:33:49 +00:00
parent 8f46200449
commit 2db69318ce
2 changed files with 18 additions and 12 deletions

View File

@ -961,9 +961,9 @@ RegionMoveDrag::finished_no_copy (
RegionSelection new_views;
PlaylistSet modified_playlists;
PlaylistSet frozen_playlists;
PlaylistSet relayer_suspended_playlists;
list<pair<boost::shared_ptr<Region>, double> > pending_relayers;
list<pair<boost::shared_ptr<Region>, double> > pending_explicit_relayers;
Playlist::RegionList pending_implicit_relayers;
if (_brushing) {
/* all changes were made during motion event handlers */
@ -1045,7 +1045,9 @@ RegionMoveDrag::finished_no_copy (
bool const explicit_relayer = dest_rtv->view()->layer_display() == Stacked || dest_rtv->view()->layer_display() == Expanded;
if (explicit_relayer) {
pending_relayers.push_back (make_pair (rv->region (), dest_layer));
pending_explicit_relayers.push_back (make_pair (rv->region (), dest_layer));
} else {
pending_implicit_relayers.push_back (rv->region ());
}
/* freeze playlist to avoid lots of relayering in the case of a multi-region drag */
@ -1054,6 +1056,7 @@ RegionMoveDrag::finished_no_copy (
if (r.second) {
playlist->freeze ();
playlist->suspend_relayer ();
}
/* this movement may result in a crossfade being modified, so we need to get undo
@ -1065,9 +1068,6 @@ RegionMoveDrag::finished_no_copy (
playlist->clear_changes ();
}
relayer_suspended_playlists.insert (playlist);
playlist->suspend_relayer ();
rv->region()->set_position (where);
_editor->session()->add_command (new StatefulDiffCommand (rv->region()));
@ -1112,18 +1112,24 @@ RegionMoveDrag::finished_no_copy (
_editor->selection->set (new_views);
}
/* We can't use the normal mechanism for relayering, as some regions may require an explicit relayer
rather than an implicit one. So we thaw before resuming relayering, then do the relayers
that we require.
*/
for (PlaylistSet::iterator p = frozen_playlists.begin(); p != frozen_playlists.end(); ++p) {
(*p)->thaw();
}
for (PlaylistSet::iterator p = relayer_suspended_playlists.begin(); p != relayer_suspended_playlists.end(); ++p) {
(*p)->resume_relayer ();
}
for (list<pair<boost::shared_ptr<Region>, double> >::iterator i = pending_relayers.begin(); i != pending_relayers.end(); ++i) {
for (list<pair<boost::shared_ptr<Region>, double> >::iterator i = pending_explicit_relayers.begin(); i != pending_explicit_relayers.end(); ++i) {
i->first->playlist()->relayer (i->first, i->second);
}
for (Playlist::RegionList::iterator i = pending_implicit_relayers.begin(); i != pending_implicit_relayers.end(); ++i) {
(*i)->playlist()->relayer (*i);
}
/* write commands for the accumulated diffs for all our modified playlists */
add_stateful_diff_commands_for_playlists (modified_playlists);

View File

@ -225,6 +225,7 @@ public:
framepos_t find_next_top_layer_position (framepos_t) const;
uint32_t combine_ops() const { return _combine_ops; }
void relayer (boost::shared_ptr<Region>);
void relayer (boost::shared_ptr<Region>, double);
void suspend_relayer ();
void resume_relayer ();
@ -355,7 +356,6 @@ public:
boost::shared_ptr<Playlist> cut (framepos_t start, framecnt_t cnt, bool result_is_hidden);
boost::shared_ptr<Playlist> copy (framepos_t start, framecnt_t cnt, bool result_is_hidden);
void relayer (boost::shared_ptr<Region>);
void relayer (RegionList const &);
void begin_undo ();