mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-21 06:01:13 +02:00
Don't pass whole TimeTrack to Ruler or Mixer...
... they need only the information in a (Bounded)Envelope.
This commit is contained in:
@@ -64,8 +64,8 @@ array of Ruler::Label.
|
||||
|
||||
#include "../AColor.h"
|
||||
#include "../AllThemeResources.h"
|
||||
#include "../Envelope.h"
|
||||
#include "../NumberScale.h"
|
||||
#include "../TimeTrack.h"
|
||||
#include "../ViewInfo.h"
|
||||
|
||||
using std::min;
|
||||
@@ -954,7 +954,19 @@ void Ruler::Update()
|
||||
Update(NULL);
|
||||
}
|
||||
|
||||
void Ruler::Update(const TimeTrack* timetrack)// Envelope *speedEnv, long minSpeed, long maxSpeed )
|
||||
namespace {
|
||||
double ComputeWarpedLength(const Envelope &env, double t0, double t1)
|
||||
{
|
||||
return env.IntegralOfInverse(t0, t1);
|
||||
}
|
||||
|
||||
double SolveWarpedLength(const Envelope &env, double t0, double length)
|
||||
{
|
||||
return env.SolveIntegralOfInverse(t0, length);
|
||||
}
|
||||
}
|
||||
|
||||
void Ruler::Update(const Envelope* envelope)// Envelope *speedEnv, long minSpeed, long maxSpeed )
|
||||
{
|
||||
const ZoomInfo *zoomInfo = NULL;
|
||||
if (!mLog && mOrientation == wxHORIZONTAL)
|
||||
@@ -1115,8 +1127,8 @@ void Ruler::Update(const TimeTrack* timetrack)// Envelope *speedEnv, long minSpe
|
||||
}
|
||||
else
|
||||
d = mMin - UPP / 2;
|
||||
if (timetrack)
|
||||
warpedD = timetrack->ComputeWarpedLength(0.0, d);
|
||||
if (envelope)
|
||||
warpedD = ComputeWarpedLength(*envelope, 0.0, d);
|
||||
else
|
||||
warpedD = d;
|
||||
// using ints doesn't work, as
|
||||
@@ -1133,8 +1145,8 @@ void Ruler::Update(const TimeTrack* timetrack)// Envelope *speedEnv, long minSpe
|
||||
}
|
||||
else
|
||||
nextD = d + UPP;
|
||||
if (timetrack)
|
||||
warpedD += timetrack->ComputeWarpedLength(d, nextD);
|
||||
if (envelope)
|
||||
warpedD += ComputeWarpedLength(*envelope, d, nextD);
|
||||
else
|
||||
warpedD = nextD;
|
||||
d = nextD;
|
||||
@@ -1290,14 +1302,14 @@ void Ruler::Draw(wxDC& dc)
|
||||
Draw( dc, NULL);
|
||||
}
|
||||
|
||||
void Ruler::Draw(wxDC& dc, const TimeTrack* timetrack)
|
||||
void Ruler::Draw(wxDC& dc, const Envelope* envelope)
|
||||
{
|
||||
mDC = &dc;
|
||||
if( mLength <=0 )
|
||||
return;
|
||||
|
||||
if (!mValid)
|
||||
Update(timetrack);
|
||||
Update(envelope);
|
||||
|
||||
mDC->SetTextForeground( mTickColour );
|
||||
#ifdef EXPERIMENTAL_THEMING
|
||||
|
@@ -21,7 +21,7 @@ class wxDC;
|
||||
class wxFont;
|
||||
|
||||
class NumberScale;
|
||||
class TimeTrack;
|
||||
class Envelope;
|
||||
class ZoomInfo;
|
||||
|
||||
class AUDACITY_DLL_API Ruler {
|
||||
@@ -136,7 +136,7 @@ class AUDACITY_DLL_API Ruler {
|
||||
|
||||
// Note that it will not erase for you...
|
||||
void Draw(wxDC& dc);
|
||||
void Draw(wxDC& dc, const TimeTrack* timetrack);
|
||||
void Draw(wxDC& dc, const Envelope* envelope);
|
||||
// If length <> 0, draws lines perpendiculars to ruler corresponding
|
||||
// to selected ticks (major, minor, or both), in an adjacent window.
|
||||
// You may need to use the offsets if you are using part of the dc for rulers, borders etc.
|
||||
@@ -151,7 +151,7 @@ class AUDACITY_DLL_API Ruler {
|
||||
|
||||
private:
|
||||
void Update();
|
||||
void Update(const TimeTrack* timetrack);
|
||||
void Update(const Envelope* envelope);
|
||||
void FindTickSizes();
|
||||
void FindLinearTickSizes(double UPP);
|
||||
wxString LabelString(double d, bool major);
|
||||
|
Reference in New Issue
Block a user