Always pass ViewInfo to TrackShiftHandle::HitTest

This commit is contained in:
Paul Licameli 2020-09-19 22:04:34 -04:00
parent 637ce894c1
commit f204ee3192
5 changed files with 10 additions and 6 deletions

View File

@ -643,7 +643,8 @@ double DoClipMove( AudacityProject &project, Track *track,
// Find the first channel that has a clip at time t0
for (auto channel : TrackList::Channels(track) ) {
uShifter = MakeTrackShifter::Call( *track, project );
if( uShifter->HitTest( t0 ) == TrackShifter::HitTestResult::Miss )
if ( uShifter->HitTest( t0, viewInfo ) ==
TrackShifter::HitTestResult::Miss )
uShifter.reset();
else
break;

View File

@ -742,7 +742,7 @@ public:
~NoteTrackShifter() override {}
Track &GetTrack() const override { return *mpTrack; }
HitTestResult HitTest( double, HitTestParams* ) override
HitTestResult HitTest( double, const ViewInfo&, HitTestParams* ) override
{
return HitTestResult::Intervals;
}

View File

@ -1314,7 +1314,8 @@ public:
~WaveTrackShifter() override {}
Track &GetTrack() const override { return *mpTrack; }
HitTestResult HitTest( double time, HitTestParams* ) override
HitTestResult HitTest(
double time, const ViewInfo&, HitTestParams* ) override
{
auto pClip = mpTrack->GetClipAtTime( time );

View File

@ -241,7 +241,8 @@ CoarseTrackShifter::CoarseTrackShifter( Track &track )
CoarseTrackShifter::~CoarseTrackShifter() = default;
auto CoarseTrackShifter::HitTest( double, HitTestParams* ) -> HitTestResult
auto CoarseTrackShifter::HitTest(
double, const ViewInfo&, HitTestParams* ) -> HitTestResult
{
return HitTestResult::Track;
}
@ -466,7 +467,7 @@ UIHandle::Result TimeShiftHandle::Click
TrackShifter::HitTestParams params{
rect, event.m_x, event.m_y
};
switch( pShifter->HitTest( clickTime, &params ) ) {
switch( pShifter->HitTest( clickTime, viewInfo, &params ) ) {
case TrackShifter::HitTestResult::Miss:
return Cancelled;
case TrackShifter::HitTestResult::Intervals: {

View File

@ -54,6 +54,7 @@ public:
*/
virtual HitTestResult HitTest(
double time, //!< A time value to test
const ViewInfo &viewInfo,
HitTestParams *pParams = nullptr //!< Optional extra information
) = 0;
@ -172,7 +173,7 @@ public:
~CoarseTrackShifter() override;
Track &GetTrack() const override { return *mpTrack; }
HitTestResult HitTest( double, HitTestParams* ) override;
HitTestResult HitTest( double, const ViewInfo&, HitTestParams* ) override;
//! Returns false
bool SyncLocks() override;