Audacity  3.0.3
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Scrubber Class Referencefinal

#include <Scrubbing.h>

Inheritance diagram for Scrubber:
[legend]
Collaboration diagram for Scrubber:
[legend]

Classes

class  ScrubPoller
 
class  ScrubPollerThread
 

Public Member Functions

 Scrubber (AudacityProject *project)
 
 Scrubber (const Scrubber &) PROHIBITED
 
Scrubberoperator= (const Scrubber &) PROHIBITED
 
 ~Scrubber ()
 
void MarkScrubStart (wxCoord xx, bool smoothScrolling, bool seek)
 
bool MaybeStartScrubbing (wxCoord xx)
 
bool StartSpeedPlay (double speed, double time0, double time1)
 
bool StartKeyboardScrubbing (double time0, bool backwards)
 
double GetKeyboardScrubbingSpeed ()
 
void ContinueScrubbingUI ()
 
void ContinueScrubbingPoll ()
 
void StopScrubbing ()
 
wxCoord GetScrubStartPosition () const
 
bool WasSpeedPlaying () const
 
bool IsSpeedPlaying () const
 
bool WasKeyboardScrubbing () const
 
bool IsKeyboardScrubbing () const
 
void SetBackwards (bool backwards)
 
bool IsBackwards () const
 
bool HasMark () const
 
bool IsScrubbing () const
 
bool IsScrollScrubbing () const
 
void SetScrollScrubbing (bool value)
 
bool ChoseSeeking () const
 
void SetMayDragToSeek (bool value)
 
bool MayDragToSeek () const
 
bool TemporarilySeeks () const
 
bool Seeks () const
 
bool Scrubs () const
 
bool ShowsBar () const
 
void Cancel ()
 
bool ShouldDrawScrubSpeed ()
 
double FindScrubSpeed (bool seeking, double time) const
 
double GetMaxScrubSpeed () const
 
void HandleScrollWheel (int steps)
 
bool CanScrub () const
 
void PopulatePopupMenu (wxMenu &menu)
 
void OnScrubOrSeek (bool seek)
 
void OnScrub (const CommandContext &)
 
void OnSeek (const CommandContext &)
 
void OnToggleScrubRuler (const CommandContext &)
 
void OnKeyboardScrubBackwards (const CommandContext &)
 
void OnKeyboardScrubForwards (const CommandContext &)
 
void DoKeyboardScrub (bool backwards, bool keyUp)
 
template<void(Scrubber::*)(const CommandContext &) pfn>
void Thunk (wxCommandEvent &)
 
const TranslatableStringGetUntranslatedStateString () const
 
wxString StatusMessageForWave () const
 
void Pause (bool paused)
 
bool IsPaused () const
 
void CheckMenuItems ()
 
bool IsTransportingPinned () const
 
void SetSeekPress (bool value)
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Static Public Member Functions

static ScrubberGet (AudacityProject &project)
 
static const ScrubberGet (const AudacityProject &project)
 
static bool ShouldScrubPinned ()
 

Private Member Functions

void UpdatePrefs () override
 
void StartPolling ()
 
void StopPolling ()
 
void DoScrub (bool seek)
 
void OnActivateOrDeactivateApp (wxActivateEvent &event)
 
- Private Member Functions inherited from PrefsListener
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdateSelectedPrefs (int id)
 

Private Attributes

int mScrubToken
 
int mScrubSpeedDisplayCountdown
 
wxCoord mScrubStartPosition
 
wxCoord mLastScrubPosition {}
 
bool mScrubSeekPress {}
 
bool mSmoothScrollingScrub
 
bool mPaused {}
 
bool mSeeking {}
 
bool mSpeedPlaying {true}
 
bool mKeyboardScrubbing {}
 
bool mBackwards {}
 
bool mDragging {}
 
bool mCancelled {}
 
AudacityProjectmProject
 
ScrubPollerThreadmpThread {}
 
std::unique_ptr< ScrubPollermPoller
 
ScrubbingOptions mOptions
 
double mMaxSpeed { 1.0 }
 
bool mShowScrubbing { false }
 
bool mMayDragToSeek { false }
 

Additional Inherited Members

- Static Private Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 

Detailed Description

Definition at line 40 of file Scrubbing.h.

Constructor & Destructor Documentation

◆ Scrubber() [1/2]

Scrubber::Scrubber ( AudacityProject project)
explicit

Definition at line 211 of file Scrubbing.cpp.

212  : mScrubToken(-1)
213  , mPaused(true)
215  , mScrubStartPosition(-1)
216 #ifdef EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL
217  , mSmoothScrollingScrub(false)
218  , mLogMaxScrubSpeed(0)
219 #endif
220 
221  , mProject(project)
222  , mPoller { std::make_unique<ScrubPoller>(*this) }
223  , mOptions {}
224 
225 {
226  if (wxTheApp)
227  wxTheApp->Bind
228  (wxEVT_ACTIVATE_APP,
230 
231  UpdatePrefs();
232 }

◆ Scrubber() [2/2]

Scrubber::Scrubber ( const Scrubber )

◆ ~Scrubber()

Scrubber::~Scrubber ( )

Definition at line 234 of file Scrubbing.cpp.

235 {
236 #ifdef USE_SCRUB_THREAD
237  if (mpThread)
238  mpThread->Delete();
239 #endif
240 }

References mpThread.

Member Function Documentation

◆ Cancel()

void Scrubber::Cancel ( )
inline

Definition at line 108 of file Scrubbing.h.

109  { mCancelled = true; }

◆ CanScrub()

bool Scrubber::CanScrub ( ) const

◆ CheckMenuItems()

void Scrubber::CheckMenuItems ( )

Referenced by MarkScrubStart().

Here is the caller graph for this function:

◆ ChoseSeeking()

bool Scrubber::ChoseSeeking ( ) const

◆ ContinueScrubbingPoll()

void Scrubber::ContinueScrubbingPoll ( )

Referenced by Scrubber::ScrubPoller::Notify().

Here is the caller graph for this function:

◆ ContinueScrubbingUI()

void Scrubber::ContinueScrubbingUI ( )

Referenced by Scrubber::ScrubPoller::Notify().

Here is the caller graph for this function:

◆ DoKeyboardScrub()

void Scrubber::DoKeyboardScrub ( bool  backwards,
bool  keyUp 
)

◆ DoScrub()

void Scrubber::DoScrub ( bool  seek)
private

◆ FindScrubSpeed()

double Scrubber::FindScrubSpeed ( bool  seeking,
double  time 
) const

Referenced by ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ Get() [1/2]

Scrubber & Scrubber::Get ( AudacityProject project)
static

◆ Get() [2/2]

const Scrubber & Scrubber::Get ( const AudacityProject project)
static

Definition at line 206 of file Scrubbing.cpp.

207 {
208  return Get( const_cast< AudacityProject & >( project ) );
209 }

References Get().

Here is the call graph for this function:

◆ GetKeyboardScrubbingSpeed()

double Scrubber::GetKeyboardScrubbingSpeed ( )

◆ GetMaxScrubSpeed()

double Scrubber::GetMaxScrubSpeed ( ) const
inline

Definition at line 113 of file Scrubbing.h.

113 { return mOptions.maxSpeed; }

Referenced by ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ GetScrubStartPosition()

wxCoord Scrubber::GetScrubStartPosition ( ) const
inline

Definition at line 74 of file Scrubbing.h.

75  { return mScrubStartPosition; }

◆ GetUntranslatedStateString()

const TranslatableString& Scrubber::GetUntranslatedStateString ( ) const

Referenced by ControlToolBar::StateForStatusBar().

Here is the caller graph for this function:

◆ HandleScrollWheel()

void Scrubber::HandleScrollWheel ( int  steps)

Referenced by anonymous_namespace{ProjectWindow.cpp}::MouseWheelHandler::operator()().

Here is the caller graph for this function:

◆ HasMark()

bool Scrubber::HasMark ( ) const
inline

Definition at line 91 of file Scrubbing.h.

92  { return GetScrubStartPosition() >= 0; }

Referenced by ScrubbingOverlay::OnTimer(), and anonymous_namespace{AdornedRulerPanel.cpp}::ScrubbingMessage().

Here is the caller graph for this function:

◆ IsBackwards()

bool Scrubber::IsBackwards ( ) const
inline

Definition at line 87 of file Scrubbing.h.

88  { return mBackwards;}

◆ IsKeyboardScrubbing()

bool Scrubber::IsKeyboardScrubbing ( ) const
inline

Definition at line 83 of file Scrubbing.h.

84  { return IsScrubbing() && mKeyboardScrubbing; }

Referenced by ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ IsPaused()

bool Scrubber::IsPaused ( ) const

◆ IsScrollScrubbing()

bool Scrubber::IsScrollScrubbing ( ) const
inline

Definition at line 95 of file Scrubbing.h.

96  { return mSmoothScrollingScrub; }

Referenced by ScrubbingOverlay::Draw(), ScrubbingOverlay::OnTimer(), and anonymous_namespace{ProjectWindow.cpp}::MouseWheelHandler::operator()().

Here is the caller graph for this function:

◆ IsScrubbing()

bool Scrubber::IsScrubbing ( ) const

Referenced by anonymous_namespace{AdornedRulerPanel.cpp}::ContinueScrubbingMessage(), ScrubbingOverlay::OnTimer(), and anonymous_namespace{ProjectWindow.cpp}::MouseWheelHandler::operator()().

Here is the caller graph for this function:

◆ IsSpeedPlaying()

bool Scrubber::IsSpeedPlaying ( ) const
inline

Definition at line 79 of file Scrubbing.h.

80  { return IsScrubbing() && mSpeedPlaying; }

Referenced by ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ IsTransportingPinned()

bool Scrubber::IsTransportingPinned ( ) const

Referenced by anonymous_namespace{PlayIndicatorOverlay.cpp}::GetIndicatorBitmap().

Here is the caller graph for this function:

◆ MarkScrubStart()

void Scrubber::MarkScrubStart ( wxCoord  xx,
bool  smoothScrolling,
bool  seek 
)

Definition at line 313 of file Scrubbing.cpp.

317 {
318  // Don't actually start scrubbing, but collect some information
319  // needed for the decision to start scrubbing later when handling
320  // drag events.
321  mSmoothScrollingScrub = smoothScrolling;
322 
323  auto &projectAudioManager = ProjectAudioManager::Get( *mProject );
324 
325  // Stop any play in progress
326  // Bug 1492: mCancelled to stop us collapsing the selected region.
327  mCancelled = true;
328  projectAudioManager.Stop();
329  mCancelled = false;
330 
331  // Usually the timer handler of TrackPanel does this, but we do this now,
332  // so that same timer does not StopPlaying() again after this function and destroy
333  // scrubber state
334  ProjectAudioIO::Get( *mProject ).SetAudioIOToken(0);
335 
336  mSeeking = seek;
337  CheckMenuItems();
338 
339  // Commented out for Bug 1421
340  // mSeeking
341  // ? ControlToolBar::PlayAppearance::Seek
342  // : ControlToolBar::PlayAppearance::Scrub);
343 
344  mScrubStartPosition = xx;
345  mCancelled = false;
346 }

References CheckMenuItems(), ProjectAudioIO::Get(), ProjectAudioManager::Get(), mCancelled, mProject, mScrubStartPosition, mSeeking, mSmoothScrollingScrub, and ProjectAudioIO::SetAudioIOToken().

Here is the call graph for this function:

◆ MaybeStartScrubbing()

bool Scrubber::MaybeStartScrubbing ( wxCoord  xx)

Referenced by ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ MayDragToSeek()

bool Scrubber::MayDragToSeek ( ) const
inline

Definition at line 102 of file Scrubbing.h.

102 { return mMayDragToSeek; }

◆ OnActivateOrDeactivateApp()

void Scrubber::OnActivateOrDeactivateApp ( wxActivateEvent &  event)
private

◆ OnKeyboardScrubBackwards()

void Scrubber::OnKeyboardScrubBackwards ( const CommandContext )

◆ OnKeyboardScrubForwards()

void Scrubber::OnKeyboardScrubForwards ( const CommandContext )

◆ OnScrub()

void Scrubber::OnScrub ( const CommandContext )

Referenced by anonymous_namespace{Scrubbing.cpp}::menuItems().

Here is the caller graph for this function:

◆ OnScrubOrSeek()

void Scrubber::OnScrubOrSeek ( bool  seek)

◆ OnSeek()

void Scrubber::OnSeek ( const CommandContext )

Referenced by anonymous_namespace{Scrubbing.cpp}::menuItems().

Here is the caller graph for this function:

◆ OnToggleScrubRuler()

void Scrubber::OnToggleScrubRuler ( const CommandContext )

Referenced by anonymous_namespace{Scrubbing.cpp}::menuItems().

Here is the caller graph for this function:

◆ operator=()

Scrubber& Scrubber::operator= ( const Scrubber )

◆ Pause()

void Scrubber::Pause ( bool  paused)

◆ PopulatePopupMenu()

void Scrubber::PopulatePopupMenu ( wxMenu &  menu)

◆ Scrubs()

bool Scrubber::Scrubs ( ) const

Referenced by anonymous_namespace{Scrubbing.cpp}::menuItems().

Here is the caller graph for this function:

◆ Seeks()

bool Scrubber::Seeks ( ) const

Referenced by anonymous_namespace{AdornedRulerPanel.cpp}::ContinueScrubbingMessage(), anonymous_namespace{Scrubbing.cpp}::menuItems(), and ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ SetBackwards()

void Scrubber::SetBackwards ( bool  backwards)
inline

Definition at line 85 of file Scrubbing.h.

86  { mBackwards = backwards;}

◆ SetMayDragToSeek()

void Scrubber::SetMayDragToSeek ( bool  value)
inline

Definition at line 101 of file Scrubbing.h.

101 { mMayDragToSeek = value; }

◆ SetScrollScrubbing()

void Scrubber::SetScrollScrubbing ( bool  value)
inline

Definition at line 97 of file Scrubbing.h.

98  { mSmoothScrollingScrub = value; }

◆ SetSeekPress()

void Scrubber::SetSeekPress ( bool  value)
inline

Definition at line 148 of file Scrubbing.h.

148 { mScrubSeekPress = value; }

◆ ShouldDrawScrubSpeed()

bool Scrubber::ShouldDrawScrubSpeed ( )

Referenced by ScrubbingOverlay::DoGetRectangle(), ScrubbingOverlay::Draw(), and ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ ShouldScrubPinned()

bool Scrubber::ShouldScrubPinned ( )
static

Definition at line 164 of file Scrubbing.cpp.

References TracksPrefs::GetPinnedHeadPreference(), and PlaybackPrefs::GetUnpinnedScrubbingPreference().

Referenced by AdornedRulerPanel::ScrubbingHandle::Click().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShowsBar()

bool Scrubber::ShowsBar ( ) const

Referenced by anonymous_namespace{Scrubbing.cpp}::menuItems().

Here is the caller graph for this function:

◆ StartKeyboardScrubbing()

bool Scrubber::StartKeyboardScrubbing ( double  time0,
bool  backwards 
)

◆ StartPolling()

void Scrubber::StartPolling ( )
private

◆ StartSpeedPlay()

bool Scrubber::StartSpeedPlay ( double  speed,
double  time0,
double  time1 
)

◆ StatusMessageForWave()

wxString Scrubber::StatusMessageForWave ( ) const

◆ StopPolling()

void Scrubber::StopPolling ( )
private

◆ StopScrubbing()

void Scrubber::StopScrubbing ( )

◆ TemporarilySeeks()

bool Scrubber::TemporarilySeeks ( ) const

Referenced by ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ Thunk()

template<void(Scrubber::*)(const CommandContext &) pfn>
void Scrubber::Thunk ( wxCommandEvent &  )
inline

Definition at line 134 of file Scrubbing.h.

135  { (this->*pfn)(*mProject); }

◆ UpdatePrefs()

void Scrubber::UpdatePrefs ( )
overrideprivatevirtual

Implements PrefsListener.

◆ WasKeyboardScrubbing()

bool Scrubber::WasKeyboardScrubbing ( ) const
inline

Definition at line 81 of file Scrubbing.h.

82  { return mKeyboardScrubbing; }

◆ WasSpeedPlaying()

bool Scrubber::WasSpeedPlaying ( ) const
inline

Definition at line 77 of file Scrubbing.h.

78  { return mSpeedPlaying;}

Member Data Documentation

◆ mBackwards

bool Scrubber::mBackwards {}
private

Definition at line 170 of file Scrubbing.h.

◆ mCancelled

bool Scrubber::mCancelled {}
private

Definition at line 173 of file Scrubbing.h.

Referenced by MarkScrubStart().

◆ mDragging

bool Scrubber::mDragging {}
private

Definition at line 171 of file Scrubbing.h.

◆ mKeyboardScrubbing

bool Scrubber::mKeyboardScrubbing {}
private

Definition at line 169 of file Scrubbing.h.

◆ mLastScrubPosition

wxCoord Scrubber::mLastScrubPosition {}
private

Definition at line 162 of file Scrubbing.h.

◆ mMaxSpeed

double Scrubber::mMaxSpeed { 1.0 }
private

Definition at line 196 of file Scrubbing.h.

◆ mMayDragToSeek

bool Scrubber::mMayDragToSeek { false }
private

Definition at line 199 of file Scrubbing.h.

◆ mOptions

ScrubbingOptions Scrubber::mOptions
private

Definition at line 195 of file Scrubbing.h.

◆ mPaused

bool Scrubber::mPaused {}
private

Definition at line 166 of file Scrubbing.h.

◆ mPoller

std::unique_ptr<ScrubPoller> Scrubber::mPoller
private

Definition at line 193 of file Scrubbing.h.

◆ mProject

AudacityProject* Scrubber::mProject
private

Definition at line 179 of file Scrubbing.h.

Referenced by MarkScrubStart().

◆ mpThread

ScrubPollerThread* Scrubber::mpThread {}
private

Definition at line 187 of file Scrubbing.h.

Referenced by ~Scrubber().

◆ mScrubSeekPress

bool Scrubber::mScrubSeekPress {}
private

Definition at line 163 of file Scrubbing.h.

◆ mScrubSpeedDisplayCountdown

int Scrubber::mScrubSpeedDisplayCountdown
private

Definition at line 160 of file Scrubbing.h.

◆ mScrubStartPosition

wxCoord Scrubber::mScrubStartPosition
private

Definition at line 161 of file Scrubbing.h.

Referenced by MarkScrubStart().

◆ mScrubToken

int Scrubber::mScrubToken
private

Definition at line 159 of file Scrubbing.h.

◆ mSeeking

bool Scrubber::mSeeking {}
private

Definition at line 167 of file Scrubbing.h.

Referenced by MarkScrubStart().

◆ mShowScrubbing

bool Scrubber::mShowScrubbing { false }
private

Definition at line 198 of file Scrubbing.h.

◆ mSmoothScrollingScrub

bool Scrubber::mSmoothScrollingScrub
private

Definition at line 164 of file Scrubbing.h.

Referenced by MarkScrubStart().

◆ mSpeedPlaying

bool Scrubber::mSpeedPlaying {true}
private

Definition at line 168 of file Scrubbing.h.


The documentation for this class was generated from the following files:
Scrubber::mSeeking
bool mSeeking
Definition: Scrubbing.h:167
Scrubber::Get
static Scrubber & Get(AudacityProject &project)
Definition: Scrubbing.cpp:201
ProjectAudioManager::Get
static ProjectAudioManager & Get(AudacityProject &project)
Definition: ProjectAudioManager.cpp:55
Scrubber::mProject
AudacityProject * mProject
Definition: Scrubbing.h:179
Scrubber::mOptions
ScrubbingOptions mOptions
Definition: Scrubbing.h:195
PlaybackPrefs::GetUnpinnedScrubbingPreference
static bool GetUnpinnedScrubbingPreference()
Definition: PlaybackPrefs.cpp:164
Scrubber::mBackwards
bool mBackwards
Definition: Scrubbing.h:170
Scrubber::mScrubSpeedDisplayCountdown
int mScrubSpeedDisplayCountdown
Definition: Scrubbing.h:160
ProjectAudioIO::Get
static ProjectAudioIO & Get(AudacityProject &project)
Definition: ProjectAudioIO.cpp:22
Scrubber
Definition: Scrubbing.h:45
Scrubber::mCancelled
bool mCancelled
Definition: Scrubbing.h:173
ScrubbingOptions::maxSpeed
double maxSpeed
Definition: ScrubState.h:36
Scrubber::UpdatePrefs
void UpdatePrefs() override
Scrubber::CheckMenuItems
void CheckMenuItems()
Scrubber::mpThread
ScrubPollerThread * mpThread
Definition: Scrubbing.h:187
Scrubber::mScrubStartPosition
wxCoord mScrubStartPosition
Definition: Scrubbing.h:161
Scrubber::mMayDragToSeek
bool mMayDragToSeek
Definition: Scrubbing.h:199
Scrubber::mScrubToken
int mScrubToken
Definition: Scrubbing.h:159
key
static const AudacityProject::AttachedObjects::RegisteredFactory key
Definition: Scrubbing.cpp:196
Scrubber::mPaused
bool mPaused
Definition: Scrubbing.h:166
ProjectAudioIO::SetAudioIOToken
void SetAudioIOToken(int token)
Definition: ProjectAudioIO.cpp:46
TracksPrefs::GetPinnedHeadPreference
static bool GetPinnedHeadPreference()
Definition: TracksPrefs.cpp:387
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
Scrubber::IsScrubbing
bool IsScrubbing() const
Scrubber::mKeyboardScrubbing
bool mKeyboardScrubbing
Definition: Scrubbing.h:169
Scrubber::mSpeedPlaying
bool mSpeedPlaying
Definition: Scrubbing.h:168
Scrubber::mPoller
std::unique_ptr< ScrubPoller > mPoller
Definition: Scrubbing.h:192
Scrubber::OnActivateOrDeactivateApp
void OnActivateOrDeactivateApp(wxActivateEvent &event)
Scrubber::GetScrubStartPosition
wxCoord GetScrubStartPosition() const
Definition: Scrubbing.h:74
Scrubber::mSmoothScrollingScrub
bool mSmoothScrollingScrub
Definition: Scrubbing.h:164
Scrubber::mScrubSeekPress
bool mScrubSeekPress
Definition: Scrubbing.h:163