Audacity  3.0.3
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle Class Reference
Inheritance diagram for anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle:
[legend]
Collaboration diagram for anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle:
[legend]

Public Member Functions

 PlayheadHandle (wxCoord xx)
 
- 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 HandlesRightClick ()
 Whether the handle has any special right-button handling. More...
 
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)
 

Static Public Member Functions

static UIHandle::Result NeedChangeHighlight (const PlayheadHandle &oldState, const PlayheadHandle &newState)
 
static std::shared_ptr< PlayheadHandleHitTest (const AudacityProject *pProject, wxCoord xx)
 
- 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 Member Functions

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

Protected Attributes

wxCoord mX
 
double mOrigPreference {}
 
- Protected Attributes inherited from UIHandle
Result mChangeHighlight { 0 }
 

Additional Inherited Members

- Public Types inherited from UIHandle
using Result = unsigned
 
using Cell = TrackPanelCell
 

Detailed Description

Definition at line 592 of file AdornedRulerPanel.cpp.

Constructor & Destructor Documentation

◆ PlayheadHandle()

anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::PlayheadHandle ( wxCoord  xx)
inlineexplicit

Definition at line 596 of file AdornedRulerPanel.cpp.

597  : mX( xx )
598  {}

Member Function Documentation

◆ Cancel()

Result anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::Cancel ( AudacityProject )
inlineoverrideprotectedvirtual

Implements UIHandle.

Definition at line 674 of file AdornedRulerPanel.cpp.

References RefreshCode::DrawOverlays, and TracksPrefs::SetPinnedHeadPositionPreference().

Here is the call graph for this function:

◆ Click()

Result anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::Click ( const TrackPanelMouseEvent event,
AudacityProject  
)
inlineoverrideprotectedvirtual

Implements UIHandle.

Definition at line 623 of file AdornedRulerPanel.cpp.

625  {
626  if (event.event.LeftDClick()) {
627  // Restore default position on double click
629 
631  // Do not start a drag
633  }
634  // Fix for Bug 2357
635  if (!event.event.LeftIsDown())
636  return RefreshCode::Cancelled;
637 
639  return 0;
640  }

References RefreshCode::Cancelled, RefreshCode::DrawOverlays, TrackPanelMouseEvent::event, TracksPrefs::GetPinnedHeadPositionPreference(), and TracksPrefs::SetPinnedHeadPositionPreference().

Here is the call graph for this function:

◆ Drag()

Result anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::Drag ( const TrackPanelMouseEvent event,
AudacityProject pProject 
)
inlineoverrideprotectedvirtual

Implements UIHandle.

Definition at line 642 of file AdornedRulerPanel.cpp.

644  {
645 
646  auto value = GetPlayHeadFraction(pProject, event.event.m_x );
649  }

References RefreshCode::DrawOverlays, TrackPanelMouseEvent::event, anonymous_namespace{AdornedRulerPanel.cpp}::GetPlayHeadFraction(), and TracksPrefs::SetPinnedHeadPositionPreference().

Here is the call graph for this function:

◆ Enter()

void anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::Enter ( bool  ,
AudacityProject  
)
inlineoverrideprotectedvirtual

Reimplemented from UIHandle.

Definition at line 680 of file AdornedRulerPanel.cpp.

681  {
683  }

References RefreshCode::DrawOverlays.

◆ HitTest()

static std::shared_ptr<PlayheadHandle> anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::HitTest ( const AudacityProject pProject,
wxCoord  xx 
)
inlinestatic

Definition at line 609 of file AdornedRulerPanel.cpp.

610  {
611  if( Scrubber::Get( *pProject )
612  .IsTransportingPinned() &&
613  ProjectAudioIO::Get( *pProject ).IsAudioActive() )
614  {
615  const auto targetX = GetPlayHeadX( pProject );
616  if ( abs( xx - targetX ) <= SELECT_TOLERANCE_PIXEL )
617  return std::make_shared<PlayheadHandle>( xx );
618  }
619  return {};
620  }

References ProjectAudioIO::Get(), Scrubber::Get(), anonymous_namespace{AdornedRulerPanel.cpp}::GetPlayHeadX(), ProjectAudioIO::IsAudioActive(), and SELECT_TOLERANCE_PIXEL.

Here is the call graph for this function:

◆ NeedChangeHighlight()

static UIHandle::Result anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::NeedChangeHighlight ( const PlayheadHandle oldState,
const PlayheadHandle newState 
)
inlinestatic

Definition at line 600 of file AdornedRulerPanel.cpp.

602  {
603  if (oldState.mX != newState.mX)
605  return 0;
606  }

References RefreshCode::DrawOverlays, and mX.

◆ Preview()

HitTestPreview anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::Preview ( const TrackPanelMouseState ,
AudacityProject  
)
inlineoverrideprotectedvirtual

Implements UIHandle.

Definition at line 651 of file AdornedRulerPanel.cpp.

654  {
655  static wxCursor cursor{ wxCURSOR_SIZEWE };
656  return {
657  XO( "Click and drag to adjust, double-click to reset" ),
658  &cursor,
659  /* i18n-hint: This text is a tooltip on the icon (of a pin) representing
660  the temporal position in the audio. */
661  XO( "Record/Play head" )
662  };
663  }

References XO.

◆ Release()

Result anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::Release ( const TrackPanelMouseEvent event,
AudacityProject pProject,
wxWindow *   
)
inlineoverrideprotectedvirtual

Implements UIHandle.

Definition at line 665 of file AdornedRulerPanel.cpp.

668  {
669  auto value = GetPlayHeadFraction(pProject, event.event.m_x );
672  }

References RefreshCode::DrawOverlays, TrackPanelMouseEvent::event, anonymous_namespace{AdornedRulerPanel.cpp}::GetPlayHeadFraction(), and TracksPrefs::SetPinnedHeadPositionPreference().

Here is the call graph for this function:

Member Data Documentation

◆ mOrigPreference

double anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::mOrigPreference {}
protected

Definition at line 686 of file AdornedRulerPanel.cpp.

◆ mX

wxCoord anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::mX
protected

Definition at line 685 of file AdornedRulerPanel.cpp.

Referenced by NeedChangeHighlight().


The documentation for this class was generated from the following file:
RefreshCode::DrawOverlays
@ DrawOverlays
Definition: RefreshCode.h:32
Scrubber::Get
static Scrubber & Get(AudacityProject &project)
Definition: Scrubbing.cpp:201
SELECT_TOLERANCE_PIXEL
#define SELECT_TOLERANCE_PIXEL
Definition: AdornedRulerPanel.cpp:67
RefreshCode::Cancelled
@ Cancelled
Definition: RefreshCode.h:23
XO
#define XO(s)
Definition: Internat.h:31
ProjectAudioIO::Get
static ProjectAudioIO & Get(AudacityProject &project)
Definition: ProjectAudioIO.cpp:22
TracksPrefs::SetPinnedHeadPositionPreference
static void SetPinnedHeadPositionPreference(double value, bool flush=false)
Definition: TracksPrefs.cpp:414
ProjectAudioIO::IsAudioActive
bool IsAudioActive() const
Definition: ProjectAudioIO.cpp:51
UIHandle::mChangeHighlight
Result mChangeHighlight
Definition: UIHandle.h:139
anonymous_namespace{AdornedRulerPanel.cpp}::GetPlayHeadX
wxCoord GetPlayHeadX(const AudacityProject *pProject)
Definition: AdornedRulerPanel.cpp:574
TracksPrefs::GetPinnedHeadPositionPreference
static double GetPinnedHeadPositionPreference()
Definition: TracksPrefs.cpp:406
anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::mX
wxCoord mX
Definition: AdornedRulerPanel.cpp:685
anonymous_namespace{AdornedRulerPanel.cpp}::GetPlayHeadFraction
double GetPlayHeadFraction(const AudacityProject *pProject, wxCoord xx)
Definition: AdornedRulerPanel.cpp:582
TrackPanelMouseEvent::event
wxMouseEvent & event
Definition: TrackPanelMouseEvent.h:58
anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::mOrigPreference
double mOrigPreference
Definition: AdornedRulerPanel.cpp:686