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

#include <CommonTrackPanelCell.h>

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

Public Member Functions

 CommonTrackCell (const std::shared_ptr< Track > &pTrack, size_t iChannel)
 Construct from a track and a channel index. More...
 
 CommonTrackCell (ChannelGroup &group, size_t iChannel)
 Construct from a channel group and a channel index. More...
 
 ~CommonTrackCell ()
 
std::shared_ptr< TrackDoFindTrack () override
 
void Reparent (const std::shared_ptr< Track > &parent) override
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
size_t GetChannelIndex () const
 
std::shared_ptr< ChannelFindChannel ()
 May return null. More...
 
std::shared_ptr< const ChannelFindChannel () const
 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 TrackAttachment
virtual ~TrackAttachment ()
 
virtual void CopyTo (Track &track) const
 Copy state, for undo/redo purposes. More...
 
virtual void Reparent (const std::shared_ptr< Track > &parent)
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
virtual void WriteXMLAttributes (XMLWriter &) const
 Serialize persistent attributes. More...
 
virtual bool HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView)
 Deserialize an attribute, returning true if recognized. More...
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Private Attributes

std::weak_ptr< TrackmwTrack
 
const size_t miChannel
 

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 100 of file CommonTrackPanelCell.h.

Constructor & Destructor Documentation

◆ CommonTrackCell() [1/2]

CommonTrackCell::CommonTrackCell ( const std::shared_ptr< Track > &  pTrack,
size_t  iChannel 
)

Construct from a track and a channel index.

Definition at line 118 of file CommonTrackPanelCell.cpp.

120 : mwTrack{ parent }
122{
123 // TODO wide wave tracks -- remove assertion
124 assert(iChannel == 0);
125}
std::weak_ptr< Track > mwTrack

References anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel.

◆ CommonTrackCell() [2/2]

CommonTrackCell::CommonTrackCell ( ChannelGroup group,
size_t  iChannel 
)

Construct from a channel group and a channel index.

Precondition
dynamic_cast<Track&>(&group) != nullptr

Definition at line 127 of file CommonTrackPanelCell.cpp.

128 : CommonTrackCell{ static_cast<Track&>(group).shared_from_this(), iChannel }
129{
130}
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:122

◆ ~CommonTrackCell()

CommonTrackCell::~CommonTrackCell ( )
default

Member Function Documentation

◆ DoFindTrack()

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

Implements CommonTrackPanelCell.

Definition at line 139 of file CommonTrackPanelCell.cpp.

140{
141 return mwTrack.lock();
142}

References mwTrack.

Referenced by NoteTrackView::GetAffordanceControls().

Here is the caller graph for this function:

◆ FindChannel() [1/2]

std::shared_ptr< Channel > CommonTrackCell::FindChannel ( )

May return null.

Definition at line 144 of file CommonTrackPanelCell.cpp.

145{
146 if (const auto pTrack = FindTrack())
147 return pTrack->GetChannel(miChannel);
148 return {};
149}
std::shared_ptr< Track > FindTrack()

References CommonTrackPanelCell::FindTrack(), and miChannel.

Referenced by FindChannel().

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

◆ FindChannel() [2/2]

std::shared_ptr< const Channel > CommonTrackCell::FindChannel ( ) const

May return null.

Definition at line 151 of file CommonTrackPanelCell.cpp.

152{
153 return const_cast<CommonTrackCell*>(this)->FindChannel();
154}
std::shared_ptr< Channel > FindChannel()
May return null.

References FindChannel().

Here is the call graph for this function:

◆ GetChannelIndex()

size_t CommonTrackCell::GetChannelIndex ( ) const
inline

Definition at line 119 of file CommonTrackPanelCell.h.

119{ return miChannel; }

Referenced by anonymous_namespace{ChannelView.cpp}::AttributeName(), SpectrumView::Draw(), WaveformView::Draw(), and WaveChannelView::GetSelectedClip().

Here is the caller graph for this function:

◆ Reparent()

void CommonTrackCell::Reparent ( const std::shared_ptr< Track > &  parent)
overridevirtual

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

default does nothing

Reimplemented from TrackAttachment.

Definition at line 134 of file CommonTrackPanelCell.cpp.

135{
136 mwTrack = parent;
137}

References mwTrack.

Referenced by LabelTrackView::Reparent(), and WaveChannelView::Reparent().

Here is the caller graph for this function:

Member Data Documentation

◆ miChannel

const size_t CommonTrackCell::miChannel
private

Definition at line 129 of file CommonTrackPanelCell.h.

Referenced by FindChannel().

◆ mwTrack

std::weak_ptr< Track > CommonTrackCell::mwTrack
private

Definition at line 128 of file CommonTrackPanelCell.h.

Referenced by DoFindTrack(), and Reparent().


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