diff options
author | nick_m <mainsbridge@gmail.com> | 2016-06-17 03:20:37 +1000 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-07-10 02:18:36 +1000 |
commit | 93c24e4433d69fe1de28d4d2ed2045aa7cb3596b (patch) | |
tree | 9cf3017f3075d57a1b7a3c5d9388b6554cbb0c7b /gtk2_ardour | |
parent | 94e0a15325278ec26dbeba4990a0e883db859338 (diff) |
Paste uses exact beats. rework _start_beats calculation in copy-with-offset ctor.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/automation_time_axis.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/automation_time_axis.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 4 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 17 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.h | 3 | ||||
-rw-r--r-- | gtk2_ardour/editor_keys.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 10 | ||||
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/midi_region_view.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/midi_streamview.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/midi_streamview.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/midi_time_axis.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/midi_time_axis.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/route_time_axis.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.h | 3 |
16 files changed, 37 insertions, 32 deletions
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 3a1dbf3c0c..7a8e8ac5b3 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -658,7 +658,7 @@ AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t when, } bool -AutomationTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx) +AutomationTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t& sub_num) { if (_line) { return paste_one (pos, ctx.count, ctx.times, selection, ctx.counts, ctx.greedy); diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h index d073890061..f352dae1ed 100644 --- a/gtk2_ardour/automation_time_axis.h +++ b/gtk2_ardour/automation_time_axis.h @@ -97,7 +97,7 @@ class AutomationTimeAxisView : public TimeAxisView { /* editing operations */ void cut_copy_clear (Selection&, Editing::CutCopyOp); - bool paste (ARDOUR::framepos_t, const Selection&, PasteContext&); + bool paste (ARDOUR::framepos_t, const Selection&, PasteContext&, const int32_t& sub_num); int set_state (const XMLNode&, int version); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index af781f019c..7c224a1d0c 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1190,7 +1190,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void cut_copy_midi (Editing::CutCopyOp); void mouse_paste (); - void paste_internal (framepos_t position, float times); + void paste_internal (framepos_t position, float times, const int32_t& sub_num); /* EDITING OPERATIONS */ @@ -1283,7 +1283,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void delete_ (); void cut (); void copy (); - void paste (float times, bool from_context_menu = false); + void paste (float times, bool from_context_menu); void place_transient (); void remove_transient (ArdourCanvas::Item* item); diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 11809af788..212c02513f 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -1256,8 +1256,8 @@ RegionMoveDrag::motion (GdkEvent* event, bool first_move) MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(rv); const boost::shared_ptr<const Region> original = rv->region(); - boost::shared_ptr<Region> region_copy = RegionFactory::create (original, true); - region_copy->set_position (original->position(), _editor->get_grid_music_divisions (event->button.state)); + boost::shared_ptr<Region> region_copy = RegionFactory::create (original, true + , _editor->get_grid_music_divisions (event->button.state)); /* need to set this so that the drop zone code can work. This doesn't actually put the region into the playlist, but just sets a weak pointer to it. @@ -1478,7 +1478,9 @@ RegionMoveDrag::finished_copy (bool const changed_position, bool const /*changed } if (dest_rtv != 0) { - RegionView* new_view = insert_region_into_playlist (i->view->region(), dest_rtv, i->layer, where, modified_playlists); + RegionView* new_view = insert_region_into_playlist (i->view->region(), dest_rtv, i->layer, where, + modified_playlists, _editor->get_grid_music_divisions (ev_state)); + if (new_view != 0) { new_views.push_back (new_view); } @@ -1574,7 +1576,8 @@ RegionMoveDrag::finished_no_copy ( /* insert into new playlist */ RegionView* new_view = insert_region_into_playlist ( - RegionFactory::create (rv->region (), true), dest_rtv, dest_layer, where, modified_playlists + RegionFactory::create (rv->region (), true), dest_rtv, dest_layer, where, + modified_playlists, _editor->get_grid_music_divisions (ev_state) ); if (new_view == 0) { @@ -1737,7 +1740,8 @@ RegionMoveDrag::insert_region_into_playlist ( RouteTimeAxisView* dest_rtv, layer_t dest_layer, framecnt_t where, - PlaylistSet& modified_playlists + PlaylistSet& modified_playlists, + const int32_t& sub_num ) { boost::shared_ptr<Playlist> dest_playlist = dest_rtv->playlist (); @@ -1754,8 +1758,7 @@ RegionMoveDrag::insert_region_into_playlist ( if (r.second) { dest_playlist->clear_changes (); } - - dest_playlist->add_region (region, where); + dest_playlist->add_region (region, where, 1.0, false, sub_num); if (dest_rtv->view()->layer_display() == Stacked || dest_rtv->view()->layer_display() == Expanded) { dest_playlist->set_layer (region, dest_layer); diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h index d9ac49cfd4..911b8fbf35 100644 --- a/gtk2_ardour/editor_drag.h +++ b/gtk2_ardour/editor_drag.h @@ -423,7 +423,8 @@ private: RouteTimeAxisView*, ARDOUR::layer_t, ARDOUR::framecnt_t, - PlaylistSet& + PlaylistSet&, + const int32_t& sub_num ); void remove_region_from_playlist ( diff --git a/gtk2_ardour/editor_keys.cc b/gtk2_ardour/editor_keys.cc index 8b1e46e0b7..1edcd16c9e 100644 --- a/gtk2_ardour/editor_keys.cc +++ b/gtk2_ardour/editor_keys.cc @@ -105,5 +105,5 @@ Editor::keyboard_selection_begin (Editing::EditIgnoreOption ign) void Editor::keyboard_paste () { - paste (1); + paste (1, false); } diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 80a5ee399e..b7809f0394 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -4635,7 +4635,7 @@ Editor::paste (float times, bool from_context) { DEBUG_TRACE (DEBUG::CutNPaste, "paste to preferred edit pos\n"); - paste_internal (get_preferred_edit_position (EDIT_IGNORE_NONE, from_context), times); + paste_internal (get_preferred_edit_position (EDIT_IGNORE_NONE, from_context), times, get_grid_music_divisions (0)); } void @@ -4649,11 +4649,11 @@ Editor::mouse_paste () } snap_to (where); - paste_internal (where, 1); + paste_internal (where, 1, get_grid_music_divisions (0)); } void -Editor::paste_internal (framepos_t position, float times) +Editor::paste_internal (framepos_t position, float times, const int32_t& sub_num) { DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("apparent paste position is %1\n", position)); @@ -4746,7 +4746,7 @@ Editor::paste_internal (framepos_t position, float times) "greedy" paste from one automation type to another. */ PasteContext ctx(paste_count, times, ItemCounts(), true); - ts.front()->paste (position, *cut_buffer, ctx); + ts.front()->paste (position, *cut_buffer, ctx, sub_num); } else { @@ -4754,7 +4754,7 @@ Editor::paste_internal (framepos_t position, float times) PasteContext ctx(paste_count, times, ItemCounts(), false); for (TrackViewList::iterator i = ts.begin(); i != ts.end(); ++i) { - (*i)->paste (position, *cut_buffer, ctx); + (*i)->paste (position, *cut_buffer, ctx, sub_num); } } diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 6ffba154f4..5c460cdf48 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -3491,7 +3491,7 @@ MidiRegionView::selection_as_cut_buffer () const /** This method handles undo */ bool -MidiRegionView::paste (framepos_t pos, const ::Selection& selection, PasteContext& ctx) +MidiRegionView::paste (framepos_t pos, const ::Selection& selection, PasteContext& ctx, const int32_t& sub_num) { bool commit = false; // Paste notes, if available @@ -3506,7 +3506,7 @@ MidiRegionView::paste (framepos_t pos, const ::Selection& selection, PasteContex typedef RouteTimeAxisView::AutomationTracks ATracks; const ATracks& atracks = midi_view()->automation_tracks(); for (ATracks::const_iterator a = atracks.begin(); a != atracks.end(); ++a) { - if (a->second->paste(pos, selection, ctx)) { + if (a->second->paste(pos, selection, ctx, sub_num)) { commit = true; } } diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h index b24b767981..fd423a3d0c 100644 --- a/gtk2_ardour/midi_region_view.h +++ b/gtk2_ardour/midi_region_view.h @@ -122,7 +122,7 @@ public: void resolve_note(uint8_t note_num, Evoral::Beats end_time); void cut_copy_clear (Editing::CutCopyOp); - bool paste (framepos_t pos, const ::Selection& selection, PasteContext& ctx); + bool paste (framepos_t pos, const ::Selection& selection, PasteContext& ctx, const int32_t& sub_num); void paste_internal (framepos_t pos, unsigned paste_count, float times, const MidiCutBuffer&); void add_canvas_patch_change (ARDOUR::MidiModel::PatchChangePtr patch, const std::string& displaytext, bool); diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc index 88947e7e3d..24328148d4 100644 --- a/gtk2_ardour/midi_streamview.cc +++ b/gtk2_ardour/midi_streamview.cc @@ -662,7 +662,7 @@ struct RegionPositionSorter { }; bool -MidiStreamView::paste (ARDOUR::framepos_t pos, const Selection& selection, PasteContext& ctx) +MidiStreamView::paste (ARDOUR::framepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t& sub_num) { /* Paste into the first region which starts on or before pos. Only called when using an internal editing tool. */ @@ -690,5 +690,5 @@ MidiStreamView::paste (ARDOUR::framepos_t pos, const Selection& selection, Paste } MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (*prev); - return mrv ? mrv->paste(pos, selection, ctx) : false; + return mrv ? mrv->paste(pos, selection, ctx, sub_num) : false; } diff --git a/gtk2_ardour/midi_streamview.h b/gtk2_ardour/midi_streamview.h index 9be3b34d9c..582c72fc1f 100644 --- a/gtk2_ardour/midi_streamview.h +++ b/gtk2_ardour/midi_streamview.h @@ -98,7 +98,7 @@ class MidiStreamView : public StreamView RegionView* create_region_view (boost::shared_ptr<ARDOUR::Region>, bool, bool); - bool paste (ARDOUR::framepos_t pos, const Selection& selection, PasteContext& ctx); + bool paste (ARDOUR::framepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t& sub_num); void apply_note_range(uint8_t lowest, uint8_t highest, bool to_region_views); diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 4b709c4e5c..fcb073aed9 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -1635,12 +1635,12 @@ MidiTimeAxisView::capture_channel_mode_changed () } bool -MidiTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx) +MidiTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t& sub_num) { if (!_editor.internal_editing()) { // Non-internal paste, paste regions like any other route - return RouteTimeAxisView::paste(pos, selection, ctx); + return RouteTimeAxisView::paste(pos, selection, ctx, sub_num); } - return midi_view()->paste(pos, selection, ctx); + return midi_view()->paste(pos, selection, ctx, sub_num); } diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h index b8e60660b4..4b78553d8c 100644 --- a/gtk2_ardour/midi_time_axis.h +++ b/gtk2_ardour/midi_time_axis.h @@ -88,7 +88,7 @@ public: void show_existing_automation (bool apply_to_selection = false); void create_automation_child (const Evoral::Parameter& param, bool show); - bool paste (ARDOUR::framepos_t, const Selection&, PasteContext& ctx); + bool paste (ARDOUR::framepos_t, const Selection&, PasteContext& ctx, const int32_t& sub_num); ARDOUR::NoteMode note_mode() const { return _note_mode; } ARDOUR::ColorMode color_mode() const { return _color_mode; } diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 7b73f36532..6d377df96b 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -1585,7 +1585,7 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op) } bool -RouteTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx) +RouteTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t& sub_num) { if (!is_track()) { return false; @@ -1619,7 +1619,7 @@ RouteTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteConte framecnt_t amount = extent.second - extent.first; pl->ripple(pos, amount * ctx.times, boost::shared_ptr<Region>()); } - pl->paste (*p, pos, ctx.times); + pl->paste (*p, pos, ctx.times, sub_num); vector<Command*> cmds; pl->rdiff (cmds); diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h index 3af3f1e08e..efa2bfafb8 100644 --- a/gtk2_ardour/route_time_axis.h +++ b/gtk2_ardour/route_time_axis.h @@ -107,7 +107,7 @@ public: /* Editing operations */ void cut_copy_clear (Selection&, Editing::CutCopyOp); - bool paste (ARDOUR::framepos_t, const Selection&, PasteContext& ctx); + bool paste (ARDOUR::framepos_t, const Selection&, PasteContext& ctx, const int32_t& sub_num); RegionView* combine_regions (); void uncombine_regions (); void uncombine_region (RegionView*); diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index aed4576f20..2ad2214952 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -185,7 +185,8 @@ class TimeAxisView : public virtual AxisView */ virtual bool paste (ARDOUR::framepos_t pos, const Selection& selection, - PasteContext& ctx) { return false; } + PasteContext& ctx, + const int32_t& sub_num) { return false; } virtual void set_selected_regionviews (RegionSelection&) {} virtual void set_selected_points (PointSelection&) {} |