Make Cut mode respect snap modifer

This commit is contained in:
Tim Mayberry 2016-11-21 22:19:56 +10:00
parent d4190d3761
commit 73f3e479d3
4 changed files with 17 additions and 10 deletions

View File

@ -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::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false);
RegionSelection get_regions_from_selection_and_mouse (framepos_t);

View File

@ -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

View File

@ -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 */

View File

@ -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::Region>, 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<void,TimeAxisView&>) = 0;