13
0

tempo twist drag: changes to work with new (old) implementation

This commit is contained in:
Paul Davis 2022-05-13 19:02:55 -06:00
parent 1ccda17504
commit db17a46498

View File

@ -3817,22 +3817,7 @@ void
TempoTwistDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) TempoTwistDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
{ {
Drag::start_grab (event, cursor); Drag::start_grab (event, cursor);
}
void
TempoTwistDrag::setup_pointer_offset ()
{
// _pointer_offset = timepos_t (_grab_qn).distance (raw_grab_time());
}
void
TempoTwistDrag::motion (GdkEvent* event, bool first_move)
{
if (!_drag_valid) {
return;
}
if (first_move) {
map = _editor->begin_tempo_map_edit (); map = _editor->begin_tempo_map_edit ();
/* Get the tempo point that starts this section */ /* Get the tempo point that starts this section */
@ -3852,24 +3837,38 @@ TempoTwistDrag::motion (GdkEvent* event, bool first_move)
} }
} }
void
TempoTwistDrag::setup_pointer_offset ()
{
_pointer_offset = timecnt_t (Temporal::Beats());
}
void
TempoTwistDrag::motion (GdkEvent* event, bool first_move)
{
if (!_drag_valid) {
return;
}
if (first_move) {
/* get current state */ /* get current state */
_before_state = &map->get_state(); _before_state = &map->get_state();
_editor->tempo_curve_selected (_tempo, true); _editor->tempo_curve_selected (_tempo, true);
if (_next_tempo) { if (_next_tempo) {
_editor->tempo_curve_selected (_next_tempo, true); _editor->tempo_curve_selected (_next_tempo, true);
} }
Beats mouse_beats;
if (_editor->grid_musical()) {
mouse_beats = adjusted_current_time (event, false).beats();
} else {
mouse_beats = adjusted_current_time (event).beats();
} }
samplepos_t mouse_pos;
map->twist_tempi (_tempo, timepos_t (_tempo->beats()), timepos_t (mouse_beats)); if (_editor->grid_musical()) {
mouse_pos = adjusted_current_time (event, false).samples();
} else {
mouse_pos = adjusted_current_time (event).samples();
}
/* adjust this and the next tempi to match pointer sample */
map->twist_tempi (_tempo, adjusted_time (grab_time(), 0, false).samples(), mouse_pos);
ostringstream sstr; ostringstream sstr;
sstr << "start: " << fixed << setprecision(3) << _tempo->note_types_per_minute() << "\n"; sstr << "start: " << fixed << setprecision(3) << _tempo->note_types_per_minute() << "\n";