Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
SubViewCloseHandle Class Reference
Inheritance diagram for SubViewCloseHandle:
Collaboration diagram for SubViewCloseHandle:

Public Member Functions

 SubViewCloseHandle (SubViewAdjuster &&adjuster, size_t index, const std::shared_ptr< Track > &pTrack, const wxRect &rect)
Result CommitChanges (const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
TranslatableString Tip (const wxMouseState &state, AudacityProject &project) const override
void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
- 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< SubViewCloseHandle > &holder, WaveTrackView &view, WaveTrackSubView &subView, const TrackPanelMouseState &state)
- 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)

Static Private Member Functions

static wxRect GetButtonRect (const wxRect &rect)

Private Attributes

SubViewAdjuster mAdjuster
size_t mMySubView {}

Additional Inherited Members

- Public Types inherited from UIHandle
using Result = unsigned
using Cell = TrackPanelCell
- 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
- 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 619 of file WaveTrackView.cpp.

Constructor & Destructor Documentation

◆ SubViewCloseHandle()

SubViewCloseHandle::SubViewCloseHandle ( SubViewAdjuster &&  adjuster,
size_t  index,
const std::shared_ptr< Track > &  pTrack,
const wxRect &  rect 

Definition at line 650 of file WaveTrackView.cpp.

653 : ButtonHandle{ pTrack, rect }
654 , mAdjuster{ std::move( adjuster ) }
655 , mMySubView{ index }
656 {
657 }
A UIHandle for a TrackPanel button, such as the Mute and Solo buttons.
Definition: ButtonHandle.h:26
SubViewAdjuster mAdjuster

Member Function Documentation

◆ CommitChanges()

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

Implements ButtonHandle.

Definition at line 659 of file WaveTrackView.cpp.

662 {
663 ProjectHistory::Get( *pProject ).ModifyState( false );
664 auto &myPlacement =
666 myPlacement.fraction = 0;
667 mAdjuster.UpdateViews( false );
669 }
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
void UpdateViews(bool rollback)
WaveTrackSubViewPlacements mNewPlacements
std::vector< size_t > mPermutation

References ProjectHistory::Get(), mAdjuster, mMySubView, SubViewAdjuster::mNewPlacements, ProjectHistory::ModifyState(), SubViewAdjuster::mPermutation, RefreshCode::RefreshAll, and SubViewAdjuster::UpdateViews().

Here is the call graph for this function:

◆ Draw()

void SubViewCloseHandle::Draw ( TrackPanelDrawingContext context,
const wxRect &  rect,
unsigned  iPass 

Reimplemented from TrackPanelDrawable.

Definition at line 678 of file WaveTrackView.cpp.

681 {
682 if ( iPass == TrackArtist::PassMargins ) { // after PassTracks
684 context, GetButtonRect(rect), GetTrack().get(), this );
685 }
686 }
std::shared_ptr< Track > GetTrack() const
Definition: ButtonHandle.h:30
static wxRect GetButtonRect(const wxRect &rect)
AUDACITY_DLL_API void DrawCloseButton(TrackPanelDrawingContext &context, const wxRect &bev, const Track *pTrack, ButtonHandle *target)
Definition: TrackInfo.cpp:267

References TrackInfo::DrawCloseButton(), GetButtonRect(), ButtonHandle::GetTrack(), and TrackArtist::PassMargins.

Here is the call graph for this function:

◆ GetButtonRect()

static wxRect SubViewCloseHandle::GetButtonRect ( const wxRect &  rect)

Definition at line 621 of file WaveTrackView.cpp.

622 {
623 return {
624 rect.GetLeft(),
625 rect.GetTop(),
628 };
629 }
@ kTrackInfoBtnSize
Definition: ViewInfo.h:96

References kTrackInfoBtnSize.

Referenced by Draw(), and HitTest().

Here is the caller graph for this function:

◆ HitTest()

static UIHandlePtr SubViewCloseHandle::HitTest ( std::weak_ptr< SubViewCloseHandle > &  holder,
WaveTrackView view,
WaveTrackSubView subView,
const TrackPanelMouseState state 

Definition at line 632 of file WaveTrackView.cpp.

635 {
636 SubViewAdjuster adjuster{ view };
637 if ( adjuster.NVisible() < 2 )
638 return {};
640 const auto rect = GetButtonRect( state.rect );
641 if ( !rect.Contains( state.state.GetPosition() ) )
642 return {};
643 auto index = adjuster.FindIndex( subView );
644 auto result = std::make_shared<SubViewCloseHandle>(
645 std::move( adjuster ), index, view.FindTrack(), rect );
646 result = AssignUIHandlePtr( holder, result );
647 return result;
648 }
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:151
std::shared_ptr< Track > FindTrack()

References AssignUIHandlePtr(), CommonTrackPanelCell::FindTrack(), GetButtonRect(), TrackPanelMouseState::rect, and TrackPanelMouseState::state.

Referenced by WaveTrackSubView::DoDetailedHitTest().

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

◆ Tip()

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

Implements ButtonHandle.

Definition at line 671 of file WaveTrackView.cpp.

673 {
674 return XO("Close sub-view");
675 }

References XO().

Here is the call graph for this function:

Member Data Documentation

◆ mAdjuster

SubViewAdjuster SubViewCloseHandle::mAdjuster

Definition at line 689 of file WaveTrackView.cpp.

Referenced by CommitChanges().

◆ mMySubView

size_t SubViewCloseHandle::mMySubView {}

Definition at line 690 of file WaveTrackView.cpp.

Referenced by CommitChanges().

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