Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CommonChannelCell Class Reference

#include <CommonTrackPanelCell.h>

Inheritance diagram for CommonChannelCell:
[legend]
Collaboration diagram for CommonChannelCell:
[legend]

Public Member Functions

 CommonChannelCell (const std::shared_ptr< Channel > &pChannel)
 Construct from a channel. More...
 
 ~CommonChannelCell ()
 
std::shared_ptr< TrackDoFindTrack () override
 
void Reparent (const std::shared_ptr< Track > &parent, size_t iChannel) override
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
template<typename Subtype = Channel>
auto FindChannel () -> std::shared_ptr< Subtype >
 May return null. More...
 
template<typename Subtype = const Channel>
auto FindChannel () const -> std::enable_if_t< std::is_const_v< Subtype >, std::shared_ptr< Subtype > >
 May return null. More...
 
- Public Member Functions inherited from CommonTrackPanelCell
 CommonTrackPanelCell ()
 
virtual ~CommonTrackPanelCell ()=0
 
HitTestPreview DefaultPreview (const TrackPanelMouseState &, const AudacityProject *) override
 
std::shared_ptr< TrackFindTrack ()
 
std::shared_ptr< const TrackFindTrack () const
 
virtual std::vector< MenuItemGetMenuItems (const wxRect &rect, const wxPoint *pPosition, AudacityProject *pProject)
 Return a list of items for DoContextMenu() (empties for separators) More...
 
- Public Member Functions inherited from TrackPanelCell
 TrackPanelCell ()=default
 
 TrackPanelCell (const TrackPanelCell &)=delete
 
TrackPanelCelloperator= (const TrackPanelCell &)=delete
 
virtual ~TrackPanelCell ()=0
 
virtual HitTestPreview DefaultPreview (const TrackPanelMouseState &state, const AudacityProject *pProject)
 
virtual std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject)=0
 
virtual unsigned HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject)
 
virtual std::shared_ptr< TrackPanelCellContextMenuDelegate ()
 
virtual unsigned DoContextMenu (const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition, AudacityProject *pProject)
 
virtual unsigned CaptureKey (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
 
virtual unsigned KeyDown (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
 
virtual unsigned KeyUp (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
 
virtual unsigned Char (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
 
virtual unsigned LoseFocus (AudacityProject *project)
 
- Public Member Functions inherited from TrackPanelNode
 TrackPanelNode ()
 
virtual ~TrackPanelNode ()=0
 
- 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)
 
- Public Member Functions inherited from ChannelAttachment
virtual ~ChannelAttachment ()
 
virtual void CopyTo (Track &track, size_t iChannel) const
 Copy state, for undo/redo purposes. More...
 
virtual void Reparent (const std::shared_ptr< Track > &parent, size_t iChannel)
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
virtual void WriteXMLAttributes (XMLWriter &writer, size_t iChannel) const
 Serialize persistent attributes. More...
 
virtual bool HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView, size_t iChannel)
 Deserialize an attribute, returning true if recognized. More...
 

Private Member Functions

std::shared_ptr< ChannelDoFindChannel ()
 
std::shared_ptr< const ChannelDoFindChannel () const
 

Private Attributes

std::weak_ptr< ChannelmwChannel
 

Additional Inherited Members

- 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)
 
- Protected Member Functions inherited from CommonTrackPanelCell
virtual std::shared_ptr< TrackDoFindTrack ()=0
 
unsigned DoContextMenu (const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition, AudacityProject *pProject) override
 
unsigned HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject) override
 

Detailed Description

Definition at line 118 of file CommonTrackPanelCell.h.

Constructor & Destructor Documentation

◆ CommonChannelCell()

CommonChannelCell::CommonChannelCell ( const std::shared_ptr< Channel > &  pChannel)

Construct from a channel.

Definition at line 135 of file CommonTrackPanelCell.cpp.

136 : mwChannel{ parent }
137{
138}
std::weak_ptr< Channel > mwChannel

◆ ~CommonChannelCell()

CommonChannelCell::~CommonChannelCell ( )
default

Member Function Documentation

◆ DoFindChannel() [1/2]

std::shared_ptr< Channel > CommonChannelCell::DoFindChannel ( )
private

Definition at line 156 of file CommonTrackPanelCell.cpp.

157{
158 return mwChannel.lock();
159}

References mwChannel.

◆ DoFindChannel() [2/2]

std::shared_ptr< const Channel > CommonChannelCell::DoFindChannel ( ) const
private

Definition at line 161 of file CommonTrackPanelCell.cpp.

162{
163 return const_cast<CommonChannelCell*>(this)->FindChannel();
164}
auto FindChannel() -> std::shared_ptr< Subtype >
May return null.

References FindChannel().

Here is the call graph for this function:

◆ DoFindTrack()

std::shared_ptr< Track > CommonChannelCell::DoFindTrack ( )
overridevirtual

Implements CommonTrackPanelCell.

Definition at line 148 of file CommonTrackPanelCell.cpp.

149{
150 Track *pTrack{};
151 if (const auto pChannel = mwChannel.lock())
152 pTrack = dynamic_cast<Track *>(&pChannel->GetChannelGroup());
153 return pTrack ? pTrack->SharedPointer() : nullptr;
154}
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:110
std::shared_ptr< Subclass > SharedPointer()
Definition: Track.h:146

References mwChannel, and Track::SharedPointer().

Referenced by NoteTrackView::GetAffordanceControls().

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

◆ FindChannel() [1/2]

template<typename Subtype = Channel>
auto CommonChannelCell::FindChannel ( ) -> std::shared_ptr<Subtype>
inline

◆ FindChannel() [2/2]

template<typename Subtype = const Channel>
auto CommonChannelCell::FindChannel ( ) const -> std::enable_if_t<std::is_const_v<Subtype>, std::shared_ptr<Subtype> >
inline

May return null.

Definition at line 140 of file CommonTrackPanelCell.h.

144 { return std::dynamic_pointer_cast<Subtype>(DoFindChannel()); }

◆ Reparent()

void CommonChannelCell::Reparent ( const std::shared_ptr< Track > &  parent,
size_t  iChannel 
)
overridevirtual

Object may be shared among tracks but hold a special back-pointer to one of them; reassign it.

Parameters
iChannelposition of the attachment's channel in the group The default does nothing

Reimplemented from ChannelAttachment.

Definition at line 142 of file CommonTrackPanelCell.cpp.

References anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, and mwChannel.

Referenced by ChannelView::Reparent().

Here is the caller graph for this function:

Member Data Documentation

◆ mwChannel

std::weak_ptr<Channel> CommonChannelCell::mwChannel
private

Definition at line 150 of file CommonTrackPanelCell.h.

Referenced by DoFindChannel(), DoFindTrack(), and Reparent().


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