Paste to the source of a copy if there are no selected tracks (rather than using the track under the mouse). Fixes #3333.

git-svn-id: svn://localhost/ardour2/branches/3.0@7729 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-09-02 01:06:19 +00:00
parent e76c4ee06d
commit b9191eb0c5
3 changed files with 18 additions and 3 deletions

View File

@ -303,6 +303,7 @@ Editor::Editor ()
, meters_running(false)
, _pending_locate_request (false)
, _pending_initial_locate (false)
, _last_cut_copy_source_track (0)
{
constructed = false;

View File

@ -2044,6 +2044,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
RegionLayeringOrderEditor* layering_order_editor;
void update_region_layering_order_editor (ARDOUR::framepos_t);
/** Track that was the source for the last cut/copy operation. Used as a place
to paste things iff there is no selected track.
*/
TimeAxisView* _last_cut_copy_source_track;
friend class Drag;
friend class RegionDrag;
friend class RegionMoveDrag;

View File

@ -4213,10 +4213,15 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs)
foo.push_back ((*i).pl);
}
if (!foo.empty()) {
cut_buffer->set (foo);
}
if (pmap.empty()) {
_last_cut_copy_source_track = 0;
} else {
_last_cut_copy_source_track = pmap.front().tv;
}
for (FreezeList::iterator pl = freezelist.begin(); pl != freezelist.end(); ++pl) {
(*pl)->thaw ();
@ -4293,10 +4298,14 @@ Editor::paste_internal (nframes64_t position, float times)
/* get everything in the correct order */
if (!selection->tracks.empty()) {
/* there are some selected tracks, so paste to them */
sort_track_selection ();
ts = selection->tracks;
} else if (entered_track) {
ts.push_back (entered_track);
} else if (_last_cut_copy_source_track) {
/* otherwise paste to the track that the cut/copy came from;
see discussion in mants #3333.
*/
ts.push_back (_last_cut_copy_source_track);
}
for (nth = 0, i = ts.begin(); i != ts.end(); ++i, ++nth) {