mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-05 08:10:17 +01:00
Split "Do" functions out of the "Set" functions for some Track settings
This commit is contained in:
@@ -210,11 +210,11 @@ double NoteTrack::GetEndTime() const
|
|||||||
return GetStartTime() + GetSeq().get_real_dur();
|
return GetStartTime() + GetSeq().get_real_dur();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteTrack::SetHeight(int h)
|
void NoteTrack::DoSetHeight(int h)
|
||||||
{
|
{
|
||||||
auto oldHeight = GetHeight();
|
auto oldHeight = GetHeight();
|
||||||
auto oldMargin = GetNoteMargin(oldHeight);
|
auto oldMargin = GetNoteMargin(oldHeight);
|
||||||
Track::SetHeight(h);
|
PlayableTrack::DoSetHeight(h);
|
||||||
auto margin = GetNoteMargin(h);
|
auto margin = GetNoteMargin(h);
|
||||||
Zoom(
|
Zoom(
|
||||||
wxRect{ 0, 0, 1, h }, // only height matters
|
wxRect{ 0, 0, 1, h }, // only height matters
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class AUDACITY_DLL_API NoteTrack final
|
|||||||
double GetStartTime() const override;
|
double GetStartTime() const override;
|
||||||
double GetEndTime() const override;
|
double GetEndTime() const override;
|
||||||
|
|
||||||
void SetHeight(int h) override;
|
void DoSetHeight(int h) override;
|
||||||
|
|
||||||
Alg_seq &GetSeq() const;
|
Alg_seq &GetSeq() const;
|
||||||
|
|
||||||
|
|||||||
@@ -153,6 +153,11 @@ int Track::GetY() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Track::SetY(int y)
|
void Track::SetY(int y)
|
||||||
|
{
|
||||||
|
DoSetY(y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Track::DoSetY(int y)
|
||||||
{
|
{
|
||||||
mY = y;
|
mY = y;
|
||||||
}
|
}
|
||||||
@@ -168,14 +173,21 @@ int Track::GetHeight() const
|
|||||||
|
|
||||||
void Track::SetHeight(int h)
|
void Track::SetHeight(int h)
|
||||||
{
|
{
|
||||||
mHeight = h;
|
|
||||||
auto pList = mList.lock();
|
auto pList = mList.lock();
|
||||||
|
|
||||||
|
DoSetHeight(h);
|
||||||
|
|
||||||
if (pList) {
|
if (pList) {
|
||||||
pList->RecalcPositions(mNode);
|
pList->RecalcPositions(mNode);
|
||||||
pList->ResizingEvent(mNode);
|
pList->ResizingEvent(mNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Track::DoSetHeight(int h)
|
||||||
|
{
|
||||||
|
mHeight = h;
|
||||||
|
}
|
||||||
|
|
||||||
bool Track::GetMinimized() const
|
bool Track::GetMinimized() const
|
||||||
{
|
{
|
||||||
return mMinimized;
|
return mMinimized;
|
||||||
@@ -184,23 +196,37 @@ bool Track::GetMinimized() const
|
|||||||
void Track::SetMinimized(bool isMinimized)
|
void Track::SetMinimized(bool isMinimized)
|
||||||
{
|
{
|
||||||
auto pList = mList.lock();
|
auto pList = mList.lock();
|
||||||
mMinimized = isMinimized;
|
|
||||||
|
DoSetMinimized(isMinimized);
|
||||||
|
|
||||||
if (pList) {
|
if (pList) {
|
||||||
pList->RecalcPositions(mNode);
|
pList->RecalcPositions(mNode);
|
||||||
pList->ResizingEvent(mNode);
|
pList->ResizingEvent(mNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Track::DoSetMinimized(bool isMinimized)
|
||||||
|
{
|
||||||
|
mMinimized = isMinimized;
|
||||||
|
}
|
||||||
|
|
||||||
void Track::SetLinked(bool l)
|
void Track::SetLinked(bool l)
|
||||||
{
|
{
|
||||||
auto pList = mList.lock();
|
auto pList = mList.lock();
|
||||||
mLinked = l;
|
|
||||||
|
DoSetLinked(l);
|
||||||
|
|
||||||
if (pList) {
|
if (pList) {
|
||||||
pList->RecalcPositions(mNode);
|
pList->RecalcPositions(mNode);
|
||||||
pList->ResizingEvent(mNode);
|
pList->ResizingEvent(mNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Track::DoSetLinked(bool l)
|
||||||
|
{
|
||||||
|
mLinked = l;
|
||||||
|
}
|
||||||
|
|
||||||
Track *Track::GetLink() const
|
Track *Track::GetLink() const
|
||||||
{
|
{
|
||||||
auto pList = mList.lock();
|
auto pList = mList.lock();
|
||||||
@@ -787,7 +813,7 @@ void TrackList::RecalcPositions(TrackNodePointer node)
|
|||||||
for (auto n = TrackListIterator{ this, node }; n != theEnd; ++n) {
|
for (auto n = TrackListIterator{ this, node }; n != theEnd; ++n) {
|
||||||
t = *n;
|
t = *n;
|
||||||
t->SetIndex(i++);
|
t->SetIndex(i++);
|
||||||
t->SetY(y);
|
t->DoSetY(y);
|
||||||
y += t->GetHeight();
|
y += t->GetHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
28
src/Track.h
28
src/Track.h
@@ -151,12 +151,28 @@ class AUDACITY_DLL_API Track /* not final */
|
|||||||
|
|
||||||
int GetIndex() const;
|
int GetIndex() const;
|
||||||
void SetIndex(int index);
|
void SetIndex(int index);
|
||||||
|
|
||||||
int GetY() const;
|
int GetY() const;
|
||||||
|
private:
|
||||||
|
// Always maintain a strictly contiguous layout of tracks.
|
||||||
|
// So client code is not permitted to modify this attribute directly.
|
||||||
void SetY(int y);
|
void SetY(int y);
|
||||||
|
// No need yet to make this virtual
|
||||||
|
void DoSetY(int y);
|
||||||
|
public:
|
||||||
|
|
||||||
int GetHeight() const;
|
int GetHeight() const;
|
||||||
virtual void SetHeight(int h);
|
void SetHeight(int h);
|
||||||
|
protected:
|
||||||
|
virtual void DoSetHeight(int h);
|
||||||
|
public:
|
||||||
|
|
||||||
bool GetMinimized() const;
|
bool GetMinimized() const;
|
||||||
virtual void SetMinimized(bool isMinimized);
|
void SetMinimized(bool isMinimized);
|
||||||
|
protected:
|
||||||
|
virtual void DoSetMinimized(bool isMinimized);
|
||||||
|
public:
|
||||||
|
|
||||||
Track *GetLink() const;
|
Track *GetLink() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -215,10 +231,14 @@ class AUDACITY_DLL_API Track /* not final */
|
|||||||
void SetDefaultName( const wxString &n ) { mDefaultName = n; }
|
void SetDefaultName( const wxString &n ) { mDefaultName = n; }
|
||||||
|
|
||||||
bool GetSelected() const { return mSelected; }
|
bool GetSelected() const { return mSelected; }
|
||||||
bool GetLinked () const { return mLinked; }
|
|
||||||
|
|
||||||
virtual void SetSelected(bool s);
|
virtual void SetSelected(bool s);
|
||||||
|
|
||||||
|
bool GetLinked () const { return mLinked; }
|
||||||
void SetLinked (bool l);
|
void SetLinked (bool l);
|
||||||
|
private:
|
||||||
|
// No need yet to make this virtual
|
||||||
|
void DoSetLinked(bool l);
|
||||||
|
public:
|
||||||
|
|
||||||
virtual int GetChannel() const { return mChannel;};
|
virtual int GetChannel() const { return mChannel;};
|
||||||
virtual double GetOffset() const = 0;
|
virtual double GetOffset() const = 0;
|
||||||
|
|||||||
@@ -452,7 +452,7 @@ float WaveTrack::GetChannelGain(int channel) const
|
|||||||
return right*mGain;
|
return right*mGain;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaveTrack::SetMinimized(bool isMinimized){
|
void WaveTrack::DoSetMinimized(bool isMinimized){
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_HALF_WAVE
|
#ifdef EXPERIMENTAL_HALF_WAVE
|
||||||
// Show half wave on collapse, full on restore.
|
// Show half wave on collapse, full on restore.
|
||||||
@@ -465,7 +465,7 @@ void WaveTrack::SetMinimized(bool isMinimized){
|
|||||||
pWtvc->DoZoomPreset( isMinimized ? 1:0);
|
pWtvc->DoZoomPreset( isMinimized ? 1:0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Track::SetMinimized( isMinimized );
|
PlayableTrack::DoSetMinimized( isMinimized );
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaveTrack::SetWaveColorIndex(int colorIndex)
|
void WaveTrack::SetWaveColorIndex(int colorIndex)
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class AUDACITY_DLL_API WaveTrack final : public PlayableTrack {
|
|||||||
// Takes gain and pan into account
|
// Takes gain and pan into account
|
||||||
float GetChannelGain(int channel) const;
|
float GetChannelGain(int channel) const;
|
||||||
|
|
||||||
void SetMinimized(bool isMinimized) override;
|
void DoSetMinimized(bool isMinimized) override;
|
||||||
|
|
||||||
int GetWaveColorIndex() const { return mWaveColorIndex; };
|
int GetWaveColorIndex() const { return mWaveColorIndex; };
|
||||||
void SetWaveColorIndex(int colorIndex);
|
void SetWaveColorIndex(int colorIndex);
|
||||||
|
|||||||
Reference in New Issue
Block a user