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 HandlesRightClick ()
 Whether the handle has any special right-button handling. More...
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< 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 ()
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 614 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 645 of file WaveTrackView.cpp.

648  : ButtonHandle{ pTrack, rect }
649  , mAdjuster{ std::move( adjuster ) }
650  , mMySubView{ index }
651  {
652  }

Member Function Documentation

◆ CommitChanges()

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

Implements ButtonHandle.

Definition at line 654 of file WaveTrackView.cpp.

657  {
658  ProjectHistory::Get( *pProject ).ModifyState( false );
659  auto &myPlacement =
661  myPlacement.fraction = 0;
662  mAdjuster.UpdateViews( false );
664  }

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 673 of file WaveTrackView.cpp.

676  {
677  if ( iPass == TrackArtist::PassMargins ) { // after PassTracks
679  context, GetButtonRect(rect), GetTrack().get(), this );
680  }
681  }

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 616 of file WaveTrackView.cpp.

617  {
618  return {
619  rect.GetLeft(),
620  rect.GetTop(),
623  };
624  }

References kTrackInfoBtnSize.

◆ HitTest()

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

Definition at line 627 of file WaveTrackView.cpp.

630  {
631  SubViewAdjuster adjuster{ view };
632  if ( adjuster.NVisible() < 2 )
633  return {};
635  const auto rect = GetButtonRect( state.rect );
636  if ( !rect.Contains( state.state.GetPosition() ) )
637  return {};
638  auto index = adjuster.FindIndex( subView );
639  auto result = std::make_shared<SubViewCloseHandle>(
640  std::move( adjuster ), index, view.FindTrack(), rect );
641  result = AssignUIHandlePtr( holder, result );
642  return result;
643  }

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 666 of file WaveTrackView.cpp.

668  {
669  return XO("Close sub-view");
670  }

References XO.

Member Data Documentation

◆ mAdjuster

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

Definition at line 684 of file WaveTrackView.cpp.

◆ mMySubView

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

Definition at line 685 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:616
@ RefreshAll
Definition: RefreshCode.h:26
std::shared_ptr< Track > FindTrack()
Definition: CommonTrackPanelCell.h:46
void UpdateViews(bool rollback)
Definition: WaveTrackView.cpp:194
#define XO(s)
Definition: Internat.h:31
@ kTrackInfoBtnSize
Definition: ViewInfo.h:108
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:266
WaveTrackSubViewPlacements mNewPlacements
Definition: WaveTrackView.cpp:207
SubViewAdjuster mAdjuster
Definition: WaveTrackView.cpp:684
size_t mMySubView
Definition: WaveTrackView.cpp:685
std::vector< size_t > mPermutation
Definition: WaveTrackView.cpp:209
@ PassMargins
Definition: TrackArtist.h:82
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:151
wxMouseState & state
Definition: TrackPanelMouseEvent.h:38
static ProjectHistory & Get(AudacityProject &project)
Definition: ProjectHistory.cpp:26