1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-05 03:03:10 +01:00

TrackArtist, LabelTrack, TimeTrack, Envelope functions take ZoomInfo...

... and SelectedRegion, and not ViewInfo or zoom level as a double.

Also some leftOffset arguments.

Assumptions of uniform zoom level persist in TrackArtist::DrawClipSpectrum and
in TrackArtist::DrawClipWaveform but no longer in the rest.
This commit is contained in:
Paul Licameli
2015-06-09 10:45:14 -04:00
parent 5316032fee
commit e0f4595485
11 changed files with 215 additions and 219 deletions

View File

@@ -13,15 +13,16 @@
*//*******************************************************************/
#include "Audacity.h"
#include "TimeTrack.h"
#include <wx/intl.h>
#include "Audacity.h"
#include "AColor.h"
#include "TimeTrack.h"
#include "widgets/Ruler.h"
#include "Prefs.h"
#include "Internat.h"
#include "Resample.h"
#include "ViewInfo.h"
//TODO-MB: are these sensible values?
#define TIMETRACK_MIN 0.01
@@ -223,19 +224,15 @@ void TimeTrack::WriteXML(XMLWriter &xmlFile)
xmlFile.EndTag(wxT("timetrack"));
}
void TimeTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps)
void TimeTrack::Draw(wxDC & dc, const wxRect & r, const ZoomInfo &zoomInfo)
{
double tstep = 1.0 / pps; // Seconds per point
double t0 = h;
double t1 = h + (r.width * tstep);
//Make sure t1 (the right bound) is greater than 0
if (t1 < 0.0)
t1 = 0.0;
//make sure t1 is greater than t0
if (t0 > t1)
t0 = t1;
double min = zoomInfo.PositionToTime(0);
double max = zoomInfo.PositionToTime(r.width);
if (min > max)
{
wxASSERT(false);
min = max;
}
dc.SetBrush(blankBrush);
dc.SetPen(blankPen);
@@ -246,8 +243,6 @@ void TimeTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps)
// Draw the Ruler
mRuler->SetBounds(r.x, r.y, r.x + r.width - 1, r.y + r.height - 1);
double min = t0;
double max = min + r.width / pps;
mRuler->SetRange(min, max);
mRuler->SetFlip(false); // If we don't do this, the Ruler doesn't redraw itself when the envelope is modified.
// I have no idea why!
@@ -258,7 +253,7 @@ void TimeTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps)
mRuler->Draw(dc, this);
double *envValues = new double[mid.width];
GetEnvelope()->GetValues(envValues, mid.width, t0, tstep);
GetEnvelope()->GetValues(envValues, mid.width, 0, zoomInfo);
dc.SetPen(AColor::envelopePen);