Audacity  2.2.2
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:
ButtonHandle UIHandle

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 () const
 
virtual bool Escape ()
 
virtual void DrawExtras (DrawingPass pass, wxDC *dc, const wxRegion &updateRegion, const wxRect &panelRect)
 
virtual void OnProjectChange (AudacityProject *pProject)
 
Result GetChangeHighlight () const
 
void SetChangeHighlight (Result val)
 

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 &)
 

Protected Member Functions

Result CommitChanges (const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
 
wxString Tip (const wxMouseState &state) 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) finaloverride
 
Result Click (const TrackPanelMouseEvent &event, AudacityProject *pProject) finaloverride
 
Result Drag (const TrackPanelMouseEvent &event, AudacityProject *pProject) finaloverride
 
HitTestPreview Preview (const TrackPanelMouseState &state, const AudacityProject *pProject) finaloverride
 
Result Release (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) finaloverride
 
Result Cancel (AudacityProject *pProject) finaloverride
 

Private Member Functions

 SoloButtonHandle (const SoloButtonHandle &)=delete
 

Additional Inherited Members

- Public Types inherited from UIHandle
enum  DrawingPass { Cells, Panel }
 
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 47 of file PlayableTrackButtonHandles.h.

Constructor & Destructor Documentation

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

Definition at line 79 of file PlayableTrackButtonHandles.cpp.

80  : ButtonHandle{ pTrack, rect }
81 {}
SoloButtonHandle::~SoloButtonHandle ( )
virtual

Definition at line 83 of file PlayableTrackButtonHandles.cpp.

84 {
85 }

Member Function Documentation

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

Implements ButtonHandle.

Definition at line 88 of file PlayableTrackButtonHandles.cpp.

References AudacityProject::DoTrackSolo(), and RefreshCode::RefreshNone.

89 {
90  auto pTrack = mpTrack.lock();
91  if ( dynamic_cast< PlayableTrack* >( pTrack.get() ) )
92  pProject->DoTrackSolo(pTrack.get(), event.ShiftDown());
93 
95 }
void DoTrackSolo(Track *pTrack, bool exclusive)
Definition: Project.cpp:5692
std::weak_ptr< Track > mpTrack
Definition: ButtonHandle.h:69
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 112 of file PlayableTrackButtonHandles.cpp.

References AssignUIHandlePtr(), TrackInfo::GetMuteSoloRect(), TrackInfo::HideTopItem(), and AudacityProject::IsSoloNone().

Referenced by WaveTrackControls::HitTest().

115 {
116  wxRect buttonRect;
117  if ( pTrack )
118  TrackInfo::GetMuteSoloRect(rect, buttonRect, true,
119  !pProject->IsSoloNone(), pTrack.get());
120 
121  if ( TrackInfo::HideTopItem( rect, buttonRect ) )
122  return {};
123 
124  if ( pTrack && buttonRect.Contains(state.m_x, state.m_y) ) {
125  auto result = std::make_shared<SoloButtonHandle>( pTrack, buttonRect );
126  result = AssignUIHandlePtr(holder, result);
127  return result;
128  }
129  else
130  return {};
131 }
static bool HideTopItem(const wxRect &rect, const wxRect &subRect, int allowance=0)
bool IsSoloNone() const
Definition: Project.h:607
static void GetMuteSoloRect(const wxRect &rect, wxRect &dest, bool solo, bool bHasSoloButton, const Track *pTrack)
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:162
SoloButtonHandle& SoloButtonHandle::operator= ( const SoloButtonHandle )
default
bool SoloButtonHandle::StopsOnKeystroke ( )
inlineoverrideprotectedvirtual

Reimplemented from UIHandle.

Definition at line 66 of file PlayableTrackButtonHandles.h.

66 { return true; }
wxString SoloButtonHandle::Tip ( const wxMouseState &  state) const
overrideprotectedvirtual

Implements ButtonHandle.

Definition at line 97 of file PlayableTrackButtonHandles.cpp.

References _(), GetActiveProject(), ButtonHandle::GetTrack(), and name.

98 {
99  auto name = _("Solo");
100  auto project = ::GetActiveProject();
101  auto focused =
102  project->GetTrackPanel()->GetFocusedTrack() == GetTrack().get();
103  if (!focused)
104  return name;
105 
106  auto commandManager = project->GetCommandManager();
107  TranslatedInternalString command{ wxT("TrackSolo"), name };
108  return commandManager->DescribeCommandsAndShortcuts( &command, 1u );
109 }
std::shared_ptr< Track > GetTrack() const
Definition: ButtonHandle.h:28
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
const wxChar * name
Definition: Distortion.cpp:94
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:308

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