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

#include <PlayableTrackButtonHandles.h>

Inheritance diagram for MuteButtonHandle:
Collaboration diagram for MuteButtonHandle:

Public Member Functions

 MuteButtonHandle (const std::shared_ptr< Track > &pTrack, const wxRect &rect)
MuteButtonHandleoperator= (const MuteButtonHandle &)=default
virtual ~MuteButtonHandle ()
- Public Member Functions inherited from ButtonHandle
std::shared_ptr< TrackGetTrack () const
bool IsClicked () const
- 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)
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< MuteButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, const std::shared_ptr< Track > &pTrack)
- 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
bool StopsOnKeystroke () override
- Protected Member Functions inherited from ButtonHandle
 ButtonHandle (const std::shared_ptr< Track > &pTrack, const wxRect &rect)
ButtonHandleoperator= (const ButtonHandle &)=default
virtual ~ButtonHandle ()
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

 MuteButtonHandle (const MuteButtonHandle &)=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 17 of file PlayableTrackButtonHandles.h.

Constructor & Destructor Documentation

◆ MuteButtonHandle() [1/2]

MuteButtonHandle::MuteButtonHandle ( const MuteButtonHandle )

◆ MuteButtonHandle() [2/2]

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

Definition at line 28 of file PlayableTrackButtonHandles.cpp.

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

◆ ~MuteButtonHandle()

MuteButtonHandle::~MuteButtonHandle ( )

Definition at line 33 of file PlayableTrackButtonHandles.cpp.


Member Function Documentation

◆ CommitChanges()

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

Implements ButtonHandle.

Definition at line 37 of file PlayableTrackButtonHandles.cpp.

40 auto pTrack = mpTrack.lock();
41 if ( dynamic_cast< PlayableTrack* >( pTrack.get() ) )
42 TrackUtilities::DoTrackMute(*pProject, pTrack.get(), event.ShiftDown());
std::weak_ptr< Track > mpTrack
Definition: ButtonHandle.h:72
AudioTrack subclass that can also be audibly replayed by the program.
Definition: Track.h:917
void DoTrackMute(AudacityProject &project, Track *t, bool exclusive)

References TrackUtilities::DoTrackMute(), ButtonHandle::mpTrack, and RefreshCode::RefreshNone.

Here is the call graph for this function:

◆ HitTest()

UIHandlePtr MuteButtonHandle::HitTest ( std::weak_ptr< MuteButtonHandle > &  holder,
const wxMouseState &  state,
const wxRect &  rect,
const AudacityProject pProject,
const std::shared_ptr< Track > &  pTrack 

Definition at line 61 of file PlayableTrackButtonHandles.cpp.

66 wxRect buttonRect;
67 if ( pTrack )
68 PlayableTrackControls::GetMuteSoloRect(rect, buttonRect, false,
69 !ProjectSettings::Get( *pProject ).IsSoloNone(), pTrack.get());
70 if ( TrackInfo::HideTopItem( rect, buttonRect ) )
71 return {};
73 if ( pTrack && buttonRect.Contains(state.m_x, state.m_y) ) {
74 auto result = std::make_shared<MuteButtonHandle>(pTrack, buttonRect);
75 result = AssignUIHandlePtr(holder, result);
76 return result;
77 }
78 else
79 return {};
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:151
static void GetMuteSoloRect(const wxRect &rect, wxRect &dest, bool solo, bool bHasSoloButton, const Track *pTrack)
static ProjectSettings & Get(AudacityProject &project)
bool IsSoloNone() const
AUDACITY_DLL_API bool HideTopItem(const wxRect &rect, const wxRect &subRect, int allowance=0)
Definition: TrackInfo.cpp:208

References AssignUIHandlePtr(), ProjectSettings::Get(), PlayableTrackControls::GetMuteSoloRect(), TrackInfo::HideTopItem(), and ProjectSettings::IsSoloNone().

Referenced by NoteTrackControls::HitTest(), and WaveTrackControls::HitTest().

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

◆ operator=()

MuteButtonHandle & MuteButtonHandle::operator= ( const MuteButtonHandle )

◆ StopsOnKeystroke()

bool MuteButtonHandle::StopsOnKeystroke ( )

Reimplemented from UIHandle.

Definition at line 37 of file PlayableTrackButtonHandles.h.

37{ return true; }

◆ Tip()

TranslatableString MuteButtonHandle::Tip ( const wxMouseState &  state,
AudacityProject project 
) const

Implements ButtonHandle.

Definition at line 47 of file PlayableTrackButtonHandles.cpp.

50 auto name = XO("Mute");
51 auto focused =
52 TrackFocus::Get( project ).Get() == GetTrack().get();
53 if (!focused)
54 return name;
56 auto &commandManager = CommandManager::Get( project );
57 ComponentInterfaceSymbol command{ wxT("TrackMute"), name };
58 return commandManager.DescribeCommandsAndShortcuts(&command, 1u);
const TranslatableString name
Definition: Distortion.cpp:76
std::shared_ptr< Track > GetTrack() const
Definition: ButtonHandle.h:30
Subclass & Get(const RegisteredFactory &key)
Get reference to an attachment, creating on demand if not present, down-cast it to Subclass.
Definition: ClientData.h:309
static CommandManager & Get(AudacityProject &project)
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Track * Get()

References TrackFocus::Get(), CommandManager::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), ButtonHandle::GetTrack(), name, wxT(), and XO().

Here is the call graph for this function:

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