From 59daffea1d78cb55b35fe19c135cc4ab472bd01d Mon Sep 17 00:00:00 2001 From: nick_m Date: Fri, 27 Jan 2017 00:41:17 +1100 Subject: rework snap snap now fills in a struct (MusicFrame) which contins a snapped frame along with a music divisor. this gives useful information wrt magnetic snap which may or may not have rounded to an exact musical position. region position may now be set musically (using quarter notes for now). this patch fixes several problems in the current code: - dragging a list of music-locked regions now maintains correct musical offsets within the list. - splitting regions using magnetic snap works correctly (#7192) - cut drag should now work correctly with magnetic snap. - musical length of split midi regions is no longer frame based. --- gtk2_ardour/editor_mouse.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'gtk2_ardour/editor_mouse.cc') diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 8e1ef327ab..d5bf07bd78 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1269,9 +1269,9 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp UIConfiguration::instance().get_follow_edits() && !_session->config.get_external_sync()) { - framepos_t where = canvas_event_sample (event); - snap_to(where); - _session->request_locate (where, false); + MusicFrame where (canvas_event_sample (event), 0); + snap_to (where); + _session->request_locate (where.frame, false); } switch (event->button.button) { @@ -1318,7 +1318,7 @@ Editor::button_release_dispatch (GdkEventButton* ev) bool Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type) { - framepos_t where = canvas_event_sample (event); + MusicFrame where (canvas_event_sample (event), 0); AutomationTimeAxisView* atv = 0; _press_cursor_ctx.reset(); @@ -1466,7 +1466,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT case SamplesRulerItem: case MinsecRulerItem: case BBTRulerItem: - popup_ruler_menu (where, item_type); + popup_ruler_menu (where.frame, item_type); break; case MarkerItem: @@ -1558,7 +1558,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT case MarkerBarItem: if (!_dragging_playhead) { snap_to_with_modifier (where, event, RoundNearest, true); - mouse_add_new_marker (where); + mouse_add_new_marker (where.frame); } return true; @@ -1566,14 +1566,14 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT if (!_dragging_playhead) { // if we get here then a dragged range wasn't done snap_to_with_modifier (where, event, RoundNearest, true); - mouse_add_new_marker (where, true); + mouse_add_new_marker (where.frame, true); } return true; case TempoBarItem: case TempoCurveItem: if (!_dragging_playhead) { snap_to_with_modifier (where, event); - mouse_add_new_tempo_event (where); + mouse_add_new_tempo_event (where.frame); } return true; @@ -1617,7 +1617,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT bool with_guard_points = Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier); atv = dynamic_cast(clicked_axisview); if (atv) { - atv->add_automation_event (event, where, event->button.y, with_guard_points); + atv->add_automation_event (event, where.frame, event->button.y, with_guard_points); } return true; break; -- cgit v1.2.3