From 355c079f1050fbf38327e92ac890d44f2d402031 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 4 Aug 2010 23:45:01 +0000 Subject: [PATCH] make bar-resync button in step editor work (move insertion point to next bar boundary) git-svn-id: svn://localhost/ardour2/branches/3.0@7543 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/midi_time_axis.cc | 8 ++++++++ gtk2_ardour/step_entry.cc | 1 + 2 files changed, 9 insertions(+) diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index b2c6cb81ae..3dada95f84 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -1093,6 +1093,14 @@ MidiTimeAxisView::step_edit_beat_sync () void MidiTimeAxisView::step_edit_bar_sync () { + if (!_session || !step_edit_region_view || !step_edit_region) { + return; + } + + nframes64_t fpos = step_edit_region->position() + + step_edit_region_view->beats_to_frames (step_edit_beat_pos); + fpos = _session->tempo_map().round_to_bar (fpos, 1); + step_edit_beat_pos = ceil (step_edit_region_view->frames_to_beats (fpos - step_edit_region->position())); } boost::shared_ptr diff --git a/gtk2_ardour/step_entry.cc b/gtk2_ardour/step_entry.cc index f85849012d..8387956a45 100644 --- a/gtk2_ardour/step_entry.cc +++ b/gtk2_ardour/step_entry.cc @@ -394,4 +394,5 @@ StepEntry::beat_resync_click () void StepEntry::bar_resync_click () { + _mtv->step_edit_bar_sync (); }