diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 06fd443ca3..d28319c558 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -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) diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 9b1ffb30b8..f1ba7d7bd5 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -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. diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 5081096c2d..2054f20793 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -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, 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::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 */ diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 18de1cc205..70a6159a5f 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -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;