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:
[legend]
Collaboration diagram for SubViewCloseHandle:
[legend]

Public Member Functions

 SubViewCloseHandle (SubViewAdjuster &&adjuster, size_t index, const std::shared_ptr< Channel > &pChannel, 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 IsDragging () const override
 
- 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)
 
virtual std::shared_ptr< const TrackFindTrack () const =0
 
virtual bool IsDragging () const
 
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, WaveChannelView &view, WaveChannelSubView &subView, const TrackPanelMouseState &state)
 
- Static Public Member Functions inherited from UIHandle
static UIHandle::Result NeedChangeHighlight (const UIHandle &, const UIHandle &)
 
static std::shared_ptr< const TrackTrackFromChannel (const std::shared_ptr< const Channel > &pChannel)
 A frequent convenience in the definition of UIHandles. More...
 
- 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

std::weak_ptr< ChannelmpChannel
 
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 ()
 
std::shared_ptr< const TrackFindTrack () const override
 
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 mIsDragging {}
 
- Protected Attributes inherited from UIHandle
Result mChangeHighlight { 0 }
 

Detailed Description

Definition at line 683 of file WaveChannelView.cpp.

Constructor & Destructor Documentation

◆ SubViewCloseHandle()

SubViewCloseHandle::SubViewCloseHandle ( SubViewAdjuster &&  adjuster,
size_t  index,
const std::shared_ptr< Channel > &  pChannel,
const wxRect &  rect 
)
inline

Definition at line 714 of file WaveChannelView.cpp.

717 : ButtonHandle{ static_cast<Track&>(pChannel->GetChannelGroup())
718 .SharedPointer(),
719 rect }
720 , mpChannel{ pChannel }
721 , mAdjuster{ std::move( adjuster ) }
722 , mMySubView{ index }
723 {
724 }
A UIHandle for a TrackPanel button, such as the Mute and Solo buttons.
Definition: ButtonHandle.h:26
SubViewAdjuster mAdjuster
std::weak_ptr< Channel > mpChannel
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:110

Member Function Documentation

◆ CommitChanges()

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

Implements ButtonHandle.

Definition at line 726 of file WaveChannelView.cpp.

729 {
730 ProjectHistory::Get( *pProject ).ModifyState( false );
731 auto &myPlacement =
733 myPlacement.fraction = 0;
734 mAdjuster.UpdateViews( false );
736 }
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
WaveChannelSubViewPlacements mNewPlacements
void UpdateViews(bool rollback)
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 
)
inlineoverridevirtual

Reimplemented from TrackPanelDrawable.

Definition at line 745 of file WaveChannelView.cpp.

748 {
749 if (iPass == TrackArtist::PassMargins) { // after PassTracks
751 context, GetButtonRect(rect), mpChannel.lock().get(), this);
752 }
753 }
static wxRect GetButtonRect(const wxRect &rect)
AUDACITY_DLL_API void DrawCloseButton(TrackPanelDrawingContext &context, const wxRect &bev, const Channel *pChannel, UIHandle *target)

References CommonTrackInfo::DrawCloseButton(), GetButtonRect(), mpChannel, and TrackArtist::PassMargins.

Here is the call graph for this function:

◆ GetButtonRect()

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

Definition at line 685 of file WaveChannelView.cpp.

686 {
687 return {
688 rect.GetLeft(),
689 rect.GetTop(),
692 };
693 }
@ 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,
WaveChannelView view,
WaveChannelSubView subView,
const TrackPanelMouseState state 
)
inlinestatic

Definition at line 696 of file WaveChannelView.cpp.

699 {
700 SubViewAdjuster adjuster{ view };
701 if ( adjuster.NVisible() < 2 )
702 return {};
703
704 const auto rect = GetButtonRect( state.rect );
705 if ( !rect.Contains( state.state.GetPosition() ) )
706 return {};
707 auto index = adjuster.FindIndex( subView );
708 auto result = std::make_shared<SubViewCloseHandle>(
709 std::move(adjuster), index, view.FindChannel(), rect);
710 result = AssignUIHandlePtr( holder, result );
711 return result;
712 }
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:164
auto FindChannel() -> std::shared_ptr< Subtype >
May return null.

References AssignUIHandlePtr(), CommonChannelCell::FindChannel(), GetButtonRect(), TrackPanelMouseState::rect, and TrackPanelMouseState::state.

Referenced by WaveChannelSubView::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
inlineoverridevirtual

Implements ButtonHandle.

Definition at line 738 of file WaveChannelView.cpp.

740 {
741 return XO("Close sub-view");
742 }
XO("Cut/Copy/Paste")

References XO().

Here is the call graph for this function:

Member Data Documentation

◆ mAdjuster

SubViewAdjuster SubViewCloseHandle::mAdjuster
private

Definition at line 757 of file WaveChannelView.cpp.

Referenced by CommitChanges().

◆ mMySubView

size_t SubViewCloseHandle::mMySubView {}
private

Definition at line 758 of file WaveChannelView.cpp.

Referenced by CommitChanges().

◆ mpChannel

std::weak_ptr<Channel> SubViewCloseHandle::mpChannel
private

Definition at line 756 of file WaveChannelView.cpp.

Referenced by Draw().


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