Audacity 3.2.0
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 (AdornedRulerPanel &parent, wxCoord xx)
 
std::shared_ptr< const TrackFindTrack () const override
 
- Public Member Functions inherited from UIHandle
virtual ~UIHandle ()=0
 
virtual void Enter (bool forward, AudacityProject *pProject)
 
virtual bool HasRotation () const
 
virtual bool Rotate (bool forward)
 
virtual bool HasEscape (AudacityProject *pProject) const
 
virtual bool Escape (AudacityProject *pProject)
 
virtual bool HandlesRightClick ()
 Whether the handle has any special right-button handling. More...
 
virtual Result Click (const TrackPanelMouseEvent &event, AudacityProject *pProject)=0
 
virtual Result Drag (const TrackPanelMouseEvent &event, AudacityProject *pProject)=0
 
virtual HitTestPreview Preview (const TrackPanelMouseState &state, AudacityProject *pProject)=0
 
virtual Result Release (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)=0
 
virtual Result Cancel (AudacityProject *pProject)=0
 
virtual bool StopsOnKeystroke ()
 
virtual void OnProjectChange (AudacityProject *pProject)
 
virtual std::shared_ptr< const TrackFindTrack () const =0
 
virtual bool IsDragging () const
 
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, AdornedRulerPanel &parent, wxCoord xx)
 
- Static Public Member Functions inherited from UIHandle
static UIHandle::Result NeedChangeHighlight (const UIHandle &, const UIHandle &)
 
static std::shared_ptr< const TrackTrackFromChannel (const std::shared_ptr< const Channel > &pChannel)
 A frequent convenience in the definition of UIHandles. More...
 
- 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

AdornedRulerPanelmpParent
 
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 918 of file AdornedRulerPanel.cpp.

Constructor & Destructor Documentation

◆ PlayheadHandle()

anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::PlayheadHandle ( AdornedRulerPanel parent,
wxCoord  xx 
)
inline

Member Function Documentation

◆ Cancel()

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

Implements UIHandle.

Definition at line 1005 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 953 of file AdornedRulerPanel.cpp.

955 {
956 if (event.event.LeftDClick()) {
957 // Restore default position on double click
959
961 // Do not start a drag
963 }
964 // Fix for Bug 2357
965 if (!event.event.LeftIsDown())
967
969 return 0;
970 }
static double GetPinnedHeadPositionPreference()

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 972 of file AdornedRulerPanel.cpp.

974 {
975
976 auto value = GetPlayHeadFraction(pProject, event.event.m_x );
979 }
double GetPlayHeadFraction(const AudacityProject *pProject, wxCoord xx)

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 1011 of file AdornedRulerPanel.cpp.

1012 {
1014 }
Result mChangeHighlight
Definition: UIHandle.h:152

References RefreshCode::DrawOverlays.

◆ FindTrack()

std::shared_ptr< const Track > anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::FindTrack ( ) const
inlineoverridevirtual
Returns
pointer to associated track, if any

Implements UIHandle.

Definition at line 926 of file AdornedRulerPanel.cpp.

927 { return nullptr; }

◆ HitTest()

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

Definition at line 938 of file AdornedRulerPanel.cpp.

940 {
941 if( Scrubber::Get( *pProject )
942 .IsTransportingPinned() &&
943 ProjectAudioIO::Get( *pProject ).IsAudioActive() )
944 {
945 const auto targetX = GetPlayHeadX( pProject );
946 if ( abs( xx - targetX ) <= SELECT_TOLERANCE_PIXEL )
947 return std::make_shared<PlayheadHandle>( parent, xx );
948 }
949 return {};
950 }
#define SELECT_TOLERANCE_PIXEL
bool IsAudioActive() const
static ProjectAudioIO & Get(AudacityProject &project)
static Scrubber & Get(AudacityProject &project)
Definition: Scrubbing.cpp:186
wxCoord GetPlayHeadX(const AudacityProject *pProject)

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 929 of file AdornedRulerPanel.cpp.

931 {
932 if (oldState.mX != newState.mX)
934 return 0;
935 }

References RefreshCode::DrawOverlays, and mX.

◆ Preview()

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

Implements UIHandle.

Definition at line 981 of file AdornedRulerPanel.cpp.

984 {
986 static wxCursor cursor{ wxCURSOR_SIZEWE };
987 return {
988 XO( "Click and drag to adjust, double-click to reset" ),
989 &cursor,
990 /* i18n-hint: This text is a tooltip on the icon (of a pin) representing
991 the temporal position in the audio. */
992 XO( "Record/Playhead" )
993 };
994 }
XO("Cut/Copy/Paste")
void SetNumGuides(size_t nn)

References XO().

Here is the call graph for this function:

◆ Release()

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

Implements UIHandle.

Definition at line 996 of file AdornedRulerPanel.cpp.

999 {
1000 auto value = GetPlayHeadFraction(pProject, event.event.m_x );
1003 }

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 1018 of file AdornedRulerPanel.cpp.

◆ mpParent

AdornedRulerPanel* anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::mpParent
protected

Definition at line 1016 of file AdornedRulerPanel.cpp.

◆ mX

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

Definition at line 1017 of file AdornedRulerPanel.cpp.

Referenced by NeedChangeHighlight().


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