[Summary] Fixed bug 45965: Copy does not work properly in multiselection mode

[Details] Regions will be copied to the same tracks they were copied/cut from regardless track header selection, using playhead position as paste point
[Reviewed by QA] MKosharniy
This commit is contained in:
GZharun 2015-01-23 17:13:38 +02:00
parent 28c2378df8
commit 28b7e75164
4 changed files with 21 additions and 30 deletions

View file

@ -312,8 +312,6 @@ Editor::Editor ()
, meters_running(false)
, _pending_locate_request (false)
, _pending_initial_locate (false)
, _last_cut_copy_source_track (0)
, _region_selection_change_updates_region_list (true)
, _following_mixer_bridge_view_selection (false)
, _following_meter_bridge_selection (false)

View file

@ -342,6 +342,15 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
bool follow_playhead() const { return _follow_playhead; }
bool dragging_playhead () const { return _dragging_playhead; }
framepos_t get_playhead_position () const
{
if (_session) {
return _session->audible_frame();
} else {
return 0;
}
}
void toggle_zero_line_visibility ();
void set_summary ();
void set_group_tabs ();
@ -2115,7 +2124,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
/** 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;
TrackViewList _last_cut_copy_source_tracks;
/** true if a change in Selection->regions should change the selection in the region list.
See EditorRegions::selection_changed.

View file

@ -4019,7 +4019,7 @@ Editor::cut_copy_points (CutCopyOp op)
}
/* XXX: not ideal, as there may be more than one track involved in the point selection */
_last_cut_copy_source_track = &selection->points.front()->line().trackview;
_last_cut_copy_source_tracks.push_back(&selection->points.front()->line().trackview);
/* Keep a record of the AutomationLists that we end up using in this operation */
typedef std::map<boost::shared_ptr<AutomationList>, AutomationRecord> Lists;
@ -4365,11 +4365,11 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs)
cut_buffer->set (foo);
}
if (pmap.empty()) {
_last_cut_copy_source_track = 0;
} else {
_last_cut_copy_source_track = pmap.front().tv;
}
_last_cut_copy_source_tracks.clear ();
for (vector<PlaylistMapping>::iterator i = pmap.begin(); i != pmap.end(); ++i) {
_last_cut_copy_source_tracks.push_back(i->tv);
}
}
for (FreezeList::iterator pl = freezelist.begin(); pl != freezelist.end(); ++pl) {
@ -4416,7 +4416,7 @@ Editor::paste (float times, bool from_context)
{
DEBUG_TRACE (DEBUG::CutNPaste, "paste to preferred edit pos\n");
paste_internal (get_preferred_edit_position (false, from_context), times);
paste_internal (get_playhead_position (), times);
}
void
@ -4453,26 +4453,9 @@ Editor::paste_internal (framepos_t position, float times)
DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("preferred edit position is %1\n", position));
}
TrackViewList ts;
TrackViewList::iterator i;
size_t nth;
/* get everything in the correct order */
if (_edit_point == Editing::EditAtMouse && entered_track) {
/* With the mouse edit point, paste onto the track under the mouse */
ts.push_back (entered_track);
} else if (!selection->tracks.empty()) {
/* Otherwise, if there are some selected tracks, paste to them */
ts = selection->tracks.filter_to_unique_playlists ();
sort_track_selection (ts);
} else if (_last_cut_copy_source_track) {
/* Otherwise paste to the track that the cut/copy came from;
see discussion in mantis #3333.
*/
ts.push_back (_last_cut_copy_source_track);
}
TrackViewList ts = _last_cut_copy_source_tracks.filter_to_unique_playlists();
TrackViewList::iterator i;
size_t nth;
if (internal_editing ()) {
/* undo/redo is handled by individual tracks/regions */

View file

@ -272,6 +272,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
/** @return true if the playhead is currently being dragged, otherwise false */
virtual bool dragging_playhead () const = 0;
virtual framepos_t get_playhead_position () const = 0;
virtual void ensure_float (Gtk::Window&) = 0;
virtual void show_window () = 0;
virtual framepos_t leftmost_sample() const = 0;