1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-24 16:20:05 +02:00

Add some comments to the places I got confused. This would be much clearer if classes had copy-constructors\!

This commit is contained in:
richardash1981 2012-12-31 13:13:58 +00:00
parent afbbcc179a
commit 389beeb7fc
2 changed files with 15 additions and 1 deletions

View File

@ -59,8 +59,9 @@ TimeTrack::TimeTrack(DirManager *projDirManager):
TimeTrack::TimeTrack(TimeTrack &orig): TimeTrack::TimeTrack(TimeTrack &orig):
Track(orig) Track(orig)
{ {
Init(orig); Init(orig); // this copies the TimeTrack metadata (name, range, etc)
///@TODO: Give Envelope:: a copy-constructor instead of this?
mEnvelope = new Envelope(); mEnvelope = new Envelope();
mEnvelope->SetTrackLen(1000000000.0); mEnvelope->SetTrackLen(1000000000.0);
SetInterpolateLog(orig.GetInterpolateLog()); // this calls Envelope::SetInterpolateDB SetInterpolateLog(orig.GetInterpolateLog()); // this calls Envelope::SetInterpolateDB
@ -70,6 +71,7 @@ TimeTrack::TimeTrack(TimeTrack &orig):
mEnvelope->SetRange(orig.mEnvelope->GetMinValue(), orig.mEnvelope->GetMaxValue()); mEnvelope->SetRange(orig.mEnvelope->GetMinValue(), orig.mEnvelope->GetMaxValue());
mEnvelope->Paste(0.0, orig.mEnvelope); mEnvelope->Paste(0.0, orig.mEnvelope);
///@TODO: Give Ruler:: a copy-constructor instead of this?
mRuler = new Ruler(); mRuler = new Ruler();
mRuler->SetLabelEdges(false); mRuler->SetLabelEdges(false);
mRuler->SetFormat(Ruler::TimeFormat); mRuler->SetFormat(Ruler::TimeFormat);

View File

@ -27,6 +27,13 @@ class TimeTrack: public Track {
public: public:
TimeTrack(DirManager * projDirManager); TimeTrack(DirManager * projDirManager);
/** @brief Copy-Constructor - create a new TimeTrack:: which is an independent copy of the original
*
* Calls TimeTrack::Init() to copy the track metadata, then does a bunch of manipulations on the
* Envelope:: and Ruler:: members in order to copy one to the other - unfortunately both lack a
* copy-constructor to encapsulate this.
* @param orig The original track to copy from
*/
TimeTrack(TimeTrack &orig); TimeTrack(TimeTrack &orig);
virtual ~TimeTrack(); virtual ~TimeTrack();
@ -102,6 +109,11 @@ class TimeTrack: public Track {
bool mDisplayLog; bool mDisplayLog;
bool mRescaleXMLValues; // needed for backward-compatibility with older project files bool mRescaleXMLValues; // needed for backward-compatibility with older project files
/** @brief Copy the metadata from another track but not the points
*
* Copies the Name, DefaultName, Range and Display data from the source track
* @param orig the TimeTrack to copy from
*/
void Init(const TimeTrack &orig); void Init(const TimeTrack &orig);
virtual Track *Duplicate(); virtual Track *Duplicate();