1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-11 09:31:13 +02:00

Changed misleading terminology in scrubber...

... It was confusing that HasStartedScrubbing() could be true
while also not IsScrubbing()
This commit is contained in:
Paul Licameli 2018-07-29 14:11:17 -04:00
parent b33d3516f0
commit 5f27ae905c
8 changed files with 19 additions and 19 deletions

View File

@ -1676,7 +1676,7 @@ void AudacityApp::OnKeyDown(wxKeyEvent &event)
auto project = ::GetActiveProject(); auto project = ::GetActiveProject();
auto token = project->GetAudioIOToken(); auto token = project->GetAudioIOToken();
auto &scrubber = project->GetScrubber(); auto &scrubber = project->GetScrubber();
auto scrubbing = scrubber.HasStartedScrubbing(); auto scrubbing = scrubber.HasMark();
if (scrubbing) if (scrubbing)
scrubber.Cancel(); scrubber.Cancel();
if((token > 0 && if((token > 0 &&

View File

@ -2922,7 +2922,7 @@ bool AudacityProject::DoPlayStopSelect(bool click, bool shift)
ControlToolBar *toolbar = GetControlToolBar(); ControlToolBar *toolbar = GetControlToolBar();
//If busy, stop playing, make sure everything is unpaused. //If busy, stop playing, make sure everything is unpaused.
if (GetScrubber().HasStartedScrubbing() || if (GetScrubber().HasMark() ||
gAudioIO->IsStreamActive(GetAudioIOToken())) { gAudioIO->IsStreamActive(GetAudioIOToken())) {
toolbar->SetPlay(false); //Pops toolbar->SetPlay(false); //Pops
toolbar->SetStop(true); //Pushes stop down toolbar->SetStop(true); //Pushes stop down
@ -3007,7 +3007,7 @@ void AudacityProject::OnTogglePinnedHead(const CommandContext &WXUNUSED(context)
ruler->UpdateButtonStates(); ruler->UpdateButtonStates();
auto &scrubber = GetScrubber(); auto &scrubber = GetScrubber();
if (scrubber.HasStartedScrubbing()) if (scrubber.HasMark())
scrubber.SetScrollScrubbing(value); scrubber.SetScrollScrubbing(value);
} }

View File

@ -1801,7 +1801,7 @@ bool AudacityProject::MayScrollBeyondZero() const
if (mViewInfo.bScrollBeyondZero) if (mViewInfo.bScrollBeyondZero)
return true; return true;
if (GetScrubber().HasStartedScrubbing() || if (GetScrubber().HasMark() ||
IsAudioActive()) { IsAudioActive()) {
if (mPlaybackScroller) { if (mPlaybackScroller) {
auto mode = mPlaybackScroller->GetMode(); auto mode = mPlaybackScroller->GetMode();

View File

@ -1496,7 +1496,7 @@ void ControlToolBar::StartScrollingIfPreferred()
if (TracksPrefs::GetPinnedHeadPreference()) if (TracksPrefs::GetPinnedHeadPreference())
StartScrolling(); StartScrolling();
#ifdef __WXMAC__ #ifdef __WXMAC__
else if (::GetActiveProject()->GetScrubber().HasStartedScrubbing()) { else if (::GetActiveProject()->GetScrubber().HasMark()) {
// PRL: cause many "unnecessary" refreshes. For reasons I don't understand, // PRL: cause many "unnecessary" refreshes. For reasons I don't understand,
// doing this causes wheel rotation events (mapped from the double finger vertical // doing this causes wheel rotation events (mapped from the double finger vertical
// swipe) to be delivered more uniformly to the application, so that speed control // swipe) to be delivered more uniformly to the application, so that speed control

View File

@ -137,7 +137,7 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
if (!mProject->IsAudioActive()) { if (!mProject->IsAudioActive()) {
mNewIndicatorX = -1; mNewIndicatorX = -1;
const auto &scrubber = mProject->GetScrubber(); const auto &scrubber = mProject->GetScrubber();
if (scrubber.HasStartedScrubbing()) { if (scrubber.HasMark()) {
auto position = scrubber.GetScrubStartPosition(); auto position = scrubber.GetScrubStartPosition();
int width; int width;
trackPanel->GetTracksUsableArea(&width, nullptr); trackPanel->GetTracksUsableArea(&width, nullptr);

View File

@ -636,7 +636,7 @@ void Scrubber::StopScrubbing()
mPoller->Stop(); mPoller->Stop();
if (HasStartedScrubbing() && !mCancelled) { if (HasMark() && !mCancelled) {
const wxMouseState state(::wxGetMouseState()); const wxMouseState state(::wxGetMouseState());
// Stop and set cursor // Stop and set cursor
bool bShift = state.ShiftDown(); bool bShift = state.ShiftDown();
@ -719,14 +719,14 @@ bool Scrubber::TemporarilySeeks() const
bool Scrubber::Seeks() const bool Scrubber::Seeks() const
{ {
return (HasStartedScrubbing() || IsScrubbing()) && ChoseSeeking(); return (HasMark() || IsScrubbing()) && ChoseSeeking();
} }
bool Scrubber::Scrubs() const bool Scrubber::Scrubs() const
{ {
if( Seeks() ) if( Seeks() )
return false; return false;
return (HasStartedScrubbing() || IsScrubbing()) && !ChoseSeeking(); return (HasMark() || IsScrubbing()) && !ChoseSeeking();
} }
bool Scrubber::ShouldDrawScrubSpeed() bool Scrubber::ShouldDrawScrubSpeed()
@ -889,7 +889,7 @@ void ScrubbingOverlay::OnTimer(wxCommandEvent &event)
return; return;
{ {
if(scrubber.HasStartedScrubbing()) { if(scrubber.HasMark()) {
auto xx = ruler->ScreenToClient(position).x; auto xx = ruler->ScreenToClient(position).x;
ruler->UpdateQuickPlayPos(xx); ruler->UpdateQuickPlayPos(xx);
@ -972,7 +972,7 @@ void Scrubber::DoScrub(bool seek)
{ {
if( !CanScrub() ) if( !CanScrub() )
return; return;
const bool wasScrubbing = HasStartedScrubbing() || IsScrubbing(); const bool wasScrubbing = HasMark() || IsScrubbing();
const bool scroll = TracksPrefs::GetPinnedHeadPreference(); const bool scroll = TracksPrefs::GetPinnedHeadPreference();
if (!wasScrubbing) { if (!wasScrubbing) {
auto tp = mProject->GetTrackPanel(); auto tp = mProject->GetTrackPanel();
@ -997,7 +997,7 @@ void Scrubber::OnScrubOrSeek(bool seek)
{ {
DoScrub(seek); DoScrub(seek);
if (HasStartedScrubbing()) { if (HasMark()) {
// Show the correct status. // Show the correct status.
const auto ctb = mProject->GetControlToolBar(); const auto ctb = mProject->GetControlToolBar();
ctb->UpdateStatusBar(mProject); ctb->UpdateStatusBar(mProject);
@ -1059,7 +1059,7 @@ const wxString &Scrubber::GetUntranslatedStateString() const
if (IsSpeedPlaying()) { if (IsSpeedPlaying()) {
return(_("Playing at Speed")); return(_("Playing at Speed"));
} }
else if (HasStartedScrubbing()) { else if (HasMark()) {
auto &item = FindMenuItem(Seeks() || TemporarilySeeks()); auto &item = FindMenuItem(Seeks() || TemporarilySeeks());
return item.status; return item.status;
} }

View File

@ -98,11 +98,11 @@ public:
{ return IsScrubbing() && mSpeedPlaying; } { return IsScrubbing() && mSpeedPlaying; }
// True iff the user has clicked to start scrub and not yet stopped, // True iff the user has clicked to start scrub and not yet stopped,
// but IsScrubbing() may yet be false // but IsScrubbing() may yet be false
bool HasStartedScrubbing() const bool HasMark() const
{ return GetScrubStartPosition() >= 0; } { return GetScrubStartPosition() >= 0; }
bool IsScrubbing() const; bool IsScrubbing() const;
bool IsScrollScrubbing() const // If true, implies HasStartedScrubbing() bool IsScrollScrubbing() const // If true, implies HasMark()
{ return mSmoothScrollingScrub; } { return mSmoothScrollingScrub; }
void SetScrollScrubbing(bool value) void SetScrollScrubbing(bool value)
{ mSmoothScrollingScrub = value; } { mSmoothScrollingScrub = value; }

View File

@ -2216,7 +2216,7 @@ namespace {
const wxString ScrubbingMessage(const Scrubber &scrubber) const wxString ScrubbingMessage(const Scrubber &scrubber)
{ {
if (scrubber.HasStartedScrubbing()) if (scrubber.HasMark())
return ContinueScrubbingMessage(scrubber); return ContinueScrubbingMessage(scrubber);
else else
return StartScrubbingMessage(scrubber); return StartScrubbingMessage(scrubber);
@ -2450,7 +2450,7 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
mPrevZone = zone; mPrevZone = zone;
auto &scrubber = mProject->GetScrubber(); auto &scrubber = mProject->GetScrubber();
if (scrubber.HasStartedScrubbing()) { if (scrubber.HasMark()) {
if (evt.RightDown() ) if (evt.RightDown() )
// Fall through to context menu handling // Fall through to context menu handling
; ;
@ -2863,7 +2863,7 @@ void AdornedRulerPanel::UpdateStatusBarAndTooltips(StatusChoice choice)
wxString message {}; wxString message {};
const auto &scrubber = mProject->GetScrubber(); const auto &scrubber = mProject->GetScrubber();
const bool scrubbing = scrubber.HasStartedScrubbing(); const bool scrubbing = scrubber.HasMark();
if (scrubbing && choice != StatusChoice::Leaving) if (scrubbing && choice != StatusChoice::Leaving)
// Don't distinguish zones // Don't distinguish zones
choice = StatusChoice::EnteringScrubZone; choice = StatusChoice::EnteringScrubZone;
@ -2922,7 +2922,7 @@ bool AdornedRulerPanel::ShowingScrubControl() const
return return
mMouseEventState == AdornedRulerPanel::mesNone && mMouseEventState == AdornedRulerPanel::mesNone &&
(mPrevZone == AdornedRulerPanel::StatusChoice::EnteringScrubZone || (mPrevZone == AdornedRulerPanel::StatusChoice::EnteringScrubZone ||
(scrubber.HasStartedScrubbing())); (scrubber.HasMark()));
} }
void AdornedRulerPanel::OnContextMenu(wxContextMenuEvent & WXUNUSED(event)) void AdornedRulerPanel::OnContextMenu(wxContextMenuEvent & WXUNUSED(event))