1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-18 17:10:05 +02:00

Revert "Bug990 (seek key reponsiveness), and, change Scrub UI again, so Ctrl key seeks."

This reverts commit 841bca36ea321e6ea92578dd6668bc4011f1d30b.
This commit is contained in:
Paul Licameli 2015-05-29 19:45:43 -04:00
parent 841bca36ea
commit 9f2dfbc70b
4 changed files with 13 additions and 38 deletions

View File

@ -608,7 +608,6 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
mMaxScrubSpeed = 1.0; mMaxScrubSpeed = 1.0;
mScrubSpeedDisplayCountdown = 0; mScrubSpeedDisplayCountdown = 0;
mScrubHasFocus = false; mScrubHasFocus = false;
mScrubSeekKeypress = false;
#endif #endif
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL #ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
@ -1034,21 +1033,12 @@ void TrackPanel::OnTimer()
// Call ContinueScrubbing() here rather than in SelectionHandleDrag() // Call ContinueScrubbing() here rather than in SelectionHandleDrag()
// so that even without drag events, we can instruct the play head to // so that even without drag events, we can instruct the play head to
// keep approaching the mouse cursor, when its maximum speed is limited. // keep approaching the mouse cursor, when its maximum speed is limited.
// Thus scrubbing relies mostly on periodic polling of mouse and keys,
// not event notifications. But there are a few event handlers that
// leave messages for this routine, in mScrubSeekKeypress and in mScrubHasFocus.
if (IsScrubbing()) if (IsScrubbing())
{ {
wxCoord position = ::wxGetMouseState().GetX(); wxMouseState state = ::wxGetMouseState();
// Detect key state here, or use the record of key transition wxCoord position = state.GetX();
// made elsewhere.
const bool seek = mScrubSeekKeypress || IsScrubSeekKeyDown();
ScreenToClient(&position, NULL); ScreenToClient(&position, NULL);
if (ContinueScrubbing(position, mScrubHasFocus, seek)) ContinueScrubbing(position, state.ShiftDown());
// Successfully enqueued one stutter
mScrubSeekKeypress = false;
// else if seeking, try again at the next round.
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL #ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
if (mSmoothScrollingScrub) if (mSmoothScrollingScrub)
@ -1637,14 +1627,6 @@ void TrackPanel::HandleShiftKey(bool down)
void TrackPanel::HandleControlKey(bool down) void TrackPanel::HandleControlKey(bool down)
{ {
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
// Scrubbing is mostly not event driven, it uses periodic polling and tests
// key state. But it might otherwise miss a fast keypress and release,
// so this is not redundant:
if (down && IsScrubbing())
mScrubSeekKeypress = true;
#endif
mLastMouseEvent.m_controlDown = down; mLastMouseEvent.m_controlDown = down;
HandleCursorForLastMouseEvent(); HandleCursorForLastMouseEvent();
} }
@ -2323,11 +2305,6 @@ double TrackPanel::FindScrubSpeed(double timeAtMouse) const
#endif #endif
#ifdef EXPERIMENTAL_SCRUBBING_BASIC #ifdef EXPERIMENTAL_SCRUBBING_BASIC
bool TrackPanel::IsScrubSeekKeyDown()
{
return ::wxGetMouseState().CmdDown();
}
bool TrackPanel::IsScrubbing() bool TrackPanel::IsScrubbing()
{ {
if (mScrubToken <= 0) if (mScrubToken <= 0)
@ -2434,10 +2411,10 @@ bool TrackPanel::MaybeStartScrubbing(wxMouseEvent &event)
return false; return false;
} }
bool TrackPanel::ContinueScrubbing(wxCoord position, bool hasFocus, bool maySkip) bool TrackPanel::ContinueScrubbing(wxCoord position, bool maySkip)
{ {
// When we don't have focus, enqueue silent scrubs until we regain focus. // When we don't have focus, enqueue silent scrubs until we regain focus.
if (!hasFocus) if (!mScrubHasFocus)
return gAudioIO->EnqueueScrubBySignedSpeed(0, mMaxScrubSpeed, maySkip); return gAudioIO->EnqueueScrubBySignedSpeed(0, mMaxScrubSpeed, maySkip);
const double newEnd = PositionToTime(position, GetLeftOffset()); const double newEnd = PositionToTime(position, GetLeftOffset());
@ -7397,7 +7374,7 @@ void TrackPanel::DrawScrubSpeed(wxDC &dc)
return; return;
// Don't draw it during stutter play with shift down // Don't draw it during stutter play with shift down
if (!IsScrubSeekKeyDown() && ( if (!::wxGetMouseState().ShiftDown() && (
mScrubSpeedDisplayCountdown > 0 mScrubSpeedDisplayCountdown > 0

View File

@ -305,7 +305,6 @@ class AUDACITY_DLL_API TrackPanel:public wxPanel {
#endif #endif
#ifdef EXPERIMENTAL_SCRUBBING_BASIC #ifdef EXPERIMENTAL_SCRUBBING_BASIC
static bool IsScrubSeekKeyDown();
bool IsScrubbing(); bool IsScrubbing();
void ToggleScrubbing( void ToggleScrubbing(
wxCoord xx wxCoord xx
@ -314,7 +313,7 @@ class AUDACITY_DLL_API TrackPanel:public wxPanel {
#endif #endif
); );
bool MaybeStartScrubbing(wxMouseEvent &event); bool MaybeStartScrubbing(wxMouseEvent &event);
bool ContinueScrubbing(wxCoord position, bool hasFocus, bool maySkip); bool ContinueScrubbing(wxCoord position, bool maySkip);
bool StopScrubbing(); bool StopScrubbing();
#endif #endif
@ -782,8 +781,7 @@ protected:
wxCoord mScrubStartPosition; wxCoord mScrubStartPosition;
double mMaxScrubSpeed; double mMaxScrubSpeed;
int mScrubSpeedDisplayCountdown; int mScrubSpeedDisplayCountdown;
bool mScrubHasFocus; // To do: rely on wxWindow::HasFocus() instead, wx verions 2.9.0+ bool mScrubHasFocus;
bool mScrubSeekKeypress;
#endif #endif
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL #ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL

View File

@ -105,11 +105,11 @@ void MousePrefs::CreateList()
AddItem(_("Shift-Left-Click"), _("Select"), _("Extend Selection Range")); AddItem(_("Shift-Left-Click"), _("Select"), _("Extend Selection Range"));
AddItem(_("Left-Double-Click"), _("Select"), _("Select Clip or Entire Track")); AddItem(_("Left-Double-Click"), _("Select"), _("Select Clip or Entire Track"));
#ifdef EXPERIMENTAL_SCRUBBING_BASIC #ifdef EXPERIMENTAL_SCRUBBING_BASIC
AddItem(_("Ctrl-Left-Click"), _("Select"), _("Scrub")); AddItem(_("Ctrl-Left-Click"), _("Select"), _("Scrub"));
AddItem(_("Ctrl"), _("Select"), _("Seek (while scrubbing)")); AddItem(_("Shift-Ctrl-Left-Click"), _("Select"), _("Seek"));
#endif #endif
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL #ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
AddItem(_("Ctrl-Left-Double-Click"), _("Select"), _("Scroll-Scrub")); AddItem(_("Ctrl-Left-Double-Click"), _("Select"), _("Smooth Scrolling Scrub"));
AddItem(_("Wheel-Rotate"), _("Select"), _("Change scrub speed")); AddItem(_("Wheel-Rotate"), _("Select"), _("Change scrub speed"));
#endif #endif

View File

@ -85,9 +85,9 @@ ToolsToolBar::ToolsToolBar()
mMessageOfTool[selectTool] = mMessageOfTool[selectTool] =
#if defined(__WXMAC__) #if defined(__WXMAC__)
_("Click and drag to select audio, Command-Click to scrub, Command-Double-Click to scroll-scrub, Command to seek while scrubbing") _("Click and drag to select audio, Command-Click and drag to scrub, Shift-Command-Click and drag to seek")
#else #else
_("Click and drag to select audio, Ctrl-Click to scrub, Ctrl-Double-Click to scroll-scrub, Ctrl to seek while scrubbing") _("Click and drag to select audio, Ctrl-Click and drag to scrub, Shift-Ctrl-Click and drag to seek")
#endif #endif
; ;