Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
SelectButtonHandle Class Referencefinal

#include <TrackButtonHandles.h>

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

Public Member Functions

 SelectButtonHandle (const std::shared_ptr< Track > &pTrack, const wxRect &rect)
 
SelectButtonHandleoperator= (const SelectButtonHandle &)=default
 
virtual ~SelectButtonHandle ()
 
- Public Member Functions inherited from ButtonHandle
std::shared_ptr< TrackGetTrack () const
 
bool IsDragging () 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 UIHandlePtr HitTest (std::weak_ptr< SelectButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, TrackPanelCell *pCell)
 
- 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 CommitChanges (const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
 
TranslatableString Tip (const wxMouseState &state, AudacityProject &) const override
 
- Protected Member Functions inherited from ButtonHandle
 ButtonHandle (const std::shared_ptr< Track > &pTrack, const wxRect &rect)
 
ButtonHandleoperator= (const ButtonHandle &)=default
 
virtual ~ButtonHandle ()
 
std::shared_ptr< const TrackFindTrack () const override
 
virtual Result CommitChanges (const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent)=0
 
virtual TranslatableString Tip (const wxMouseState &state, AudacityProject &project) const =0
 
void Enter (bool forward, AudacityProject *) final override
 
Result Click (const TrackPanelMouseEvent &event, AudacityProject *pProject) final override
 
Result Drag (const TrackPanelMouseEvent &event, AudacityProject *pProject) final override
 
HitTestPreview Preview (const TrackPanelMouseState &state, AudacityProject *pProject) final override
 
Result Release (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) final override
 
Result Cancel (AudacityProject *pProject) final override
 

Private Member Functions

 SelectButtonHandle (const SelectButtonHandle &)=delete
 

Additional Inherited Members

- Public Types inherited from UIHandle
using Result = unsigned
 
using Cell = TrackPanelCell
 
- Protected Attributes inherited from ButtonHandle
std::weak_ptr< TrackmpTrack
 
wxRect mRect
 
bool mWasIn { true }
 
bool mIsDragging {}
 
- Protected Attributes inherited from UIHandle
Result mChangeHighlight { 0 }
 

Detailed Description

Definition at line 44 of file TrackButtonHandles.h.

Constructor & Destructor Documentation

◆ SelectButtonHandle() [1/2]

SelectButtonHandle::SelectButtonHandle ( const SelectButtonHandle )
privatedelete

◆ SelectButtonHandle() [2/2]

SelectButtonHandle::SelectButtonHandle ( const std::shared_ptr< Track > &  pTrack,
const wxRect &  rect 
)
explicit

Definition at line 85 of file TrackButtonHandles.cpp.

87 : ButtonHandle{ pTrack, rect }
88{}
A UIHandle for a TrackPanel button, such as the Mute and Solo buttons.
Definition: ButtonHandle.h:26

◆ ~SelectButtonHandle()

SelectButtonHandle::~SelectButtonHandle ( )
virtual

Definition at line 90 of file TrackButtonHandles.cpp.

91{
92}

Member Function Documentation

◆ CommitChanges()

UIHandle::Result SelectButtonHandle::CommitChanges ( const wxMouseEvent &  event,
AudacityProject pProject,
wxWindow *  pParent 
)
overrideprotectedvirtual

Implements ButtonHandle.

Definition at line 94 of file TrackButtonHandles.cpp.

96{
97 using namespace RefreshCode;
98
99 auto pTrack = mpTrack.lock();
100 if (pTrack)
101 {
102 const bool unsafe = ProjectAudioIO::Get( *pProject ).IsAudioActive();
104 *pTrack, event.ShiftDown(), event.ControlDown(), !unsafe);
105// return RefreshAll ;
106 }
107
108 return RefreshNone;
109}
std::weak_ptr< Track > mpTrack
Definition: ButtonHandle.h:74
bool IsAudioActive() const
static ProjectAudioIO & Get(AudacityProject &project)
Namespace containing an enum 'what to do on a refresh?'.
Definition: RefreshCode.h:16
void DoListSelection(AudacityProject &project, Track &t, bool shift, bool ctrl, bool modifyState)

References SelectUtilities::DoListSelection(), ProjectAudioIO::Get(), ProjectAudioIO::IsAudioActive(), ButtonHandle::mpTrack, and RefreshCode::RefreshNone.

Here is the call graph for this function:

◆ HitTest()

UIHandlePtr SelectButtonHandle::HitTest ( std::weak_ptr< SelectButtonHandle > &  holder,
const wxMouseState &  state,
const wxRect &  rect,
TrackPanelCell pCell 
)
static

Definition at line 122 of file TrackButtonHandles.cpp.

125{
126 wxRect buttonRect;
127 CommonTrackInfo::GetSelectButtonRect(rect, buttonRect);
128
129 if (buttonRect.Contains(state.m_x, state.m_y)) {
130 auto pTrack = static_cast<CommonTrackPanelCell*>(pCell)->FindTrack();
131 auto result = std::make_shared<SelectButtonHandle>( pTrack, buttonRect );
132 result = AssignUIHandlePtr(holder, result);
133 return result;
134 }
135 else
136 return {};
137}
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:164
std::shared_ptr< const Track > FindTrack() const override
AUDACITY_DLL_API void GetSelectButtonRect(const wxRect &rect, wxRect &dest)

References AssignUIHandlePtr(), ButtonHandle::FindTrack(), and CommonTrackInfo::GetSelectButtonRect().

Referenced by CommonTrackControls::HitTest().

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

◆ operator=()

SelectButtonHandle & SelectButtonHandle::operator= ( const SelectButtonHandle )
default

◆ Tip()

TranslatableString SelectButtonHandle::Tip ( const wxMouseState &  state,
AudacityProject  
) const
overrideprotectedvirtual

Implements ButtonHandle.

Definition at line 111 of file TrackButtonHandles.cpp.

113{
114 auto pTrack = GetTrack();
115#if defined(__WXMAC__)
116 return pTrack->GetSelected() ? XO("Command+Click to deselect") : XO("Select track");
117#else
118 return pTrack->GetSelected() ? XO("Ctrl+Click to deselect") : XO("Select track");
119#endif
120}
XO("Cut/Copy/Paste")
std::shared_ptr< Track > GetTrack() const
Definition: ButtonHandle.h:30

References ButtonHandle::GetTrack(), and XO().

Here is the call graph for this function:

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