summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_drag.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-09-23 05:06:03 +1000
committernick_m <mainsbridge@gmail.com>2016-09-23 05:06:03 +1000
commit4270569528c8972ae00060b4d52668deaeb35ea7 (patch)
tree8fec7d82c8c33554a77366d2c1e2556b36825482 /gtk2_ardour/editor_drag.cc
parent080e7755a614a71e8a2dcd97fb7310fc3401e5ca (diff)
Fix bug where drawing long notes placed the new note on the previous snap line.
- NoteCreateDrag already applies this shift, so it was always applied twice to the note start frame.
Diffstat (limited to 'gtk2_ardour/editor_drag.cc')
-rw-r--r--gtk2_ardour/editor_drag.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index c35d1fedef..f7b75a5855 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -6190,8 +6190,8 @@ NoteCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
const framepos_t pf = _drags->current_pointer_frame ();
const int32_t divisions = _editor->get_grid_music_divisions (event->button.state);
- const double qaf = map.quarter_note_at_frame (pf);
- double eqaf;
+ double eqaf = map.exact_qn_at_frame (pf, divisions);
+
if (divisions != 0) {
bool success = false;
Evoral::Beats grid_beats = _editor->get_grid_type_as_beats (success, pf);
@@ -6199,17 +6199,16 @@ NoteCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
grid_beats = Evoral::Beats(1);
}
- eqaf = map.exact_qn_at_frame (pf, divisions);
+ const double qaf = map.quarter_note_at_frame (pf);
/* Hack so that we always snap to the note that we are over, instead of snapping
to the next one if we're more than halfway through the one we're over.
*/
- const double rem = fmod (qaf, grid_beats.to_double());
- if (rem >= grid_beats.to_double() / 2.0) {
+
+ const double rem = eqaf - qaf;
+ if (rem >= 0.0 && eqaf - grid_beats.to_double() > _region_view->region()->pulse() * 4.0) {
eqaf -= grid_beats.to_double();
}
- } else {
- eqaf = qaf;
}
_note[0] = map.frame_at_quarter_note (eqaf) - _region_view->region()->position();
@@ -6257,7 +6256,7 @@ NoteCreateDrag::finished (GdkEvent* ev, bool had_movement)
const double qn_length = map.quarter_note_at_frame (start_sess_rel + length) - map.quarter_note_at_frame (start_sess_rel);
Evoral::Beats qn_length_beats = max (one_tick, Evoral::Beats (qn_length));
- _region_view->create_note_at (start, _drag_rect->y0(), qn_length_beats, ev->button.state);
+ _region_view->create_note_at (start, _drag_rect->y0(), qn_length_beats, ev->button.state, false);
}
double