Audacity  2.3.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
Track Class Referenceabstract

Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the WaveTrack, NoteTrack, LabelTrack and TimeTrack. More...

#include <Track.h>

Inheritance diagram for Track:
CommonTrackPanelCell XMLTagHandler TrackPanelCell TrackPanelNode AudioTrack LabelTrack TimeTrack PlayableTrack NoteTrack WaveTrack

Classes

struct  Dispatcher
 
struct  Executor
 
struct  Executor< R, ConcreteType >
 
struct  Executor< R, ConcreteType, Function, Functions... >
 
struct  Executor< R, const ConcreteType, Function, Functions... >
 
struct  Executor< void, ConcreteType >
 

Public Types

enum  ChannelType { LeftChannel = 0, RightChannel = 1, MonoChannel = 2 }
 
enum  : unsigned { DefaultHeight = 150 }
 
using Holder = std::unique_ptr< Track >
 
template<typename R = void>
using Continuation = std::function< R() >
 
using Fallthrough = Continuation<>
 

Public Member Functions

TrackId GetId () const
 
std::shared_ptr< const TrackSubstitutePendingChangedTrack () const
 
std::shared_ptr< const TrackSubstituteOriginalTrack () const
 
std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &, const AudacityProject *pProject) finaloverride
 
std::shared_ptr< TrackPanelCellContextMenuDelegate () override
 
virtual std::vector< UIHandlePtrDetailedHitTest (const TrackPanelMouseState &, const AudacityProject *pProject, int currentTool, bool bMultiTool)=0
 
std::shared_ptr< TrackPanelCellGetTrackControl ()
 
std::shared_ptr< TrackPanelCellGetVRulerControl ()
 
std::shared_ptr< TrackPanelCellGetResizer ()
 
virtual int GetMinimizedHeight () const
 
int GetActualHeight () const
 
int GetIndex () const
 
void SetIndex (int index)
 
int GetY () const
 
int GetHeight () const
 
void SetHeight (int h)
 
bool GetMinimized () const
 
void SetMinimized (bool isMinimized)
 
bool LinkConsistencyCheck ()
 
 Track (const std::shared_ptr< DirManager > &projDirManager)
 
 Track (const Track &orig)
 
virtual ~Track ()
 
void Init (const Track &orig)
 
virtual Holder Duplicate () const =0
 
virtual void Merge (const Track &orig)
 
wxString GetName () const
 
void SetName (const wxString &n)
 
wxString GetDefaultName () const
 
void SetDefaultName (const wxString &n)
 
bool GetSelected () const
 
virtual void SetSelected (bool s)
 
virtual ChannelType GetChannel () const
 
virtual double GetOffset () const =0
 
void Offset (double t)
 
virtual void SetOffset (double o)
 
virtual void SetPan (float)
 
virtual void SetPanFromChannelType ()
 
const std::shared_ptr
< DirManager > & 
GetDirManager () const
 
virtual Holder Cut (double WXUNUSED(t0), double WXUNUSED(t1))=0
 
virtual Holder Copy (double WXUNUSED(t0), double WXUNUSED(t1), bool forClipboard=true) const =0
 
virtual void Clear (double WXUNUSED(t0), double WXUNUSED(t1))=0
 
virtual void Paste (double WXUNUSED(t), const Track *WXUNUSED(src))=0
 
virtual void SyncLockAdjust (double oldT1, double newT1)
 
virtual void Silence (double WXUNUSED(t0), double WXUNUSED(t1))=0
 
virtual void InsertSilence (double WXUNUSED(t), double WXUNUSED(len))=0
 
bool SameKindAs (const Track &track) const
 
template<typename R = void, typename... Functions>
TypeSwitch (const Functions &...functions)
 
template<typename R = void, typename... Functions>
TypeSwitch (const Functions &...functions) const
 
virtual void WriteXML (XMLWriter &xmlFile) const =0
 
virtual bool GetErrorOpening ()
 
virtual double GetStartTime () const =0
 
virtual double GetEndTime () const =0
 
bool IsSyncLockSelected () const
 
void Notify (int code=-1)
 
bool Any () const
 
bool IsSelected () const
 
bool IsSelectedOrSyncLockSelected () const
 
bool IsLeader () const
 
bool IsSelectedLeader () const
 
- Public Member Functions inherited from CommonTrackPanelCell
 CommonTrackPanelCell ()
 
virtual ~CommonTrackPanelCell ()=0
 
HitTestPreview DefaultPreview (const TrackPanelMouseState &, const AudacityProject *) override
 
- Public Member Functions inherited from TrackPanelCell
virtual ~TrackPanelCell ()=0
 
virtual unsigned DoContextMenu (const wxRect &rect, wxWindow *pParent, wxPoint *pPosition)
 
virtual unsigned CaptureKey (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent)
 
virtual unsigned KeyDown (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent)
 
virtual unsigned KeyUp (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent)
 
virtual unsigned Char (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent)
 
- Public Member Functions inherited from TrackPanelNode
 TrackPanelNode ()
 
virtual ~TrackPanelNode ()=0
 
- Public Member Functions inherited from XMLTagHandler
 XMLTagHandler ()
 
virtual ~XMLTagHandler ()
 
virtual bool HandleXMLTag (const wxChar *tag, const wxChar **attrs)=0
 
virtual void HandleXMLEndTag (const wxChar *WXUNUSED(tag))
 
virtual void HandleXMLContent (const wxString &WXUNUSED(content))
 
virtual XMLTagHandlerHandleXMLChild (const wxChar *tag)=0
 
bool ReadXMLTag (const char *tag, const char **attrs)
 
void ReadXMLEndTag (const char *tag)
 
void ReadXMLContent (const char *s, int len)
 
XMLTagHandlerReadXMLChild (const char *tag)
 

Static Public Member Functions

template<typename Subclass = Track>
static std::shared_ptr< Subclass > Pointer (Track *t)
 
template<typename Subclass = const Track>
static std::shared_ptr< Subclass > Pointer (const Track *t)
 
static void FinishCopy (const Track *n, Track *dest)
 

Public Attributes

wxSize vrulerSize
 

Protected Member Functions

virtual void DoSetHeight (int h)
 
virtual void DoSetMinimized (bool isMinimized)
 
std::shared_ptr< TrackFindTrack () override
 
virtual std::shared_ptr
< TrackControls
GetControls ()=0
 
virtual std::shared_ptr
< TrackVRulerControls
GetVRulerControls ()=0
 
- Protected Member Functions inherited from CommonTrackPanelCell
unsigned HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject) override
 

Protected Attributes

std::weak_ptr< TrackListmList
 
TrackNodePointer mNode {}
 
int mIndex
 
int mY
 
int mHeight
 
wxString mName
 
wxString mDefaultName
 
bool mLinked
 
bool mMinimized
 
ChannelType mChannel
 
double mOffset
 
std::shared_ptr< DirManagermDirManager
 
std::shared_ptr< TrackControlsmpControls
 
std::shared_ptr
< TrackVRulerControls
mpVRulerContols
 
std::shared_ptr
< TrackPanelResizerCell
mpResizer
 
std::weak_ptr< SelectHandlemSelectHandle
 
std::weak_ptr< TimeShiftHandlemTimeShiftHandle
 

Private Member Functions

void SetId (TrackId id)
 
void SetY (int y)
 
void DoSetY (int y)
 
std::shared_ptr< TrackListGetOwner () const
 
TrackGetLink () const
 
bool GetLinked () const
 
void SetLinked (bool l)
 
void SetChannel (ChannelType c)
 
void DoSetLinked (bool l)
 
TrackNodePointer GetNode () const
 
void SetOwner (const std::weak_ptr< TrackList > &list, TrackNodePointer node)
 
virtual TrackKind GetKind () const
 

Private Attributes

TrackId mId
 
bool mSelected
 
friend WaveTrack
 

Friends

class TrackList
 
template<typename T >
std::enable_if
< std::is_pointer< T >::value,
T >::type 
track_cast (Track *track)
 
template<typename T >
std::enable_if
< std::is_pointer< T >::value
&&std::is_const< typename
std::remove_pointer< T >::type >
::value, T >::type 
track_cast (const Track *track)
 

Detailed Description

Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the WaveTrack, NoteTrack, LabelTrack and TimeTrack.

Definition at line 191 of file Track.h.

Member Typedef Documentation

template<typename R = void>
using Track::Continuation = std::function< R() >

Definition at line 449 of file Track.h.

Definition at line 450 of file Track.h.

using Track::Holder = std::unique_ptr<Track>

Definition at line 369 of file Track.h.

Member Enumeration Documentation

anonymous enum : unsigned
Enumerator
DefaultHeight 

Definition at line 360 of file Track.h.

360 : unsigned { DefaultHeight = 150 };
Enumerator
LeftChannel 
RightChannel 
MonoChannel 

Definition at line 218 of file Track.h.

219  {
220  LeftChannel = 0,
221  RightChannel = 1,
222  MonoChannel = 2
223  };

Constructor & Destructor Documentation

Track::Track ( const std::shared_ptr< DirManager > &  projDirManager)

Definition at line 50 of file Track.cpp.

References DefaultHeight, mChannel, mHeight, mIndex, mLinked, mMinimized, mOffset, MonoChannel, mSelected, and mY.

51 : vrulerSize(36,0),
52  mDirManager(projDirManager)
53 {
54  mSelected = false;
55  mLinked = false;
56 
57  mY = 0;
59  mIndex = 0;
60 
61  mMinimized = false;
62 
63  mOffset = 0.0;
64 
66 }
int mIndex
Definition: Track.h:203
int mHeight
Definition: Track.h:205
ChannelType mChannel
Definition: Track.h:353
bool mSelected
Definition: Track.h:210
bool mMinimized
Definition: Track.h:214
double mOffset
Definition: Track.h:354
bool mLinked
Definition: Track.h:213
wxSize vrulerSize
Definition: Track.h:284
int mY
Definition: Track.h:204
std::shared_ptr< DirManager > mDirManager
Definition: Track.h:356
Track::Track ( const Track orig)

Definition at line 68 of file Track.cpp.

References Init(), mIndex, mOffset, and mY.

69 : vrulerSize( orig.vrulerSize )
70 {
71  mY = 0;
72  mIndex = 0;
73  Init(orig);
74  mOffset = orig.mOffset;
75 }
int mIndex
Definition: Track.h:203
double mOffset
Definition: Track.h:354
void Init(const Track &orig)
Definition: Track.cpp:78
wxSize vrulerSize
Definition: Track.h:284
int mY
Definition: Track.h:204
Track::~Track ( )
virtual

Definition at line 117 of file Track.cpp.

118 {
119 }

Member Function Documentation

bool Track::Any ( ) const
virtual void Track::Clear ( double   WXUNUSEDt0,
double   WXUNUSEDt1 
)
pure virtual
std::shared_ptr<TrackPanelCell> Track::ContextMenuDelegate ( )
inlineoverridevirtual

Reimplemented from TrackPanelCell.

Definition at line 273 of file Track.h.

274  { return GetTrackControl(); }
std::shared_ptr< TrackPanelCell > GetTrackControl()
Definition: TrackUI.cpp:81
virtual Holder Track::Copy ( double   WXUNUSEDt0,
double   WXUNUSEDt1,
bool  forClipboard = true 
) const
pure virtual
virtual Holder Track::Cut ( double   WXUNUSEDt0,
double   WXUNUSEDt1 
)
pure virtual
virtual std::vector<UIHandlePtr> Track::DetailedHitTest ( const TrackPanelMouseState ,
const AudacityProject pProject,
int  currentTool,
bool  bMultiTool 
)
pure virtual

Implemented in LabelTrack, WaveTrack, NoteTrack, and TimeTrack.

void Track::DoSetHeight ( int  h)
protectedvirtual

Reimplemented in NoteTrack.

Definition at line 212 of file Track.cpp.

References mHeight.

Referenced by NoteTrack::DoSetHeight(), and SetHeight().

213 {
214  mHeight = h;
215 }
int mHeight
Definition: Track.h:205
void Track::DoSetLinked ( bool  l)
private

Definition at line 267 of file Track.cpp.

References mLinked.

Referenced by SetLinked().

268 {
269  mLinked = l;
270 }
bool mLinked
Definition: Track.h:213
void Track::DoSetMinimized ( bool  isMinimized)
protectedvirtual

Reimplemented in WaveTrack.

Definition at line 242 of file Track.cpp.

References mMinimized.

Referenced by WaveTrack::DoSetMinimized(), and SetMinimized().

243 {
244  mMinimized = isMinimized;
245 }
bool mMinimized
Definition: Track.h:214
void Track::DoSetY ( int  y)
private

Definition at line 178 of file Track.cpp.

References mY.

Referenced by TrackList::RecalcPositions(), and SetY().

179 {
180  mY = y;
181 }
int mY
Definition: Track.h:204
virtual Holder Track::Duplicate ( ) const
pure virtual
std::shared_ptr< Track > Track::FindTrack ( )
overrideprotectedvirtual

Implements CommonTrackPanelCell.

Definition at line 375 of file Track.cpp.

References Pointer().

376 {
377  return Pointer( this );
378 }
static std::shared_ptr< Subclass > Pointer(Track *t)
Definition: Track.h:233
void Track::FinishCopy ( const Track n,
Track dest 
)
static

Definition at line 455 of file Track.cpp.

References GetChannel(), GetLinked(), GetName(), SetChannel(), SetLinked(), and SetName().

456 {
457  if (dest) {
458  dest->SetChannel(n->GetChannel());
459  dest->SetLinked(n->GetLinked());
460  dest->SetName(n->GetName());
461  }
462 }
void SetLinked(bool l)
Definition: Track.cpp:247
bool GetLinked() const
Definition: Track.h:336
virtual ChannelType GetChannel() const
Definition: Track.h:387
wxString GetName() const
Definition: Track.h:376
void SetChannel(ChannelType c)
Definition: Track.h:341
void SetName(const wxString &n)
Definition: Track.cpp:94
int Track::GetActualHeight ( ) const
inline

Definition at line 301 of file Track.h.

Referenced by NoteTrack::WriteXML(), and AudacityProject::WriteXML().

301 { return mHeight; }
int mHeight
Definition: Track.h:205
virtual ChannelType Track::GetChannel ( ) const
inlinevirtual

Reimplemented in WaveTrack.

Definition at line 387 of file Track.h.

Referenced by FinishCopy(), LinkConsistencyCheck(), and TrackInfo::MidiControlsDrawFunction().

387 { return mChannel;}
ChannelType mChannel
Definition: Track.h:353
virtual std::shared_ptr<TrackControls> Track::GetControls ( )
protectedpure virtual

Implemented in WaveTrack, LabelTrack, NoteTrack, and TimeTrack.

Referenced by GetTrackControl().

wxString Track::GetDefaultName ( ) const
inline
const std::shared_ptr<DirManager>& Track::GetDirManager ( ) const
inline

Definition at line 400 of file Track.h.

Referenced by LabelTrack::Copy().

400 { return mDirManager; }
std::shared_ptr< DirManager > mDirManager
Definition: Track.h:356
virtual double Track::GetEndTime ( ) const
pure virtual
virtual bool Track::GetErrorOpening ( )
inlinevirtual

Reimplemented in WaveTrack.

Definition at line 716 of file Track.h.

716 { return false; }
int Track::GetHeight ( ) const
TrackId Track::GetId ( ) const
inline
int Track::GetIndex ( ) const

Definition at line 147 of file Track.cpp.

References mIndex.

Referenced by SelectionState::ChangeSelectionOnShiftClick(), TrackList::RecalcPositions(), and SelectionState::SelectRangeOfTracks().

148 {
149  return mIndex;
150 }
int mIndex
Definition: Track.h:203
virtual TrackKind Track::GetKind ( ) const
inlineprivatevirtual

Reimplemented in WaveTrack, LabelTrack, NoteTrack, and TimeTrack.

Definition at line 431 of file Track.h.

References None.

Referenced by SameKindAs(), and track_cast().

431 { return TrackKind::None; }
Track * Track::GetLink ( ) const
private

Definition at line 272 of file Track.cpp.

References mLinked, mList, and mNode.

Referenced by GetInfoCommand::ExploreTrackPanel(), TrackList::GetPrev(), IsLeader(), and LinkConsistencyCheck().

273 {
274  auto pList = mList.lock();
275  if (!pList)
276  return nullptr;
277 
278  if (!pList->isNull(mNode)) {
279  if (mLinked) {
280  auto next = pList->getNext( mNode );
281  if ( !pList->isNull( next ) )
282  return next.first->get();
283  }
284 
285  if (mNode.first != mNode.second->begin()) {
286  auto prev = pList->getPrev( mNode );
287  if ( !pList->isNull( prev ) ) {
288  auto track = prev.first->get();
289  if (track && track->GetLinked())
290  return track;
291  }
292  }
293  }
294 
295  return nullptr;
296 }
TrackNodePointer mNode
Definition: Track.h:202
std::weak_ptr< TrackList > mList
Definition: Track.h:201
bool mLinked
Definition: Track.h:213
bool Track::GetLinked ( ) const
inlineprivate

Definition at line 336 of file Track.h.

Referenced by FinishCopy(), TrackList::GetNext(), TrackList::GetPrev(), IsLeader(), and LinkConsistencyCheck().

336 { return mLinked; }
bool mLinked
Definition: Track.h:213
bool Track::GetMinimized ( ) const
int Track::GetMinimizedHeight ( ) const
virtual

Definition at line 137 of file Track.cpp.

References TrackList::Channels(), and TrackInfo::MinimumTrackHeight().

Referenced by TrackPanelResizeHandle::Drag(), and GetHeight().

138 {
139  auto height = TrackInfo::MinimumTrackHeight();
140  auto channels = TrackList::Channels(this);
141  auto nChannels = channels.size();
142  auto begin = channels.begin();
143  auto index = std::distance(begin, std::find(begin, channels.end(), this));
144  return (height * (index + 1) / nChannels) - (height * index / nChannels);
145 }
unsigned MinimumTrackHeight()
Definition: TrackPanel.cpp:917
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1356
wxString Track::GetName ( ) const
inline
TrackNodePointer Track::GetNode ( ) const
private

Definition at line 122 of file Track.cpp.

References mList, and mNode.

Referenced by TrackList::GetNext(), TrackList::GetPrev(), TrackList::MoveDown(), TrackList::MoveUp(), TrackList::Remove(), and TrackList::Replace().

123 {
124  wxASSERT(mList.lock() == NULL || this == mNode.first->get());
125  return mNode;
126 }
TrackNodePointer mNode
Definition: Track.h:202
std::weak_ptr< TrackList > mList
Definition: Track.h:201
virtual double Track::GetOffset ( ) const
pure virtual
std::shared_ptr<TrackList> Track::GetOwner ( ) const
inlineprivate

Definition at line 333 of file Track.h.

333 { return mList.lock(); }
std::weak_ptr< TrackList > mList
Definition: Track.h:201
std::shared_ptr< TrackPanelCell > Track::GetResizer ( )

Definition at line 98 of file TrackUI.cpp.

References mpResizer, and Pointer().

99 {
100  if (!mpResizer)
101  // create on demand
102  mpResizer = std::make_shared<TrackPanelResizerCell>( Pointer( this ) );
103  return mpResizer;
104 }
std::shared_ptr< TrackPanelResizerCell > mpResizer
Definition: Track.h:748
static std::shared_ptr< Subclass > Pointer(Track *t)
Definition: Track.h:233
bool Track::GetSelected ( ) const
inline
virtual double Track::GetStartTime ( ) const
pure virtual
std::shared_ptr< TrackPanelCell > Track::GetTrackControl ( )

Definition at line 81 of file TrackUI.cpp.

References GetControls(), and mpControls.

82 {
83  if (!mpControls)
84  // create on demand
86  return mpControls;
87 }
virtual std::shared_ptr< TrackControls > GetControls()=0
std::shared_ptr< TrackControls > mpControls
Definition: Track.h:746
std::shared_ptr< TrackPanelCell > Track::GetVRulerControl ( )

Definition at line 89 of file TrackUI.cpp.

References GetVRulerControls(), and mpVRulerContols.

90 {
91  if (!mpVRulerContols)
92  // create on demand
94  return mpVRulerContols;
95 }
virtual std::shared_ptr< TrackVRulerControls > GetVRulerControls()=0
std::shared_ptr< TrackVRulerControls > mpVRulerContols
Definition: Track.h:747
virtual std::shared_ptr<TrackVRulerControls> Track::GetVRulerControls ( )
protectedpure virtual

Implemented in WaveTrack, LabelTrack, NoteTrack, and TimeTrack.

Referenced by GetVRulerControl().

int Track::GetY ( ) const

Definition at line 157 of file Track.cpp.

References mY.

Referenced by TrackPanel::FindTrackRect(), IsVisibleTrack::operator()(), TrackList::RecalcPositions(), and TrackPanel::RefreshTrack().

158 {
159  return mY;
160 }
int mY
Definition: Track.h:204
std::vector< UIHandlePtr > Track::HitTest ( const TrackPanelMouseState st,
const AudacityProject pProject 
)
finaloverridevirtual

Implements TrackPanelCell.

Definition at line 29 of file TrackUI.cpp.

References AudacityProject::GetBackgroundCell(), ToolsToolBar::GetCurrentTool(), AudacityProject::GetToolsToolBar(), ZoomHandle::HitAnywhere(), TimeShiftHandle::HitAnywhere(), ZoomHandle::HitTest(), SelectHandle::HitTest(), ToolsToolBar::IsDown(), multiTool, selectTool, slideTool, TrackPanelMouseState::state, and zoomTool.

31 {
32  UIHandlePtr result;
33  std::vector<UIHandlePtr> results;
34  const ToolsToolBar * pTtb = pProject->GetToolsToolBar();
35  const bool isMultiTool = pTtb->IsDown(multiTool);
36  const auto currentTool = pTtb->GetCurrentTool();
37 
38  if ( !isMultiTool && currentTool == zoomTool ) {
39  // Zoom tool is a non-selecting tool that takes precedence in all tracks
40  // over all other tools, no matter what detail you point at.
41  result = ZoomHandle::HitAnywhere(
42  pProject->GetBackgroundCell()->mZoomHandle);
43  results.push_back(result);
44  return results;
45  }
46 
47  // In other tools, let subclasses determine detailed hits.
48  results =
49  DetailedHitTest( st, pProject, currentTool, isMultiTool );
50 
51  // There are still some general cases.
52 
53  // Sliding applies in more than one track type.
54  if ( !isMultiTool && currentTool == slideTool ) {
56  mTimeShiftHandle, Pointer(this), false);
57  if (result)
58  results.push_back(result);
59  }
60 
61  // Let the multi-tool right-click handler apply only in default of all
62  // other detailed hits.
63  if ( isMultiTool ) {
64  result = ZoomHandle::HitTest(
65  pProject->GetBackgroundCell()->mZoomHandle, st.state);
66  if (result)
67  results.push_back(result);
68  }
69 
70  // Finally, default of all is adjustment of the selection box.
71  if ( isMultiTool || currentTool == selectTool ) {
72  result = SelectHandle::HitTest(
73  mSelectHandle, st, pProject, Pointer(this));
74  if (result)
75  results.push_back(result);
76  }
77 
78  return results;
79 }
std::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:27
static UIHandlePtr HitAnywhere(std::weak_ptr< ZoomHandle > &holder)
Definition: ZoomHandle.cpp:65
static UIHandlePtr HitTest(std::weak_ptr< ZoomHandle > &holder, const wxMouseState &state)
Definition: ZoomHandle.cpp:73
std::weak_ptr< SelectHandle > mSelectHandle
Definition: Track.h:750
ToolsToolBar * GetToolsToolBar()
Definition: Project.cpp:4873
static UIHandlePtr HitAnywhere(std::weak_ptr< TimeShiftHandle > &holder, const std::shared_ptr< Track > &pTrack, bool gripHit)
std::weak_ptr< TimeShiftHandle > mTimeShiftHandle
Definition: Track.h:751
int GetCurrentTool() const
static UIHandlePtr HitTest(std::weak_ptr< SelectHandle > &holder, const TrackPanelMouseState &state, const AudacityProject *pProject, const std::shared_ptr< Track > &pTrack)
std::shared_ptr< BackgroundCell > GetBackgroundCell() const
Definition: Project.h:828
bool IsDown(int tool) const
virtual std::vector< UIHandlePtr > DetailedHitTest(const TrackPanelMouseState &, const AudacityProject *pProject, int currentTool, bool bMultiTool)=0
A kind of ToolBar with Tools on it.
Definition: ToolsToolBar.h:49
static std::shared_ptr< Subclass > Pointer(Track *t)
Definition: Track.h:233
void Track::Init ( const Track orig)

Definition at line 78 of file Track.cpp.

References mChannel, mDefaultName, mDirManager, mHeight, mId, mLinked, mMinimized, mName, and mSelected.

Referenced by TimeTrack::Init(), PlayableTrack::Init(), and Track().

79 {
80  mId = orig.mId;
81 
83  mName = orig.mName;
84 
85  mDirManager = orig.mDirManager;
86 
87  mSelected = orig.mSelected;
88  mLinked = orig.mLinked;
89  mHeight = orig.mHeight;
90  mMinimized = orig.mMinimized;
91  mChannel = orig.mChannel;
92 }
int mHeight
Definition: Track.h:205
ChannelType mChannel
Definition: Track.h:353
bool mSelected
Definition: Track.h:210
wxString mDefaultName
Definition: Track.h:207
bool mMinimized
Definition: Track.h:214
bool mLinked
Definition: Track.h:213
std::shared_ptr< DirManager > mDirManager
Definition: Track.h:356
TrackId mId
Definition: Track.h:198
wxString mName
Definition: Track.h:206
virtual void Track::InsertSilence ( double   WXUNUSEDt,
double   WXUNUSEDlen 
)
pure virtual
bool Track::IsLeader ( ) const
bool Track::IsSelected ( ) const
bool Track::IsSelectedLeader ( ) const

Definition at line 451 of file Track.cpp.

References IsLeader(), and IsSelected().

Referenced by TrackList::SelectedLeaders().

452  { return IsSelected() && IsLeader(); }
bool IsLeader() const
Definition: Track.cpp:448
bool IsSelected() const
Definition: Track.cpp:442
bool Track::IsSelectedOrSyncLockSelected ( ) const

Definition at line 445 of file Track.cpp.

References GetSelected(), and IsSyncLockSelected().

Referenced by EffectTruncSilence::DoRemoval(), EditActions::Handler::OnCut(), and EffectReverse::Process().

446  { return GetSelected() || IsSyncLockSelected(); }
bool GetSelected() const
Definition: Track.h:381
bool IsSyncLockSelected() const
Definition: Track.cpp:318
bool Track::IsSyncLockSelected ( ) const

Definition at line 318 of file Track.cpp.

References GetActiveProject(), GetSelected(), IsSelected(), AudacityProject::IsSyncLocked(), mList, SubstituteOriginalTrack(), TrackList::SyncLockGroup(), and track_cast.

Referenced by TrackArt::DrawBackgroundWithSelection(), TrackArt::DrawClipWaveform(), IsSelectedOrSyncLockSelected(), TrackInfo::MinimizeSyncLockDrawFunction(), EditActions::Handler::OnDelete(), EditActions::Handler::OnPaste(), SelectActions::Handler::OnSelectSyncLockSel(), EffectSBSMS::Process(), EffectRepeat::Process(), and EffectChangeSpeed::Process().

319 {
320 #ifdef EXPERIMENTAL_SYNC_LOCK
322  if (!p || !p->IsSyncLocked())
323  return false;
324 
325  auto pList = mList.lock();
326  if (!pList)
327  return false;
328 
329  auto shTrack = this->SubstituteOriginalTrack();
330  if (!shTrack)
331  return false;
332 
333  const auto pTrack = shTrack.get();
334  auto trackRange = TrackList::SyncLockGroup( pTrack );
335 
336  if (trackRange.size() <= 1) {
337  // Not in a sync-locked group.
338  // Return true iff selected and of a sync-lockable type.
339  return (IsSyncLockableNonLabelTrack( pTrack ) ||
340  track_cast<const LabelTrack*>( pTrack )) && GetSelected();
341  }
342 
343  // Return true iff any track in the group is selected.
344  return *(trackRange + &Track::IsSelected).begin();
345 #endif
346 
347  return false;
348 }
bool GetSelected() const
Definition: Track.h:381
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:113
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:174
std::weak_ptr< TrackList > mList
Definition: Track.h:201
std::shared_ptr< const Track > SubstituteOriginalTrack() const
Definition: Track.cpp:1386
bool IsSyncLocked()
Definition: Project.cpp:5297
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:311
bool IsSelected() const
Definition: Track.cpp:442
static TrackIterRange< Track > SyncLockGroup(Track *pTrack)
Definition: Track.cpp:688
friend std::enable_if< std::is_pointer< T >::value, T >::type track_cast(Track *track)
Definition: Track.h:801
bool Track::LinkConsistencyCheck ( )

Definition at line 464 of file Track.cpp.

References GetChannel(), GetLink(), GetLinked(), GetName(), LeftChannel, RightChannel, and SetLinked().

465 {
466  // Sanity checks for linked tracks; unsetting the linked property
467  // doesn't fix the problem, but it likely leaves us with orphaned
468  // blockfiles instead of much worse problems.
469  bool err = false;
470  if (GetLinked())
471  {
472  Track *l = GetLink();
473  if (l)
474  {
475  // A linked track's partner should never itself be linked
476  if (l->GetLinked())
477  {
478  wxLogWarning(
479  wxT("Left track %s had linked right track %s with extra right track link.\n Removing extra link from right track."),
480  GetName(), l->GetName());
481  err = true;
482  l->SetLinked(false);
483  }
484 
485  // Channels should be left and right
486  if ( !( (GetChannel() == Track::LeftChannel &&
487  l->GetChannel() == Track::RightChannel) ||
489  l->GetChannel() == Track::LeftChannel) ) )
490  {
491  wxLogWarning(
492  wxT("Track %s and %s had left/right track links out of order. Setting tracks to not be linked."),
493  GetName(), l->GetName());
494  err = true;
495  SetLinked(false);
496  }
497  }
498  else
499  {
500  wxLogWarning(
501  wxT("Track %s had link to NULL track. Setting it to not be linked."),
502  GetName());
503  err = true;
504  SetLinked(false);
505  }
506  }
507 
508  return ! err;
509 }
void SetLinked(bool l)
Definition: Track.cpp:247
bool GetLinked() const
Definition: Track.h:336
virtual ChannelType GetChannel() const
Definition: Track.h:387
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:191
wxString GetName() const
Definition: Track.h:376
Track * GetLink() const
Definition: Track.cpp:272
void Track::Merge ( const Track orig)
virtual

Reimplemented in PlayableTrack, and WaveTrack.

Definition at line 112 of file Track.cpp.

References mSelected.

Referenced by PlayableTrack::Merge().

113 {
114  mSelected = orig.mSelected;
115 }
bool mSelected
Definition: Track.h:210
void Track::Notify ( int  code = -1)

Definition at line 350 of file Track.cpp.

References mList, and Pointer().

Referenced by WaveTrack::SetGain(), PlayableTrack::SetMute(), SetName(), WaveTrack::SetPan(), PlayableTrack::SetSolo(), and NoteTrack::SetVelocity().

351 {
352  auto pList = mList.lock();
353  if (pList)
354  pList->DataEvent( Pointer(this), code );
355 }
std::weak_ptr< TrackList > mList
Definition: Track.h:201
static std::shared_ptr< Subclass > Pointer(Track *t)
Definition: Track.h:233
void Track::Offset ( double  t)
inline

Definition at line 390 of file Track.h.

Referenced by Effect::Preview(), and StretchHandle::Stretch().

390 { SetOffset(GetOffset() + t); }
virtual double GetOffset() const =0
virtual void SetOffset(double o)
Definition: Track.h:391
virtual void Track::Paste ( double   WXUNUSEDt,
const Track WXUNUSEDsrc 
)
pure virtual
template<typename Subclass = Track>
static std::shared_ptr<Subclass> Track::Pointer ( Track t)
inlinestatic
template<typename Subclass = const Track>
static std::shared_ptr<Subclass> Track::Pointer ( const Track t)
inlinestatic

Definition at line 244 of file Track.h.

References mList, and mNode.

245  {
246  if (t) {
247  auto pList = t->mList.lock();
248  if (pList) {
249  std::shared_ptr<const Track> p{ *t->mNode.first };
250  // Let you change the type, but not cast away the const
251  return std::static_pointer_cast<Subclass>(p);
252  }
253  }
254  return {};
255  }
TrackNodePointer mNode
Definition: Track.h:202
std::weak_ptr< TrackList > mList
Definition: Track.h:201
bool Track::SameKindAs ( const Track track) const
inline

Definition at line 445 of file Track.h.

References GetKind().

Referenced by EditActions::Handler::OnPaste().

446  { return GetKind() == track.GetKind(); }
virtual TrackKind GetKind() const
Definition: Track.h:431
void Track::SetChannel ( ChannelType  c)
inlineprivate

Definition at line 341 of file Track.h.

Referenced by FinishCopy().

341 { mChannel = c; }
ChannelType mChannel
Definition: Track.h:353
void Track::SetDefaultName ( const wxString &  n)
inline
void Track::SetHeight ( int  h)

Definition at line 192 of file Track.cpp.

References DoSetHeight(), GetId(), mList, and mNode.

Referenced by SetTrackVisualsCommand::ApplyInner(), TrackPanelResizeHandle::Cancel(), TrackPanelResizeHandle::Drag(), LabelTrack::HandleXMLTag(), LabelTrack::LabelTrack(), NoteTrack::NoteTrack(), WaveTrackMenuTable::OnMergeStereo(), and WaveTrack::WaveTrack().

193 {
194  auto pList = mList.lock();
195  if (pList && !pList->mPendingUpdates.empty()) {
196  auto orig = pList->FindById( GetId() );
197  if (orig && orig != this) {
198  // delegate, and rely on RecalcPositions to copy back
199  orig->SetHeight(h);
200  return;
201  }
202  }
203 
204  DoSetHeight(h);
205 
206  if (pList) {
207  pList->RecalcPositions(mNode);
208  pList->ResizingEvent(mNode);
209  }
210 }
TrackNodePointer mNode
Definition: Track.h:202
TrackId GetId() const
Definition: Track.h:225
std::weak_ptr< TrackList > mList
Definition: Track.h:201
virtual void DoSetHeight(int h)
Definition: Track.cpp:212
void Track::SetId ( TrackId  id)
inlineprivate

Definition at line 227 of file Track.h.

Referenced by TrackList::Add(), TrackList::AddToHead(), and TrackList::Replace().

227 { mId = id; }
TrackId mId
Definition: Track.h:198
void Track::SetIndex ( int  index)

Definition at line 152 of file Track.cpp.

References mIndex.

Referenced by TrackList::RecalcPositions().

153 {
154  mIndex = index;
155 }
int mIndex
Definition: Track.h:203
void Track::SetLinked ( bool  l)
private

Definition at line 247 of file Track.cpp.

References DoSetLinked(), GetId(), mList, and mNode.

Referenced by FinishCopy(), WaveTrack::HandleXMLTag(), and LinkConsistencyCheck().

248 {
249  auto pList = mList.lock();
250  if (pList && !pList->mPendingUpdates.empty()) {
251  auto orig = pList->FindById( GetId() );
252  if (orig && orig != this) {
253  // delegate, and rely on RecalcPositions to copy back
254  orig->SetLinked(l);
255  return;
256  }
257  }
258 
259  DoSetLinked(l);
260 
261  if (pList) {
262  pList->RecalcPositions(mNode);
263  pList->ResizingEvent(mNode);
264  }
265 }
TrackNodePointer mNode
Definition: Track.h:202
TrackId GetId() const
Definition: Track.h:225
void DoSetLinked(bool l)
Definition: Track.cpp:267
std::weak_ptr< TrackList > mList
Definition: Track.h:201
void Track::SetMinimized ( bool  isMinimized)

Definition at line 222 of file Track.cpp.

References DoSetMinimized(), GetId(), mList, and mNode.

Referenced by TrackPanelResizeHandle::Cancel(), LabelTrack::HandleXMLTag(), and WaveTrackMenuTable::OnMergeStereo().

223 {
224  auto pList = mList.lock();
225  if (pList && !pList->mPendingUpdates.empty()) {
226  auto orig = pList->FindById( GetId() );
227  if (orig && orig != this) {
228  // delegate, and rely on RecalcPositions to copy back
229  orig->SetMinimized(isMinimized);
230  return;
231  }
232  }
233 
234  DoSetMinimized(isMinimized);
235 
236  if (pList) {
237  pList->RecalcPositions(mNode);
238  pList->ResizingEvent(mNode);
239  }
240 }
TrackNodePointer mNode
Definition: Track.h:202
TrackId GetId() const
Definition: Track.h:225
std::weak_ptr< TrackList > mList
Definition: Track.h:201
virtual void DoSetMinimized(bool isMinimized)
Definition: Track.cpp:242
void Track::SetName ( const wxString &  n)
virtual void Track::SetOffset ( double  o)
inlinevirtual

Reimplemented in LabelTrack, WaveTrack, and TimeTrack.

Definition at line 391 of file Track.h.

Referenced by NoteTrack::Clear(), ControlToolBar::DoRecord(), NoteTrack::HandleXMLTag(), ImportMIDI(), NoteTrack::Paste(), and NoteTrack::Trim().

391 { mOffset = o; }
double mOffset
Definition: Track.h:354
void Track::SetOwner ( const std::weak_ptr< TrackList > &  list,
TrackNodePointer  node 
)
private

Definition at line 129 of file Track.cpp.

Referenced by TrackList::Add(), TrackList::AddToHead(), TrackList::Permute(), TrackList::Remove(), TrackList::Replace(), and TrackList::SwapNodes().

130 {
131  // BUG: When using this function to clear an owner, we may need to clear
132  // focussed track too. Otherwise focus could remain on an invisible (or deleted) track.
133  mList = list;
134  mNode = node;
135 }
TrackNodePointer mNode
Definition: Track.h:202
std::weak_ptr< TrackList > mList
Definition: Track.h:201
virtual void Track::SetPan ( float  )
inlinevirtual

Reimplemented in WaveTrack.

Definition at line 393 of file Track.h.

Referenced by SetTrackAudioCommand::ApplyInner().

393 { ;}
virtual void Track::SetPanFromChannelType ( )
inlinevirtual

Reimplemented in WaveTrack.

Definition at line 394 of file Track.h.

394 { ;};
void Track::SetSelected ( bool  s)
virtual

Reimplemented in LabelTrack.

Definition at line 102 of file Track.cpp.

References mList, mSelected, and Pointer().

Referenced by SetTrackStatusCommand::ApplyInner(), Effect::DoEffect(), NoteTrack::HandleXMLTag(), WaveTrack::HandleXMLTag(), LabelEditActions::Handler::OnPasteNewLabel(), SelectActions::Handler::OnSelectSyncLockSel(), AudacityProject::SaveCopyWaveTracks(), LabelTrack::SetSelected(), and SelectionStateChanger::~SelectionStateChanger().

103 {
104  if (mSelected != s) {
105  mSelected = s;
106  auto pList = mList.lock();
107  if (pList)
108  pList->SelectionEvent( Pointer( this ) );
109  }
110 }
bool mSelected
Definition: Track.h:210
std::weak_ptr< TrackList > mList
Definition: Track.h:201
static std::shared_ptr< Subclass > Pointer(Track *t)
Definition: Track.h:233
void Track::SetY ( int  y)
private

Definition at line 162 of file Track.cpp.

References DoSetY(), GetId(), and mList.

163 {
164  auto pList = mList.lock();
165  if (pList && !pList->mPendingUpdates.empty()) {
166  auto orig = pList->FindById( GetId() );
167  if (orig && orig != this) {
168  // delegate, and rely on the update to copy back
169  orig->SetY(y);
170  pList->UpdatePendingTracks();
171  return;
172  }
173  }
174 
175  DoSetY(y);
176 }
TrackId GetId() const
Definition: Track.h:225
void DoSetY(int y)
Definition: Track.cpp:178
std::weak_ptr< TrackList > mList
Definition: Track.h:201
virtual void Track::Silence ( double   WXUNUSEDt0,
double   WXUNUSEDt1 
)
pure virtual
std::shared_ptr< const Track > Track::SubstituteOriginalTrack ( ) const

Definition at line 1386 of file Track.cpp.

References GetId(), mList, and Pointer().

Referenced by IsSyncLockSelected().

1387 {
1388  auto pList = mList.lock();
1389  if (pList) {
1390  const auto id = GetId();
1391  const auto pred = [=]( const ListOfTracks::value_type &ptr ) {
1392  return ptr->GetId() == id; };
1393  const auto end = pList->mPendingUpdates.end();
1394  const auto it = std::find_if( pList->mPendingUpdates.begin(), end, pred );
1395  if (it != end) {
1396  const auto &list2 = (const ListOfTracks &) *pList;
1397  const auto end2 = list2.end();
1398  const auto it2 = std::find_if( list2.begin(), end2, pred );
1399  if ( it2 != end2 )
1400  return *it2;
1401  }
1402  }
1403  return Pointer( this );
1404 }
TrackId GetId() const
Definition: Track.h:225
std::weak_ptr< TrackList > mList
Definition: Track.h:201
static std::shared_ptr< Subclass > Pointer(Track *t)
Definition: Track.h:233
std::list< std::shared_ptr< Track > > ListOfTracks
Definition: Track.h:64
std::shared_ptr< const Track > Track::SubstitutePendingChangedTrack ( ) const

Definition at line 1370 of file Track.cpp.

References GetId(), mList, and Pointer().

Referenced by TrackArt::DrawTracks(), and TrackPanel::DrawTracks().

1371 {
1372  // Linear search. Tracks in a project are usually very few.
1373  auto pList = mList.lock();
1374  if (pList) {
1375  const auto id = GetId();
1376  const auto end = pList->mPendingUpdates.end();
1377  auto it = std::find_if(
1378  pList->mPendingUpdates.begin(), end,
1379  [=](const ListOfTracks::value_type &ptr){ return ptr->GetId() == id; } );
1380  if (it != end)
1381  return *it;
1382  }
1383  return Pointer( this );
1384 }
TrackId GetId() const
Definition: Track.h:225
std::weak_ptr< TrackList > mList
Definition: Track.h:201
static std::shared_ptr< Subclass > Pointer(Track *t)
Definition: Track.h:233
void Track::SyncLockAdjust ( double  oldT1,
double  newT1 
)
virtual

Reimplemented in WaveTrack.

Definition at line 357 of file Track.cpp.

References Clear(), Cut(), GetEndTime(), and Paste().

Referenced by EditActions::Handler::OnPaste().

358 {
359  if (newT1 > oldT1) {
360  // Insert space within the track
361 
362  if (oldT1 > GetEndTime())
363  return;
364 
365  auto tmp = Cut(oldT1, GetEndTime());
366 
367  Paste(newT1, tmp.get());
368  }
369  else if (newT1 < oldT1) {
370  // Remove from the track
371  Clear(newT1, oldT1);
372  }
373 }
virtual void Paste(double WXUNUSED(t), const Track *WXUNUSED(src))=0
virtual double GetEndTime() const =0
virtual Holder Cut(double WXUNUSED(t0), double WXUNUSED(t1))=0
virtual void Clear(double WXUNUSED(t0), double WXUNUSED(t1))=0
template<typename R = void, typename... Functions>
R Track::TypeSwitch ( const Functions &...  functions)
inline

Definition at line 630 of file Track.h.

References All, Label, Note, Time, and Wave.

Referenced by SetClipCommand::ApplyInner(), SetEnvelopeCommand::ApplyInner(), SelectHandle::AssignSelection(), TimeShiftHandle::Click(), TimeShiftHandle::Drag(), PlayIndicatorOverlayBase::Draw(), TrackArt::DrawTrack(), TrackArt::DrawVRuler(), EffectAutoDuck::Init(), WaveTrack::Merge(), EditActions::Handler::OnPaste(), TrackActions::Handler::OnTrackGain(), TrackActions::Handler::OnTrackGainDec(), TrackActions::Handler::OnTrackGainInc(), TrackActions::Handler::OnTrackMute(), TrackActions::Handler::OnTrackPan(), TrackActions::Handler::OnTrackPanLeft(), TrackActions::Handler::OnTrackPanRight(), TrackActions::Handler::OnTrackSolo(), TimeTrack::Paste(), NoteTrack::Paste(), WaveTrack::Paste(), LabelTrack::Paste(), LabelTrack::PasteOver(), NyquistEffect::ProcessOne(), StretchHandle::Stretch(), and TrackArtist::UpdateVRuler().

631  {
632  using WaveExecutor =
633  Executor< R, WaveTrack, Functions... >;
634  using NoteExecutor =
635  Executor< R, NoteTrack, Functions... >;
636  using LabelExecutor =
637  Executor< R, LabelTrack, Functions... >;
638  using TimeExecutor =
639  Executor< R, TimeTrack, Functions... >;
640  using DefaultExecutor =
641  Executor< R, Track >;
642  enum { All = sizeof...( functions ) };
643 
644  static_assert(
645  (1u << All) - 1u ==
646  (WaveExecutor::SetUsed |
647  NoteExecutor::SetUsed |
648  LabelExecutor::SetUsed |
649  TimeExecutor::SetUsed),
650  "Uncallable case in Track::TypeSwitch"
651  );
652 
653  switch (GetKind()) {
654  case TrackKind::Wave:
655  return WaveExecutor{} (this, functions...);
656 #if defined(USE_MIDI)
657  case TrackKind::Note:
658  return NoteExecutor{} (this, functions...);
659 #endif
660  case TrackKind::Label:
661  return LabelExecutor{}(this, functions...);
662  case TrackKind::Time:
663  return TimeExecutor{} (this, functions...);
664  default:
665  return DefaultExecutor{} (this);
666  }
667  }
virtual TrackKind GetKind() const
Definition: Track.h:431
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:113
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:29
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:66
friend WaveTrack
Definition: Track.h:338
template<typename R = void, typename... Functions>
R Track::TypeSwitch ( const Functions &...  functions) const
inline

Definition at line 672 of file Track.h.

References All, Label, Note, Time, and Wave.

673  {
674  using WaveExecutor =
675  Executor< R, const WaveTrack, Functions... >;
676  using NoteExecutor =
677  Executor< R, const NoteTrack, Functions... >;
678  using LabelExecutor =
679  Executor< R, const LabelTrack, Functions... >;
680  using TimeExecutor =
681  Executor< R, const TimeTrack, Functions... >;
682  using DefaultExecutor =
683  Executor< R, const Track >;
684  enum { All = sizeof...( functions ) };
685 
686  static_assert(
687  (1u << All) - 1u ==
688  (WaveExecutor::SetUsed |
689  NoteExecutor::SetUsed |
690  LabelExecutor::SetUsed |
691  TimeExecutor::SetUsed),
692  "Uncallable case in Track::TypeSwitch"
693  );
694 
695  switch (GetKind()) {
696  case TrackKind::Wave:
697  return WaveExecutor{} (this, functions...);
698 #if defined(USE_MIDI)
699  case TrackKind::Note:
700  return NoteExecutor{} (this, functions...);
701 #endif
702  case TrackKind::Label:
703  return LabelExecutor{}(this, functions...);
704  case TrackKind::Time:
705  return TimeExecutor{} (this, functions...);
706  default:
707  return DefaultExecutor{} (this);
708  }
709  }
virtual TrackKind GetKind() const
Definition: Track.h:431
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:113
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:29
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:66
friend WaveTrack
Definition: Track.h:338
virtual void Track::WriteXML ( XMLWriter xmlFile) const
pure virtual

Implemented in WaveTrack, NoteTrack, LabelTrack, and TimeTrack.

Friends And Related Function Documentation

template<typename T >
std::enable_if< std::is_pointer<T>::value, T >::type track_cast ( Track track)
friend

Definition at line 801 of file Track.h.

Referenced by IsSyncLockSelected().

802 {
803  using BareType = typename std::remove_pointer< T >::type;
804  if (track &&
805  CompatibleTrackKinds( track_kind<BareType>(), track->GetKind() ))
806  return reinterpret_cast<T>(track);
807  else
808  return nullptr;
809 }
constexpr bool CompatibleTrackKinds(TrackKind desired, TrackKind actual)
Definition: Track.h:92
virtual TrackKind GetKind() const
Definition: Track.h:431
template<typename T >
std::enable_if< std::is_pointer<T>::value && std::is_const< typename std::remove_pointer< T >::type >::value, T >::type track_cast ( const Track track)
friend

Definition at line 818 of file Track.h.

819 {
820  using BareType = typename std::remove_pointer< T >::type;
821  if (track &&
822  CompatibleTrackKinds( track_kind<BareType>(), track->GetKind() ))
823  return reinterpret_cast<T>(track);
824  else
825  return nullptr;
826 }
constexpr bool CompatibleTrackKinds(TrackKind desired, TrackKind actual)
Definition: Track.h:92
virtual TrackKind GetKind() const
Definition: Track.h:431
friend class TrackList
friend

Definition at line 194 of file Track.h.

Member Data Documentation

ChannelType Track::mChannel
protected
wxString Track::mDefaultName
protected

Definition at line 207 of file Track.h.

Referenced by Init().

std::shared_ptr<DirManager> Track::mDirManager
mutableprotected
int Track::mHeight
protected
TrackId Track::mId
private

Definition at line 198 of file Track.h.

Referenced by Init().

int Track::mIndex
protected

Definition at line 203 of file Track.h.

Referenced by GetIndex(), SetIndex(), and Track().

bool Track::mLinked
protected

Definition at line 213 of file Track.h.

Referenced by DoSetLinked(), GetLink(), Init(), and Track().

std::weak_ptr<TrackList> Track::mList
protected
bool Track::mMinimized
protected
wxString Track::mName
protected
TrackNodePointer Track::mNode {}
protected
double Track::mOffset
protected
std::shared_ptr<TrackControls> Track::mpControls
protected

Definition at line 746 of file Track.h.

Referenced by GetTrackControl().

std::shared_ptr<TrackPanelResizerCell> Track::mpResizer
protected

Definition at line 748 of file Track.h.

Referenced by GetResizer().

std::shared_ptr<TrackVRulerControls> Track::mpVRulerContols
protected

Definition at line 747 of file Track.h.

Referenced by GetVRulerControl().

bool Track::mSelected
private

Definition at line 210 of file Track.h.

Referenced by Init(), Merge(), SetSelected(), and Track().

std::weak_ptr<SelectHandle> Track::mSelectHandle
protected

Definition at line 750 of file Track.h.

std::weak_ptr<TimeShiftHandle> Track::mTimeShiftHandle
protected

Definition at line 751 of file Track.h.

int Track::mY
protected

Definition at line 204 of file Track.h.

Referenced by DoSetY(), GetY(), and Track().

wxSize Track::vrulerSize
mutable
friend Track::WaveTrack
private

Definition at line 338 of file Track.h.


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