Audacity  3.0.3
Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
anonymous_namespace{WaveTrackView.cpp}::SubViewCloseHandle Class Reference
Inheritance diagram for anonymous_namespace{WaveTrackView.cpp}::SubViewCloseHandle:
Collaboration diagram for anonymous_namespace{WaveTrackView.cpp}::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 bool HasRotation () const
virtual bool Rotate (bool forward)
virtual bool HasEscape () const
virtual bool Escape (AudacityProject *pProject)
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 wxRect DrawingArea (TrackPanelDrawingContext &context, const wxRect &rect, const wxRect &panelRect, unsigned iPass)

Static Public Member Functions

static UIHandlePtr HitTest (std::weak_ptr< UIHandle > &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 ()
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 608 of file WaveTrackView.cpp.

Constructor & Destructor Documentation

◆ SubViewCloseHandle()

anonymous_namespace{WaveTrackView.cpp}::SubViewCloseHandle::SubViewCloseHandle ( SubViewAdjuster &&  adjuster,
size_t  index,
const std::shared_ptr< Track > &  pTrack,
const wxRect &  rect 

Definition at line 639 of file WaveTrackView.cpp.

642  : ButtonHandle{ pTrack, rect }
643  , mAdjuster{ std::move( adjuster ) }
644  , mMySubView{ index }
645  {
646  }

Member Function Documentation

◆ CommitChanges()

Result anonymous_namespace{WaveTrackView.cpp}::SubViewCloseHandle::CommitChanges ( const wxMouseEvent &  event,
AudacityProject pProject,
wxWindow *  pParent 

Implements ButtonHandle.

Definition at line 648 of file WaveTrackView.cpp.

651  {
652  ProjectHistory::Get( *pProject ).ModifyState( false );
653  auto &myPlacement =
655  myPlacement.fraction = 0;
656  mAdjuster.UpdateViews( false );
658  }

References ProjectHistory::Get(), ProjectHistory::ModifyState(), and RefreshCode::RefreshAll.

Here is the call graph for this function:

◆ Draw()

void anonymous_namespace{WaveTrackView.cpp}::SubViewCloseHandle::Draw ( TrackPanelDrawingContext context,
const wxRect &  rect,
unsigned  iPass 

Reimplemented from TrackPanelDrawable.

Definition at line 667 of file WaveTrackView.cpp.

670  {
671  if ( iPass == TrackArtist::PassMargins ) { // after PassTracks
673  context, GetButtonRect(rect), GetTrack().get(), this );
674  }
675  }

References TrackInfo::DrawCloseButton(), and TrackArtist::PassMargins.

Here is the call graph for this function:

◆ GetButtonRect()

static wxRect anonymous_namespace{WaveTrackView.cpp}::SubViewCloseHandle::GetButtonRect ( const wxRect &  rect)

Definition at line 610 of file WaveTrackView.cpp.

611  {
612  return {
613  rect.GetLeft(),
614  rect.GetTop(),
617  };
618  }

References kTrackInfoBtnSize.

◆ HitTest()

static UIHandlePtr anonymous_namespace{WaveTrackView.cpp}::SubViewCloseHandle::HitTest ( std::weak_ptr< UIHandle > &  holder,
WaveTrackView view,
WaveTrackSubView subView,
const TrackPanelMouseState state 

Definition at line 621 of file WaveTrackView.cpp.

624  {
625  SubViewAdjuster adjuster{ view };
626  if ( adjuster.NVisible() < 2 )
627  return {};
629  const auto rect = GetButtonRect( state.rect );
630  if ( !rect.Contains( state.state.GetPosition() ) )
631  return {};
632  auto index = adjuster.FindIndex( subView );
633  UIHandlePtr result = std::make_shared<SubViewCloseHandle>(
634  std::move( adjuster ), index, view.FindTrack(), rect );
635  result = AssignUIHandlePtr( holder, result );
636  return result;
637  }

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

Here is the call graph for this function:

◆ Tip()

TranslatableString anonymous_namespace{WaveTrackView.cpp}::SubViewCloseHandle::Tip ( const wxMouseState &  state,
AudacityProject project 
) const

Implements ButtonHandle.

Definition at line 660 of file WaveTrackView.cpp.

662  {
663  return XO("Close sub-view");
664  }

References XO.

Member Data Documentation

◆ mAdjuster

SubViewAdjuster anonymous_namespace{WaveTrackView.cpp}::SubViewCloseHandle::mAdjuster

Definition at line 678 of file WaveTrackView.cpp.

◆ mMySubView

size_t anonymous_namespace{WaveTrackView.cpp}::SubViewCloseHandle::mMySubView {}

Definition at line 679 of file WaveTrackView.cpp.

The documentation for this class was generated from the following file:
void ModifyState(bool bWantsAutoSave)
Definition: ProjectHistory.cpp:124
static wxRect GetButtonRect(const wxRect &rect)
Definition: WaveTrackView.cpp:610
@ RefreshAll
Definition: RefreshCode.h:26
std::shared_ptr< Track > FindTrack()
Definition: CommonTrackPanelCell.h:44
void UpdateViews(bool rollback)
Definition: WaveTrackView.cpp:188
#define XO(s)
Definition: Internat.h:31
@ kTrackInfoBtnSize
Definition: ViewInfo.h:111
std::shared_ptr< Track > GetTrack() const
Definition: ButtonHandle.h:30
const wxRect & rect
Definition: TrackPanelMouseEvent.h:39
A UIHandle for a TrackPanel button, such as the Mute and Solo buttons.
Definition: ButtonHandle.h:26
AUDACITY_DLL_API void DrawCloseButton(TrackPanelDrawingContext &context, const wxRect &bev, const Track *pTrack, ButtonHandle *target)
Definition: TrackInfo.cpp:267
WaveTrackSubViewPlacements mNewPlacements
Definition: WaveTrackView.cpp:201
std::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:28
SubViewAdjuster mAdjuster
Definition: WaveTrackView.cpp:678
size_t mMySubView
Definition: WaveTrackView.cpp:679
std::vector< size_t > mPermutation
Definition: WaveTrackView.cpp:203
@ PassMargins
Definition: TrackArtist.h:64
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:145
wxMouseState & state
Definition: TrackPanelMouseEvent.h:38
static ProjectHistory & Get(AudacityProject &project)
Definition: ProjectHistory.cpp:26