From 73f3e479d363ef35bb12a89b61d21609a7428e19 Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Mon, 21 Nov 2016 22:19:56 +1000 Subject: Make Cut mode respect snap modifer --- gtk2_ardour/editor.h | 2 +- gtk2_ardour/editor_drag.cc | 12 +++++++----- gtk2_ardour/editor_ops.cc | 11 ++++++++--- gtk2_ardour/public_editor.h | 2 +- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index beb3978c7f..57e72393fa 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -536,7 +536,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD /* editing operations that need to be public */ void mouse_add_new_marker (framepos_t where, bool is_cd=false); - void split_regions_at (framepos_t, RegionSelection&, const int32_t sub_num); + void split_regions_at (framepos_t, RegionSelection&, const int32_t sub_num, bool snap = true); void split_region_at_points (boost::shared_ptr, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false); RegionSelection get_regions_from_selection_and_mouse (framepos_t); diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 5d0bfc60ed..4e52649850 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -6534,12 +6534,12 @@ RegionCutDrag::start_grab (GdkEvent* event, Gdk::Cursor* c) } void -RegionCutDrag::motion (GdkEvent*, bool) +RegionCutDrag::motion (GdkEvent* event, bool) { - framepos_t where = _drags->current_pointer_frame(); - _editor->snap_to (where); + framepos_t pos = _drags->current_pointer_frame(); + _editor->snap_to_with_modifier (pos, event); - line->set_position (where); + line->set_position (pos); } void @@ -6548,6 +6548,7 @@ RegionCutDrag::finished (GdkEvent* event, bool) _editor->get_track_canvas()->canvas()->re_enter(); framepos_t pos = _drags->current_pointer_frame(); + _editor->snap_to_with_modifier (pos, event); line->hide (); @@ -6557,7 +6558,8 @@ RegionCutDrag::finished (GdkEvent* event, bool) return; } - _editor->split_regions_at (pos, rs, _editor->get_grid_music_divisions (event->button.state)); + _editor->split_regions_at (pos, rs, _editor->get_grid_music_divisions (event->button.state), + false); } void diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 0037ac8bc7..643780a490 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -166,7 +166,8 @@ Editor::redo (uint32_t n) } void -Editor::split_regions_at (framepos_t where, RegionSelection& regions, const int32_t sub_num) +Editor::split_regions_at (framepos_t where, RegionSelection& regions, const int32_t sub_num, + bool snap_frame) { bool frozen = false; @@ -192,10 +193,14 @@ Editor::split_regions_at (framepos_t where, RegionSelection& regions, const int3 case SnapToRegionEnd: break; default: - snap_to (where); + if (snap_frame) { + snap_to (where); + } } } else { - snap_to (where); + if (snap_frame) { + snap_to (where); + } frozen = true; EditorFreeze(); /* Emit Signal */ diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 576fd17096..fb6da74dbf 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -289,7 +289,7 @@ class PublicEditor : public Gtkmm2ext::Tabbable { virtual void restore_editing_space () = 0; virtual framepos_t get_preferred_edit_position (Editing::EditIgnoreOption = Editing::EDIT_IGNORE_NONE, bool from_context_menu = false, bool from_outside_canvas = false) = 0; virtual void toggle_meter_updating() = 0; - virtual void split_regions_at (framepos_t, RegionSelection&, const int32_t sub_num) = 0; + virtual void split_regions_at (framepos_t, RegionSelection&, const int32_t sub_num, bool snap) = 0; virtual void split_region_at_points (boost::shared_ptr, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false) = 0; virtual void mouse_add_new_marker (framepos_t where, bool is_cd=false) = 0; virtual void foreach_time_axis_view (sigc::slot) = 0; -- cgit v1.2.3