From ccb51a8ddbecd2fe3d6847d85b3a4ba1f55d3ef1 Mon Sep 17 00:00:00 2001 From: nick_m Date: Sat, 25 Feb 2017 05:09:16 +1100 Subject: rework tempo editing. most changes are due to a new design where tempo discontinuities at the beginning of a ramped section may be set. this allows easier mapping of live performance, especially in the common case of a ramped ritard before the beginning of a new section. feature summary: holding constraint modifier (shift) while dragging the BBT ruler area drags the tempo lines by changing the start tempo (as before) holding copy modifier (control) while dragging the BBT ruler area drags the tempo lines by changing the end tempo (ahem. not quite there) dragging a tempo mark while holding constraint (shift) will change the previous end tempo to match the marker position *worth trying*. holding constraint and copy modifier (control + shift) while dragging the BBT ruler area attempts to'pinch' or twist the surrounding tempi sp that later ones are not repositioned (currently suffereng from rounding errors) --- gtk2_ardour/editor_canvas_events.cc | 53 ++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'gtk2_ardour/editor_canvas_events.cc') diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index 9a12ada070..af5b8a9241 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -1006,8 +1006,59 @@ Editor::canvas_videotl_bar_event (GdkEvent *event, ArdourCanvas::Item* item) } bool -Editor::canvas_tempo_marker_event (GdkEvent *event, ArdourCanvas::Item* item, TempoMarker* /*marker*/) +Editor::canvas_tempo_marker_event (GdkEvent *event, ArdourCanvas::Item* item, TempoMarker* marker) { + + if (event->type == GDK_SCROLL) { + + TempoMap& tmap (session()->tempo_map()); + bool handled = false; + double ntpm_adjust = 2.0; + XMLNode* before_state = &tmap.get_state(); + + if (ArdourKeyboard::modifier_state_contains (event->scroll.state, ArdourKeyboard::fine_adjust_modifier())) { + ntpm_adjust /= 10.0; + } + + switch (event->scroll.direction) { + + case GDK_SCROLL_UP: + + if (ArdourKeyboard::indicates_copy (event->scroll.state) && ArdourKeyboard::indicates_constraint (event->scroll.state)) { + tmap.gui_change_tempo (&marker->tempo(), marker->tempo().note_types_per_minute() + ntpm_adjust, false); + handled = true; + } else if (ArdourKeyboard::indicates_copy (event->scroll.state)) { + tmap.gui_change_tempo (&marker->tempo(), marker->tempo().end_note_types_per_minute() + ntpm_adjust,true); + handled = true; + } + + break; + + case GDK_SCROLL_DOWN: + + if (ArdourKeyboard::indicates_copy (event->scroll.state) && ArdourKeyboard::indicates_constraint (event->scroll.state)) { + tmap.gui_change_tempo (&marker->tempo(), marker->tempo().note_types_per_minute() - ntpm_adjust, false); + handled = true; + } else if (ArdourKeyboard::indicates_copy (event->scroll.state)) { + tmap.gui_change_tempo (&marker->tempo(), marker->tempo().end_note_types_per_minute() - ntpm_adjust, true); + handled = true; + } + + break; + + default: + break; + } + + if (handled) { + begin_reversible_command (_("Change Tempo")); + session()->add_command (new MementoCommand(tmap, before_state, &tmap.get_state())); + commit_reversible_command (); + } + + return handled; + } + return typed_event (item, event, TempoMarkerItem); } -- cgit v1.2.3