mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-06 07:09:39 +02:00
Let's commit to EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
This commit is contained in:
parent
a3b7305386
commit
5944391e24
@ -173,7 +173,6 @@
|
|||||||
// The following enable parts of the scrubbing user interface.
|
// The following enable parts of the scrubbing user interface.
|
||||||
#define EXPERIMENTAL_SCRUBBING_BASIC
|
#define EXPERIMENTAL_SCRUBBING_BASIC
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
|
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
|
||||||
#define EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
|
||||||
#define EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL
|
#define EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -5364,7 +5364,6 @@ void AudacityProject::PlaybackScroller::OnTimer(wxCommandEvent &event)
|
|||||||
// Let other listeners get the notification
|
// Let other listeners get the notification
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
|
||||||
if (mActive && mProject->IsAudioActive())
|
if (mActive && mProject->IsAudioActive())
|
||||||
{
|
{
|
||||||
// Pan the view, so that we center the play indicator.
|
// Pan the view, so that we center the play indicator.
|
||||||
@ -5382,5 +5381,4 @@ void AudacityProject::PlaybackScroller::OnTimer(wxCommandEvent &event)
|
|||||||
viewInfo.h = std::max(0.0, viewInfo.h);
|
viewInfo.h = std::max(0.0, viewInfo.h);
|
||||||
trackPanel->Refresh(false);
|
trackPanel->Refresh(false);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -5472,12 +5472,9 @@ void TrackPanel::HandleWheelRotation(wxMouseEvent & event)
|
|||||||
(event.m_wheelDelta > 0 ? (double)event.m_wheelDelta : 120.0);
|
(event.m_wheelDelta > 0 ? (double)event.m_wheelDelta : 120.0);
|
||||||
|
|
||||||
if (event.ShiftDown()
|
if (event.ShiftDown()
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
|
||||||
// Don't pan during smooth scrolling. That would conflict with keeping
|
// Don't pan during smooth scrolling. That would conflict with keeping
|
||||||
// the play indicator centered.
|
// the play indicator centered.
|
||||||
&& !GetProject()->GetScrubber().IsScrollScrubbing()
|
&& !GetProject()->GetScrubber().IsScrollScrubbing())
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// MM: Scroll left/right when used with Shift key down
|
// MM: Scroll left/right when used with Shift key down
|
||||||
mListener->TP_ScrollWindow(
|
mListener->TP_ScrollWindow(
|
||||||
@ -5506,15 +5503,12 @@ void TrackPanel::HandleWheelRotation(wxMouseEvent & event)
|
|||||||
// Time corresponding to mouse position
|
// Time corresponding to mouse position
|
||||||
wxCoord xx;
|
wxCoord xx;
|
||||||
double center_h;
|
double center_h;
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
|
||||||
if (GetProject()->GetScrubber().IsScrollScrubbing()) {
|
if (GetProject()->GetScrubber().IsScrollScrubbing()) {
|
||||||
// Expand or contract about the center, ignoring mouse position
|
// Expand or contract about the center, ignoring mouse position
|
||||||
center_h = mViewInfo->h + (GetScreenEndTime() - mViewInfo->h) / 2.0;
|
center_h = mViewInfo->h + (GetScreenEndTime() - mViewInfo->h) / 2.0;
|
||||||
xx = mViewInfo->TimeToPosition(center_h, trackLeftEdge);
|
xx = mViewInfo->TimeToPosition(center_h, trackLeftEdge);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
#endif
|
|
||||||
{
|
|
||||||
xx = event.m_x;
|
xx = event.m_x;
|
||||||
center_h = mViewInfo->PositionToTime(xx, trackLeftEdge);
|
center_h = mViewInfo->PositionToTime(xx, trackLeftEdge);
|
||||||
}
|
}
|
||||||
|
@ -188,11 +188,7 @@ namespace {
|
|||||||
|
|
||||||
void Scrubber::MarkScrubStart(
|
void Scrubber::MarkScrubStart(
|
||||||
// Assume xx is relative to the left edge of TrackPanel!
|
// Assume xx is relative to the left edge of TrackPanel!
|
||||||
wxCoord xx
|
wxCoord xx, bool smoothScrolling, bool alwaysSeeking
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
|
||||||
, bool smoothScrolling
|
|
||||||
#endif
|
|
||||||
, bool alwaysSeeking
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UncheckAllMenuItems();
|
UncheckAllMenuItems();
|
||||||
@ -200,9 +196,7 @@ void Scrubber::MarkScrubStart(
|
|||||||
// Don't actually start scrubbing, but collect some information
|
// Don't actually start scrubbing, but collect some information
|
||||||
// needed for the decision to start scrubbing later when handling
|
// needed for the decision to start scrubbing later when handling
|
||||||
// drag events.
|
// drag events.
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
|
||||||
mSmoothScrollingScrub = smoothScrolling;
|
mSmoothScrollingScrub = smoothScrolling;
|
||||||
#endif
|
|
||||||
mAlwaysSeeking = alwaysSeeking;
|
mAlwaysSeeking = alwaysSeeking;
|
||||||
|
|
||||||
ControlToolBar * const ctb = mProject->GetControlToolBar();
|
ControlToolBar * const ctb = mProject->GetControlToolBar();
|
||||||
@ -350,13 +344,11 @@ void Scrubber::ContinueScrubbing()
|
|||||||
// Cause OnTimer() to suppress the speed display
|
// Cause OnTimer() to suppress the speed display
|
||||||
mScrubSpeedDisplayCountdown = 1;
|
mScrubSpeedDisplayCountdown = 1;
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
|
||||||
if (mSmoothScrollingScrub) {
|
if (mSmoothScrollingScrub) {
|
||||||
const double speed = FindScrubSpeed(seek, time);
|
const double speed = FindScrubSpeed(seek, time);
|
||||||
result = gAudioIO->EnqueueScrubBySignedSpeed(speed, mMaxScrubSpeed, seek);
|
result = gAudioIO->EnqueueScrubBySignedSpeed(speed, mMaxScrubSpeed, seek);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
result = gAudioIO->EnqueueScrubByPosition
|
result = gAudioIO->EnqueueScrubByPosition
|
||||||
(time, seek ? 1.0 : mMaxScrubSpeed, seek);
|
(time, seek ? 1.0 : mMaxScrubSpeed, seek);
|
||||||
}
|
}
|
||||||
@ -366,12 +358,9 @@ void Scrubber::ContinueScrubbing()
|
|||||||
// else, if seek requested, try again at a later time when we might
|
// else, if seek requested, try again at a later time when we might
|
||||||
// enqueue a long enough stutter
|
// enqueue a long enough stutter
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
|
||||||
if (mSmoothScrollingScrub)
|
if (mSmoothScrollingScrub)
|
||||||
;
|
;
|
||||||
else
|
else {
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if (mScrubSpeedDisplayCountdown > 0)
|
if (mScrubSpeedDisplayCountdown > 0)
|
||||||
--mScrubSpeedDisplayCountdown;
|
--mScrubSpeedDisplayCountdown;
|
||||||
}
|
}
|
||||||
@ -404,9 +393,7 @@ bool Scrubber::IsScrubbing() const
|
|||||||
else {
|
else {
|
||||||
const_cast<Scrubber&>(*this).mScrubToken = -1;
|
const_cast<Scrubber&>(*this).mScrubToken = -1;
|
||||||
const_cast<Scrubber&>(*this).mScrubStartPosition = -1;
|
const_cast<Scrubber&>(*this).mScrubStartPosition = -1;
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
|
||||||
const_cast<Scrubber&>(*this).mSmoothScrollingScrub = false;
|
const_cast<Scrubber&>(*this).mSmoothScrollingScrub = false;
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -417,10 +404,8 @@ bool Scrubber::ShouldDrawScrubSpeed()
|
|||||||
mScrubHasFocus && (
|
mScrubHasFocus && (
|
||||||
// Draw for (non-scroll) scrub, sometimes, but never for seek
|
// Draw for (non-scroll) scrub, sometimes, but never for seek
|
||||||
(!PollIsSeeking() && mScrubSpeedDisplayCountdown > 0)
|
(!PollIsSeeking() && mScrubSpeedDisplayCountdown > 0)
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
|
||||||
// Draw always for scroll-scrub and for scroll-seek
|
// Draw always for scroll-scrub and for scroll-seek
|
||||||
|| mSmoothScrollingScrub
|
|| mSmoothScrollingScrub
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,9 +427,7 @@ void Scrubber::HandleScrollWheel(int steps)
|
|||||||
newSpeed <= AudioIO::GetMaxScrubSpeed()) {
|
newSpeed <= AudioIO::GetMaxScrubSpeed()) {
|
||||||
mLogMaxScrubSpeed = newLogMaxScrubSpeed;
|
mLogMaxScrubSpeed = newLogMaxScrubSpeed;
|
||||||
mMaxScrubSpeed = newSpeed;
|
mMaxScrubSpeed = newSpeed;
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
|
||||||
if (!mSmoothScrollingScrub)
|
if (!mSmoothScrollingScrub)
|
||||||
#endif
|
|
||||||
// Show the speed for one second
|
// Show the speed for one second
|
||||||
mScrubSpeedDisplayCountdown = kOneSecondCountdown + 1;
|
mScrubSpeedDisplayCountdown = kOneSecondCountdown + 1;
|
||||||
}
|
}
|
||||||
@ -539,11 +522,9 @@ void ScrubbingOverlay::Draw(OverlayPanel &, wxDC &dc)
|
|||||||
// (b) Error alerts
|
// (b) Error alerts
|
||||||
// So they were changed to 'orange' and 'lime'.
|
// So they were changed to 'orange' and 'lime'.
|
||||||
static const wxColour clrNoScroll(215, 162, 0), clrScroll(0, 204, 153);
|
static const wxColour clrNoScroll(215, 162, 0), clrScroll(0, 204, 153);
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
|
||||||
if (scrubber.IsScrollScrubbing())
|
if (scrubber.IsScrollScrubbing())
|
||||||
dc.SetTextForeground(clrScroll);
|
dc.SetTextForeground(clrScroll);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
dc.SetTextForeground(clrNoScroll);
|
dc.SetTextForeground(clrNoScroll);
|
||||||
|
|
||||||
dc.DrawText(mLastScrubSpeedText, mLastScrubRect.GetX(), mLastScrubRect.GetY());
|
dc.DrawText(mLastScrubSpeedText, mLastScrubRect.GetX(), mLastScrubRect.GetY());
|
||||||
@ -598,23 +579,17 @@ void ScrubbingOverlay::OnTimer(wxCommandEvent &event)
|
|||||||
// Find the text
|
// Find the text
|
||||||
const double maxScrubSpeed = GetScrubber().GetMaxScrubSpeed();
|
const double maxScrubSpeed = GetScrubber().GetMaxScrubSpeed();
|
||||||
const double speed =
|
const double speed =
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
|
||||||
scrubber.IsScrollScrubbing()
|
scrubber.IsScrollScrubbing()
|
||||||
? scrubber.FindScrubSpeed
|
? scrubber.FindScrubSpeed
|
||||||
(seeking, mProject->GetViewInfo().PositionToTime(position.x, trackPanel->GetLeftOffset()))
|
(seeking, mProject->GetViewInfo().PositionToTime(position.x, trackPanel->GetLeftOffset()))
|
||||||
:
|
: maxScrubSpeed;
|
||||||
#endif
|
|
||||||
maxScrubSpeed;
|
|
||||||
|
|
||||||
const wxChar *format =
|
const wxChar *format =
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
|
||||||
scrubber.IsScrollScrubbing()
|
scrubber.IsScrollScrubbing()
|
||||||
? seeking
|
? seeking
|
||||||
? wxT("%+.2fX")
|
? wxT("%+.2fX")
|
||||||
: wxT("%+.2f")
|
: wxT("%+.2f")
|
||||||
:
|
: wxT("%.2f");
|
||||||
#endif
|
|
||||||
wxT("%.2f");
|
|
||||||
|
|
||||||
mNextScrubSpeedText = wxString::Format(format, speed);
|
mNextScrubSpeedText = wxString::Format(format, speed);
|
||||||
|
|
||||||
|
@ -29,11 +29,8 @@ public:
|
|||||||
|
|
||||||
// Assume xx is relative to the left edge of TrackPanel!
|
// Assume xx is relative to the left edge of TrackPanel!
|
||||||
void MarkScrubStart(
|
void MarkScrubStart(
|
||||||
wxCoord xx
|
wxCoord xx, bool smoothScrolling,
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
bool alwaysSeeking // if false, can switch seeking or scrubbing
|
||||||
, bool smoothScrolling
|
|
||||||
#endif
|
|
||||||
, bool alwaysSeeking // if false, can switch seeking or scrubbing
|
|
||||||
// by mouse button state
|
// by mouse button state
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user