clamp setting tempo via vertical drag.
authornick_m <mainsbridge@gmail.com>
Mon, 31 Oct 2016 13:40:05 +0000 (00:40 +1100)
committernick_m <mainsbridge@gmail.com>
Thu, 10 Nov 2016 16:37:08 +0000 (03:37 +1100)
- a bit suboptimal. we really need the opposite of _trackview_only
  to prevent jumping to track canvas scrolled coordinates in the first place.

gtk2_ardour/editor_drag.cc
gtk2_ardour/editor_drag.h

index c4ca3a1ca6448dcb6dd04017d28d2f9d3d9ae311..048aa5077248f93969505454e5424403328f9cfb 100644 (file)
@@ -3271,6 +3271,7 @@ MeterMarkerDrag::aborted (bool moved)
 TempoMarkerDrag::TempoMarkerDrag (Editor* e, ArdourCanvas::Item* i, bool c)
        : Drag (e, i)
        , _copy (c)
+       , _grab_bpm (0.0)
        , before_state (0)
 {
        DEBUG_TRACE (DEBUG::Drags, "New TempoMarkerDrag\n");
@@ -3278,6 +3279,7 @@ TempoMarkerDrag::TempoMarkerDrag (Editor* e, ArdourCanvas::Item* i, bool c)
        _marker = reinterpret_cast<TempoMarker*> (_item->get_data ("marker"));
        _real_section = &_marker->tempo();
        _movable = _real_section->movable();
+       _grab_bpm = _real_section->beats_per_minute();
        assert (_marker);
 }
 
@@ -3357,9 +3359,8 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
 
        if (ArdourKeyboard::indicates_constraint (event->button.state)) {
                /* use vertical movement to alter tempo .. should be log */
-               double new_bpm = _real_section->beats_per_minute() + ((last_pointer_y() - current_pointer_y()) / 5.0);
+               double new_bpm = max (1.5, _grab_bpm + ((grab_y() - min (-1.0, current_pointer_y())) / 5.0));
                stringstream strs;
-
                _editor->session()->tempo_map().gui_change_tempo (_real_section, Tempo (new_bpm, _real_section->note_type()));
                strs << new_bpm;
                show_verbose_cursor_text (strs.str());
index a3e17bfaf916cdcfad781cbd3ae7033e2d9935ee..2976b55bdb7202479b3094ffed368510fd6db372 100644 (file)
@@ -745,6 +745,7 @@ private:
 
        bool _copy;
        bool _movable;
+       double _grab_bpm;
        XMLNode* before_state;
 };