Audacity  2.2.2
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
Scrubber Class Reference

#include <Scrubbing.h>

Inheritance diagram for Scrubber:

Classes

struct  Forwarder
 
class  ScrubPoller
 
class  ScrubPollerThread
 

Public Member Functions

 Scrubber (AudacityProject *project)
 
 ~Scrubber ()
 
void MarkScrubStart (wxCoord xx, bool smoothScrolling, bool seek)
 
bool MaybeStartScrubbing (wxCoord xx)
 
void ContinueScrubbingUI ()
 
void ContinueScrubbingPoll ()
 
void StopScrubbing ()
 
wxCoord GetScrubStartPosition () const
 
bool HasStartedScrubbing () const
 
bool IsScrubbing () const
 
bool IsScrollScrubbing () const
 
void SetScrollScrubbing (bool value)
 
bool ChoseSeeking () const
 
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 AddMenuItems ()
 
void PopulatePopupMenu (wxMenu &menu)
 
void OnScrubOrSeek (bool seek)
 
void OnScrub (const CommandContext &)
 
void OnSeek (const CommandContext &)
 
void OnToggleScrubRuler (const CommandContext &)
 
template<void(Scrubber::*)(const CommandContext &) pfn>
void Thunk (wxCommandEvent &)
 
const wxString & GetUntranslatedStateString () const
 
wxString StatusMessageForWave () const
 
void Pause (bool paused)
 
bool IsPaused () const
 
void CheckMenuItems ()
 
bool IsOneShotSeeking () const
 

Static Public Member Functions

static std::vector< wxString > GetAllUntranslatedStatusStrings ()
 

Public Attributes

bool mInOneShotMode
 

Private Member Functions

void DoScrub (bool seek)
 
void OnActivateOrDeactivateApp (wxActivateEvent &event)
 

Private Attributes

Forwarder mForwarder { *this }
 
int mScrubToken
 
bool mPaused
 
int mScrubSpeedDisplayCountdown
 
wxCoord mScrubStartPosition
 
wxCoord mLastScrubPosition {}
 
bool mScrubSeekPress {}
 
bool mSmoothScrollingScrub
 
bool mSeeking {}
 
bool mDragging {}
 
bool mCancelled {}
 
int mLogMaxScrubSpeed
 
AudacityProjectmProject
 
ScrubPollerThreadmpThread {}
 
std::unique_ptr< ScrubPollermPoller
 
ScrubbingOptions mOptions
 
double mMaxSpeed { 1.0 }
 

Detailed Description

Definition at line 71 of file Scrubbing.h.

Constructor & Destructor Documentation

Scrubber::Scrubber ( AudacityProject project)

Definition at line 185 of file Scrubbing.cpp.

186  : mInOneShotMode( false )
187  , mScrubToken(-1)
188  , mPaused(true)
190  , mScrubStartPosition(-1)
191 #ifdef EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL
192  , mSmoothScrollingScrub(false)
193  , mLogMaxScrubSpeed(0)
194 #endif
195 
196  , mProject(project)
197  , mPoller { std::make_unique<ScrubPoller>(*this) }
198  , mOptions {}
199 
200 {
201  if (wxTheApp)
202  wxTheApp->Bind
203  (wxEVT_ACTIVATE_APP,
205  mProject->PushEventHandler(&mForwarder);
206 }
AudacityProject * mProject
Definition: Scrubbing.h:188
bool mPaused
Definition: Scrubbing.h:171
int mScrubToken
Definition: Scrubbing.h:170
int mLogMaxScrubSpeed
Definition: Scrubbing.h:185
std::unique_ptr< ScrubPoller > mPoller
Definition: Scrubbing.h:201
Forwarder mForwarder
Definition: Scrubbing.h:167
wxCoord mScrubStartPosition
Definition: Scrubbing.h:173
void OnActivateOrDeactivateApp(wxActivateEvent &event)
Definition: Scrubbing.cpp:688
bool mInOneShotMode
Definition: Scrubbing.h:150
bool mSmoothScrollingScrub
Definition: Scrubbing.h:176
ScrubbingOptions mOptions
Definition: Scrubbing.h:204
int mScrubSpeedDisplayCountdown
Definition: Scrubbing.h:172
Scrubber::~Scrubber ( )

Definition at line 208 of file Scrubbing.cpp.

References mProject, and mpThread.

209 {
210 #ifdef USE_SCRUB_THREAD
211  if (mpThread)
212  mpThread->Delete();
213 #endif
214 
215  mProject->PopEventHandler();
216 }
AudacityProject * mProject
Definition: Scrubbing.h:188
ScrubPollerThread * mpThread
Definition: Scrubbing.h:196

Member Function Documentation

void Scrubber::AddMenuItems ( )

Definition at line 997 of file Scrubbing.cpp.

References _(), CommandManager::BeginSubMenu(), CheckMenuItems(), findme(), AudacityProject::GetCommandManager(), and mProject.

Referenced by AudacityProject::CreateMenusAndCommands().

998 {
999  auto cm = mProject->GetCommandManager();
1000 
1001  cm->BeginSubMenu(_("Scru&bbing"));
1002  for (const auto &item : menuItems) {
1003  if (item.StatusTest)
1004  cm->AddCheck(item.name, wxGetTranslation(item.label),
1005  // No menu items yet have dialogs
1006  false,
1007  findme, static_cast<CommandFunctorPointer>(item.memFn),
1008  false,
1009  item.flags, item.flags);
1010  else
1011  // The start item
1012  cm->AddItem(item.name, wxGetTranslation(item.label),
1013  // No menu items yet have dialogs
1014  false,
1015  findme, static_cast<CommandFunctorPointer>(item.memFn),
1016  item.flags, item.flags);
1017  }
1018  cm->EndSubMenu();
1019  CheckMenuItems();
1020 }
AudacityProject * mProject
Definition: Scrubbing.h:188
wxMenu * BeginSubMenu(const wxString &tName)
void CheckMenuItems()
Definition: Scrubbing.cpp:1038
CommandManager * GetCommandManager()
Definition: Project.h:346
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
static CommandHandlerObject & findme(AudacityProject &project)
Definition: Scrubbing.cpp:994
void Scrubber::Cancel ( )
inline

Definition at line 111 of file Scrubbing.h.

References mCancelled.

112  { mCancelled = true; }
bool mCancelled
Definition: Scrubbing.h:182
bool Scrubber::CanScrub ( ) const

Definition at line 986 of file Scrubbing.cpp.

References AudacityProject::GetCommandManager(), CommandManager::GetEnabled(), mProject, and name.

Referenced by DoScrub(), ScrubbingToolBar::EnableDisableButtons(), and AdornedRulerPanel::OnMouseEvents().

987 {
988  // Return the enabled state for the menu item that really launches the scrub or seek.
989  auto cm = mProject->GetCommandManager();
990  return cm->GetEnabled(menuItems[ 0 ].name);
991 }
bool GetEnabled(const wxString &name)
AudacityProject * mProject
Definition: Scrubbing.h:188
CommandManager * GetCommandManager()
Definition: Project.h:346
const wxChar * name
Definition: Distortion.cpp:94
void Scrubber::CheckMenuItems ( )

Definition at line 1038 of file Scrubbing.cpp.

References CommandManager::Check(), AudacityProject::GetCommandManager(), and mProject.

Referenced by AddMenuItems(), MarkScrubStart(), OnScrub(), OnScrubOrSeek(), OnSeek(), OnToggleScrubRuler(), and StopScrubbing().

1039 {
1040  auto cm = mProject->GetCommandManager();
1041  for (const auto &item : menuItems) {
1042  auto test = item.StatusTest;
1043  if (test)
1044  cm->Check(item.name, (this->*test)());
1045  }
1046 }
AudacityProject * mProject
Definition: Scrubbing.h:188
CommandManager * GetCommandManager()
Definition: Project.h:346
void Check(const wxString &name, bool checked)
bool Scrubber::ChoseSeeking ( ) const

Definition at line 590 of file Scrubbing.cpp.

References mDragging, and mSeeking.

Referenced by Scrubs(), and Seeks().

591 {
592  return
593 #if !defined(DRAG_SCRUB)
594  // Drag always seeks
595  mDragging ||
596 #endif
597  mSeeking;
598 }
bool mSeeking
Definition: Scrubbing.h:178
bool mDragging
Definition: Scrubbing.h:180
void Scrubber::ContinueScrubbingPoll ( )

Definition at line 435 of file Scrubbing.cpp.

References ScrubbingOptions::adjustStart, ScrubbingOptions::enqueueBySpeed, AudioIO::EnqueueScrub(), FindScrubSpeed(), gAudioIO, AudioIO::GetLastTimeInScrubQueue(), AudacityProject::GetTrackPanel(), AudacityProject::GetViewInfo(), ScrubbingOptions::maxSpeed, mDragging, ScrubbingOptions::minSpeed, mLastScrubPosition, mMaxSpeed, mOptions, mPaused, mProject, mScrubSeekPress, mSmoothScrollingScrub, Seeks(), and TemporarilySeeks().

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

436 {
437  // Thus scrubbing relies mostly on periodic polling of mouse and keys,
438  // not event notifications. But there are a few event handlers that
439  // leave messages for this routine, in mScrubSeekPress and in mPaused.
440 
441  // Decide whether to skip play, because either mouse is down now,
442  // or there was a left click event. (This is then a delayed reaction, in a
443  // timer callback, to a left click event detected elsewhere.)
444  const bool seek = TemporarilySeeks() || Seeks();
445 
446  bool result = false;
447  if (mPaused) {
448  // When paused, enqueue silent scrubs.
449  mOptions.minSpeed = 0.0;
451  mOptions.adjustStart = false;
452  mOptions.enqueueBySpeed = true;
453  result = gAudioIO->EnqueueScrub(0, mOptions);
454  }
455  else {
456  const wxMouseState state(::wxGetMouseState());
457  const auto trackPanel = mProject->GetTrackPanel();
458  const wxPoint position = trackPanel->ScreenToClient(state.GetPosition());
459  const auto &viewInfo = mProject->GetViewInfo();
460 #ifdef DRAG_SCRUB
462  const auto lastTime = gAudioIO->GetLastTimeInScrubQueue();
463  const auto delta = mLastScrubPosition - position.x;
464  const double time = viewInfo.OffsetTimeByPixels(lastTime, delta);
465  mOptions.minSpeed = 0.0;
467  mOptions.adjustStart = true;
468  mOptions.enqueueBySpeed = false;
469  result = gAudioIO->EnqueueScrub(time, mOptions);
470  mLastScrubPosition = position.x;
471  }
472  else
473 #endif
474  {
475  const double time = viewInfo.PositionToTime(position.x, trackPanel->GetLeftOffset());
476  mOptions.adjustStart = seek;
477  mOptions.minSpeed = seek ? 1.0 : 0.0;
478  mOptions.maxSpeed = seek ? 1.0 : mMaxSpeed;
479 
480  if (mSmoothScrollingScrub) {
481  const double speed = FindScrubSpeed(seek, time);
482  mOptions.enqueueBySpeed = true;
483  result = gAudioIO->EnqueueScrub(speed, mOptions);
484  }
485  else {
486  mOptions.enqueueBySpeed = false;
487  result = gAudioIO->EnqueueScrub(time, mOptions);
488  }
489  }
490  }
491 
492  if (result)
493  mScrubSeekPress = false;
494 
495  // else, if seek requested, try again at a later time when we might
496  // enqueue a long enough stutter
497 }
AudacityProject * mProject
Definition: Scrubbing.h:188
bool mScrubSeekPress
Definition: Scrubbing.h:175
double GetLastTimeInScrubQueue() const
return the ending time of the last enqueued scrub interval.
Definition: AudioIO.cpp:2872
bool mPaused
Definition: Scrubbing.h:171
wxCoord mLastScrubPosition
Definition: Scrubbing.h:174
bool TemporarilySeeks() const
Definition: Scrubbing.cpp:622
double FindScrubSpeed(bool seeking, double time) const
Definition: Scrubbing.cpp:651
bool EnqueueScrub(double endTimeOrSpeed, const ScrubbingOptions &options)
enqueue a NEW scrub play interval, using the last end as the NEW start, to be played over the same du...
Definition: AudioIO.cpp:2864
bool Seeks() const
Definition: Scrubbing.cpp:628
double mMaxSpeed
Definition: Scrubbing.h:205
double maxSpeed
Definition: Scrubbing.h:53
bool mDragging
Definition: Scrubbing.h:180
AudioIO * gAudioIO
Definition: AudioIO.cpp:482
double minSpeed
Definition: Scrubbing.h:52
bool mSmoothScrollingScrub
Definition: Scrubbing.h:176
TrackPanel * GetTrackPanel()
Definition: Project.h:307
bool enqueueBySpeed
Definition: Scrubbing.h:47
const ViewInfo & GetViewInfo() const
Definition: Project.h:207
ScrubbingOptions mOptions
Definition: Scrubbing.h:204
void Scrubber::ContinueScrubbingUI ( )

Definition at line 499 of file Scrubbing.cpp.

References AudacityProject::DoPlayStopSelect(), AudacityProject::GetControlToolBar(), mDragging, mProject, mScrubSpeedDisplayCountdown, mSeeking, mSmoothScrollingScrub, ControlToolBar::OnStop(), Seeks(), TemporarilySeeks(), and ControlToolBar::UpdateStatusBar().

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

500 {
501  const wxMouseState state(::wxGetMouseState());
502 
503  if (mDragging && !state.LeftIsDown()) {
504  // Dragging scrub can stop with mouse up
505  // Stop and set cursor
506  bool bShift = state.ShiftDown();
507  mProject->DoPlayStopSelect(true, bShift);
508  wxCommandEvent evt;
510  return;
511  }
512 
513  const bool seek = Seeks() || TemporarilySeeks();
514 
515  {
516  // Show the correct status for seeking.
517  bool backup = mSeeking;
518  mSeeking = seek;
519  const auto ctb = mProject->GetControlToolBar();
520  if (ctb)
522  mSeeking = backup;
523  }
524 
525  if (seek)
527 
529  ;
530  else {
533  }
534 }
AudacityProject * mProject
Definition: Scrubbing.h:188
bool mSeeking
Definition: Scrubbing.h:178
void UpdateStatusBar(AudacityProject *pProject)
bool TemporarilySeeks() const
Definition: Scrubbing.cpp:622
bool Seeks() const
Definition: Scrubbing.cpp:628
void OnStop(wxCommandEvent &evt)
bool mDragging
Definition: Scrubbing.h:180
ControlToolBar * GetControlToolBar()
Definition: Project.cpp:5003
bool mSmoothScrollingScrub
Definition: Scrubbing.h:176
int mScrubSpeedDisplayCountdown
Definition: Scrubbing.h:172
bool DoPlayStopSelect(bool click, bool shift)
Definition: Menus.cpp:2918
void Scrubber::DoScrub ( bool  seek)
private

Definition at line 864 of file Scrubbing.cpp.

References CanScrub(), AudacityProject::GetControlToolBar(), TracksPrefs::GetPinnedHeadPreference(), AudacityProject::GetTrackPanel(), TrackPanel::GetTracksUsableArea(), HasStartedScrubbing(), IsScrubbing(), MarkScrubStart(), min(), mProject, mSeeking, and ControlToolBar::StopPlaying().

Referenced by OnScrubOrSeek().

865 {
866  if( !CanScrub() )
867  return;
868  const bool wasScrubbing = HasStartedScrubbing() || IsScrubbing();
869  const bool scroll = TracksPrefs::GetPinnedHeadPreference();
870  if (!wasScrubbing) {
871  auto tp = mProject->GetTrackPanel();
872  wxCoord xx = tp->ScreenToClient(::wxGetMouseState().GetPosition()).x;
873 
874  // Limit x
875  int width;
876  tp->GetTracksUsableArea(&width, nullptr);
877  const auto offset = tp->GetLeftOffset();
878  xx = (std::max(offset, std::min(offset + width - 1, xx)));
879 
880  MarkScrubStart(xx, scroll, seek);
881  }
882  else if (mSeeking != seek) {
883  // just switching mode
884  }
885  else
887 }
bool HasStartedScrubbing() const
Definition: Scrubbing.h:95
AudacityProject * mProject
Definition: Scrubbing.h:188
bool mSeeking
Definition: Scrubbing.h:178
void StopPlaying(bool stopStream=true)
void GetTracksUsableArea(int *width, int *height) const
Definition: TrackPanel.cpp:421
bool IsScrubbing() const
Definition: Scrubbing.cpp:575
int min(int a, int b)
bool CanScrub() const
Definition: Scrubbing.cpp:986
ControlToolBar * GetControlToolBar()
Definition: Project.cpp:5003
static bool GetPinnedHeadPreference()
TrackPanel * GetTrackPanel()
Definition: Project.h:307
void MarkScrubStart(wxCoord xx, bool smoothScrolling, bool seek)
Definition: Scrubbing.cpp:263
double Scrubber::FindScrubSpeed ( bool  seeking,
double  time 
) const

Definition at line 651 of file Scrubbing.cpp.

References AudacityProject::GetScreenEndTime(), AudacityProject::GetViewInfo(), ZoomInfo::h, mMaxSpeed, and mProject.

Referenced by ContinueScrubbingPoll(), and ScrubbingOverlay::OnTimer().

652 {
653  ViewInfo &viewInfo = mProject->GetViewInfo();
654  const double screen = mProject->GetScreenEndTime() - viewInfo.h;
655  return (seeking ? FindSeekSpeed : FindScrubbingSpeed)
656  (viewInfo, mMaxSpeed, screen, time);
657 }
ViewInfo is used mainly to hold the zooming, selection and scroll information. It also has some statu...
Definition: ViewInfo.h:141
AudacityProject * mProject
Definition: Scrubbing.h:188
double h
Definition: ViewInfo.h:47
double mMaxSpeed
Definition: Scrubbing.h:205
double GetScreenEndTime() const
Definition: Menus.cpp:6741
const ViewInfo & GetViewInfo() const
Definition: Project.h:207
std::vector< wxString > Scrubber::GetAllUntranslatedStatusStrings ( )
static

Definition at line 974 of file Scrubbing.cpp.

Referenced by ControlToolBar::WidthForStatusBar().

975 {
976  using namespace std;
977  vector<wxString> results;
978  for (const auto &item : menuItems) {
979  const auto &status = item.GetStatus();
980  if (!status.empty())
981  results.push_back(status);
982  }
983  return move(results);
984 }
double Scrubber::GetMaxScrubSpeed ( ) const
inline

Definition at line 116 of file Scrubbing.h.

References ScrubbingOptions::maxSpeed, and mOptions.

Referenced by ScrubbingOverlay::OnTimer().

116 { return mOptions.maxSpeed; }
double maxSpeed
Definition: Scrubbing.h:53
ScrubbingOptions mOptions
Definition: Scrubbing.h:204
wxCoord Scrubber::GetScrubStartPosition ( ) const
inline

Definition at line 90 of file Scrubbing.h.

References mScrubStartPosition.

Referenced by HasStartedScrubbing(), and PlayIndicatorOverlay::OnTimer().

91  { return mScrubStartPosition; }
wxCoord mScrubStartPosition
Definition: Scrubbing.h:173
const wxString & Scrubber::GetUntranslatedStateString ( ) const

Definition at line 948 of file Scrubbing.cpp.

949 {
950  static wxString empty;
951 
952  if (HasStartedScrubbing()) {
953  auto &item = FindMenuItem(Seeks() || TemporarilySeeks());
954  return item.status;
955  }
956  else
957  return empty;
958 }
bool HasStartedScrubbing() const
Definition: Scrubbing.h:95
bool TemporarilySeeks() const
Definition: Scrubbing.cpp:622
bool Seeks() const
Definition: Scrubbing.cpp:628
void Scrubber::HandleScrollWheel ( int  steps)

Definition at line 659 of file Scrubbing.cpp.

References kOneSecondCountdown, ScrubbingOptions::MaxAllowedScrubSpeed(), ScrubbingOptions::MinAllowedScrubSpeed(), mLogMaxScrubSpeed, mMaxSpeed, mScrubSpeedDisplayCountdown, mSmoothScrollingScrub, and ScrubSpeedStepsPerOctave.

Referenced by Scrubber::Forwarder::OnMouse().

660 {
661  if (steps == 0)
662  return;
663 
664  const int newLogMaxScrubSpeed = mLogMaxScrubSpeed + steps;
665  static const double maxScrubSpeedBase =
666  pow(2.0, 1.0 / ScrubSpeedStepsPerOctave);
667  double newSpeed = pow(maxScrubSpeedBase, newLogMaxScrubSpeed);
668  if (newSpeed >= ScrubbingOptions::MinAllowedScrubSpeed() &&
670  mLogMaxScrubSpeed = newLogMaxScrubSpeed;
671  mMaxSpeed = newSpeed;
673  // Show the speed for one second
675  }
676 }
int mLogMaxScrubSpeed
Definition: Scrubbing.h:185
static double MaxAllowedScrubSpeed()
Definition: Scrubbing.h:64
double mMaxSpeed
Definition: Scrubbing.h:205
bool mSmoothScrollingScrub
Definition: Scrubbing.h:176
int mScrubSpeedDisplayCountdown
Definition: Scrubbing.h:172
static double MinAllowedScrubSpeed()
Definition: Scrubbing.h:66
bool Scrubber::HasStartedScrubbing ( ) const
inline
bool Scrubber::IsOneShotSeeking ( ) const
inline

Definition at line 150 of file Scrubbing.h.

Referenced by AdornedRulerPanel::OnMouseEvents().

150 { return mInOneShotMode && IsScrubbing();};
bool IsScrubbing() const
Definition: Scrubbing.cpp:575
bool mInOneShotMode
Definition: Scrubbing.h:150
bool Scrubber::IsPaused ( ) const

Definition at line 683 of file Scrubbing.cpp.

References mPaused.

Referenced by AdornedRulerPanel::OnMouseEvents().

684 {
685  return mPaused;
686 }
bool mPaused
Definition: Scrubbing.h:171
bool Scrubber::IsScrollScrubbing ( ) const
inline

Definition at line 99 of file Scrubbing.h.

References mSmoothScrollingScrub.

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

100  { return mSmoothScrollingScrub; }
bool mSmoothScrollingScrub
Definition: Scrubbing.h:176
bool Scrubber::IsScrubbing ( ) const

Definition at line 575 of file Scrubbing.cpp.

References AudacityProject::GetAudioIOToken(), AudacityProject::IsAudioActive(), mProject, mScrubStartPosition, mScrubToken, and mSmoothScrollingScrub.

Referenced by DoScrub(), MaybeStartScrubbing(), OnActivateOrDeactivateApp(), Scrubber::Forwarder::OnMouse(), AdornedRulerPanel::OnMouseEvents(), ScrubbingOverlay::OnTimer(), Scrubs(), Seeks(), ShouldDrawScrubSpeed(), AdornedRulerPanel::ShowOrHideQuickPlayIndicator(), and StopScrubbing().

576 {
577  if (mScrubToken <= 0)
578  return false;
579  else if (mScrubToken == mProject->GetAudioIOToken() &&
581  return true;
582  else {
583  const_cast<Scrubber&>(*this).mScrubToken = -1;
584  const_cast<Scrubber&>(*this).mScrubStartPosition = -1;
585  const_cast<Scrubber&>(*this).mSmoothScrollingScrub = false;
586  return false;
587  }
588 }
AudacityProject * mProject
Definition: Scrubbing.h:188
int GetAudioIOToken() const
Definition: Project.cpp:1444
int mScrubToken
Definition: Scrubbing.h:170
wxCoord mScrubStartPosition
Definition: Scrubbing.h:173
bool IsAudioActive() const
Definition: Project.cpp:1454
bool mSmoothScrollingScrub
Definition: Scrubbing.h:176
void Scrubber::MarkScrubStart ( wxCoord  xx,
bool  smoothScrolling,
bool  seek 
)

Definition at line 263 of file Scrubbing.cpp.

References CheckMenuItems(), AudacityProject::GetControlToolBar(), mCancelled, mOptions, mProject, mScrubStartPosition, mSeeking, mSmoothScrollingScrub, AudacityProject::SetAudioIOToken(), ControlToolBar::SetPlay(), ScrubbingOptions::startClockTimeMillis, ControlToolBar::StopPlaying(), ControlToolBar::Straight, and ControlToolBar::UpdateStatusBar().

Referenced by DoScrub(), and AdornedRulerPanel::OnMouseEvents().

267 {
268  // Don't actually start scrubbing, but collect some information
269  // needed for the decision to start scrubbing later when handling
270  // drag events.
271  mSmoothScrollingScrub = smoothScrolling;
272 
273  ControlToolBar * const ctb = mProject->GetControlToolBar();
274 
275  // Stop any play in progress
276  // Bug 1492: mCancelled to stop us collapsing the selected region.
277  mCancelled = true;
278  ctb->StopPlaying();
279  mCancelled = false;
280 
281  // Usually the timer handler of TrackPanel does this, but we do this now,
282  // so that same timer does not StopPlaying() again after this function and destroy
283  // scrubber state
285 
286  mSeeking = seek;
287  CheckMenuItems();
288 
290  // Commented out for Bug 1421
291  // mSeeking
292  // ? ControlToolBar::PlayAppearance::Seek
293  // : ControlToolBar::PlayAppearance::Scrub);
294 
295  mScrubStartPosition = xx;
297  mOptions.startClockTimeMillis = ::wxGetLocalTimeMillis();
298  mCancelled = false;
299 }
void SetPlay(bool down, PlayAppearance appearance=PlayAppearance::Straight)
A ToolBar that has the main Transport buttons.
AudacityProject * mProject
Definition: Scrubbing.h:188
bool mSeeking
Definition: Scrubbing.h:178
void SetAudioIOToken(int token)
Definition: Project.cpp:1449
bool mCancelled
Definition: Scrubbing.h:182
void StopPlaying(bool stopStream=true)
void CheckMenuItems()
Definition: Scrubbing.cpp:1038
void UpdateStatusBar(AudacityProject *pProject)
wxCoord mScrubStartPosition
Definition: Scrubbing.h:173
wxLongLong startClockTimeMillis
Definition: Scrubbing.h:62
ControlToolBar * GetControlToolBar()
Definition: Project.cpp:5003
bool mSmoothScrollingScrub
Definition: Scrubbing.h:176
ScrubbingOptions mOptions
Definition: Scrubbing.h:204
bool Scrubber::MaybeStartScrubbing ( wxCoord  xx)

Definition at line 303 of file Scrubbing.cpp.

References ScrubbingOptions::delay, gAudioIO, AudacityProject::GetControlToolBar(), AudacityProject::GetDefaultPlayOptions(), TrackList::GetEndTime(), TrackPanel::GetLeftOffset(), AudioIO::GetNumCaptureChannels(), TranscriptionToolBar::GetPlaySpeed(), AudacityProject::GetScreenEndTime(), AudacityProject::GetTrackPanel(), AudacityProject::GetTracks(), AudacityProject::GetTranscriptionToolBar(), AudacityProject::GetViewInfo(), ZoomInfo::h, AudioIO::IsBusy(), IsScrubbing(), lrint, ScrubbingOptions::maxSample, ScrubbingOptions::maxSpeed, mDragging, min(), ScrubbingOptions::minSample, ScrubbingOptions::minSpeed, ScrubbingOptions::minStutter, MinStutter, mLastScrubPosition, mLogMaxScrubSpeed, mMaxSpeed, mOptions, mPaused, mPoller, mProject, mpThread, mScrubSpeedDisplayCountdown, mScrubStartPosition, mScrubToken, mSmoothScrollingScrub, normalPlay, ControlToolBar::PlayPlayRegion(), ZoomInfo::PositionToTime(), AudioIOStartStreamOptions::pScrubbingOptions, safenew, SCRUBBING_PIXEL_TOLERANCE, ScrubPollInterval_ms, ScrubSpeedStepsPerOctave, ScrubbingOptions::startClockTimeMillis, ControlToolBar::StopPlaying(), and ControlToolBar::Straight.

Referenced by ScrubbingOverlay::OnTimer().

304 {
305  if (mScrubStartPosition < 0)
306  return false;
307  if (IsScrubbing())
308  return false;
309  else {
310  const auto state = ::wxGetMouseState();
311  mDragging = state.LeftIsDown();
312 
313  const bool busy = gAudioIO->IsBusy();
314  if (busy && gAudioIO->GetNumCaptureChannels() > 0) {
315  // Do not stop recording, and don't try to start scrubbing after
316  // recording stops
317  mScrubStartPosition = -1;
318  return false;
319  }
320 
321  wxCoord position = xx;
322  if (abs(mScrubStartPosition - position) >= SCRUBBING_PIXEL_TOLERANCE) {
323  const ViewInfo &viewInfo = mProject->GetViewInfo();
324  TrackPanel *const trackPanel = mProject->GetTrackPanel();
325  ControlToolBar * const ctb = mProject->GetControlToolBar();
326  double maxTime = mProject->GetTracks()->GetEndTime();
327  const int leftOffset = trackPanel->GetLeftOffset();
328  double time0 = std::min(maxTime,
329  viewInfo.PositionToTime(mScrubStartPosition, leftOffset)
330  );
331  double time1 = std::min(maxTime,
332  viewInfo.PositionToTime(position, leftOffset)
333  );
334  if (time1 != time0)
335  {
336  if (busy) {
337  auto position = mScrubStartPosition;
338  ctb->StopPlaying();
339  mScrubStartPosition = position;
340  }
341 
342 #ifdef DRAG_SCRUB
344  auto delta = time0 - time1;
345  time0 = std::max(0.0, std::min(maxTime,
346  (viewInfo.h + mProject->GetScreenEndTime()) / 2
347  ));
348  time1 = time0 + delta;
349  }
350 #endif
351 
353  options.pScrubbingOptions = &mOptions;
354  options.timeTrack = NULL;
355  mOptions.delay = (ScrubPollInterval_ms * 0.9 / 1000.0);
356  mOptions.minSpeed = 0.0;
357 #ifdef USE_TRANSCRIPTION_TOOLBAR
358  if (!mAlwaysSeeking) {
359  // Take the starting speed limit from the transcription toolbar,
360  // but it may be varied during the scrub.
363  }
364 #else
365  // That idea seems unpopular... just make it one for move-scrub,
366  // but big for drag-scrub
367 #ifdef DRAG_SCRUB
368  mMaxSpeed = mOptions.maxSpeed = mDragging ? MaxDragSpeed : 1.0;
369 #else
370  mMaxSpeed = mOptions.maxSpeed = 1.0;
371 #endif
372 
373 #endif
374  mOptions.minSample = 0;
376  lrint(std::max(0.0, mProject->GetTracks()->GetEndTime()) * options.rate);
378 #ifdef DRAG_SCRUB
379  mDragging ? 0.0 :
380 #endif
381  lrint(std::max(0.0, MinStutter) * options.rate);
382 
383  ControlToolBar::PlayAppearance appearance =
384  // commented out to fix Bug 1241
385  // mSeeking
386  // ? ControlToolBar::PlayAppearance::Seek
387  // : ControlToolBar::PlayAppearance::Scrub;
389 // const bool cutPreview = false;
390  const bool backwards = time1 < time0;
391 #ifdef EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL
392  static const double maxScrubSpeedBase =
393  pow(2.0, 1.0 / ScrubSpeedStepsPerOctave);
394  mLogMaxScrubSpeed = floor(0.5 +
395  log(mMaxSpeed) / log(maxScrubSpeedBase)
396  );
397 #endif
399  mScrubToken =
400  ctb->PlayPlayRegion(SelectedRegion(time0, time1), options,
401  PlayMode::normalPlay, appearance, backwards);
402  if (mScrubToken <= 0) {
403  // Bug1627 (part of it):
404  // infinite error spew when trying to start scrub:
405  // If failed for reasons of audio device problems, do not try
406  // again with repeated timer ticks.
407  mScrubStartPosition = -1;
408  return false;
409  }
410  }
411  }
412  else
413  // Wait to test again
414  mOptions.startClockTimeMillis = ::wxGetLocalTimeMillis();
415 
416  if (IsScrubbing()) {
417  mPaused = false;
418  mLastScrubPosition = xx;
419 
420 #ifdef USE_SCRUB_THREAD
421  // Detached thread is self-deleting, after it receives the Delete() message
422  mpThread = safenew ScrubPollerThread{ *this };
423  mpThread->Create(4096);
424  mpThread->Run();
425 #endif
426 
428  }
429 
430  // Return true whether we started scrub, or are still waiting to decide.
431  return true;
432  }
433 }
A ToolBar that has the main Transport buttons.
AudioIOStartStreamOptions GetDefaultPlayOptions()
Definition: Project.cpp:1298
sampleCount maxSample
Definition: Scrubbing.h:44
ViewInfo is used mainly to hold the zooming, selection and scroll information. It also has some statu...
Definition: ViewInfo.h:141
AudacityProject * mProject
Definition: Scrubbing.h:188
double GetEndTime() const
Definition: Track.cpp:1418
unsigned GetNumCaptureChannels() const
Definition: AudioIO.h:399
static const double MinStutter
Definition: Scrubbing.cpp:58
double PositionToTime(wxInt64 position, wxInt64 origin=0, bool ignoreFisheye=false) const
Definition: ViewInfo.cpp:49
void StopPlaying(bool stopStream=true)
bool IsBusy()
Returns true if audio i/o is busy starting, stopping, playing, or recording.
Definition: AudioIO.cpp:2882
ScrubbingOptions * pScrubbingOptions
Definition: AudioIO.h:150
double h
Definition: ViewInfo.h:47
ScrubPollerThread * mpThread
Definition: Scrubbing.h:196
bool mPaused
Definition: Scrubbing.h:171
#define safenew
Definition: Audacity.h:230
int mScrubToken
Definition: Scrubbing.h:170
int mLogMaxScrubSpeed
Definition: Scrubbing.h:185
double GetPlaySpeed() const
wxCoord mLastScrubPosition
Definition: Scrubbing.h:174
bool IsScrubbing() const
Definition: Scrubbing.cpp:575
Defines a selected portion of a project.
The TrackPanel class coordinates updates and operations on the main part of the screen which contains...
Definition: TrackPanel.h:245
struct holding stream options, including a pointer to the TimeTrack and AudioIOListener and whether t...
Definition: AudioIO.h:123
#define lrint(dbl)
Definition: float_cast.h:136
std::unique_ptr< ScrubPoller > mPoller
Definition: Scrubbing.h:201
int min(int a, int b)
double mMaxSpeed
Definition: Scrubbing.h:205
wxCoord mScrubStartPosition
Definition: Scrubbing.h:173
TranscriptionToolBar * GetTranscriptionToolBar()
Definition: Project.cpp:5082
double maxSpeed
Definition: Scrubbing.h:53
bool mDragging
Definition: Scrubbing.h:180
AudioIO * gAudioIO
Definition: AudioIO.cpp:482
int PlayPlayRegion(const SelectedRegion &selectedRegion, const AudioIOStartStreamOptions &options, PlayMode playMode, PlayAppearance appearance=PlayAppearance::Straight, bool backwards=false, bool playWhiteSpace=false)
wxLongLong startClockTimeMillis
Definition: Scrubbing.h:62
ControlToolBar * GetControlToolBar()
Definition: Project.cpp:5003
double minSpeed
Definition: Scrubbing.h:52
double GetScreenEndTime() const
Definition: Menus.cpp:6741
sampleCount minSample
Definition: Scrubbing.h:45
bool mSmoothScrollingScrub
Definition: Scrubbing.h:176
TrackPanel * GetTrackPanel()
Definition: Project.h:307
int GetLeftOffset() const
Definition: TrackPanel.h:287
TrackList * GetTracks()
Definition: Project.h:192
const ViewInfo & GetViewInfo() const
Definition: Project.h:207
ScrubbingOptions mOptions
Definition: Scrubbing.h:204
int mScrubSpeedDisplayCountdown
Definition: Scrubbing.h:172
bool Scrubber::MayDragToSeek ( ) const

Definition at line 600 of file Scrubbing.cpp.

References AudacityProject::GetRulerPanel(), and mProject.

Referenced by Scrubber::Forwarder::OnMouse(), and TemporarilySeeks().

601 {
602  // Return true only if the pointer is in the
603  // ruler or the track panel
604  const auto &state = ::wxGetMouseState();
605  const auto &position = state.GetPosition();
606 
607  auto ruler = mProject->GetRulerPanel();
608  if (ruler &&
609  ruler->GetScreenRect().Contains(position))
610  return true;
611 
612  /*
613  auto trackPanel = mProject->GetTrackPanel();
614  if (trackPanel &&
615  trackPanel->GetScreenRect().Contains(position))
616  return true;
617  */
618 
619  return false;
620 }
AudacityProject * mProject
Definition: Scrubbing.h:188
AdornedRulerPanel * GetRulerPanel()
Definition: Project.cpp:1439
void Scrubber::OnActivateOrDeactivateApp ( wxActivateEvent &  event)
private

Definition at line 688 of file Scrubbing.cpp.

References AudacityProject::GetControlToolBar(), ControlToolBar::IsPauseDown(), IsScrubbing(), mProject, and Pause().

689 {
690  if (event.GetActive())
692  else
693  Pause(true);
694 
695  event.Skip();
696 }
void Pause(bool paused)
Definition: Scrubbing.cpp:678
AudacityProject * mProject
Definition: Scrubbing.h:188
bool IsPauseDown() const
bool IsScrubbing() const
Definition: Scrubbing.cpp:575
ControlToolBar * GetControlToolBar()
Definition: Project.cpp:5003
void Scrubber::OnScrub ( const CommandContext )

Definition at line 912 of file Scrubbing.cpp.

References CheckMenuItems(), and OnScrubOrSeek().

913 {
914  OnScrubOrSeek(false);
915  CheckMenuItems();
916 }
void CheckMenuItems()
Definition: Scrubbing.cpp:1038
void OnScrubOrSeek(bool seek)
Definition: Scrubbing.cpp:889
void Scrubber::OnScrubOrSeek ( bool  seek)

Definition at line 889 of file Scrubbing.cpp.

References CheckMenuItems(), DoScrub(), ScrubbingToolBar::EnableDisableButtons(), AudacityProject::GetControlToolBar(), AudacityProject::GetRulerPanel(), AudacityProject::GetScrubbingToolBar(), HasStartedScrubbing(), mProject, mSeeking, AdornedRulerPanel::UpdateButtonStates(), and ControlToolBar::UpdateStatusBar().

Referenced by OnScrub(), and OnSeek().

890 {
891  DoScrub(seek);
892 
893  if (HasStartedScrubbing()) {
894  // Show the correct status.
895  const auto ctb = mProject->GetControlToolBar();
897  }
898 
899  mSeeking = seek;
900  CheckMenuItems();
901 
902  auto ruler = mProject->GetRulerPanel();
903  if (ruler)
904  // Update button images
905  ruler->UpdateButtonStates();
906 
907  auto scrubbingToolBar = mProject->GetScrubbingToolBar();
908  scrubbingToolBar->EnableDisableButtons();
909  scrubbingToolBar->RegenerateTooltips();
910 }
bool HasStartedScrubbing() const
Definition: Scrubbing.h:95
AudacityProject * mProject
Definition: Scrubbing.h:188
bool mSeeking
Definition: Scrubbing.h:178
void CheckMenuItems()
Definition: Scrubbing.cpp:1038
void UpdateStatusBar(AudacityProject *pProject)
ScrubbingToolBar * GetScrubbingToolBar()
Definition: Project.cpp:5040
AdornedRulerPanel * GetRulerPanel()
Definition: Project.cpp:1439
ControlToolBar * GetControlToolBar()
Definition: Project.cpp:5003
void EnableDisableButtons() override
void DoScrub(bool seek)
Definition: Scrubbing.cpp:864
void UpdateButtonStates()
Definition: Ruler.cpp:2933
void Scrubber::OnSeek ( const CommandContext )

Definition at line 918 of file Scrubbing.cpp.

References CheckMenuItems(), and OnScrubOrSeek().

919 {
920  OnScrubOrSeek(true);
921  CheckMenuItems();
922 }
void CheckMenuItems()
Definition: Scrubbing.cpp:1038
void OnScrubOrSeek(bool seek)
Definition: Scrubbing.cpp:889
void Scrubber::OnToggleScrubRuler ( const CommandContext )

Definition at line 924 of file Scrubbing.cpp.

References CheckMenuItems(), ToolBar::EnableDisableButtons(), AudacityProject::GetRulerPanel(), ToolManager::GetToolBar(), AudacityProject::GetToolManager(), mProject, AdornedRulerPanel::OnToggleScrubRuler(), and ScrubbingBarID.

Referenced by AdornedRulerPanel::OnToggleScrubRulerFromMenu().

925 {
927  const auto toolbar = mProject->GetToolManager()->GetToolBar(ScrubbingBarID);
928  toolbar->EnableDisableButtons();
929  CheckMenuItems();
930 }
AudacityProject * mProject
Definition: Scrubbing.h:188
void OnToggleScrubRuler()
Definition: Ruler.cpp:2903
void CheckMenuItems()
Definition: Scrubbing.cpp:1038
AdornedRulerPanel * GetRulerPanel()
Definition: Project.cpp:1439
virtual void EnableDisableButtons()=0
ToolManager * GetToolManager()
Definition: Project.h:704
ToolBar * GetToolBar(int type) const
void Scrubber::Pause ( bool  paused)

Definition at line 678 of file Scrubbing.cpp.

References mPaused.

Referenced by OnActivateOrDeactivateApp(), and ControlToolBar::OnPause().

679 {
680  mPaused = paused;
681 }
bool mPaused
Definition: Scrubbing.h:171
void Scrubber::PopulatePopupMenu ( wxMenu &  menu)

Definition at line 1022 of file Scrubbing.cpp.

References CommandManager::Check(), CMD_ID, AudacityProject::GetCommandManager(), and mProject.

Referenced by AdornedRulerPanel::ShowScrubMenu().

1023 {
1024  int id = CMD_ID;
1025  auto cm = mProject->GetCommandManager();
1026  for (const auto &item : menuItems) {
1027  if (cm->GetEnabled(item.name)) {
1028  auto test = item.StatusTest;
1029  menu.Append(id, wxGetTranslation(item.label), wxString{},
1030  test ? wxITEM_CHECK : wxITEM_NORMAL);
1031  if(test && (this->*test)())
1032  menu.FindItem(id)->Check();
1033  }
1034  ++id;
1035  }
1036 }
AudacityProject * mProject
Definition: Scrubbing.h:188
CommandManager * GetCommandManager()
Definition: Project.h:346
void Check(const wxString &name, bool checked)
bool Scrubber::Scrubs ( ) const

Definition at line 633 of file Scrubbing.cpp.

References ChoseSeeking(), HasStartedScrubbing(), IsScrubbing(), and Seeks().

Referenced by StatusMessageForWave().

634 {
635  if( Seeks() )
636  return false;
637  return (HasStartedScrubbing() || IsScrubbing()) && !ChoseSeeking();
638 }
bool ChoseSeeking() const
Definition: Scrubbing.cpp:590
bool HasStartedScrubbing() const
Definition: Scrubbing.h:95
bool IsScrubbing() const
Definition: Scrubbing.cpp:575
bool Seeks() const
Definition: Scrubbing.cpp:628
bool Scrubber::Seeks ( ) const

Definition at line 628 of file Scrubbing.cpp.

References ChoseSeeking(), HasStartedScrubbing(), and IsScrubbing().

Referenced by ContinueScrubbingPoll(), ContinueScrubbingUI(), ScrubbingOverlay::OnTimer(), Scrubs(), ShouldDrawScrubSpeed(), and StatusMessageForWave().

629 {
630  return (HasStartedScrubbing() || IsScrubbing()) && ChoseSeeking();
631 }
bool ChoseSeeking() const
Definition: Scrubbing.cpp:590
bool HasStartedScrubbing() const
Definition: Scrubbing.h:95
bool IsScrubbing() const
Definition: Scrubbing.cpp:575
void Scrubber::SetScrollScrubbing ( bool  value)
inline

Definition at line 101 of file Scrubbing.h.

References mSmoothScrollingScrub.

102  { mSmoothScrollingScrub = value; }
bool mSmoothScrollingScrub
Definition: Scrubbing.h:176
bool Scrubber::ShouldDrawScrubSpeed ( )

Definition at line 640 of file Scrubbing.cpp.

References IsScrubbing(), mPaused, mScrubSpeedDisplayCountdown, mSmoothScrollingScrub, Seeks(), and TemporarilySeeks().

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

641 {
642  return IsScrubbing() &&
643  !mPaused && (
644  // Draw for (non-scroll) scrub, sometimes, but never for seek
646  // Draw always for scroll-scrub and for scroll-seek
648  );
649 }
bool mPaused
Definition: Scrubbing.h:171
bool IsScrubbing() const
Definition: Scrubbing.cpp:575
bool TemporarilySeeks() const
Definition: Scrubbing.cpp:622
bool Seeks() const
Definition: Scrubbing.cpp:628
bool mSmoothScrollingScrub
Definition: Scrubbing.h:176
int mScrubSpeedDisplayCountdown
Definition: Scrubbing.h:172
bool Scrubber::ShowsBar ( ) const

Definition at line 570 of file Scrubbing.cpp.

References AudacityProject::GetRulerPanel(), mProject, and AdornedRulerPanel::ShowingScrubRuler().

571 {
573 }
bool ShowingScrubRuler() const
Definition: Ruler.h:365
AudacityProject * mProject
Definition: Scrubbing.h:188
AdornedRulerPanel * GetRulerPanel()
Definition: Project.cpp:1439
wxString Scrubber::StatusMessageForWave ( ) const

Definition at line 960 of file Scrubbing.cpp.

References _(), Scrubs(), and Seeks().

961 {
962  wxString result;
963  result = "";
964 
965  if( Seeks() )
966  result = _("Move mouse pointer to Seek");
967  else if( Scrubs() )
968  result = _("Move mouse pointer to Scrub");
969  return result;
970 }
bool Seeks() const
Definition: Scrubbing.cpp:628
bool Scrubs() const
Definition: Scrubbing.cpp:633
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
void Scrubber::StopScrubbing ( )

Definition at line 536 of file Scrubbing.cpp.

References CheckMenuItems(), AudacityProject::DoPlayStopSelect(), AudacityProject::GetControlToolBar(), AudacityProject::GetRulerPanel(), HasStartedScrubbing(), AdornedRulerPanel::HideQuickPlayIndicator(), IsScrubbing(), mCancelled, mDragging, mPoller, mProject, mpThread, mScrubStartPosition, mSeeking, ControlToolBar::SetPlay(), and ControlToolBar::Straight.

Referenced by ControlToolBar::StopPlaying().

537 {
538 #ifdef USE_SCRUB_THREAD
539  if (mpThread) {
540  mpThread->Delete();
541  mpThread = nullptr;
542  }
543 #endif
544 
545  mPoller->Stop();
546 
547  if (HasStartedScrubbing() && !mCancelled) {
548  const wxMouseState state(::wxGetMouseState());
549  // Stop and set cursor
550  bool bShift = state.ShiftDown();
551  mProject->DoPlayStopSelect(true, bShift);
552  }
553 
554  mScrubStartPosition = -1;
555  mDragging = false;
556  mSeeking = false;
557 
558  if (!IsScrubbing())
559  {
560  // Marked scrub start, but
561  // didn't really play, but did change button apperance
562  const auto ctb = mProject->GetControlToolBar();
564  }
565 
567  CheckMenuItems();
568 }
void SetPlay(bool down, PlayAppearance appearance=PlayAppearance::Straight)
bool HasStartedScrubbing() const
Definition: Scrubbing.h:95
AudacityProject * mProject
Definition: Scrubbing.h:188
bool mSeeking
Definition: Scrubbing.h:178
bool mCancelled
Definition: Scrubbing.h:182
void CheckMenuItems()
Definition: Scrubbing.cpp:1038
ScrubPollerThread * mpThread
Definition: Scrubbing.h:196
void HideQuickPlayIndicator(bool repaint_all=false)
Definition: Ruler.cpp:3364
bool IsScrubbing() const
Definition: Scrubbing.cpp:575
AdornedRulerPanel * GetRulerPanel()
Definition: Project.cpp:1439
std::unique_ptr< ScrubPoller > mPoller
Definition: Scrubbing.h:201
wxCoord mScrubStartPosition
Definition: Scrubbing.h:173
bool mDragging
Definition: Scrubbing.h:180
ControlToolBar * GetControlToolBar()
Definition: Project.cpp:5003
bool DoPlayStopSelect(bool click, bool shift)
Definition: Menus.cpp:2918
bool Scrubber::TemporarilySeeks ( ) const

Definition at line 622 of file Scrubbing.cpp.

References MayDragToSeek(), and mScrubSeekPress.

Referenced by ContinueScrubbingPoll(), ContinueScrubbingUI(), ScrubbingOverlay::OnTimer(), and ShouldDrawScrubSpeed().

623 {
624  return mScrubSeekPress ||
625  (::wxGetMouseState().LeftIsDown() && MayDragToSeek());
626 }
bool MayDragToSeek() const
Definition: Scrubbing.cpp:600
bool mScrubSeekPress
Definition: Scrubbing.h:175
template<void(Scrubber::*)(const CommandContext &) pfn>
void Scrubber::Thunk ( wxCommandEvent &  )
inline

Definition at line 135 of file Scrubbing.h.

References GetActiveProject().

136  { (this->*pfn)(*GetActiveProject()); }
AudacityProject * GetActiveProject()
Definition: Project.cpp:308

Member Data Documentation

bool Scrubber::mCancelled {}
private

Definition at line 182 of file Scrubbing.h.

Referenced by Cancel(), MarkScrubStart(), and StopScrubbing().

bool Scrubber::mDragging {}
private
Forwarder Scrubber::mForwarder { *this }
private

Definition at line 167 of file Scrubbing.h.

bool Scrubber::mInOneShotMode

Definition at line 150 of file Scrubbing.h.

Referenced by AdornedRulerPanel::OnMouseEvents().

wxCoord Scrubber::mLastScrubPosition {}
private

Definition at line 174 of file Scrubbing.h.

Referenced by ContinueScrubbingPoll(), and MaybeStartScrubbing().

int Scrubber::mLogMaxScrubSpeed
private

Definition at line 185 of file Scrubbing.h.

Referenced by HandleScrollWheel(), and MaybeStartScrubbing().

double Scrubber::mMaxSpeed { 1.0 }
private
ScrubbingOptions Scrubber::mOptions
private
bool Scrubber::mPaused
private
std::unique_ptr<ScrubPoller> Scrubber::mPoller
private

Definition at line 201 of file Scrubbing.h.

Referenced by MaybeStartScrubbing(), and StopScrubbing().

AudacityProject* Scrubber::mProject
private
ScrubPollerThread* Scrubber::mpThread {}
private

Definition at line 196 of file Scrubbing.h.

Referenced by MaybeStartScrubbing(), StopScrubbing(), and ~Scrubber().

bool Scrubber::mScrubSeekPress {}
private
int Scrubber::mScrubSpeedDisplayCountdown
private
wxCoord Scrubber::mScrubStartPosition
private
int Scrubber::mScrubToken
private

Definition at line 170 of file Scrubbing.h.

Referenced by IsScrubbing(), and MaybeStartScrubbing().

bool Scrubber::mSeeking {}
private
bool Scrubber::mSmoothScrollingScrub
private

The documentation for this class was generated from the following files: