Audacity  3.0.3
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
SoloButtonHandle Class Referencefinal

#include <PlayableTrackButtonHandles.h>

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

Public Member Functions

 SoloButtonHandle (const std::shared_ptr< Track > &pTrack, const wxRect &rect)
 
SoloButtonHandleoperator= (const SoloButtonHandle &)=default
 
virtual ~SoloButtonHandle ()
 
- 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 (AudacityProject *pProject) const
 
virtual bool Escape (AudacityProject *pProject)
 
virtual bool HandlesRightClick ()
 Whether the handle has any special right-button handling. More...
 
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< SoloButtonHandle > &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 ()
 
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

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

Constructor & Destructor Documentation

◆ SoloButtonHandle() [1/2]

SoloButtonHandle::SoloButtonHandle ( const SoloButtonHandle )
privatedelete

◆ SoloButtonHandle() [2/2]

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

Definition at line 81 of file PlayableTrackButtonHandles.cpp.

83  : ButtonHandle{ pTrack, rect }
84 {}

◆ ~SoloButtonHandle()

SoloButtonHandle::~SoloButtonHandle ( )
virtual

Definition at line 86 of file PlayableTrackButtonHandles.cpp.

87 {
88 }

Member Function Documentation

◆ CommitChanges()

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

Implements ButtonHandle.

Definition at line 90 of file PlayableTrackButtonHandles.cpp.

92 {
93  auto pTrack = mpTrack.lock();
94  if ( dynamic_cast< PlayableTrack* >( pTrack.get() ) )
95  TrackUtilities::DoTrackSolo(*pProject, pTrack.get(), event.ShiftDown());
96 
98 }

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

Here is the call graph for this function:

◆ HitTest()

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

Definition at line 114 of file PlayableTrackButtonHandles.cpp.

118 {
119  wxRect buttonRect;
120  if ( pTrack )
121  PlayableTrackControls::GetMuteSoloRect(rect, buttonRect, true,
122  !ProjectSettings::Get( *pProject ).IsSoloNone(), pTrack.get());
123 
124  if ( TrackInfo::HideTopItem( rect, buttonRect ) )
125  return {};
126 
127  if ( pTrack && buttonRect.Contains(state.m_x, state.m_y) ) {
128  auto result = std::make_shared<SoloButtonHandle>( pTrack, buttonRect );
129  result = AssignUIHandlePtr(holder, result);
130  return result;
131  }
132  else
133  return {};
134 }

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=()

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

◆ StopsOnKeystroke()

bool SoloButtonHandle::StopsOnKeystroke ( )
inlineoverrideprotectedvirtual

Reimplemented from UIHandle.

Definition at line 68 of file PlayableTrackButtonHandles.h.

68 { return true; }

◆ Tip()

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

Implements ButtonHandle.

Definition at line 100 of file PlayableTrackButtonHandles.cpp.

102 {
103  auto name = XO("Solo");
104  auto focused =
105  TrackFocus::Get( project ).Get() == GetTrack().get();
106  if (!focused)
107  return name;
108 
109  auto &commandManager = CommandManager::Get( project );
110  ComponentInterfaceSymbol command{ wxT("TrackSolo"), name };
111  return commandManager.DescribeCommandsAndShortcuts( &command, 1u );
112 }

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

Here is the call graph for this function:

The documentation for this class was generated from the following files:
RefreshCode::RefreshNone
@ RefreshNone
Definition: RefreshCode.h:21
ClientData::Site::Get
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
ButtonHandle::mpTrack
std::weak_ptr< Track > mpTrack
Definition: ButtonHandle.h:72
XO
#define XO(s)
Definition: Internat.h:31
ProjectSettings::Get
static ProjectSettings & Get(AudacityProject &project)
Definition: ProjectSettings.cpp:45
ButtonHandle::GetTrack
std::shared_ptr< Track > GetTrack() const
Definition: ButtonHandle.h:30
TrackUtilities::DoTrackSolo
void DoTrackSolo(AudacityProject &project, Track *t, bool exclusive)
Definition: TrackUtilities.cpp:112
ComponentInterfaceSymbol
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Definition: ComponentInterfaceSymbol.h:27
PlayableTrackControls::GetMuteSoloRect
static void GetMuteSoloRect(const wxRect &rect, wxRect &dest, bool solo, bool bHasSoloButton, const Track *pTrack)
Definition: PlayableTrackControls.cpp:164
ButtonHandle
A UIHandle for a TrackPanel button, such as the Mute and Solo buttons.
Definition: ButtonHandle.h:26
name
const TranslatableString name
Definition: Distortion.cpp:98
TrackFocus::Get
Track * Get()
Definition: TrackPanelAx.cpp:760
PlayableTrack
AudioTrack subclass that can also be audibly replayed by the program.
Definition: Track.h:875
TrackInfo::HideTopItem
AUDACITY_DLL_API bool HideTopItem(const wxRect &rect, const wxRect &subRect, int allowance=0)
Definition: TrackInfo.cpp:208
ProjectSettings::IsSoloNone
bool IsSoloNone() const
Definition: ProjectSettings.h:128
AssignUIHandlePtr
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:151
CommandManager::Get
static CommandManager & Get(AudacityProject &project)
Definition: CommandManager.cpp:207