diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 56826a79bd..f64910fe25 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -3596,137 +3596,6 @@ MappingLinearDrag::aborted (bool /* moved */) /******************************************************************************/ -MappingStretchDrag::MappingStretchDrag (Editor* e, ArdourCanvas::Item* i, Temporal::TempoMap::WritableSharedPtr& wmap, Temporal::TempoPoint& focus, XMLNode& before) - : Drag (e, i, Temporal::BeatTime) - , _focus (focus) - , map (wmap) - , direction (0.) - , delta (0.) - , _before_state (before) - , _drag_valid (true) -{ - DEBUG_TRACE (DEBUG::Drags, "New MappingStretchDrag\n"); -} - -void -MappingStretchDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) -{ - Drag::start_grab (event, cursor); - - stringstream sstr; - - sstr << "start: " << fixed << setprecision(3) << _focus.note_types_per_minute(); - show_verbose_cursor_text (sstr.str()); - initial_npm = _focus.note_types_per_minute(); -} - -void -MappingStretchDrag::setup_pointer_offset () -{ - Beats grab_qn = max (Beats(), raw_grab_time().beats()); - - uint32_t divisions = _editor->get_grid_beat_divisions (_editor->grid_type()); - - if (divisions == 0) { - divisions = 4; - } - - grab_qn = grab_qn.round_to_subdivision (divisions, Temporal::RoundDownAlways); - _pointer_offset = timepos_t (grab_qn).distance (raw_grab_time()); -} - -void -MappingStretchDrag::motion (GdkEvent* event, bool first_move) -{ - if (!_drag_valid) { - return; - } - - if (_drags->current_pointer_x() < last_pointer_x()) { - if (direction < 0.) { - direction = 1.; - initial_npm += delta; - std::cerr << "!!!!! RESET INTIIAL to " << initial_npm << std::endl; - delta = 0.; - } - } else { - if (direction >= 0.) { - direction = -1.; - initial_npm += delta; - std::cerr << "!!!!! RESET INTIIAL 2 to " << initial_npm << std::endl; - delta = 0.; - } - } - - - if (_drags->current_pointer_time() >= timepos_t::from_superclock (_focus.sclock())) { - std::cerr << "nope\n"; - return; - } - - // if (_drags->current_pointer_time() <= timepos_t::from_superclock (prev.sclock())) { - // return; - // } - - /* XXX needs to scale somehow with zoom level */ - - delta += 0.5 * (last_pointer_x() - _drags->current_pointer_x()); - - double new_npm = initial_npm + delta; - - if (new_npm < 8 || new_npm > 300) { - return; - } - - if (new_npm < 8 || new_npm > 300) { - return; - } - - std::cerr << "new tempo value will be " << initial_npm << " + " << delta << " = " << new_npm << std::endl; - - map->stretch_tempo (_focus, new_npm); - _editor->mid_tempo_change (Editor::MappingChanged); -} - -void -MappingStretchDrag::finished (GdkEvent* event, bool movement_occurred) -{ - if (!movement_occurred) { - - /* click, no drag */ - - _editor->abort_tempo_mapping (); - _editor->session()->request_locate (grab_sample(), false, _was_rolling ? MustRoll : RollIfAppropriate); - return; - } - - if (!_drag_valid) { - _editor->abort_tempo_mapping (); - return; - } - - XMLNode &after = map->get_state(); - - _editor->session()->add_command (new Temporal::TempoCommand (_("tempo conform/stretch"), &_before_state, &after)); - _editor->commit_reversible_command (); - - /* 2nd argument means "update tempo map display after the new map is - * installed. We need to do this because the code above has not - * actually changed anything about how tempo is displayed, it simply - * modified the map. - */ - - _editor->commit_tempo_mapping (map); -} - -void -MappingStretchDrag::aborted (bool moved) -{ - _editor->abort_tempo_mapping (); -} - -/******************************************************************************/ - MappingTwistDrag::MappingTwistDrag (Editor* e, ArdourCanvas::Item* i, Temporal::TempoMap::WritableSharedPtr& wmap, TempoPoint& prv, TempoPoint& fcus, diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h index c203ec48ed..0816c78655 100644 --- a/gtk2_ardour/editor_drag.h +++ b/gtk2_ardour/editor_drag.h @@ -942,38 +942,6 @@ private: bool _drag_valid; }; -class MappingStretchDrag : public Drag -{ -public: - MappingStretchDrag (Editor *, ArdourCanvas::Item *, Temporal::TempoMap::WritableSharedPtr&, Temporal::TempoPoint&, XMLNode&); - - void start_grab (GdkEvent *, Gdk::Cursor* c = 0); - void motion (GdkEvent *, bool); - void finished (GdkEvent *, bool); - void aborted (bool); - - bool allow_vertical_autoscroll () const { - return false; - } - - bool y_movement_matters () const { - return false; - } - - void setup_pointer_offset (); - -private: - Temporal::TempoPoint& _focus; - Temporal::TempoMap::WritableSharedPtr map; - - double direction; - double delta; - double initial_npm; - - XMLNode& _before_state; - bool _drag_valid; -}; - class MappingTwistDrag : public Drag { public: