Audacity  2.2.2
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 AudioTrack LabelTrack TimeTrack PlayableTrack WaveTrack

Public Types

enum  { LeftChannel = 0, RightChannel = 1, MonoChannel = 2 }
 
enum  TrackKindEnum {
  None, Wave, Label, Time,
  All
}
 
enum  : unsigned { DefaultHeight = 150 }
 
using Holder = std::unique_ptr< Track >
 

Public Member Functions

TrackId GetId () const
 
std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &, const AudacityProject *pProject) finaloverride
 
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)
 
TrackGetLink () const
 
 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)
 
bool GetLinked () const
 
void SetLinked (bool l)
 
virtual int GetChannel () const
 
virtual double GetOffset () const =0
 
void Offset (double t)
 
virtual void SetOffset (double o)
 
void SetChannel (int c)
 
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
 
virtual int GetKind () const
 
virtual void WriteXML (XMLWriter &xmlFile) const =0
 
virtual bool GetErrorOpening ()
 
virtual double GetStartTime () const =0
 
virtual double GetEndTime () const =0
 
bool IsSyncLockSelected () const
 
- Public Member Functions inherited from CommonTrackPanelCell
 CommonTrackPanelCell ()
 
virtual ~CommonTrackPanelCell ()=0
 
- 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 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)
 

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 mSelected
 
bool mLinked
 
bool mMinimized
 
int 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)
 
TrackNodePointer GetNode () const
 
void SetOwner (const std::weak_ptr< TrackList > &list, TrackNodePointer node)
 
void DoSetLinked (bool l)
 

Private Attributes

TrackId mId
 

Friends

class TrackList
 
class TrackListIterator
 
class SyncLockedTracksIterator
 

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 102 of file Track.h.

Member Typedef Documentation

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

Definition at line 264 of file Track.h.

Member Enumeration Documentation

anonymous enum
Enumerator
LeftChannel 
RightChannel 
MonoChannel 

Definition at line 236 of file Track.h.

237  {
238  LeftChannel = 0,
239  RightChannel = 1,
240  MonoChannel = 2
241  };
anonymous enum : unsigned
Enumerator
DefaultHeight 

Definition at line 255 of file Track.h.

255 : unsigned { DefaultHeight = 150 };
Enumerator
None 
Wave 
Label 
Time 
All 

Definition at line 243 of file Track.h.

244  {
245  None,
246  Wave,
247 #if defined(USE_MIDI)
248  Note,
249 #endif
250  Label,
251  Time,
252  All
253  };

Constructor & Destructor Documentation

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

Definition at line 55 of file Track.cpp.

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

56 : vrulerSize(36,0),
57  mDirManager(projDirManager)
58 {
59  mSelected = false;
60  mLinked = false;
61 
62  mY = 0;
64  mIndex = 0;
65 
66  mMinimized = false;
67 
68  mOffset = 0.0;
69 
71 }
int mIndex
Definition: Track.h:116
int mHeight
Definition: Track.h:118
bool mSelected
Definition: Track.h:122
bool mMinimized
Definition: Track.h:125
double mOffset
Definition: Track.h:230
bool mLinked
Definition: Track.h:124
wxSize vrulerSize
Definition: Track.h:176
int mY
Definition: Track.h:117
std::shared_ptr< DirManager > mDirManager
Definition: Track.h:232
int mChannel
Definition: Track.h:229
Track::Track ( const Track orig)

Definition at line 73 of file Track.cpp.

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

74 : vrulerSize( orig.vrulerSize )
75 {
76  mY = 0;
77  mIndex = 0;
78  Init(orig);
79  mOffset = orig.mOffset;
80 }
int mIndex
Definition: Track.h:116
double mOffset
Definition: Track.h:230
void Init(const Track &orig)
Definition: Track.cpp:83
wxSize vrulerSize
Definition: Track.h:176
int mY
Definition: Track.h:117
Track::~Track ( )
virtual

Definition at line 109 of file Track.cpp.

110 {
111 }

Member Function Documentation

virtual void Track::Clear ( double   WXUNUSEDt0,
double   WXUNUSEDt1 
)
pure virtual
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, and TimeTrack.

void Track::DoSetHeight ( int  h)
protectedvirtual

Definition at line 209 of file Track.cpp.

References mHeight.

Referenced by SetHeight().

210 {
211  mHeight = h;
212 }
int mHeight
Definition: Track.h:118
void Track::DoSetLinked ( bool  l)
private

Definition at line 264 of file Track.cpp.

References mLinked.

Referenced by SetLinked().

265 {
266  mLinked = l;
267 }
bool mLinked
Definition: Track.h:124
void Track::DoSetMinimized ( bool  isMinimized)
protectedvirtual

Reimplemented in WaveTrack.

Definition at line 239 of file Track.cpp.

References mMinimized.

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

240 {
241  mMinimized = isMinimized;
242 }
bool mMinimized
Definition: Track.h:125
void Track::DoSetY ( int  y)
private

Definition at line 175 of file Track.cpp.

References mY.

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

176 {
177  mY = y;
178 }
int mY
Definition: Track.h:117
virtual Holder Track::Duplicate ( ) const
pure virtual
std::shared_ptr< Track > Track::FindTrack ( )
overrideprotectedvirtual

Implements CommonTrackPanelCell.

Definition at line 338 of file Track.cpp.

References Pointer().

339 {
340  return Pointer( this );
341 }
static std::shared_ptr< Subclass > Pointer(Track *t)
Definition: Track.h:137
int Track::GetActualHeight ( ) const
inline

Definition at line 193 of file Track.h.

Referenced by AudacityProject::WriteXML().

193 { return mHeight; }
int mHeight
Definition: Track.h:118
virtual int Track::GetChannel ( ) const
inlinevirtual
virtual std::shared_ptr<TrackControls> Track::GetControls ( )
protectedpure virtual

Implemented in WaveTrack, LabelTrack, and TimeTrack.

Referenced by GetTrackControl().

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

Definition at line 300 of file Track.h.

Referenced by LabelTrack::Copy(), and DirManager::FindOrphanBlockFiles().

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

Reimplemented in WaveTrack.

Definition at line 337 of file Track.h.

Referenced by AudacityProject::OpenFile().

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

Definition at line 129 of file Track.h.

Referenced by TrackArtist::DrawTracks(), TrackList::HasPendingTracks(), TrackPanelAx::IsFocused(), SetHeight(), SetLinked(), SetMinimized(), and SetY().

129 { return mId; }
TrackId mId
Definition: Track.h:111
int Track::GetIndex ( ) const

Definition at line 144 of file Track.cpp.

References mIndex.

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

145 {
146  return mIndex;
147 }
int mIndex
Definition: Track.h:116
virtual int Track::GetKind ( ) const
inlinevirtual

Reimplemented in LabelTrack, WaveTrack, and TimeTrack.

Definition at line 330 of file Track.h.

Referenced by SetLabelCommand::Apply(), SetClipCommand::ApplyInner(), SetEnvelopeCommand::ApplyInner(), SelectHandle::AssignSelection(), LabelDefaultClickHandle::Click(), TrackListOfKindIterator::Condition(), AudacityProject::CountSelectedWaveTracks(), ExportMultiple::CountTracksAndLabels(), Effect::CountWaveTracks(), TimeShiftHandle::CreateListOfCapturedClips(), AudacityProject::DoAddLabel(), AudacityProject::DoEffect(), PlayIndicatorOverlayBase::Draw(), TrackPanel::DrawOutside(), TrackArtist::DrawTrack(), TrackArtist::DrawVRuler(), AudacityProject::EditByLabel(), AudacityProject::EditClipboardByLabel(), AudacityProject::EnqueueODTasks(), Exporter::ExamineTracks(), ExportMultiple::ExportMultipleByTrack(), LabelDialog::FindAllLabels(), AudacityProject::FindClipBoundaries(), AudacityProject::FindClips(), GetAllSeqBlocks(), TrackList::GetNumExportChannels(), AudacityProject::GetRegionsByLabel(), AudacityProject::GetTime(), TrackList::GetTimeTrack(), AudacityProject::GetUpdateFlags(), AudacityProject::HandleMixAndRender(), EffectAutoDuck::Init(), EffectEqualization::Init(), WaveTrackMenuTable::InitMenu(), SyncLockedTracksIterator::IsGoodNextTrack(), IsSyncLockSelected(), ODTask::IsTaskAssociatedWithProject(), WaveTrack::Merge(), MixAndRender(), AudacityProject::NearestZeroCrossing(), SyncLockedTracksIterator::Next(), AudacityProject::OnClipMove(), AudacityProject::OnCopy(), AudacityProject::OnCut(), AudacityProject::OnDisjoin(), AudacityProject::OnExportLabels(), AudacityProject::OnJoin(), AudacityProject::OnMoveToLabel(), AudacityProject::OnPanTracks(), AudacityProject::OnPaste(), AudacityProject::OnResample(), AudacityProject::OnSplit(), AudacityProject::OnSplitCut(), AudacityProject::OnSplitDelete(), AudacityProject::OnSplitNew(), AudacityProject::OnTrackGain(), AudacityProject::OnTrackGainDec(), AudacityProject::OnTrackGainInc(), AudacityProject::OnTrackPan(), AudacityProject::OnTrackPanLeft(), AudacityProject::OnTrackPanRight(), AudacityProject::OnTrim(), AudacityProject::OpenFile(), TimeTrack::Paste(), WaveTrack::Paste(), LabelTrack::Paste(), LabelTrack::PasteOver(), SyncLockedTracksIterator::Prev(), Effect::ProcessPass(), AudacityProject::RedrawProject(), AudacityProject::SaveCopyWaveTracks(), LabelDefaultClickHandle::SaveState(), GetInfoCommand::SendClips(), GetInfoCommand::SendEnvelopes(), GetInfoCommand::SendLabels(), SyncLockedTracksIterator::StartWith(), LabelDialog::TransferDataFromWindow(), TrackArtist::UpdateVRuler(), and AudacityProject::WriteXML().

330 { return None; }
Track * Track::GetLink ( ) const

Definition at line 269 of file Track.cpp.

References mLinked, mList, and mNode.

Referenced by AudacityProject::ChannelsHaveSameClipBoundaries(), ControlToolBar::ChooseExistingRecordingTracks(), EnvelopeHandle::Click(), WaveformPrefs::Commit(), VisibleTrackIterator::Condition(), TimeShiftHandle::CreateListOfCapturedClips(), TimeShiftHandle::DoSlideHorizontal(), TrackPanelResizeHandle::Drag(), TimeShiftHandle::Drag(), TrackPanel::DrawEverythingElse(), TrackArtist::DrawTrack(), TrackArtist::DrawTracks(), GetInfoCommand::ExploreTrackPanel(), AudacityProject::FindClipBoundaries(), AudacityProject::FindClips(), TrackPanel::FindTrackRect(), TrackList::GetGroupHeight(), GetMinimizedHeight(), TrackList::GetPrev(), AudacityProject::HandleMixAndRender(), WaveTrackMenuTable::InitMenu(), TrackPanelAx::IsFocused(), MixAndRender(), AudacityProject::OnClipMove(), FormatMenuTable::OnFormatChange(), WaveTrackMenuTable::OnMergeStereo(), WaveTrackMenuTable::OnSetDisplay(), TrackMenuTable::OnSetName(), SpectrumVRulerMenuTable::OnSpectrumScaleType(), WaveTrackMenuTable::OnSwapChannels(), WaveColorMenuTable::OnWaveColorChange(), WaveformVRulerMenuTable::OnWaveformScaleType(), AudacityProject::OpenFile(), SpectrumPrefs::Preview(), EffectTruncSilence::ProcessIndependently(), NyquistEffect::ProcessOne(), TrackPanel::RefreshTrack(), WaveTrackVZoomHandle::Release(), AudacityProject::RemoveTrack(), SpectrumPrefs::Rollback(), SelectionState::SelectTrackLength(), TrackPanel::SetFocusedTrack(), RateMenuTable::SetRate(), AudacityProject::SetTrackGain(), AudacityProject::SetTrackPan(), ControlToolBar::SetupCutPreviewTracks(), AudacityProject::SortTracks(), WaveTrackMenuTable::SplitStereo(), and TrackPanel::UpdateTrackVRuler().

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

Definition at line 279 of file Track.h.

Referenced by SelectTracksCommand::Apply(), audacityAudioCallback(), AudacityProject::ChannelsHaveSameClipBoundaries(), ControlToolBar::ChooseExistingRecordingTracks(), AudacityProject::FoundTrack::ComposeTrackName(), VisibleTrackIterator::Condition(), ExportMultiple::CountTracksAndLabels(), Effect::CountWaveTracks(), TimeShiftHandle::Drag(), TrackPanel::DrawBordersAroundTrack(), TrackPanel::DrawEverythingElse(), TrackPanel::DrawOutsideOfTrack(), TrackArtist::DrawTrack(), TrackArtist::DrawTracks(), TrackPanel::EnsureVisible(), ExportMultiple::ExportMultipleByTrack(), AudacityProject::FindClipBoundaries(), AudacityProject::FindClips(), TrackPanel::FindTrackRect(), AudacityProject::FinishCopy(), GetMinimizedHeight(), TrackList::GetNext(), TrackList::GetPrev(), AudacityProject::GetUpdateFlags(), AudacityProject::HandleAlign(), AudacityProject::HandleMixAndRender(), AudacityProject::HandleTrackMute(), AudacityProject::HandleTrackSolo(), WaveTrackMenuTable::InitMenu(), MacroCommands::IsMono(), AudacityProject::OnClipMove(), AudacityProject::OnPaste(), TrackMenuTable::OnSetName(), AudacityProject::OpenFile(), EffectNormalize::Process(), Effect::ProcessPass(), TrackPanel::RefreshTrack(), AudacityProject::SaveCopyWaveTracks(), TrackList::Select(), GetInfoCommand::SendClips(), GetInfoCommand::SendEnvelopes(), GetInfoCommand::SendTracks(), TrackPanel::SetFocusedTrack(), AudacityProject::SortTracks(), AudioIO::StartStream(), TrackPanel::VerticalScroll(), and AudacityProject::WriteXML().

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

Definition at line 129 of file Track.cpp.

References GetLink(), GetLinked(), and TrackInfo::MinimumTrackHeight().

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

130 {
131  auto height = TrackInfo::MinimumTrackHeight();
132 
133  if (GetLink()) {
134  auto halfHeight = height / 2;
135  if (GetLinked())
136  return halfHeight;
137  else
138  return height - halfHeight;
139  }
140 
141  return height;
142 }
bool GetLinked() const
Definition: Track.h:279
static unsigned MinimumTrackHeight()
Track * GetLink() const
Definition: Track.cpp:269
wxString Track::GetName ( ) const
inline
TrackNodePointer Track::GetNode ( ) const
private

Definition at line 114 of file Track.cpp.

References mList, and mNode.

Referenced by TrackList::GetNext(), TrackList::GetPrev(), TrackList::MoveDown(), TrackList::MoveUp(), TrackList::Remove(), TrackList::Select(), TrackListIterator::StartWith(), SyncLockedTracksIterator::StartWith(), and TrackList::SwapNodes().

115 {
116  wxASSERT(mList.lock() == NULL || this == mNode.first->get());
117  return mNode;
118 }
TrackNodePointer mNode
Definition: Track.h:115
std::weak_ptr< TrackList > mList
Definition: Track.h:114
virtual double Track::GetOffset ( ) const
pure virtual
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:355
static std::shared_ptr< Subclass > Pointer(Track *t)
Definition: Track.h:137
bool Track::GetSelected ( ) const
inline

Definition at line 276 of file Track.h.

Referenced by audacityAudioCallback(), ControlToolBar::ChooseExistingRecordingTracks(), AudacityProject::Clear(), LabelTextHandle::Click(), TimeShiftHandle::Click(), TrackInfo::CloseTitleDrawFunction(), SelectedTrackListOfKindIterator::Condition(), AudacityProject::CountSelectedTracks(), AudacityProject::CountSelectedWaveTracks(), Effect::CountWaveTracks(), TimeShiftHandle::CreateListOfCapturedClips(), AudacityProject::DoEffect(), EditCursorOverlay::Draw(), TrackArtist::DrawBackgroundWithSelection(), TrackArtist::DrawClipWaveform(), TrackArtist::DrawLabelTrack(), TrackPanel::DrawOutside(), AudacityProject::EditByLabel(), AudacityProject::EditClipboardByLabel(), Exporter::ExamineTracks(), ExportMultiple::ExportMultipleByTrack(), AudacityProject::FindClipBoundaries(), AudacityProject::FindClips(), TrackPanel::GetFirstSelectedTrack(), TrackList::GetNumExportChannels(), AudacityProject::GetRegionsByLabel(), AudacityProject::GetUpdateFlags(), AudacityProject::HandleAlign(), SelectionState::HandleListSelection(), AudacityProject::HandleMixAndRender(), AudacityProject::HandlePasteNothingSelected(), EffectAutoDuck::Init(), EffectScienFilter::Init(), EffectEqualization::Init(), IsSyncLockSelected(), TrackInfo::MinimizeSyncLockDrawFunction(), MixAndRender(), SelectHandle::MoveSnappingFreqSelection(), TrackInfo::MuteOrSoloDrawFunction(), AudacityProject::NearestZeroCrossing(), AudacityProject::OnClipMove(), AudacityProject::OnCopy(), AudacityProject::OnCursorTrackEnd(), AudacityProject::OnCursorTrackStart(), AudacityProject::OnCut(), AudacityProject::OnDisjoin(), AudacityProject::OnDuplicate(), AudacityProject::OnJoin(), AudacityProject::OnNextTrack(), AudacityProject::OnPanTracks(), AudacityProject::OnPrevTrack(), ControlToolBar::OnRecord(), AudacityProject::OnRemoveTracks(), AudacityProject::OnResample(), AudacityProject::OnSelectCursorEnd(), AudacityProject::OnSelectStartCursor(), AudacityProject::OnSelectTrackStartToEnd(), AudacityProject::OnSilence(), AudacityProject::OnSplit(), AudacityProject::OnSplitCut(), AudacityProject::OnSplitDelete(), AudacityProject::OnSplitNew(), AudacityProject::OnToggle(), AudacityProject::OnTrim(), Effect::Preview(), Effect::ProcessPass(), AudacityProject::SaveCopyWaveTracks(), and SelectionState::SelectTrack().

276 { return mSelected; }
bool mSelected
Definition: Track.h:122
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.

Referenced by TrackPanel::OnTrackMenu().

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:353
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:354
virtual std::shared_ptr<TrackVRulerControls> Track::GetVRulerControls ( )
protectedpure virtual

Implemented in WaveTrack, LabelTrack, and TimeTrack.

Referenced by GetVRulerControl().

int Track::GetY ( ) const
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 }
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:357
ToolsToolBar * GetToolsToolBar()
Definition: Project.cpp:5066
static UIHandlePtr HitAnywhere(std::weak_ptr< TimeShiftHandle > &holder, const std::shared_ptr< Track > &pTrack, bool gripHit)
std::weak_ptr< TimeShiftHandle > mTimeShiftHandle
Definition: Track.h:358
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:833
std::shared_ptr< UIHandle > UIHandlePtr
Definition: TrackPanel.h:59
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:137
void Track::Init ( const Track orig)

Definition at line 83 of file Track.cpp.

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

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

84 {
85  mId = orig.mId;
86 
88  mName = orig.mName;
89 
90  mDirManager = orig.mDirManager;
91 
92  mSelected = orig.mSelected;
93  mLinked = orig.mLinked;
94  mHeight = orig.mHeight;
95  mMinimized = orig.mMinimized;
96  mChannel = orig.mChannel;
97 }
int mHeight
Definition: Track.h:118
bool mSelected
Definition: Track.h:122
wxString mDefaultName
Definition: Track.h:120
bool mMinimized
Definition: Track.h:125
bool mLinked
Definition: Track.h:124
std::shared_ptr< DirManager > mDirManager
Definition: Track.h:232
int mChannel
Definition: Track.h:229
TrackId mId
Definition: Track.h:111
wxString mName
Definition: Track.h:119
virtual void Track::InsertSilence ( double   WXUNUSEDt,
double   WXUNUSEDlen 
)
pure virtual
bool Track::IsSyncLockSelected ( ) const

Definition at line 295 of file Track.cpp.

References GetActiveProject(), GetKind(), GetSelected(), AudacityProject::IsSyncLocked(), Label, mList, and Wave.

Referenced by AudacityProject::Clear(), TrackArtist::DrawBackgroundWithSelection(), TrackArtist::DrawClipWaveform(), TrackArtist::DrawLabelTrack(), AudacityProject::EditByLabel(), AudacityProject::HandleAlign(), TrackInfo::MinimizeSyncLockDrawFunction(), AudacityProject::OnCut(), AudacityProject::OnSelectSyncLockSel(), and Effect::ProcessPass().

296 {
297 #ifdef EXPERIMENTAL_SYNC_LOCK
299  if (!p || !p->IsSyncLocked())
300  return false;
301 
302  auto pList = mList.lock();
303  SyncLockedTracksIterator git(pList.get());
304  Track *t = git.StartWith(const_cast<Track*>(this));
305 
306  if (!t) {
307  // Not in a sync-locked group.
308  return ((this->GetKind() == Track::Wave) || (this->GetKind() == Track::Label)) && GetSelected();
309  }
310 
311  for (; t; t = git.Next()) {
312  if (t->GetSelected())
313  return true;
314  }
315 #endif
316 
317  return false;
318 }
bool GetSelected() const
Definition: Track.h:276
virtual int GetKind() const
Definition: Track.h:330
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:176
std::weak_ptr< TrackList > mList
Definition: Track.h:114
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:102
bool IsSyncLocked()
Definition: Project.cpp:5658
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:308
void Track::Merge ( const Track orig)
virtual

Reimplemented in WaveTrack, and PlayableTrack.

Definition at line 104 of file Track.cpp.

References mSelected.

Referenced by PlayableTrack::Merge().

105 {
106  mSelected = orig.mSelected;
107 }
bool mSelected
Definition: Track.h:122
void Track::Offset ( double  t)
inline

Definition at line 289 of file Track.h.

Referenced by TimeShiftHandle::DoSlideHorizontal(), TimeShiftHandle::Drag(), and Effect::Preview().

289 { SetOffset(GetOffset() + t); }
virtual double GetOffset() const =0
virtual void SetOffset(double o)
Definition: Track.h:290
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 148 of file Track.h.

References mList, and mNode.

149  {
150  if (t) {
151  auto pList = t->mList.lock();
152  if (pList) {
153  std::shared_ptr<const Track> p{ *t->mNode.first };
154  // Let you change the type, but not cast away the const
155  return std::static_pointer_cast<Subclass>(p);
156  }
157  }
158  return {};
159  }
TrackNodePointer mNode
Definition: Track.h:115
std::weak_ptr< TrackList > mList
Definition: Track.h:114
void Track::SetChannel ( int  c)
inline
void Track::SetDefaultName ( const wxString &  n)
inline

Definition at line 274 of file Track.h.

Referenced by WaveTrack::Init(), TimeTrack::Init(), LabelTrack::LabelTrack(), TimeTrack::TimeTrack(), and WaveTrack::WaveTrack().

274 { mDefaultName = n; }
wxString mDefaultName
Definition: Track.h:120
void Track::SetHeight ( int  h)

Definition at line 189 of file Track.cpp.

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

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

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

Definition at line 131 of file Track.h.

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

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

Definition at line 149 of file Track.cpp.

References mIndex.

Referenced by TrackList::RecalcPositions().

150 {
151  mIndex = index;
152 }
int mIndex
Definition: Track.h:116
void Track::SetLinked ( bool  l)

Definition at line 244 of file Track.cpp.

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

Referenced by AudacityProject::FinishCopy(), WaveTrack::HandleXMLTag(), WaveTrackMenuTable::OnMergeStereo(), AudacityProject::OnNewStereoTrack(), AudacityProject::OpenFile(), EffectStereoToMono::ProcessOne(), and WaveTrackMenuTable::SplitStereo().

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

Definition at line 219 of file Track.cpp.

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

Referenced by TrackPanelResizeHandle::Cancel(), TrackPanelResizeHandle::Drag(), LabelTrack::HandleXMLTag(), AudacityProject::OnCollapseAllTracks(), AudacityProject::OnExpandAllTracks(), and WaveTrackMenuTable::OnMergeStereo().

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

Reimplemented in LabelTrack, WaveTrack, and TimeTrack.

Definition at line 290 of file Track.h.

Referenced by AudacityProject::HandleAlign(), and AudacityProject::OnDuplicate().

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

Definition at line 121 of file Track.cpp.

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

122 {
123  // BUG: When using this function to clear an owner, we may need to clear
124  // focussed track too. Otherwise focus could remain on an invisible (or deleted) track.
125  mList = list;
126  mNode = node;
127 }
TrackNodePointer mNode
Definition: Track.h:115
std::weak_ptr< TrackList > mList
Definition: Track.h:114
virtual void Track::SetPan ( float  )
inlinevirtual

Reimplemented in WaveTrack.

Definition at line 293 of file Track.h.

Referenced by SetTrackAudioCommand::ApplyInner().

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

Reimplemented in WaveTrack.

Definition at line 294 of file Track.h.

294 { ;};
void Track::SetSelected ( bool  s)
virtual
void Track::SetY ( int  y)
private

Definition at line 159 of file Track.cpp.

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

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

Reimplemented in WaveTrack.

Definition at line 320 of file Track.cpp.

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

Referenced by AudacityProject::OnPaste(), NyquistEffect::ProcessOne(), and Effect::ProcessPass().

321 {
322  if (newT1 > oldT1) {
323  // Insert space within the track
324 
325  if (oldT1 > GetEndTime())
326  return;
327 
328  auto tmp = Cut(oldT1, GetEndTime());
329 
330  Paste(newT1, tmp.get());
331  }
332  else if (newT1 < oldT1) {
333  // Remove from the track
334  Clear(newT1, oldT1);
335  }
336 }
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
virtual void Track::WriteXML ( XMLWriter xmlFile) const
pure virtual

Implemented in WaveTrack, LabelTrack, and TimeTrack.

Referenced by AudacityProject::WriteXML().

Friends And Related Function Documentation

friend class SyncLockedTracksIterator
friend

Definition at line 107 of file Track.h.

friend class TrackList
friend

Definition at line 105 of file Track.h.

friend class TrackListIterator
friend

Definition at line 106 of file Track.h.

Member Data Documentation

int Track::mChannel
protected
wxString Track::mDefaultName
protected

Definition at line 120 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 111 of file Track.h.

Referenced by Init().

int Track::mIndex
protected

Definition at line 116 of file Track.h.

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

bool Track::mLinked
protected

Definition at line 124 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

Definition at line 115 of file Track.h.

Referenced by GetLink(), GetNode(), Pointer(), SetHeight(), SetLinked(), and SetMinimized().

double Track::mOffset
protected
std::shared_ptr<TrackControls> Track::mpControls
protected

Definition at line 353 of file Track.h.

Referenced by GetTrackControl().

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

Definition at line 355 of file Track.h.

Referenced by GetResizer().

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

Definition at line 354 of file Track.h.

Referenced by GetVRulerControl().

bool Track::mSelected
protected

Definition at line 122 of file Track.h.

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

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

Definition at line 357 of file Track.h.

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

Definition at line 358 of file Track.h.

int Track::mY
protected

Definition at line 117 of file Track.h.

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

wxSize Track::vrulerSize
mutable

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