Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Effect::ModifiedAnalysisTrack Class Reference

#include <Effect.h>

Collaboration diagram for Effect::ModifiedAnalysisTrack:
[legend]

Public Member Functions

 ModifiedAnalysisTrack ()
 
 ModifiedAnalysisTrack (ModifiedAnalysisTrack &&that)
 
LabelTrackget () const
 
void Commit ()
 
 ~ModifiedAnalysisTrack ()
 

Private Member Functions

 ModifiedAnalysisTrack (Effect *pEffect, const LabelTrack *pOrigTrack, const wxString &name)
 
 ModifiedAnalysisTrack (const ModifiedAnalysisTrack &) PROHIBITED
 

Private Attributes

friend Effect
 
EffectmpEffect {}
 
LabelTrackmpTrack {}
 
std::shared_ptr< TrackmpOrigTrack {}
 

Detailed Description

Definition at line 266 of file Effect.h.

Constructor & Destructor Documentation

◆ ModifiedAnalysisTrack() [1/4]

Effect::ModifiedAnalysisTrack::ModifiedAnalysisTrack ( Effect pEffect,
const LabelTrack pOrigTrack,
const wxString &  name 
)
private

Definition at line 793 of file Effect.cpp.

795 : mpEffect(pEffect)
796{
797 // copy LabelTrack here, so it can be undone on cancel
798 auto newTrack = pOrigTrack->Copy(pOrigTrack->GetStartTime(), pOrigTrack->GetEndTime());
799
800 mpTrack = static_cast<LabelTrack*>(newTrack.get());
801
802 // Why doesn't LabelTrack::Copy complete the job? :
803 mpTrack->SetOffset(pOrigTrack->GetStartTime());
804 if (!name.empty())
806
807 // mpOrigTrack came from mTracks which we own but expose as const to subclasses
808 // So it's okay that we cast it back to const
810 pEffect->mTracks->Replace(const_cast<LabelTrack*>(pOrigTrack),
811 newTrack );
812}
const TranslatableString name
Definition: Distortion.cpp:82
std::shared_ptr< Track > mpOrigTrack
Definition: Effect.h:290
TrackList * mTracks
Definition: EffectBase.h:125
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:89
double GetStartTime() const override
Definition: LabelTrack.cpp:346
Track::Holder Copy(double t0, double t1, bool forClipboard=true) const override
Definition: LabelTrack.cpp:714
double GetEndTime() const override
Definition: LabelTrack.cpp:354
void SetOffset(double dOffset) override
Definition: LabelTrack.cpp:176
void SetName(const wxString &n)
Definition: Track.cpp:79
ListOfTracks::value_type Replace(Track *t, const ListOfTracks::value_type &with)
Definition: Track.cpp:724

References LabelTrack::Copy(), TranslatableString::empty(), LabelTrack::GetEndTime(), LabelTrack::GetStartTime(), mpOrigTrack, mpTrack, EffectBase::mTracks, name, TrackList::Replace(), Track::SetName(), and LabelTrack::SetOffset().

Here is the call graph for this function:

◆ ModifiedAnalysisTrack() [2/4]

Effect::ModifiedAnalysisTrack::ModifiedAnalysisTrack ( const ModifiedAnalysisTrack )
private

◆ ModifiedAnalysisTrack() [3/4]

Effect::ModifiedAnalysisTrack::ModifiedAnalysisTrack ( )

◆ ModifiedAnalysisTrack() [4/4]

Effect::ModifiedAnalysisTrack::ModifiedAnalysisTrack ( ModifiedAnalysisTrack &&  that)

Definition at line 814 of file Effect.cpp.

815{
816 mpEffect = that.mpEffect;
817 mpTrack = that.mpTrack;
818 mpOrigTrack = std::move(that.mpOrigTrack);
819 that.Commit();
820}

◆ ~ModifiedAnalysisTrack()

Effect::ModifiedAnalysisTrack::~ModifiedAnalysisTrack ( )

Definition at line 827 of file Effect.cpp.

828{
829 if (mpEffect) {
830 // not committed -- DELETE the label track
831 // mpOrigTrack came from mTracks which we own but expose as const to subclasses
832 // So it's okay that we cast it back to const
834 }
835}

Member Function Documentation

◆ Commit()

void Effect::ModifiedAnalysisTrack::Commit ( )

Definition at line 822 of file Effect.cpp.

823{
824 mpEffect = nullptr;
825}

◆ get()

LabelTrack * Effect::ModifiedAnalysisTrack::get ( ) const
inline

Definition at line 279 of file Effect.h.

279{ return mpTrack; }

Member Data Documentation

◆ Effect

friend Effect::ModifiedAnalysisTrack::Effect
private

Definition at line 267 of file Effect.h.

◆ mpEffect

Effect* Effect::ModifiedAnalysisTrack::mpEffect {}
private

Definition at line 288 of file Effect.h.

◆ mpOrigTrack

std::shared_ptr<Track> Effect::ModifiedAnalysisTrack::mpOrigTrack {}
private

Definition at line 290 of file Effect.h.

Referenced by ModifiedAnalysisTrack().

◆ mpTrack

LabelTrack* Effect::ModifiedAnalysisTrack::mpTrack {}
private

Definition at line 289 of file Effect.h.

Referenced by ModifiedAnalysisTrack().


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