1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-30 15:18:42 +02:00

Improve responsiveness of drag seek during click-scrub...

.. by refreshing the TrackPanel window less often.
This commit is contained in:
Paul Licameli 2016-05-23 18:38:38 -04:00
commit 74c8dcf8d3
3 changed files with 28 additions and 1 deletions

View File

@ -256,6 +256,19 @@ private:
} }
#endif #endif
friend inline bool operator ==
(const SelectedRegion &lhs, const SelectedRegion &rhs)
{
return
lhs.mT0 == rhs.mT0
&& lhs.mT1 == rhs.mT1
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
&& lhs.mF0 == rhs.mF0
&& lhs.mF1 == rhs.mF1
#endif
;
}
double mT0; double mT0;
double mT1; double mT1;
#ifdef EXPERIMENTAL_SPECTRAL_EDITING #ifdef EXPERIMENTAL_SPECTRAL_EDITING
@ -265,4 +278,9 @@ private:
}; };
inline bool operator != (const SelectedRegion &lhs, const SelectedRegion &rhs)
{
return !(lhs == rhs);
}
#endif #endif

View File

@ -944,6 +944,9 @@ void TrackPanel::OnTimer(wxTimerEvent& )
//ANSWER-ME: Was DisplaySelection added to solve a repaint problem? //ANSWER-ME: Was DisplaySelection added to solve a repaint problem?
DisplaySelection(); DisplaySelection();
} }
if (mLastDrawnSelectedRegion != mViewInfo->selectedRegion) {
UpdateSelectionDisplay();
}
// Notify listeners for timer ticks // Notify listeners for timer ticks
{ {
@ -1045,6 +1048,8 @@ double TrackPanel::GetScreenEndTime() const
/// completing a repaint operation. /// completing a repaint operation.
void TrackPanel::OnPaint(wxPaintEvent & /* event */) void TrackPanel::OnPaint(wxPaintEvent & /* event */)
{ {
mLastDrawnSelectedRegion = mViewInfo->selectedRegion;
#if DEBUG_DRAW_TIMING #if DEBUG_DRAW_TIMING
wxStopWatch sw; wxStopWatch sw;
#endif #endif
@ -2764,7 +2769,9 @@ void TrackPanel::SelectionHandleDrag(wxMouseEvent & event, Track *clickedTrack)
#endif #endif
ExtendSelection(x, rect.x, clickedTrack); ExtendSelection(x, rect.x, clickedTrack);
UpdateSelectionDisplay(); // Don't do this at every mouse event, because it slows down seek-scrub.
// Instead, let OnTimer do it, which is often enough.
// UpdateSelectionDisplay();
} }
#ifdef EXPERIMENTAL_SPECTRAL_EDITING #ifdef EXPERIMENTAL_SPECTRAL_EDITING

View File

@ -790,6 +790,8 @@ protected:
// The screenshot class needs to access internals // The screenshot class needs to access internals
friend class ScreenshotCommand; friend class ScreenshotCommand;
SelectedRegion mLastDrawnSelectedRegion {};
public: public:
wxSize vrulerSize; wxSize vrulerSize;