summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_drag.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-05-08 03:03:12 +1000
committernick_m <mainsbridge@gmail.com>2016-05-27 23:38:16 +1000
commit86b0268e8be554e9286aebd544757fc13fe76dac (patch)
tree959f2fb0dbe33a738e15caf8186a56a58beace56 /gtk2_ardour/editor_drag.cc
parent652a59b3178b0d0905f8d9610500a71f0924edc0 (diff)
Tempo ramps - add visualtempo curve, dragging bbt or music rulers with constraint modifier dilates previous tempo.
Diffstat (limited to 'gtk2_ardour/editor_drag.cc')
-rw-r--r--gtk2_ardour/editor_drag.cc63
1 files changed, 63 insertions, 0 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index a686789253..52b5ab6d1a 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -3476,6 +3476,69 @@ TempoMarkerDrag::aborted (bool moved)
}
}
+BBTRulerDrag::BBTRulerDrag (Editor* e, ArdourCanvas::Item* i)
+ : Drag (e, i)
+ , before_state (0)
+{
+ DEBUG_TRACE (DEBUG::Drags, "New BBTRulerDrag\n");
+
+}
+
+void
+BBTRulerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
+{
+ Drag::start_grab (event, cursor);
+ show_verbose_cursor_time (adjusted_current_frame (event));
+}
+
+void
+BBTRulerDrag::setup_pointer_frame_offset ()
+{
+ _pointer_frame_offset = 0;
+}
+
+void
+BBTRulerDrag::motion (GdkEvent* event, bool first_move)
+{
+ if (first_move) {
+ TempoMap& map (_editor->session()->tempo_map());
+ /* get current state */
+ before_state = &map.get_state();
+ _editor->begin_reversible_command (_("dilate tempo"));
+ }
+
+ framepos_t const pf = adjusted_current_frame (event, false);
+
+ if (Keyboard::modifier_state_contains (event->button.state, ArdourKeyboard::constraint_modifier())) {
+ /* adjust previous tempo to match pointer frame */
+ _editor->session()->tempo_map().gui_dilate_tempo (last_pointer_frame(), pf);
+ }
+ show_verbose_cursor_time (pf);
+}
+
+void
+BBTRulerDrag::finished (GdkEvent* event, bool movement_occurred)
+{
+ if (!movement_occurred) {
+ return;
+ }
+
+ TempoMap& map (_editor->session()->tempo_map());
+
+ XMLNode &after = map.get_state();
+ _editor->session()->add_command(new MementoCommand<TempoMap>(map, before_state, &after));
+ _editor->commit_reversible_command ();
+}
+
+void
+BBTRulerDrag::aborted (bool moved)
+{
+ if (moved) {
+ _editor->session()->tempo_map().set_state (*before_state, Stateful::current_state_version);
+ }
+}
+
+
CursorDrag::CursorDrag (Editor* e, EditorCursor& c, bool s)
: Drag (e, &c.track_canvas_item(), false)
, _cursor (c)