move threshold for drags goes back to pair<int,int>

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.
This commit is contained in:
Paul Davis 2025-08-19 11:29:13 -06:00
parent f34e314d93
commit 1efd0c06bd
2 changed files with 14 additions and 30 deletions

View file

@ -309,6 +309,16 @@ Drag::~Drag ()
DEBUG_TRACE (DEBUG::Drags, "drag destroyed\n"); 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 void
Drag::set_time_domain (Temporal::TimeDomain td) Drag::set_time_domain (Temporal::TimeDomain td)
{ {
@ -504,7 +514,7 @@ Drag::motion_handler (GdkEvent* event, bool from_autoscroll)
return false; return false;
} }
pair<timecnt_t, int> const threshold = move_threshold (); MoveThreshold const threshold = move_threshold ();
bool const old_move_threshold_passed = _move_threshold_passed; bool const old_move_threshold_passed = _move_threshold_passed;

View file

@ -222,9 +222,9 @@ public:
} }
/** @return minimum number of samples (in x) and pixels (in y) that should be considered a movement */ /** @return minimum number of samples (in x) and pixels (in y) that should be considered a movement */
std::pair<Temporal::timecnt_t,int> move_threshold () const { typedef std::pair<int,int> MoveThreshold;
return std::make_pair (Temporal::timecnt_t (1, Temporal::AudioTime), 1);
} virtual MoveThreshold move_threshold () const;
virtual bool allow_vertical_autoscroll () const { virtual bool allow_vertical_autoscroll () const {
return true; return true;
@ -519,10 +519,6 @@ public:
return true; return true;
} }
std::pair<Temporal::timecnt_t,int> move_threshold () const {
return std::make_pair (Temporal::timecnt_t (4, Temporal::AudioTime), 4);
}
void setup_pointer_offset (); void setup_pointer_offset ();
private: private:
@ -684,11 +680,6 @@ private:
double y_to_region (double) const; double y_to_region (double) const;
Temporal::Beats round_to_grid (Temporal::timepos_t const & pos, GdkEvent const * event) 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<Temporal::timecnt_t,int> move_threshold () const {
return std::make_pair (Temporal::timecnt_t (0, Temporal::AudioTime), 0);
}
MidiView* _midi_view; MidiView* _midi_view;
ArdourCanvas::Rectangle* _drag_rect; ArdourCanvas::Rectangle* _drag_rect;
Temporal::timepos_t _note[2]; Temporal::timepos_t _note[2];
@ -716,11 +707,6 @@ public:
private: private:
double y_to_region (double) const; 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<Temporal::timecnt_t,int> move_threshold () const {
return std::make_pair (Temporal::timecnt_t::zero (Temporal::AudioTime), 0);
}
MidiView* _midi_view; MidiView* _midi_view;
Temporal::timepos_t _last_pos; Temporal::timepos_t _last_pos;
int _y; int _y;
@ -1292,10 +1278,6 @@ public:
void finished (GdkEvent *, bool); void finished (GdkEvent *, bool);
void aborted (bool); void aborted (bool);
std::pair<Temporal::timecnt_t,int> move_threshold () const {
return std::make_pair (Temporal::timecnt_t (8, Temporal::AudioTime), 1);
}
void do_select_things (GdkEvent *, bool); void do_select_things (GdkEvent *, bool);
/** Select some things within a rectangle. /** Select some things within a rectangle.
@ -1447,10 +1429,6 @@ public:
void finished (GdkEvent *, bool); void finished (GdkEvent *, bool);
void aborted (bool); void aborted (bool);
std::pair<Temporal::timecnt_t,int> move_threshold () const {
return std::make_pair (Temporal::timecnt_t (4, Temporal::AudioTime), 4);
}
private: private:
bool _zoom_out; bool _zoom_out;
}; };
@ -1512,10 +1490,6 @@ public:
return false; return false;
} }
std::pair<Temporal::timecnt_t,int> move_threshold () const {
return std::make_pair (Temporal::timecnt_t (4, Temporal::AudioTime), 4);
}
private: private:
AudioRegionView* arv; AudioRegionView* arv;
bool start; bool start;