Audacity  3.0.3
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:
Collaboration diagram for SelectButtonHandle:

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 IsClicked () 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 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 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 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 ()
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 mIsClicked {}
- 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 )

◆ SelectButtonHandle() [2/2]

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

Definition at line 86 of file TrackButtonHandles.cpp.

88  : ButtonHandle{ pTrack, rect }
89 {}

◆ ~SelectButtonHandle()

SelectButtonHandle::~SelectButtonHandle ( )

Definition at line 91 of file TrackButtonHandles.cpp.

92 {
93 }

Member Function Documentation

◆ CommitChanges()

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

Implements ButtonHandle.

Definition at line 95 of file TrackButtonHandles.cpp.

97 {
98  using namespace RefreshCode;
100  auto pTrack = mpTrack.lock();
101  if (pTrack)
102  {
103  const bool unsafe = ProjectAudioIO::Get( *pProject ).IsAudioActive();
105  pTrack.get(), event.ShiftDown(), event.ControlDown(), !unsafe);
106 // return RefreshAll ;
107  }
109  return RefreshNone;
110 }

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 

Definition at line 123 of file TrackButtonHandles.cpp.

126 {
127  wxRect buttonRect;
128  TrackInfo::GetSelectButtonRect(rect, buttonRect);
130  if (buttonRect.Contains(state.m_x, state.m_y)) {
131  auto pTrack = static_cast<CommonTrackPanelCell*>(pCell)->FindTrack();
132  auto result = std::make_shared<SelectButtonHandle>( pTrack, buttonRect );
133  result = AssignUIHandlePtr(holder, result);
134  return result;
135  }
136  else
137  return {};
138 }

References AssignUIHandlePtr(), anonymous_namespace{TrackPanel.cpp}::FindTrack(), and TrackInfo::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 )

◆ Tip()

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

Implements ButtonHandle.

Definition at line 112 of file TrackButtonHandles.cpp.

114 {
115  auto pTrack = GetTrack();
116 #if defined(__WXMAC__)
117  return pTrack->GetSelected() ? XO("Command+Click to deselect") : XO("Select track");
118 #else
119  return pTrack->GetSelected() ? XO("Ctrl+Click to deselect") : XO("Select track");
120 #endif
121 }

References ButtonHandle::GetTrack(), and XO.

Here is the call graph for this function:

The documentation for this class was generated from the following files:
@ RefreshNone
Definition: RefreshCode.h:21
std::weak_ptr< Track > mpTrack
Definition: ButtonHandle.h:72
#define XO(s)
Definition: Internat.h:31
std::shared_ptr< Track > GetTrack() const
Definition: ButtonHandle.h:30
static ProjectAudioIO & Get(AudacityProject &project)
Definition: ProjectAudioIO.cpp:22
bool IsAudioActive() const
Definition: ProjectAudioIO.cpp:51
A UIHandle for a TrackPanel button, such as the Mute and Solo buttons.
Definition: ButtonHandle.h:26
AUDACITY_DLL_API void GetSelectButtonRect(const wxRect &rect, wxRect &dest)
Definition: TrackInfo.cpp:533
std::shared_ptr< Track > FindTrack(TrackPanelCell *pCell)
Definition: TrackPanel.cpp:530
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:151
void DoListSelection(AudacityProject &project, Track *t, bool shift, bool ctrl, bool modifyState)
Definition: SelectUtilities.cpp:118
Definition: CommonTrackPanelCell.h:28
Namespace containing an enum 'what to do on a refresh?'.
Definition: RefreshCode.h:16