Audacity  3.0.3
Public Member Functions | Private Member Functions | List of all members
AdornedRulerPanel::ScrubbingHandle Class Referencefinal
Inheritance diagram for AdornedRulerPanel::ScrubbingHandle:
[legend]
Collaboration diagram for AdornedRulerPanel::ScrubbingHandle:
[legend]

Public Member Functions

 ScrubbingHandle (AdornedRulerPanel *pParent, wxCoord xx)
 
- Public Member Functions inherited from AdornedRulerPanel::CommonRulerHandle
 CommonRulerHandle (AdornedRulerPanel *pParent, wxCoord xx, MenuChoice menuChoice)
 
bool Clicked () const
 
- Public Member Functions inherited from UIHandle
virtual ~UIHandle ()=0
 
virtual bool HasRotation () const
 
virtual bool Rotate (bool forward)
 
virtual bool HasEscape () const
 
virtual bool Escape (AudacityProject *pProject)
 
virtual bool StopsOnKeystroke ()
 
virtual void OnProjectChange (AudacityProject *pProject)
 
Result GetChangeHighlight () const
 
void SetChangeHighlight (Result val)
 
- Public Member Functions inherited from TrackPanelDrawable
virtual ~TrackPanelDrawable ()=0
 
virtual void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
 
virtual wxRect DrawingArea (TrackPanelDrawingContext &context, const wxRect &rect, const wxRect &panelRect, unsigned iPass)
 

Private Member Functions

Result Click (const TrackPanelMouseEvent &event, AudacityProject *pProject) override
 
Result Drag (const TrackPanelMouseEvent &event, AudacityProject *pProject) override
 
HitTestPreview Preview (const TrackPanelMouseState &state, AudacityProject *pProject) override
 
Result Release (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
 
Result Cancel (AudacityProject *pProject) override
 

Additional Inherited Members

- Public Types inherited from UIHandle
using Result = unsigned
 
using Cell = TrackPanelCell
 
- Static Public Member Functions inherited from AdornedRulerPanel::CommonRulerHandle
static UIHandle::Result NeedChangeHighlight (const CommonRulerHandle &oldState, const CommonRulerHandle &newState)
 
- Static Public Member Functions inherited from UIHandle
static UIHandle::Result NeedChangeHighlight (const UIHandle &, const UIHandle &)
 
- Static Public Member Functions inherited from TrackPanelDrawable
static wxRect MaximizeWidth (const wxRect &rect, const wxRect &panelRect)
 
static wxRect MaximizeHeight (const wxRect &rect, const wxRect &panelRect)
 
- Protected Types inherited from AdornedRulerPanel::CommonRulerHandle
enum  Button { Button::None, Button::Left, Button::Right }
 
- Protected Member Functions inherited from AdornedRulerPanel::CommonRulerHandle
bool HandlesRightClick () override
 Whether the handle has any special right-button handling. More...
 
void Enter (bool, AudacityProject *) override
 
- Protected Attributes inherited from AdornedRulerPanel::CommonRulerHandle
wxWeakRef< AdornedRulerPanelmParent
 
wxCoord mX
 
MenuChoice mChoice
 
Button mClicked { Button::None }
 
- Protected Attributes inherited from UIHandle
Result mChangeHighlight { 0 }
 

Detailed Description

Definition at line 759 of file AdornedRulerPanel.cpp.

Constructor & Destructor Documentation

◆ ScrubbingHandle()

AdornedRulerPanel::ScrubbingHandle::ScrubbingHandle ( AdornedRulerPanel pParent,
wxCoord  xx 
)
inlineexplicit

Definition at line 763 of file AdornedRulerPanel.cpp.

764  : CommonRulerHandle( pParent, xx, MenuChoice::Scrub )
765  {
766  }

Member Function Documentation

◆ Cancel()

Result AdornedRulerPanel::ScrubbingHandle::Cancel ( AudacityProject pProject)
inlineoverrideprivatevirtual

Reimplemented from AdornedRulerPanel::CommonRulerHandle.

Definition at line 821 of file AdornedRulerPanel.cpp.

822  {
823  auto result = CommonRulerHandle::Cancel(pProject);
824 
825  if (mClicked == Button::Left) {
826  auto &scrubber = Scrubber::Get( *pProject );
827  scrubber.Cancel();
828 
829  ProjectAudioManager::Get( *pProject ).Stop();
830  }
831 
832  return result;
833  }

References AdornedRulerPanel::CommonRulerHandle::Cancel(), ProjectAudioManager::Get(), Scrubber::Get(), AdornedRulerPanel::CommonRulerHandle::Left, AdornedRulerPanel::CommonRulerHandle::mClicked, and ProjectAudioManager::Stop().

Here is the call graph for this function:

◆ Click()

Result AdornedRulerPanel::ScrubbingHandle::Click ( const TrackPanelMouseEvent event,
AudacityProject pProject 
)
inlineoverrideprivatevirtual

Reimplemented from AdornedRulerPanel::CommonRulerHandle.

Definition at line 769 of file AdornedRulerPanel.cpp.

771  {
772  auto result = CommonRulerHandle::Click(event, pProject);
773  if (!( result & RefreshCode::Cancelled )) {
774  if (mClicked == Button::Left) {
775  auto &scrubber = Scrubber::Get( *pProject );
776  // only if scrubbing is allowed now
777  bool canScrub =
778  scrubber.CanScrub() &&
779  mParent &&
780  mParent->ShowingScrubRuler();
781 
782  if (!canScrub)
783  return RefreshCode::Cancelled;
784  if (!scrubber.HasMark()) {
785  // Asynchronous scrub poller gets activated here
786  scrubber.MarkScrubStart(
787  event.event.m_x, Scrubber::ShouldScrubPinned(), false);
788  }
789  }
790  }
791  return result;
792  }

References RefreshCode::Cancelled, AdornedRulerPanel::CommonRulerHandle::Click(), TrackPanelMouseEvent::event, Scrubber::Get(), AdornedRulerPanel::CommonRulerHandle::Left, AdornedRulerPanel::CommonRulerHandle::mClicked, AdornedRulerPanel::CommonRulerHandle::mParent, and Scrubber::ShouldScrubPinned().

Here is the call graph for this function:

◆ Drag()

Result AdornedRulerPanel::ScrubbingHandle::Drag ( const TrackPanelMouseEvent event,
AudacityProject pProject 
)
inlineoverrideprivatevirtual

Reimplemented from AdornedRulerPanel::CommonRulerHandle.

Definition at line 794 of file AdornedRulerPanel.cpp.

796  {
797  auto result = CommonRulerHandle::Drag(event, pProject);
798  if (!( result & RefreshCode::Cancelled )) {
799  // Nothing needed here. The scrubber works by polling mouse state
800  // after the start has been marked.
801  }
802  return result;
803  }

References RefreshCode::Cancelled, and AdornedRulerPanel::CommonRulerHandle::Drag().

Here is the call graph for this function:

◆ Preview()

auto AdornedRulerPanel::ScrubbingHandle::Preview ( const TrackPanelMouseState state,
AudacityProject pProject 
)
overrideprivatevirtual

Implements UIHandle.

Definition at line 1541 of file AdornedRulerPanel.cpp.

1544 {
1545  auto &scrubber = Scrubber::Get( *pProject );
1546  auto message = ScrubbingMessage(scrubber, mClicked == Button::Left);
1547 
1548  return {
1549  message,
1550  {},
1551  // Tooltip is same as status message, or blank
1552  ((mParent && mParent->mTimelineToolTip) ? message : TranslatableString{}),
1553  };
1554 }

References Scrubber::Get(), and anonymous_namespace{AdornedRulerPanel.cpp}::ScrubbingMessage().

Here is the call graph for this function:

◆ Release()

Result AdornedRulerPanel::ScrubbingHandle::Release ( const TrackPanelMouseEvent event,
AudacityProject pProject,
wxWindow *  pParent 
)
inlineoverrideprivatevirtual

Reimplemented from AdornedRulerPanel::CommonRulerHandle.

Definition at line 809 of file AdornedRulerPanel.cpp.

811  {
812  auto result = CommonRulerHandle::Release(event, pProject, pParent);
813  if (!( result & RefreshCode::Cancelled )) {
814  // Nothing needed here either. The scrub poller may have decided to
815  // seek because a drag happened before button up, or it may decide
816  // to start a scrub, as it watches mouse movement after the button up.
817  }
818  return result;
819  }

References RefreshCode::Cancelled, and AdornedRulerPanel::CommonRulerHandle::Release().

Here is the call graph for this function:

The documentation for this class was generated from the following file:
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
Scrubber::Get
static Scrubber & Get(AudacityProject &project)
Definition: Scrubbing.cpp:201
ProjectAudioManager::Get
static ProjectAudioManager & Get(AudacityProject &project)
Definition: ProjectAudioManager.cpp:55
AdornedRulerPanel::CommonRulerHandle::mParent
wxWeakRef< AdornedRulerPanel > mParent
Definition: AdornedRulerPanel.cpp:173
Scrubber::ShouldScrubPinned
static bool ShouldScrubPinned()
Definition: Scrubbing.cpp:164
AdornedRulerPanel::CommonRulerHandle::Cancel
Result Cancel(AudacityProject *) override
Definition: AdornedRulerPanel.cpp:163
RefreshCode::Cancelled
@ Cancelled
Definition: RefreshCode.h:23
AdornedRulerPanel::CommonRulerHandle::Button::Left
@ Left
AdornedRulerPanel::CommonRulerHandle::Release
Result Release(const TrackPanelMouseEvent &event, AudacityProject *, wxWindow *) override
Definition: AdornedRulerPanel.cpp:152
anonymous_namespace{AdornedRulerPanel.cpp}::ScrubbingMessage
const TranslatableString ScrubbingMessage(const Scrubber &scrubber, bool clicked)
Definition: AdornedRulerPanel.cpp:1158
AdornedRulerPanel::CommonRulerHandle::CommonRulerHandle
CommonRulerHandle(AdornedRulerPanel *pParent, wxCoord xx, MenuChoice menuChoice)
Definition: AdornedRulerPanel.cpp:119
AdornedRulerPanel::CommonRulerHandle::Click
Result Click(const TrackPanelMouseEvent &event, AudacityProject *) override
Definition: AdornedRulerPanel.cpp:139
ProjectAudioManager::Stop
void Stop(bool stopStream=true)
Definition: ProjectAudioManager.cpp:495
AdornedRulerPanel::CommonRulerHandle::Drag
Result Drag(const TrackPanelMouseEvent &, AudacityProject *) override
Definition: AdornedRulerPanel.cpp:146
AdornedRulerPanel::MenuChoice::Scrub
@ Scrub
AdornedRulerPanel::CommonRulerHandle::mClicked
Button mClicked
Definition: AdornedRulerPanel.cpp:180
TrackPanelMouseEvent::event
wxMouseEvent & event
Definition: TrackPanelMouseEvent.h:58