From 1efd0c06bd7480a72e3084553ccd77d2ce153d66 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 19 Aug 2025 11:29:13 -0600 Subject: [PATCH] move threshold for drags goes back to pair And for now, there's only a single implementation, though other types of drags could implement it if needed. There really seems to be no need. Note that the x-axis threshold is 3x in the case of a copy-drag. --- gtk2_ardour/editor_drag.cc | 12 +++++++++++- gtk2_ardour/editor_drag.h | 32 +++----------------------------- 2 files changed, 14 insertions(+), 30 deletions(-) diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 0955c9c57c..c3a1b8e7f5 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -309,6 +309,16 @@ Drag::~Drag () DEBUG_TRACE (DEBUG::Drags, "drag destroyed\n"); } +Drag::MoveThreshold +Drag::move_threshold () const +{ + int basic_pixels = 4; + int x = _copy ? basic_pixels * 3 : basic_pixels; + int y = basic_pixels; + + return std::make_pair (x, y); +} + void Drag::set_time_domain (Temporal::TimeDomain td) { @@ -504,7 +514,7 @@ Drag::motion_handler (GdkEvent* event, bool from_autoscroll) return false; } - pair const threshold = move_threshold (); + MoveThreshold const threshold = move_threshold (); bool const old_move_threshold_passed = _move_threshold_passed; diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h index 3e00a217d5..9b4881e6b2 100644 --- a/gtk2_ardour/editor_drag.h +++ b/gtk2_ardour/editor_drag.h @@ -222,9 +222,9 @@ public: } /** @return minimum number of samples (in x) and pixels (in y) that should be considered a movement */ - std::pair move_threshold () const { - return std::make_pair (Temporal::timecnt_t (1, Temporal::AudioTime), 1); - } + typedef std::pair MoveThreshold; + + virtual MoveThreshold move_threshold () const; virtual bool allow_vertical_autoscroll () const { return true; @@ -519,10 +519,6 @@ public: return true; } - std::pair move_threshold () const { - return std::make_pair (Temporal::timecnt_t (4, Temporal::AudioTime), 4); - } - void setup_pointer_offset (); private: @@ -684,11 +680,6 @@ private: double y_to_region (double) const; Temporal::Beats round_to_grid (Temporal::timepos_t const & pos, GdkEvent const * event) const; - /** @return minimum number of samples (in x) and pixels (in y) that should be considered a movement */ - std::pair move_threshold () const { - return std::make_pair (Temporal::timecnt_t (0, Temporal::AudioTime), 0); - } - MidiView* _midi_view; ArdourCanvas::Rectangle* _drag_rect; Temporal::timepos_t _note[2]; @@ -716,11 +707,6 @@ public: private: double y_to_region (double) const; - /** @return minimum number of samples (in x) and pixels (in y) that should be considered a movement */ - std::pair move_threshold () const { - return std::make_pair (Temporal::timecnt_t::zero (Temporal::AudioTime), 0); - } - MidiView* _midi_view; Temporal::timepos_t _last_pos; int _y; @@ -1292,10 +1278,6 @@ public: void finished (GdkEvent *, bool); void aborted (bool); - std::pair move_threshold () const { - return std::make_pair (Temporal::timecnt_t (8, Temporal::AudioTime), 1); - } - void do_select_things (GdkEvent *, bool); /** Select some things within a rectangle. @@ -1447,10 +1429,6 @@ public: void finished (GdkEvent *, bool); void aborted (bool); - std::pair move_threshold () const { - return std::make_pair (Temporal::timecnt_t (4, Temporal::AudioTime), 4); - } - private: bool _zoom_out; }; @@ -1512,10 +1490,6 @@ public: return false; } - std::pair move_threshold () const { - return std::make_pair (Temporal::timecnt_t (4, Temporal::AudioTime), 4); - } - private: AudioRegionView* arv; bool start;