mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-08 00:20:19 +02: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:
parent
5316032fee
commit
e0f4595485
@ -202,13 +202,9 @@ static void DrawPoint(wxDC & dc, const wxRect & r, int x, int y, bool top)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// TODO: This should probably move to track artist.
|
/// TODO: This should probably move to track artist.
|
||||||
void Envelope::DrawPoints(wxDC & dc, const wxRect & r, double h, double pps, bool dB,
|
void Envelope::DrawPoints(wxDC & dc, const wxRect & r, const ZoomInfo &zoomInfo, bool dB,
|
||||||
float zoomMin, float zoomMax)
|
float zoomMin, float zoomMax)
|
||||||
{
|
{
|
||||||
h -= mOffset;
|
|
||||||
|
|
||||||
wxASSERT( pps > 0 );
|
|
||||||
double tright = h + (r.width / pps);
|
|
||||||
// TODO: Cache the gPrefs value. Reading it every time is inefficient.
|
// TODO: Cache the gPrefs value. Reading it every time is inefficient.
|
||||||
double dBRange = gPrefs->Read(wxT("/GUI/EnvdBRange"), ENV_DB_RANGE);
|
double dBRange = gPrefs->Read(wxT("/GUI/EnvdBRange"), ENV_DB_RANGE);
|
||||||
|
|
||||||
@ -216,7 +212,9 @@ void Envelope::DrawPoints(wxDC & dc, const wxRect & r, double h, double pps, boo
|
|||||||
dc.SetBrush(*wxWHITE_BRUSH);
|
dc.SetBrush(*wxWHITE_BRUSH);
|
||||||
|
|
||||||
for (int i = 0; i < (int)mEnv.Count(); i++) {
|
for (int i = 0; i < (int)mEnv.Count(); i++) {
|
||||||
if (mEnv[i]->GetT() >= h && mEnv[i]->GetT() <= tright) {
|
const double time = mEnv[i]->GetT() + mOffset;
|
||||||
|
const wxInt64 position = zoomInfo.TimeToPosition(time);
|
||||||
|
if (position >= 0 && position < r.width) {
|
||||||
// Change colour if this is the draggable point...
|
// Change colour if this is the draggable point...
|
||||||
if (i == mDragPoint) {
|
if (i == mDragPoint) {
|
||||||
dc.SetPen(AColor::envelopePen);
|
dc.SetPen(AColor::envelopePen);
|
||||||
@ -224,7 +222,7 @@ void Envelope::DrawPoints(wxDC & dc, const wxRect & r, double h, double pps, boo
|
|||||||
}
|
}
|
||||||
|
|
||||||
double v = mEnv[i]->GetVal();
|
double v = mEnv[i]->GetVal();
|
||||||
int x = int ((mEnv[i]->GetT() - h) * pps);
|
int x = int(position);
|
||||||
int y, y2;
|
int y, y2;
|
||||||
|
|
||||||
y = GetWaveYPos(v, zoomMin, zoomMax, r.height, dB,
|
y = GetWaveYPos(v, zoomMin, zoomMax, r.height, dB,
|
||||||
|
@ -118,7 +118,7 @@ class Envelope : public XMLTagHandler {
|
|||||||
virtual XMLTagHandler *HandleXMLChild(const wxChar *tag);
|
virtual XMLTagHandler *HandleXMLChild(const wxChar *tag);
|
||||||
virtual void WriteXML(XMLWriter &xmlFile);
|
virtual void WriteXML(XMLWriter &xmlFile);
|
||||||
|
|
||||||
void DrawPoints(wxDC & dc, const wxRect & r, double h, double pps, bool dB,
|
void DrawPoints(wxDC & dc, const wxRect & r, const ZoomInfo &zoomInfo, bool dB,
|
||||||
float zoomMin=-1.0, float zoomMax=1.0);
|
float zoomMin=-1.0, float zoomMax=1.0);
|
||||||
|
|
||||||
// Event Handlers
|
// Event Handlers
|
||||||
|
@ -444,7 +444,7 @@ void LabelTrack::ComputeTextPosition(const wxRect & r, int index)
|
|||||||
/// ComputeLayout determines which row each label
|
/// ComputeLayout determines which row each label
|
||||||
/// should be placed on, and reserves space for it.
|
/// should be placed on, and reserves space for it.
|
||||||
/// Function assumes that the labels are sorted.
|
/// Function assumes that the labels are sorted.
|
||||||
void LabelTrack::ComputeLayout(const wxRect & r, double h, double pps)
|
void LabelTrack::ComputeLayout(const wxRect & r, const ZoomInfo &zoomInfo)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int iRow;
|
int iRow;
|
||||||
@ -461,15 +461,17 @@ void LabelTrack::ComputeLayout(const wxRect & r, double h, double pps)
|
|||||||
const int nRows = wxMin((r.height / yRowHeight) + 1, MAX_NUM_ROWS);
|
const int nRows = wxMin((r.height / yRowHeight) + 1, MAX_NUM_ROWS);
|
||||||
// Initially none of the rows have been used.
|
// Initially none of the rows have been used.
|
||||||
// So set a value that is less than any valid value.
|
// So set a value that is less than any valid value.
|
||||||
const int xStart = r.x -(int)(h*pps) -100;
|
{
|
||||||
for(i=0;i<MAX_NUM_ROWS;i++)
|
const int xStart = zoomInfo.TimeToPosition(0.0, r.x) - 100;
|
||||||
xUsed[i]=xStart;
|
for(i=0;i<MAX_NUM_ROWS;i++)
|
||||||
|
xUsed[i]=xStart;
|
||||||
|
}
|
||||||
int nRowsUsed=0;
|
int nRowsUsed=0;
|
||||||
|
|
||||||
for (i = 0; i < (int)mLabels.Count(); i++)
|
for (i = 0; i < (int)mLabels.Count(); i++)
|
||||||
{
|
{
|
||||||
int x = r.x + (int) ((mLabels[i]->getT0() - h) * pps);
|
const int x = zoomInfo.TimeToPosition(mLabels[i]->getT0(), r.x);
|
||||||
int x1 = r.x + (int) ((mLabels[i]->getT1() - h) * pps);
|
const int x1 = zoomInfo.TimeToPosition(mLabels[i]->getT1(), r.x);
|
||||||
int y = r.y;
|
int y = r.y;
|
||||||
|
|
||||||
mLabels[i]->x=x;
|
mLabels[i]->x=x;
|
||||||
@ -727,8 +729,9 @@ bool LabelTrack::CalcCursorX(wxWindow * parent, int * x)
|
|||||||
/// Draw calls other functions to draw the LabelTrack.
|
/// Draw calls other functions to draw the LabelTrack.
|
||||||
/// @param dc the device context
|
/// @param dc the device context
|
||||||
/// @param r the LabelTrack rectangle.
|
/// @param r the LabelTrack rectangle.
|
||||||
void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps,
|
void LabelTrack::Draw(wxDC & dc, const wxRect & r,
|
||||||
double sel0, double sel1)
|
const SelectedRegion &selectedRegion,
|
||||||
|
const ZoomInfo &zoomInfo)
|
||||||
{
|
{
|
||||||
if(msFont.Ok())
|
if(msFont.Ok())
|
||||||
dc.SetFont(msFont);
|
dc.SetFont(msFont);
|
||||||
@ -738,7 +741,7 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps,
|
|||||||
|
|
||||||
TrackArtist::DrawBackgroundWithSelection(&dc, r, this,
|
TrackArtist::DrawBackgroundWithSelection(&dc, r, this,
|
||||||
AColor::labelSelectedBrush, AColor::labelUnselectedBrush,
|
AColor::labelSelectedBrush, AColor::labelUnselectedBrush,
|
||||||
sel0, sel1, h, pps);
|
selectedRegion, zoomInfo);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -765,7 +768,7 @@ void LabelTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps,
|
|||||||
// happens with a new label track.
|
// happens with a new label track.
|
||||||
dc.GetTextExtent(wxT("Demo Text x^y"), &textWidth, &textHeight);
|
dc.GetTextExtent(wxT("Demo Text x^y"), &textWidth, &textHeight);
|
||||||
mTextHeight = (int)textHeight;
|
mTextHeight = (int)textHeight;
|
||||||
ComputeLayout( r, h , pps );
|
ComputeLayout( r, zoomInfo );
|
||||||
dc.SetTextForeground(theTheme.Colour( clrLabelTrackText));
|
dc.SetTextForeground(theTheme.Colour( clrLabelTrackText));
|
||||||
dc.SetBackgroundMode(wxTRANSPARENT);
|
dc.SetBackgroundMode(wxTRANSPARENT);
|
||||||
dc.SetBrush(AColor::labelTextNormalBrush);
|
dc.SetBrush(AColor::labelTextNormalBrush);
|
||||||
|
@ -126,8 +126,9 @@ class AUDACITY_DLL_API LabelTrack : public Track
|
|||||||
|
|
||||||
static void ResetFont();
|
static void ResetFont();
|
||||||
|
|
||||||
void Draw(wxDC & dc, const wxRect & r, double h, double pps,
|
void Draw(wxDC & dc, const wxRect & r,
|
||||||
double sel0, double sel1);
|
const SelectedRegion &selectedRegion,
|
||||||
|
const ZoomInfo &zoomInfo);
|
||||||
|
|
||||||
int getSelectedIndex() const { return mSelIndex; }
|
int getSelectedIndex() const { return mSelIndex; }
|
||||||
|
|
||||||
@ -261,7 +262,7 @@ class AUDACITY_DLL_API LabelTrack : public Track
|
|||||||
// Set in copied label tracks
|
// Set in copied label tracks
|
||||||
double mClipLen;
|
double mClipLen;
|
||||||
|
|
||||||
void ComputeLayout(const wxRect & r, double h, double pps);
|
void ComputeLayout(const wxRect & r, const ZoomInfo &zoomInfo);
|
||||||
void ComputeTextPosition(const wxRect & r, int index);
|
void ComputeTextPosition(const wxRect & r, int index);
|
||||||
void SetCurrentCursorPosition(wxDC & dc, int xPos);
|
void SetCurrentCursorPosition(wxDC & dc, int xPos);
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ bool AudacityPrintout::OnPrintPage(int WXUNUSED(page))
|
|||||||
artist.SetBackgroundBrushes(*wxWHITE_BRUSH, *wxWHITE_BRUSH,
|
artist.SetBackgroundBrushes(*wxWHITE_BRUSH, *wxWHITE_BRUSH,
|
||||||
*wxWHITE_PEN, *wxWHITE_PEN);
|
*wxWHITE_PEN, *wxWHITE_PEN);
|
||||||
const double screenDuration = mTracks->GetEndTime();
|
const double screenDuration = mTracks->GetEndTime();
|
||||||
ViewInfo viewInfo(0.0, screenDuration, width / screenDuration);
|
ZoomInfo zoomInfo(0.0, screenDuration, width / screenDuration);
|
||||||
int y = rulerPageHeight;
|
int y = rulerPageHeight;
|
||||||
|
|
||||||
TrackListIterator iter(mTracks);
|
TrackListIterator iter(mTracks);
|
||||||
@ -93,7 +93,7 @@ bool AudacityPrintout::OnPrintPage(int WXUNUSED(page))
|
|||||||
r.width = width;
|
r.width = width;
|
||||||
r.height = (int)(n->GetHeight() * scale);
|
r.height = (int)(n->GetHeight() * scale);
|
||||||
|
|
||||||
artist.DrawTrack(n, *dc, r, &viewInfo, false, false, false, false);
|
artist.DrawTrack(n, *dc, r, SelectedRegion(), zoomInfo, false, false, false, false);
|
||||||
|
|
||||||
dc->SetPen(*wxBLACK_PEN);
|
dc->SetPen(*wxBLACK_PEN);
|
||||||
AColor::Line(*dc, 0, r.y, width, r.y);
|
AColor::Line(*dc, 0, r.y, width, r.y);
|
||||||
|
@ -13,15 +13,16 @@
|
|||||||
|
|
||||||
*//*******************************************************************/
|
*//*******************************************************************/
|
||||||
|
|
||||||
|
#include "Audacity.h"
|
||||||
|
#include "TimeTrack.h"
|
||||||
|
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#include "Audacity.h"
|
|
||||||
#include "AColor.h"
|
#include "AColor.h"
|
||||||
#include "TimeTrack.h"
|
|
||||||
#include "widgets/Ruler.h"
|
#include "widgets/Ruler.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
#include "Internat.h"
|
#include "Internat.h"
|
||||||
#include "Resample.h"
|
#include "Resample.h"
|
||||||
|
#include "ViewInfo.h"
|
||||||
|
|
||||||
//TODO-MB: are these sensible values?
|
//TODO-MB: are these sensible values?
|
||||||
#define TIMETRACK_MIN 0.01
|
#define TIMETRACK_MIN 0.01
|
||||||
@ -223,19 +224,15 @@ void TimeTrack::WriteXML(XMLWriter &xmlFile)
|
|||||||
xmlFile.EndTag(wxT("timetrack"));
|
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 min = zoomInfo.PositionToTime(0);
|
||||||
double t0 = h;
|
double max = zoomInfo.PositionToTime(r.width);
|
||||||
double t1 = h + (r.width * tstep);
|
if (min > max)
|
||||||
|
{
|
||||||
//Make sure t1 (the right bound) is greater than 0
|
wxASSERT(false);
|
||||||
if (t1 < 0.0)
|
min = max;
|
||||||
t1 = 0.0;
|
}
|
||||||
|
|
||||||
//make sure t1 is greater than t0
|
|
||||||
if (t0 > t1)
|
|
||||||
t0 = t1;
|
|
||||||
|
|
||||||
dc.SetBrush(blankBrush);
|
dc.SetBrush(blankBrush);
|
||||||
dc.SetPen(blankPen);
|
dc.SetPen(blankPen);
|
||||||
@ -246,8 +243,6 @@ void TimeTrack::Draw(wxDC & dc, const wxRect & r, double h, double pps)
|
|||||||
|
|
||||||
// Draw the Ruler
|
// Draw the Ruler
|
||||||
mRuler->SetBounds(r.x, r.y, r.x + r.width - 1, r.y + r.height - 1);
|
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->SetRange(min, max);
|
||||||
mRuler->SetFlip(false); // If we don't do this, the Ruler doesn't redraw itself when the envelope is modified.
|
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!
|
// 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);
|
mRuler->Draw(dc, this);
|
||||||
|
|
||||||
double *envValues = new double[mid.width];
|
double *envValues = new double[mid.width];
|
||||||
GetEnvelope()->GetValues(envValues, mid.width, t0, tstep);
|
GetEnvelope()->GetValues(envValues, mid.width, 0, zoomInfo);
|
||||||
|
|
||||||
dc.SetPen(AColor::envelopePen);
|
dc.SetPen(AColor::envelopePen);
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ class wxRect;
|
|||||||
class wxDC;
|
class wxDC;
|
||||||
class Envelope;
|
class Envelope;
|
||||||
class Ruler;
|
class Ruler;
|
||||||
|
class ZoomInfo;
|
||||||
|
|
||||||
class TimeTrack: public Track {
|
class TimeTrack: public Track {
|
||||||
|
|
||||||
@ -49,7 +50,7 @@ class TimeTrack: public Track {
|
|||||||
virtual double GetStartTime() const { return 0.0; }
|
virtual double GetStartTime() const { return 0.0; }
|
||||||
virtual double GetEndTime() const { return 0.0; }
|
virtual double GetEndTime() const { return 0.0; }
|
||||||
|
|
||||||
void Draw(wxDC & dc, const wxRect & r, double h, double pps);
|
void Draw(wxDC & dc, const wxRect & r, const ZoomInfo &zoomInfo);
|
||||||
|
|
||||||
// XMLTagHandler callback methods for loading and saving
|
// XMLTagHandler callback methods for loading and saving
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ TrackPanel::DoDrawIndicator();
|
|||||||
AdornedRulerPanel::DrawIndicator(); [not part of TrackPanel graphics]
|
AdornedRulerPanel::DrawIndicator(); [not part of TrackPanel graphics]
|
||||||
draw indicator on each track
|
draw indicator on each track
|
||||||
TrackPanel::DoDrawCursor();
|
TrackPanel::DoDrawCursor();
|
||||||
draw cursor on each track [at mviewInfo->selectedRegion.t0()]
|
draw cursor on each track [at selectedRegion.t0()]
|
||||||
AdornedRulerPanel::DrawCursor(); [not part of TrackPanel graphics]
|
AdornedRulerPanel::DrawCursor(); [not part of TrackPanel graphics]
|
||||||
TrackPanel::DisplaySelection();
|
TrackPanel::DisplaySelection();
|
||||||
\endcode
|
\endcode
|
||||||
@ -270,7 +270,7 @@ TrackArtist::TrackArtist()
|
|||||||
UpdatePrefs();
|
UpdatePrefs();
|
||||||
|
|
||||||
SetColours();
|
SetColours();
|
||||||
vruler = new Ruler();
|
vruler = new Ruler;
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackArtist::~TrackArtist()
|
TrackArtist::~TrackArtist()
|
||||||
@ -318,7 +318,8 @@ void TrackArtist::DrawTracks(TrackList * tracks,
|
|||||||
wxRegion & reg,
|
wxRegion & reg,
|
||||||
wxRect & rect,
|
wxRect & rect,
|
||||||
wxRect & clip,
|
wxRect & clip,
|
||||||
ViewInfo * viewInfo,
|
const SelectedRegion &selectedRegion,
|
||||||
|
const ZoomInfo &zoomInfo,
|
||||||
bool drawEnvelope,
|
bool drawEnvelope,
|
||||||
bool bigPoints,
|
bool bigPoints,
|
||||||
bool drawSliders)
|
bool drawSliders)
|
||||||
@ -341,7 +342,7 @@ void TrackArtist::DrawTracks(TrackList * tracks,
|
|||||||
// Change the +0 to +1 or +2 to see the bounding box
|
// Change the +0 to +1 or +2 to see the bounding box
|
||||||
mInsetLeft = 1+0; mInsetTop = 5+0; mInsetRight = 6+0; mInsetBottom = 2+0;
|
mInsetLeft = 1+0; mInsetTop = 5+0; mInsetRight = 6+0; mInsetBottom = 2+0;
|
||||||
|
|
||||||
// This just show what the passed in rectanges enclose
|
// This just shows what the passed in rectangles enclose
|
||||||
dc.SetPen(wxColour(*wxGREEN));
|
dc.SetPen(wxColour(*wxGREEN));
|
||||||
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||||
dc.DrawRectangle(rect);
|
dc.DrawRectangle(rect);
|
||||||
@ -354,7 +355,7 @@ void TrackArtist::DrawTracks(TrackList * tracks,
|
|||||||
|
|
||||||
t = iter.StartWith(start);
|
t = iter.StartWith(start);
|
||||||
while (t) {
|
while (t) {
|
||||||
trackRect.y = t->GetY() - viewInfo->vpos;
|
trackRect.y = t->GetY() - zoomInfo.vpos;
|
||||||
trackRect.height = t->GetHeight();
|
trackRect.height = t->GetHeight();
|
||||||
|
|
||||||
if (trackRect.y > clip.GetBottom() && !t->GetLinked()) {
|
if (trackRect.y > clip.GetBottom() && !t->GetLinked()) {
|
||||||
@ -405,13 +406,14 @@ void TrackArtist::DrawTracks(TrackList * tracks,
|
|||||||
rr.y += mInsetTop;
|
rr.y += mInsetTop;
|
||||||
rr.width -= (mInsetLeft + mInsetRight);
|
rr.width -= (mInsetLeft + mInsetRight);
|
||||||
rr.height -= (mInsetTop + mInsetBottom);
|
rr.height -= (mInsetTop + mInsetBottom);
|
||||||
DrawTrack(t, dc, rr, viewInfo,
|
DrawTrack(t, dc, rr,
|
||||||
|
selectedRegion, zoomInfo,
|
||||||
drawEnvelope, bigPoints, drawSliders, hasSolo);
|
drawEnvelope, bigPoints, drawSliders, hasSolo);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
||||||
if(MONO_WAVE_PAN(t)){
|
if(MONO_WAVE_PAN(t)){
|
||||||
trackRect.y = t->GetY(true) - viewInfo->vpos;
|
trackRect.y = t->GetY(true) - zoomInfo.vpos;
|
||||||
trackRect.height = t->GetHeight(true);
|
trackRect.height = t->GetHeight(true);
|
||||||
stereoTrackRect = trackRect;
|
stereoTrackRect = trackRect;
|
||||||
stereoTrackRect.y -= t->GetHeight();
|
stereoTrackRect.y -= t->GetHeight();
|
||||||
@ -423,7 +425,7 @@ void TrackArtist::DrawTracks(TrackList * tracks,
|
|||||||
rr.y += mInsetTop;
|
rr.y += mInsetTop;
|
||||||
rr.width -= (mInsetLeft + mInsetRight);
|
rr.width -= (mInsetLeft + mInsetRight);
|
||||||
rr.height -= (mInsetTop + mInsetBottom);
|
rr.height -= (mInsetTop + mInsetBottom);
|
||||||
DrawTrack(t, dc, rr, viewInfo,
|
DrawTrack(t, dc, rr, zoomInfo,
|
||||||
drawEnvelope, bigPoints, drawSliders, hasSolo);
|
drawEnvelope, bigPoints, drawSliders, hasSolo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -436,7 +438,8 @@ void TrackArtist::DrawTracks(TrackList * tracks,
|
|||||||
void TrackArtist::DrawTrack(const Track * t,
|
void TrackArtist::DrawTrack(const Track * t,
|
||||||
wxDC & dc,
|
wxDC & dc,
|
||||||
const wxRect & rect,
|
const wxRect & rect,
|
||||||
const ViewInfo * viewInfo,
|
const SelectedRegion &selectedRegion,
|
||||||
|
const ZoomInfo &zoomInfo,
|
||||||
bool drawEnvelope,
|
bool drawEnvelope,
|
||||||
bool bigPoints,
|
bool bigPoints,
|
||||||
bool drawSliders,
|
bool drawSliders,
|
||||||
@ -454,11 +457,11 @@ void TrackArtist::DrawTrack(const Track * t,
|
|||||||
|
|
||||||
switch (wt->GetDisplay()) {
|
switch (wt->GetDisplay()) {
|
||||||
case WaveTrack::WaveformDisplay:
|
case WaveTrack::WaveformDisplay:
|
||||||
DrawWaveform(wt, dc, rect, viewInfo,
|
DrawWaveform(wt, dc, rect, selectedRegion, zoomInfo,
|
||||||
drawEnvelope, bigPoints, drawSliders, false, muted);
|
drawEnvelope, bigPoints, drawSliders, false, muted);
|
||||||
break;
|
break;
|
||||||
case WaveTrack::WaveformDBDisplay:
|
case WaveTrack::WaveformDBDisplay:
|
||||||
DrawWaveform(wt, dc, rect, viewInfo,
|
DrawWaveform(wt, dc, rect, selectedRegion, zoomInfo,
|
||||||
drawEnvelope, bigPoints, drawSliders, true, muted);
|
drawEnvelope, bigPoints, drawSliders, true, muted);
|
||||||
break;
|
break;
|
||||||
case WaveTrack::SpectrumDisplay:
|
case WaveTrack::SpectrumDisplay:
|
||||||
@ -466,7 +469,7 @@ void TrackArtist::DrawTrack(const Track * t,
|
|||||||
case WaveTrack::SpectralSelectionDisplay:
|
case WaveTrack::SpectralSelectionDisplay:
|
||||||
case WaveTrack::SpectralSelectionLogDisplay:
|
case WaveTrack::SpectralSelectionLogDisplay:
|
||||||
case WaveTrack::PitchDisplay:
|
case WaveTrack::PitchDisplay:
|
||||||
DrawSpectrum(wt, dc, rect, viewInfo);
|
DrawSpectrum(wt, dc, rect, selectedRegion, zoomInfo);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (mbShowTrackNameInWaveform &&
|
if (mbShowTrackNameInWaveform &&
|
||||||
@ -483,15 +486,15 @@ void TrackArtist::DrawTrack(const Track * t,
|
|||||||
case Track::Note:
|
case Track::Note:
|
||||||
{
|
{
|
||||||
bool muted = (hasSolo || t->GetMute()) && !t->GetSolo();
|
bool muted = (hasSolo || t->GetMute()) && !t->GetSolo();
|
||||||
DrawNoteTrack((NoteTrack *)t, dc, rect, viewInfo, muted);
|
DrawNoteTrack((NoteTrack *)t, dc, rect, selectedRegion, zoomInfo, muted);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif // USE_MIDI
|
#endif // USE_MIDI
|
||||||
case Track::Label:
|
case Track::Label:
|
||||||
DrawLabelTrack((LabelTrack *)t, dc, rect, viewInfo);
|
DrawLabelTrack((LabelTrack *)t, dc, rect, selectedRegion, zoomInfo);
|
||||||
break;
|
break;
|
||||||
case Track::Time:
|
case Track::Time:
|
||||||
DrawTimeTrack((TimeTrack *)t, dc, rect, viewInfo);
|
DrawTimeTrack((TimeTrack *)t, dc, rect, zoomInfo);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -986,12 +989,15 @@ void TrackArtist::DrawNegativeOffsetTrackArrows(wxDC &dc, const wxRect &rect)
|
|||||||
rect.x + 6, rect.y + rect.height - 12);
|
rect.x + 6, rect.y + rect.height - 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackArtist::DrawWaveformBackground(wxDC &dc, const wxRect &rect, const double env[],
|
void TrackArtist::DrawWaveformBackground(wxDC &dc, int leftOffset, const wxRect &rect,
|
||||||
|
const double env[],
|
||||||
float zoomMin, float zoomMax, bool dB,
|
float zoomMin, float zoomMax, bool dB,
|
||||||
const ViewInfo &viewInfo, double t0, double rate,
|
const SelectedRegion &selectedRegion,
|
||||||
sampleCount ssel0, sampleCount ssel1,
|
const ZoomInfo &zoomInfo,
|
||||||
bool drawEnvelope, bool bIsSyncLockSelected)
|
bool drawEnvelope, bool bIsSyncLockSelected)
|
||||||
{
|
{
|
||||||
|
const double t0 = selectedRegion.t0(), t1 = selectedRegion.t1();
|
||||||
|
|
||||||
// Visually (one vertical slice of the waveform background, on its side;
|
// Visually (one vertical slice of the waveform background, on its side;
|
||||||
// the "*" is the actual waveform background we're drawing
|
// the "*" is the actual waveform background we're drawing
|
||||||
//
|
//
|
||||||
@ -1015,10 +1021,9 @@ void TrackArtist::DrawWaveformBackground(wxDC &dc, const wxRect &rect, const dou
|
|||||||
dc.SetBrush(blankBrush);
|
dc.SetBrush(blankBrush);
|
||||||
dc.DrawRectangle(rect);
|
dc.DrawRectangle(rect);
|
||||||
|
|
||||||
const double samplesPerPixel = rate / viewInfo.zoom;
|
double time = zoomInfo.PositionToTime(0, -leftOffset), nextTime;
|
||||||
double where = t0 * rate;
|
for (xx = 0; xx < rect.width; ++xx, time = nextTime) {
|
||||||
for (xx = 0; xx < rect.width; ++xx, where += samplesPerPixel) {
|
nextTime = zoomInfo.PositionToTime(xx + 1, -leftOffset);
|
||||||
|
|
||||||
// First we compute the truncated shape of the waveform background.
|
// First we compute the truncated shape of the waveform background.
|
||||||
// If drawEnvelope is true, then we compute the lower border of the
|
// If drawEnvelope is true, then we compute the lower border of the
|
||||||
// envelope.
|
// envelope.
|
||||||
@ -1043,7 +1048,7 @@ void TrackArtist::DrawWaveformBackground(wxDC &dc, const wxRect &rect, const dou
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We don't draw selection color for sync-lock selected tracks.
|
// We don't draw selection color for sync-lock selected tracks.
|
||||||
sel = (ssel0 <= where && where + samplesPerPixel < ssel1) && !bIsSyncLockSelected;
|
sel = (t0 <= time && nextTime < t1) && !bIsSyncLockSelected;
|
||||||
|
|
||||||
if (lmaxtop == maxtop &&
|
if (lmaxtop == maxtop &&
|
||||||
lmintop == mintop &&
|
lmintop == mintop &&
|
||||||
@ -1085,14 +1090,9 @@ void TrackArtist::DrawWaveformBackground(wxDC &dc, const wxRect &rect, const dou
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If sync-lock selected, draw in linked graphics.
|
// If sync-lock selected, draw in linked graphics.
|
||||||
if (bIsSyncLockSelected && ssel0 < ssel1) {
|
if (bIsSyncLockSelected && t0 < t1) {
|
||||||
// Find the beginning/end of the selection
|
const int begin = std::max(0, std::min(rect.width, int(zoomInfo.TimeToPosition(t0, -leftOffset))));
|
||||||
int begin, end;
|
const int end = std::max(0, std::min(rect.width, int(zoomInfo.TimeToPosition(t1, -leftOffset))));
|
||||||
double where = t0 * rate;
|
|
||||||
for (xx = 0; xx < rect.width && where < ssel0; ++xx, where += samplesPerPixel);
|
|
||||||
begin = xx;
|
|
||||||
for (; xx < rect.width && where < ssel1; ++xx, where += samplesPerPixel);
|
|
||||||
end = xx;
|
|
||||||
DrawSyncLockTiles(&dc, wxRect(rect.x + begin, rect.y, end - 1 - begin, rect.height));
|
DrawSyncLockTiles(&dc, wxRect(rect.x + begin, rect.y, end - 1 - begin, rect.height));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1107,19 +1107,15 @@ void TrackArtist::DrawWaveformBackground(wxDC &dc, const wxRect &rect, const dou
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TrackArtist::DrawMinMaxRMS(wxDC &dc, const wxRect &rect, const double env[],
|
void TrackArtist::DrawMinMaxRMS(wxDC &dc, const wxRect & rect, const double env[],
|
||||||
float zoomMin, float zoomMax, bool dB,
|
float zoomMin, float zoomMax, bool dB,
|
||||||
const WaveDisplay &display, bool /* showProgress */, bool muted
|
const float *min, const float *max, const float *rms, const int *bl,
|
||||||
|
bool /* showProgress */, bool muted
|
||||||
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
||||||
, const float gain
|
, const float gain
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const float *const min = display.min;
|
|
||||||
const float *const max = display.max;
|
|
||||||
const float *const rms = display.rms;
|
|
||||||
const int *const bl = display.bl;
|
|
||||||
|
|
||||||
// Display a line representing the
|
// Display a line representing the
|
||||||
// min and max of the samples in this region
|
// min and max of the samples in this region
|
||||||
int lasth1 = std::numeric_limits<int>::max();
|
int lasth1 = std::numeric_limits<int>::max();
|
||||||
@ -1132,7 +1128,7 @@ void TrackArtist::DrawMinMaxRMS(wxDC &dc, const wxRect &rect, const double env[]
|
|||||||
int clipcnt = 0;
|
int clipcnt = 0;
|
||||||
|
|
||||||
if (mShowClipping) {
|
if (mShowClipping) {
|
||||||
clipped = new int[rect.width];
|
clipped = new int[rect.width];
|
||||||
}
|
}
|
||||||
|
|
||||||
long pixAnimOffset = (long)fabs((double)(wxDateTime::Now().GetTicks() * -10)) +
|
long pixAnimOffset = (long)fabs((double)(wxDateTime::Now().GetTicks() * -10)) +
|
||||||
@ -1272,26 +1268,25 @@ void TrackArtist::DrawMinMaxRMS(wxDC &dc, const wxRect &rect, const double env[]
|
|||||||
delete [] r2;
|
delete [] r2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackArtist::DrawIndividualSamples(wxDC &dc, const wxRect &rect,
|
void TrackArtist::DrawIndividualSamples(wxDC &dc, int leftOffset, const wxRect &rect,
|
||||||
float zoomMin, float zoomMax, bool dB,
|
float zoomMin, float zoomMax, bool dB,
|
||||||
WaveClip *clip,
|
WaveClip *clip,
|
||||||
double t0, double pps, double WXUNUSED(h),
|
const ZoomInfo &zoomInfo,
|
||||||
bool bigPoints, bool showPoints, bool muted)
|
bool bigPoints, bool showPoints, bool muted)
|
||||||
{
|
{
|
||||||
|
const double toffset = clip->GetOffset();
|
||||||
double rate = clip->GetRate();
|
double rate = clip->GetRate();
|
||||||
sampleCount s0 = (sampleCount) (t0 * rate + 0.5);
|
const double t0 = std::max(0.0, zoomInfo.PositionToTime(0, -leftOffset) - toffset);
|
||||||
sampleCount slen = (sampleCount) (rect.width * rate / pps + 0.5);
|
const sampleCount s0 = sampleCount(floor(t0 * rate));
|
||||||
sampleCount snSamples = clip->GetNumSamples();
|
const sampleCount snSamples = clip->GetNumSamples();
|
||||||
|
if (s0 > snSamples)
|
||||||
slen += 4;
|
|
||||||
|
|
||||||
if (s0 > snSamples) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (s0 + slen > snSamples) {
|
const double t1 = zoomInfo.PositionToTime(rect.width - 1, -leftOffset) - toffset;
|
||||||
slen = snSamples - s0;
|
const sampleCount s1 = sampleCount(ceil(t1 * rate));
|
||||||
}
|
const sampleCount slen = std::min(snSamples - s0, s1 - s0 + 1);
|
||||||
|
if (slen <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
float *buffer = new float[slen];
|
float *buffer = new float[slen];
|
||||||
clip->GetSamples((samplePtr)buffer, floatSample, s0, slen);
|
clip->GetSamples((samplePtr)buffer, floatSample, s0, slen);
|
||||||
@ -1302,40 +1297,27 @@ void TrackArtist::DrawIndividualSamples(wxDC &dc, const wxRect &rect,
|
|||||||
int clipcnt = 0;
|
int clipcnt = 0;
|
||||||
sampleCount s;
|
sampleCount s;
|
||||||
|
|
||||||
if (mShowClipping) {
|
if (mShowClipping)
|
||||||
clipped = new int[slen];
|
clipped = new int[slen];
|
||||||
}
|
|
||||||
|
|
||||||
dc.SetPen(muted ? muteSamplePen : samplePen);
|
dc.SetPen(muted ? muteSamplePen : samplePen);
|
||||||
|
|
||||||
for (s = 0; s < slen; s++) {
|
for (s = 0; s < slen; s++) {
|
||||||
double tt = (s / rate);
|
const double time = toffset + (s + s0) / rate;
|
||||||
|
const int xx = // An offset into the rectangle rect
|
||||||
// MB: (s0/rate - t0) is the distance from the left edge of the screen
|
std::max(-10000, std::min(10000,
|
||||||
// to the first sample.
|
int(zoomInfo.TimeToPosition(time, -leftOffset))));
|
||||||
int xx = (int)rint((tt + s0 / rate - t0) * pps);
|
|
||||||
|
|
||||||
if (xx < -10000) {
|
|
||||||
xx = -10000;
|
|
||||||
}
|
|
||||||
if (xx > 10000) {
|
|
||||||
xx = 10000;
|
|
||||||
}
|
|
||||||
|
|
||||||
xpos[s] = xx;
|
xpos[s] = xx;
|
||||||
|
|
||||||
// t0 + clip->GetOffset() is 'h' (the absolute time of the left edge) for 'rect'.
|
const double tt = buffer[s] * clip->GetEnvelope()->GetValue(time);
|
||||||
tt = buffer[s] * clip->GetEnvelope()->GetValueAtX(xx + rect.x, rect, t0 + clip->GetOffset(), pps);
|
|
||||||
if (clipped && mShowClipping && ((tt <= -MAX_AUDIO) || (tt >= MAX_AUDIO)))
|
if (clipped && mShowClipping && ((tt <= -MAX_AUDIO) || (tt >= MAX_AUDIO)))
|
||||||
clipped[clipcnt++] = xx;
|
clipped[clipcnt++] = xx;
|
||||||
ypos[s] = GetWaveYPos(tt, zoomMin, zoomMax,
|
ypos[s] =
|
||||||
rect.height, dB, true, mdBrange, false);
|
std::max(-1,
|
||||||
if (ypos[s] < -1) {
|
std::min(rect.height,
|
||||||
ypos[s] = -1;
|
GetWaveYPos(tt, zoomMin, zoomMax,
|
||||||
}
|
rect.height, dB, true, mdBrange, false)));
|
||||||
if (ypos[s] > rect.height) {
|
|
||||||
ypos[s] = rect.height;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw lines
|
// Draw lines
|
||||||
@ -1345,9 +1327,10 @@ void TrackArtist::DrawIndividualSamples(wxDC &dc, const wxRect &rect,
|
|||||||
rect.x + xpos[s + 1], rect.y + ypos[s + 1]);
|
rect.x + xpos[s + 1], rect.y + ypos[s + 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showPoints) {
|
if (showPoints)
|
||||||
// Draw points
|
{
|
||||||
int tickSize= bigPoints ? 4 : 3;// Bigger ellipses when draggable.
|
// Draw points where spacing is enough
|
||||||
|
const int tickSize = bigPoints ? 4 : 3;// Bigger ellipses when draggable.
|
||||||
wxRect pr;
|
wxRect pr;
|
||||||
pr.width = tickSize;
|
pr.width = tickSize;
|
||||||
pr.height = tickSize;
|
pr.height = tickSize;
|
||||||
@ -1440,7 +1423,8 @@ void TrackArtist::DrawEnvLine(wxDC &dc, const wxRect &rect, int x0, int y0, int
|
|||||||
void TrackArtist::DrawWaveform(WaveTrack *track,
|
void TrackArtist::DrawWaveform(WaveTrack *track,
|
||||||
wxDC & dc,
|
wxDC & dc,
|
||||||
const wxRect & rect,
|
const wxRect & rect,
|
||||||
const ViewInfo *viewInfo,
|
const SelectedRegion &selectedRegion,
|
||||||
|
const ZoomInfo &zoomInfo,
|
||||||
bool drawEnvelope,
|
bool drawEnvelope,
|
||||||
bool bigPoints,
|
bool bigPoints,
|
||||||
bool drawSliders,
|
bool drawSliders,
|
||||||
@ -1448,11 +1432,10 @@ void TrackArtist::DrawWaveform(WaveTrack *track,
|
|||||||
bool muted)
|
bool muted)
|
||||||
{
|
{
|
||||||
DrawBackgroundWithSelection(&dc, rect, track, blankSelectedBrush, blankBrush,
|
DrawBackgroundWithSelection(&dc, rect, track, blankSelectedBrush, blankBrush,
|
||||||
viewInfo->selectedRegion.t0(), viewInfo->selectedRegion.t1(),
|
selectedRegion, zoomInfo);
|
||||||
viewInfo->h, viewInfo->zoom);
|
|
||||||
|
|
||||||
for (WaveClipList::compatibility_iterator it = track->GetClipIterator(); it; it = it->GetNext())
|
for (WaveClipList::compatibility_iterator it = track->GetClipIterator(); it; it = it->GetNext())
|
||||||
DrawClipWaveform(track, it->GetData(), dc, rect, viewInfo,
|
DrawClipWaveform(track, it->GetData(), dc, rect, selectedRegion, zoomInfo,
|
||||||
drawEnvelope, bigPoints,
|
drawEnvelope, bigPoints,
|
||||||
dB, muted);
|
dB, muted);
|
||||||
|
|
||||||
@ -1461,7 +1444,7 @@ void TrackArtist::DrawWaveform(WaveTrack *track,
|
|||||||
|
|
||||||
for (int i = 0; i<track->GetNumCachedLocations(); i++) {
|
for (int i = 0; i<track->GetNumCachedLocations(); i++) {
|
||||||
WaveTrack::Location loc = track->GetCachedLocation(i);
|
WaveTrack::Location loc = track->GetCachedLocation(i);
|
||||||
double xx = (loc.pos - viewInfo->h) * viewInfo->zoom;
|
const int xx = zoomInfo.TimeToPosition(loc.pos);
|
||||||
if (xx >= 0 && xx < rect.width) {
|
if (xx >= 0 && xx < rect.width) {
|
||||||
dc.SetPen(*wxGREY_PEN);
|
dc.SetPen(*wxGREY_PEN);
|
||||||
AColor::Line(dc, (int) (rect.x + xx - 1), rect.y, (int) (rect.x + xx - 1), rect.y + rect.height);
|
AColor::Line(dc, (int) (rect.x + xx - 1), rect.y, (int) (rect.x + xx - 1), rect.y + rect.height);
|
||||||
@ -1490,18 +1473,18 @@ struct ClipParameters
|
|||||||
// Do a bunch of calculations common to waveform and spectrum drawing.
|
// Do a bunch of calculations common to waveform and spectrum drawing.
|
||||||
ClipParameters
|
ClipParameters
|
||||||
(bool spectrum, const WaveTrack *track, const WaveClip *clip, const wxRect &rect,
|
(bool spectrum, const WaveTrack *track, const WaveClip *clip, const wxRect &rect,
|
||||||
const SelectedRegion &selectedRegion, const ViewInfo &viewInfo)
|
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo)
|
||||||
{
|
{
|
||||||
selectedRegion;
|
selectedRegion;
|
||||||
|
|
||||||
tOffset = clip->GetOffset();
|
tOffset = clip->GetOffset();
|
||||||
rate = clip->GetRate();
|
rate = clip->GetRate();
|
||||||
|
|
||||||
h = viewInfo.h; //The horizontal position in seconds
|
h = zoomInfo.h; //The horizontal position in seconds
|
||||||
pps = viewInfo.zoom; //points-per-second--the zoom level
|
pps = zoomInfo.zoom; //points-per-second--the zoom level
|
||||||
|
|
||||||
double sel0 = viewInfo.selectedRegion.t0(); //left selection bound
|
double sel0 = selectedRegion.t0(); //left selection bound
|
||||||
double sel1 = viewInfo.selectedRegion.t1(); //right selection bound
|
double sel1 = selectedRegion.t1(); //right selection bound
|
||||||
|
|
||||||
//If the track isn't selected, make the selection empty
|
//If the track isn't selected, make the selection empty
|
||||||
if (!track->GetSelected() &&
|
if (!track->GetSelected() &&
|
||||||
@ -1624,7 +1607,8 @@ void TrackArtist::DrawClipWaveform(WaveTrack *track,
|
|||||||
WaveClip *clip,
|
WaveClip *clip,
|
||||||
wxDC & dc,
|
wxDC & dc,
|
||||||
const wxRect & rect,
|
const wxRect & rect,
|
||||||
const ViewInfo *viewInfo,
|
const SelectedRegion &selectedRegion,
|
||||||
|
const ZoomInfo &zoomInfo,
|
||||||
bool drawEnvelope,
|
bool drawEnvelope,
|
||||||
bool bigPoints,
|
bool bigPoints,
|
||||||
bool dB,
|
bool dB,
|
||||||
@ -1634,7 +1618,7 @@ void TrackArtist::DrawClipWaveform(WaveTrack *track,
|
|||||||
Profiler profiler;
|
Profiler profiler;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const ClipParameters params(false, track, clip, rect, viewInfo->selectedRegion, *viewInfo);
|
const ClipParameters params(false, track, clip, rect, selectedRegion, zoomInfo);
|
||||||
const wxRect &mid = params.mid;
|
const wxRect &mid = params.mid;
|
||||||
// The "mid" rect contains the part of the display actually
|
// The "mid" rect contains the part of the display actually
|
||||||
// containing the waveform. If it's empty, we're done.
|
// containing the waveform. If it's empty, we're done.
|
||||||
@ -1646,15 +1630,12 @@ void TrackArtist::DrawClipWaveform(WaveTrack *track,
|
|||||||
const double &pps = params.pps;
|
const double &pps = params.pps;
|
||||||
const double &tOffset = params.tOffset;
|
const double &tOffset = params.tOffset;
|
||||||
const double &tstep = params.tstep;
|
const double &tstep = params.tstep;
|
||||||
const double &ssel0 = params.ssel0;
|
|
||||||
const double &ssel1 = params.ssel1;
|
|
||||||
const bool &showIndividualSamples = params.showIndividualSamples;
|
const bool &showIndividualSamples = params.showIndividualSamples;
|
||||||
const bool &showPoints = params.showPoints;
|
const bool &showPoints = params.showPoints;
|
||||||
const double &h = params.h;
|
const double &h = params.h;
|
||||||
const double &tpre = params.tpre;
|
const double &tpre = params.tpre;
|
||||||
const double &tpost = params.tpost;
|
const double &tpost = params.tpost;
|
||||||
const double &t1 = params.t1;
|
const double &t1 = params.t1;
|
||||||
const double &rate = params.rate;
|
|
||||||
|
|
||||||
// Calculate sample-based offset-corrected selection
|
// Calculate sample-based offset-corrected selection
|
||||||
|
|
||||||
@ -1679,10 +1660,11 @@ void TrackArtist::DrawClipWaveform(WaveTrack *track,
|
|||||||
// Draw the background of the track, outlining the shape of
|
// Draw the background of the track, outlining the shape of
|
||||||
// the envelope and using a colored pen for the selected
|
// the envelope and using a colored pen for the selected
|
||||||
// part of the waveform
|
// part of the waveform
|
||||||
DrawWaveformBackground(dc, mid, envValues, zoomMin, zoomMax, dB,
|
DrawWaveformBackground(dc, mid.x - rect.x, mid,
|
||||||
*viewInfo, t0, rate,
|
envValues,
|
||||||
ssel0, ssel1, drawEnvelope,
|
zoomMin, zoomMax, dB,
|
||||||
!track->GetSelected());
|
selectedRegion, zoomInfo, drawEnvelope,
|
||||||
|
!track->GetSelected());
|
||||||
|
|
||||||
if (!showIndividualSamples) {
|
if (!showIndividualSamples) {
|
||||||
WaveDisplay display(mid.width);
|
WaveDisplay display(mid.width);
|
||||||
@ -1697,23 +1679,24 @@ void TrackArtist::DrawClipWaveform(WaveTrack *track,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DrawMinMaxRMS(dc, mid, envValues,
|
||||||
|
zoomMin, zoomMax, dB,
|
||||||
|
display.min, display.max, display.rms, display.bl,
|
||||||
|
isLoadingOD, muted
|
||||||
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
||||||
DrawMinMaxRMS(dc, mid, envValues, zoomMin, zoomMax, dB,
|
, track->GetChannelGain(track->GetChannel())
|
||||||
min, max, rms, bl, isLoadingOD, muted, track->GetChannelGain(track->GetChannel()));
|
|
||||||
#else
|
|
||||||
DrawMinMaxRMS(dc, mid, envValues, zoomMin, zoomMax, dB,
|
|
||||||
display, isLoadingOD, muted);
|
|
||||||
#endif
|
#endif
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DrawIndividualSamples(dc, mid, zoomMin, zoomMax, dB,
|
DrawIndividualSamples(dc, mid.x - rect.x, mid,
|
||||||
clip, t0, pps, h,
|
zoomMin, zoomMax, dB,
|
||||||
bigPoints, showPoints, muted);
|
clip, zoomInfo, bigPoints, showPoints, muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawEnvelope) {
|
if (drawEnvelope) {
|
||||||
DrawEnvelope(dc, mid, envValues, zoomMin, zoomMax, dB);
|
DrawEnvelope(dc, mid, envValues, zoomMin, zoomMax, dB);
|
||||||
clip->GetEnvelope()->DrawPoints(dc, rect, h, pps, dB, zoomMin, zoomMax);
|
clip->GetEnvelope()->DrawPoints(dc, rect, zoomInfo, dB, zoomMin, zoomMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] envValues;
|
delete[] envValues;
|
||||||
@ -1799,15 +1782,15 @@ void TrackArtist::DrawTimeSlider(wxDC & dc,
|
|||||||
void TrackArtist::DrawSpectrum(WaveTrack *track,
|
void TrackArtist::DrawSpectrum(WaveTrack *track,
|
||||||
wxDC & dc,
|
wxDC & dc,
|
||||||
const wxRect & rect,
|
const wxRect & rect,
|
||||||
const ViewInfo *viewInfo)
|
const SelectedRegion &selectedRegion,
|
||||||
|
const ZoomInfo &zoomInfo)
|
||||||
{
|
{
|
||||||
DrawBackgroundWithSelection(&dc, rect, track, blankSelectedBrush, blankBrush,
|
DrawBackgroundWithSelection(&dc, rect, track, blankSelectedBrush, blankBrush,
|
||||||
viewInfo->selectedRegion.t0(), viewInfo->selectedRegion.t1(),
|
selectedRegion, zoomInfo);
|
||||||
viewInfo->h, viewInfo->zoom);
|
|
||||||
|
|
||||||
WaveTrackCache cache(track);
|
WaveTrackCache cache(track);
|
||||||
for (WaveClipList::compatibility_iterator it = track->GetClipIterator(); it; it = it->GetNext()) {
|
for (WaveClipList::compatibility_iterator it = track->GetClipIterator(); it; it = it->GetNext()) {
|
||||||
DrawClipSpectrum(cache, it->GetData(), dc, rect, viewInfo);
|
DrawClipSpectrum(cache, it->GetData(), dc, rect, selectedRegion, zoomInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1878,26 +1861,25 @@ AColor::ColorGradientChoice ChooseColorSet( float bin0, float bin1, float selBin
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TrackArtist::DrawClipSpectrum(WaveTrackCache &cache,
|
void TrackArtist::DrawClipSpectrum(WaveTrackCache &waveTrackCache,
|
||||||
WaveClip *clip,
|
WaveClip *clip,
|
||||||
wxDC & dc,
|
wxDC & dc,
|
||||||
const wxRect & rect,
|
const wxRect & rect,
|
||||||
const ViewInfo *viewInfo)
|
const SelectedRegion &selectedRegion,
|
||||||
|
const ZoomInfo &zoomInfo)
|
||||||
{
|
{
|
||||||
#ifdef PROFILE_WAVEFORM
|
#ifdef PROFILE_WAVEFORM
|
||||||
Profiler profiler;
|
Profiler profiler;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const WaveTrack *const track = cache.GetTrack();
|
const WaveTrack *const track = waveTrackCache.GetTrack();
|
||||||
const int display = track->GetDisplay();
|
const int display = track->GetDisplay();
|
||||||
const bool autocorrelation = (WaveTrack::PitchDisplay == display);
|
const bool autocorrelation = (WaveTrack::PitchDisplay == display);
|
||||||
const bool logF = (WaveTrack::SpectrumLogDisplay == display
|
const bool logF = (WaveTrack::SpectrumLogDisplay == display
|
||||||
|| WaveTrack::SpectralSelectionLogDisplay == display);
|
|| WaveTrack::SpectralSelectionLogDisplay == display);
|
||||||
|
|
||||||
enum { MONOCHROME_LINE = 230, COLORED_LINE = 0 };
|
|
||||||
enum { DASH_LENGTH = 10 /* pixels */ };
|
enum { DASH_LENGTH = 10 /* pixels */ };
|
||||||
|
|
||||||
const ClipParameters params(true, track, clip, rect, viewInfo->selectedRegion, *viewInfo);
|
const ClipParameters params(true, track, clip, rect, selectedRegion, zoomInfo);
|
||||||
const wxRect &mid = params.mid;
|
const wxRect &mid = params.mid;
|
||||||
// The "mid" rect contains the part of the display actually
|
// The "mid" rect contains the part of the display actually
|
||||||
// containing the waveform. If it's empty, we're done.
|
// containing the waveform. If it's empty, we're done.
|
||||||
@ -1916,8 +1898,8 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &cache,
|
|||||||
double freqHi = SelectedRegion::UndefinedFrequency;
|
double freqHi = SelectedRegion::UndefinedFrequency;
|
||||||
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
||||||
if (!autocorrelation) {
|
if (!autocorrelation) {
|
||||||
freqLo = viewInfo->selectedRegion.f0();
|
freqLo = selectedRegion.f0();
|
||||||
freqHi = viewInfo->selectedRegion.f1();
|
freqHi = selectedRegion.f1();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1950,7 +1932,7 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &cache,
|
|||||||
const float *freq = 0;
|
const float *freq = 0;
|
||||||
const sampleCount *where = 0;
|
const sampleCount *where = 0;
|
||||||
|
|
||||||
bool updated = clip->GetSpectrogram(cache, freq, where, mid.width,
|
bool updated = clip->GetSpectrogram(waveTrackCache, freq, where, mid.width,
|
||||||
t0, pps, autocorrelation);
|
t0, pps, autocorrelation);
|
||||||
|
|
||||||
int ifreq = lrint(rate/2);
|
int ifreq = lrint(rate/2);
|
||||||
@ -2023,9 +2005,11 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &cache,
|
|||||||
&& findNotesQuantize==findNotesQuantizeOld
|
&& findNotesQuantize==findNotesQuantizeOld
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
// cache is up to date
|
// Wave clip's spectrum cache is up to date,
|
||||||
|
// and so is the spectrum pixel cache
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// Update the spectrum pixel cache
|
||||||
delete clip->mSpecPxCache;
|
delete clip->mSpecPxCache;
|
||||||
clip->mSpecPxCache = new SpecPxCache(mid.width * mid.height);
|
clip->mSpecPxCache = new SpecPxCache(mid.width * mid.height);
|
||||||
clip->mSpecPxCache->valid = true;
|
clip->mSpecPxCache->valid = true;
|
||||||
@ -2471,8 +2455,8 @@ const char *LookupAtomAttribute(Alg_note_ptr note, Alg_attribute attr, char *def
|
|||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TIME_TO_X(t) (rect.x + (int) (((t) - h) * pps))
|
#define TIME_TO_X(t) (zoomInfo.TimeToPosition((t), rect.x))
|
||||||
#define X_TO_TIME(xx) (((xx) - rect.x) / pps + h)
|
#define X_TO_TIME(xx) (zoomInfo.PositionToTime((xx), rect.x))
|
||||||
|
|
||||||
// CLIP(x) changes x to lie between +/- CLIP_MAX due to graphics display problems
|
// CLIP(x) changes x to lie between +/- CLIP_MAX due to graphics display problems
|
||||||
// with very large coordinate values (this happens when you zoom in very far)
|
// with very large coordinate values (this happens when you zoom in very far)
|
||||||
@ -2512,7 +2496,7 @@ int PitchToY(double p, int bottom)
|
|||||||
*/
|
*/
|
||||||
void TrackArtist::DrawNoteBackground(NoteTrack *track, wxDC &dc,
|
void TrackArtist::DrawNoteBackground(NoteTrack *track, wxDC &dc,
|
||||||
const wxRect &rect, const wxRect &sel,
|
const wxRect &rect, const wxRect &sel,
|
||||||
const ViewInfo *viewInfo,
|
const ZoomInfo &zoomInfo,
|
||||||
const wxBrush &wb, const wxPen &wp,
|
const wxBrush &wb, const wxPen &wp,
|
||||||
const wxBrush &bb, const wxPen &bp,
|
const wxBrush &bb, const wxPen &bp,
|
||||||
const wxPen &mp)
|
const wxPen &mp)
|
||||||
@ -2520,8 +2504,6 @@ void TrackArtist::DrawNoteBackground(NoteTrack *track, wxDC &dc,
|
|||||||
dc.SetBrush(wb);
|
dc.SetBrush(wb);
|
||||||
dc.SetPen(wp);
|
dc.SetPen(wp);
|
||||||
dc.DrawRectangle(sel); // fill rectangle with white keys background
|
dc.DrawRectangle(sel); // fill rectangle with white keys background
|
||||||
double h = viewInfo->h;
|
|
||||||
double pps = viewInfo->zoom;
|
|
||||||
|
|
||||||
int left = TIME_TO_X(track->GetOffset());
|
int left = TIME_TO_X(track->GetOffset());
|
||||||
if (left < sel.x) left = sel.x; // clip on left
|
if (left < sel.x) left = sel.x; // clip on left
|
||||||
@ -2609,16 +2591,16 @@ window and draw out-of-bounds notes here instead.
|
|||||||
void TrackArtist::DrawNoteTrack(NoteTrack *track,
|
void TrackArtist::DrawNoteTrack(NoteTrack *track,
|
||||||
wxDC & dc,
|
wxDC & dc,
|
||||||
const wxRect & rect,
|
const wxRect & rect,
|
||||||
const ViewInfo *viewInfo,
|
const SelectedRegion &selectedRegion,
|
||||||
|
const ZoomInfo &zoomInfo,
|
||||||
bool muted)
|
bool muted)
|
||||||
{
|
{
|
||||||
SonifyBeginNoteBackground();
|
SonifyBeginNoteBackground();
|
||||||
double h = viewInfo->h;
|
double sel0 = selectedRegion.t0();
|
||||||
double pps = viewInfo->zoom;
|
double sel1 = selectedRegion.t1();
|
||||||
double sel0 = viewInfo->selectedRegion.t0();
|
|
||||||
double sel1 = viewInfo->selectedRegion.t1();
|
|
||||||
|
|
||||||
double h1 = X_TO_TIME(rect.x + rect.width);
|
const double h = X_TO_TIME(rect.x);
|
||||||
|
const double h1 = X_TO_TIME(rect.x + rect.width);
|
||||||
|
|
||||||
Alg_seq_ptr seq = track->mSeq;
|
Alg_seq_ptr seq = track->mSeq;
|
||||||
if (!seq) {
|
if (!seq) {
|
||||||
@ -2664,7 +2646,7 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track,
|
|||||||
wxPen barLinePen;
|
wxPen barLinePen;
|
||||||
barLinePen.SetColour(170, 170, 170);
|
barLinePen.SetColour(170, 170, 170);
|
||||||
|
|
||||||
DrawNoteBackground(track, dc, rect, rect, viewInfo, blankBrush, blankPen,
|
DrawNoteBackground(track, dc, rect, rect, zoomInfo, blankBrush, blankPen,
|
||||||
blackStripeBrush, blackStripePen, barLinePen);
|
blackStripeBrush, blackStripePen, barLinePen);
|
||||||
|
|
||||||
dc.SetClippingRegion(rect);
|
dc.SetClippingRegion(rect);
|
||||||
@ -2692,7 +2674,7 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track,
|
|||||||
wxPen selectedBarLinePen;
|
wxPen selectedBarLinePen;
|
||||||
selectedBarLinePen.SetColour(131, 131, 150);
|
selectedBarLinePen.SetColour(131, 131, 150);
|
||||||
|
|
||||||
DrawNoteBackground(track, dc, rect, selBG, viewInfo,
|
DrawNoteBackground(track, dc, rect, selBG, zoomInfo,
|
||||||
selectedWhiteKeyBrush, selectedWhiteKeyPen,
|
selectedWhiteKeyBrush, selectedWhiteKeyPen,
|
||||||
selectedBlackKeyBrush, selectedBlackKeyPen,
|
selectedBlackKeyBrush, selectedBlackKeyPen,
|
||||||
selectedBarLinePen);
|
selectedBarLinePen);
|
||||||
@ -2747,8 +2729,8 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track,
|
|||||||
nr.y = track->PitchToY(note->pitch);
|
nr.y = track->PitchToY(note->pitch);
|
||||||
nr.height = track->GetPitchHeight();
|
nr.height = track->GetPitchHeight();
|
||||||
|
|
||||||
nr.x = rect.x + (int) ((xx - h) * pps);
|
nr.x = TIME_TO_X(xx);
|
||||||
nr.width = (int) ((note->dur * pps) + 0.5);
|
nr.width = TIME_TO_X(x1) - nr.x;
|
||||||
|
|
||||||
if (nr.x + nr.width >= rect.x && nr.x < rect.x + rect.width) {
|
if (nr.x + nr.width >= rect.x && nr.x < rect.x + rect.width) {
|
||||||
if (nr.x < rect.x) {
|
if (nr.x < rect.x) {
|
||||||
@ -2845,12 +2827,12 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track,
|
|||||||
AColor::Line(dc, TIME_TO_X(xx), yy, TIME_TO_X(x1), y1);
|
AColor::Line(dc, TIME_TO_X(xx), yy, TIME_TO_X(x1), y1);
|
||||||
} else if (shape == rectangle) {
|
} else if (shape == rectangle) {
|
||||||
if (xx < h) { // clip on left, leave 10 pixels to spare
|
if (xx < h) { // clip on left, leave 10 pixels to spare
|
||||||
xx = h - (linethick + 10) / pps;
|
xx = X_TO_TIME(rect.x - (linethick + 10));
|
||||||
}
|
}
|
||||||
if (x1 > h1) { // clip on right, leave 10 pixels to spare
|
if (x1 > h1) { // clip on right, leave 10 pixels to spare
|
||||||
x1 = h1 + (linethick + 10) / pps;
|
xx = X_TO_TIME(rect.x + rect.width + linethick + 10);
|
||||||
}
|
}
|
||||||
dc.DrawRectangle(TIME_TO_X(xx), yy, int((x1 - xx) * pps + 0.5), y1 - yy + 1);
|
dc.DrawRectangle(TIME_TO_X(xx), yy, TIME_TO_X(x1) - TIME_TO_X(xx), y1 - yy + 1);
|
||||||
} else if (shape == triangle) {
|
} else if (shape == triangle) {
|
||||||
wxPoint points[3];
|
wxPoint points[3];
|
||||||
points[0].x = TIME_TO_X(xx);
|
points[0].x = TIME_TO_X(xx);
|
||||||
@ -2894,7 +2876,7 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track,
|
|||||||
} else if (shape == oval) {
|
} else if (shape == oval) {
|
||||||
int ix = TIME_TO_X(xx);
|
int ix = TIME_TO_X(xx);
|
||||||
CLIP(ix);
|
CLIP(ix);
|
||||||
int ix1 = int((x1 - xx) * pps + 0.5);
|
int ix1 = TIME_TO_X(x1) - TIME_TO_X(xx);
|
||||||
if (ix1 > CLIP_MAX * 2) ix1 = CLIP_MAX * 2; // CLIP a width
|
if (ix1 > CLIP_MAX * 2) ix1 = CLIP_MAX * 2; // CLIP a width
|
||||||
dc.DrawEllipse(ix, yy, ix1, y1 - yy + 1);
|
dc.DrawEllipse(ix, yy, ix1, y1 - yy + 1);
|
||||||
} else if (shape == text) {
|
} else if (shape == text) {
|
||||||
@ -2983,23 +2965,24 @@ void TrackArtist::DrawNoteTrack(NoteTrack *track,
|
|||||||
void TrackArtist::DrawLabelTrack(LabelTrack *track,
|
void TrackArtist::DrawLabelTrack(LabelTrack *track,
|
||||||
wxDC & dc,
|
wxDC & dc,
|
||||||
const wxRect & rect,
|
const wxRect & rect,
|
||||||
const ViewInfo *viewInfo)
|
const SelectedRegion &selectedRegion,
|
||||||
|
const ZoomInfo &zoomInfo)
|
||||||
{
|
{
|
||||||
double sel0 = viewInfo->selectedRegion.t0();
|
double sel0 = selectedRegion.t0();
|
||||||
double sel1 = viewInfo->selectedRegion.t1();
|
double sel1 = selectedRegion.t1();
|
||||||
|
|
||||||
if (!track->GetSelected() && !track->IsSyncLockSelected())
|
if (!track->GetSelected() && !track->IsSyncLockSelected())
|
||||||
sel0 = sel1 = 0.0;
|
sel0 = sel1 = 0.0;
|
||||||
|
|
||||||
track->Draw(dc, rect, viewInfo->h, viewInfo->zoom, sel0, sel1);
|
track->Draw(dc, rect, SelectedRegion(sel0, sel1), zoomInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackArtist::DrawTimeTrack(TimeTrack *track,
|
void TrackArtist::DrawTimeTrack(TimeTrack *track,
|
||||||
wxDC & dc,
|
wxDC & dc,
|
||||||
const wxRect & rect,
|
const wxRect & rect,
|
||||||
const ViewInfo *viewInfo)
|
const ZoomInfo &zoomInfo)
|
||||||
{
|
{
|
||||||
track->Draw(dc, rect, viewInfo->h, viewInfo->zoom);
|
track->Draw(dc, rect, zoomInfo);
|
||||||
wxRect envRect = rect;
|
wxRect envRect = rect;
|
||||||
envRect.height -= 2;
|
envRect.height -= 2;
|
||||||
double lower = track->GetRangeLower(), upper = track->GetRangeUpper();
|
double lower = track->GetRangeLower(), upper = track->GetRangeUpper();
|
||||||
@ -3009,7 +2992,7 @@ void TrackArtist::DrawTimeTrack(TimeTrack *track,
|
|||||||
lower = 20.0 * log10(std::max(1.0e-7, lower)) / dBRange + 1.0;
|
lower = 20.0 * log10(std::max(1.0e-7, lower)) / dBRange + 1.0;
|
||||||
upper = 20.0 * log10(std::max(1.0e-7, upper)) / dBRange + 1.0;
|
upper = 20.0 * log10(std::max(1.0e-7, upper)) / dBRange + 1.0;
|
||||||
}
|
}
|
||||||
track->GetEnvelope()->DrawPoints(dc, envRect, viewInfo->h, viewInfo->zoom,
|
track->GetEnvelope()->DrawPoints(dc, envRect, zoomInfo,
|
||||||
track->GetDisplayLog(), lower, upper);
|
track->GetDisplayLog(), lower, upper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3202,14 +3185,17 @@ void TrackArtist::DrawSyncLockTiles(wxDC *dc, wxRect rect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TrackArtist::DrawBackgroundWithSelection(wxDC *dc, const wxRect &rect,
|
void TrackArtist::DrawBackgroundWithSelection(wxDC *dc, const wxRect &rect,
|
||||||
Track *track, wxBrush &selBrush, wxBrush &unselBrush,
|
Track *track, wxBrush &selBrush, wxBrush &unselBrush,
|
||||||
double sel0, double sel1, double h, double pps)
|
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo)
|
||||||
{
|
{
|
||||||
//MM: Draw background. We should optimize that a bit more.
|
//MM: Draw background. We should optimize that a bit more.
|
||||||
//AWD: "+ 1.5" and "+ 2.5" throughout match code in
|
//AWD: "+ 1.5" and "+ 2.5" throughout match code in
|
||||||
//AdornedRulerPanel::DoDrawSelection() and make selection line up with ruler.
|
//AdornedRulerPanel::DoDrawSelection() and make selection line up with ruler.
|
||||||
//I don't know if/why this is correct.
|
//I don't know if/why this is correct.
|
||||||
|
|
||||||
|
const double sel0 = selectedRegion.t0();
|
||||||
|
const double sel1 = selectedRegion.t1();
|
||||||
|
|
||||||
dc->SetPen(*wxTRANSPARENT_PEN);
|
dc->SetPen(*wxTRANSPARENT_PEN);
|
||||||
if (track->GetSelected() || track->IsSyncLockSelected())
|
if (track->GetSelected() || track->IsSyncLockSelected())
|
||||||
{
|
{
|
||||||
@ -3218,7 +3204,7 @@ void TrackArtist::DrawBackgroundWithSelection(wxDC *dc, const wxRect &rect,
|
|||||||
wxRect within = rect;
|
wxRect within = rect;
|
||||||
wxRect after = rect;
|
wxRect after = rect;
|
||||||
|
|
||||||
before.width = int ((sel0 - h) * pps + 2.5);
|
before.width = int(zoomInfo.TimeToPosition(sel0) + 2);
|
||||||
if (before.GetRight() > rect.GetRight()) {
|
if (before.GetRight() > rect.GetRight()) {
|
||||||
before.width = rect.width;
|
before.width = rect.width;
|
||||||
}
|
}
|
||||||
@ -3229,7 +3215,7 @@ void TrackArtist::DrawBackgroundWithSelection(wxDC *dc, const wxRect &rect,
|
|||||||
|
|
||||||
within.x = before.GetRight();
|
within.x = before.GetRight();
|
||||||
}
|
}
|
||||||
within.width = rect.x + int ((sel1 - h) * pps + 2.5) - within.x;
|
within.width = rect.x + int(zoomInfo.TimeToPosition(sel1) + 2) - within.x;
|
||||||
|
|
||||||
if (within.GetRight() > rect.GetRight()) {
|
if (within.GetRight() > rect.GetRight()) {
|
||||||
within.width = rect.GetRight() - within.x;
|
within.width = rect.GetRight() - within.x;
|
||||||
|
@ -37,7 +37,8 @@ class LabelTrack;
|
|||||||
class TimeTrack;
|
class TimeTrack;
|
||||||
class TrackList;
|
class TrackList;
|
||||||
class Ruler;
|
class Ruler;
|
||||||
class ViewInfo;
|
class SelectedRegion;
|
||||||
|
class ZoomInfo;
|
||||||
|
|
||||||
#ifndef uchar
|
#ifndef uchar
|
||||||
typedef unsigned char uchar;
|
typedef unsigned char uchar;
|
||||||
@ -52,11 +53,13 @@ class AUDACITY_DLL_API TrackArtist {
|
|||||||
void SetColours();
|
void SetColours();
|
||||||
void DrawTracks(TrackList *tracks, Track *start,
|
void DrawTracks(TrackList *tracks, Track *start,
|
||||||
wxDC & dc, wxRegion & reg,
|
wxDC & dc, wxRegion & reg,
|
||||||
wxRect & rect, wxRect & clip, ViewInfo *viewInfo,
|
wxRect & rect, wxRect & clip,
|
||||||
|
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo,
|
||||||
bool drawEnvelope, bool bigPoints, bool drawSliders);
|
bool drawEnvelope, bool bigPoints, bool drawSliders);
|
||||||
|
|
||||||
void DrawTrack(const Track *t,
|
void DrawTrack(const Track *t,
|
||||||
wxDC & dc, const wxRect & rect, const ViewInfo *viewInfo,
|
wxDC & dc, const wxRect & rect,
|
||||||
|
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo,
|
||||||
bool drawEnvelope, bool bigPoints, bool drawSliders,
|
bool drawEnvelope, bool bigPoints, bool drawSliders,
|
||||||
bool hasSolo);
|
bool hasSolo);
|
||||||
|
|
||||||
@ -95,7 +98,7 @@ class AUDACITY_DLL_API TrackArtist {
|
|||||||
// Helper: draws background with selection rect
|
// Helper: draws background with selection rect
|
||||||
static void DrawBackgroundWithSelection(wxDC *dc, const wxRect &rect,
|
static void DrawBackgroundWithSelection(wxDC *dc, const wxRect &rect,
|
||||||
Track *track, wxBrush &selBrush, wxBrush &unselBrush,
|
Track *track, wxBrush &selBrush, wxBrush &unselBrush,
|
||||||
double sel0, double sel1, double h, double pps);
|
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -104,60 +107,67 @@ class AUDACITY_DLL_API TrackArtist {
|
|||||||
//
|
//
|
||||||
|
|
||||||
void DrawWaveform(WaveTrack *track,
|
void DrawWaveform(WaveTrack *track,
|
||||||
wxDC & dc, const wxRect & rect, const ViewInfo *viewInfo,
|
wxDC & dc, const wxRect & rect,
|
||||||
|
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo,
|
||||||
bool drawEnvelope, bool bigPoints, bool drawSliders,
|
bool drawEnvelope, bool bigPoints, bool drawSliders,
|
||||||
bool dB, bool muted);
|
bool dB, bool muted);
|
||||||
|
|
||||||
void DrawSpectrum(WaveTrack *track,
|
void DrawSpectrum(WaveTrack *track,
|
||||||
wxDC & dc, const wxRect & rect, const ViewInfo *viewInfo);
|
wxDC & dc, const wxRect & rect,
|
||||||
|
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo);
|
||||||
#ifdef USE_MIDI
|
#ifdef USE_MIDI
|
||||||
int GetBottom(NoteTrack *t, const wxRect &rect);
|
int GetBottom(NoteTrack *t, const wxRect &rect);
|
||||||
void DrawNoteBackground(NoteTrack *track, wxDC &dc,
|
void DrawNoteBackground(NoteTrack *track, wxDC &dc,
|
||||||
const wxRect &rect, const wxRect &sel,
|
const wxRect &rect, const wxRect &sel,
|
||||||
const ViewInfo *viewInfo,
|
const ZoomInfo &zoomInfo,
|
||||||
const wxBrush &wb, const wxPen &wp,
|
const wxBrush &wb, const wxPen &wp,
|
||||||
const wxBrush &bb, const wxPen &bp,
|
const wxBrush &bb, const wxPen &bp,
|
||||||
const wxPen &mp);
|
const wxPen &mp);
|
||||||
void DrawNoteTrack(NoteTrack *track,
|
void DrawNoteTrack(NoteTrack *track,
|
||||||
wxDC & dc, const wxRect & rect, const ViewInfo *viewInfo,
|
wxDC & dc, const wxRect & rect,
|
||||||
|
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo,
|
||||||
bool muted);
|
bool muted);
|
||||||
#endif // USE_MIDI
|
#endif // USE_MIDI
|
||||||
|
|
||||||
void DrawLabelTrack(LabelTrack *track,
|
void DrawLabelTrack(LabelTrack *track,
|
||||||
wxDC & dc, const wxRect & rect, const ViewInfo *viewInfo);
|
wxDC & dc, const wxRect & rect,
|
||||||
|
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo);
|
||||||
|
|
||||||
void DrawTimeTrack(TimeTrack *track,
|
void DrawTimeTrack(TimeTrack *track,
|
||||||
wxDC & dc, const wxRect & rect, const ViewInfo *viewInfo);
|
wxDC & dc, const wxRect & rect, const ZoomInfo &zoomInfo);
|
||||||
|
|
||||||
void DrawTimeSlider(wxDC & dc, const wxRect & rect,
|
void DrawTimeSlider(wxDC & dc, const wxRect & rect,
|
||||||
bool rightwards);
|
bool rightwards);
|
||||||
|
|
||||||
void DrawClipWaveform(WaveTrack *track, WaveClip *clip,
|
void DrawClipWaveform(WaveTrack *track, WaveClip *clip,
|
||||||
wxDC & dc, const wxRect & rect, const ViewInfo *viewInfo,
|
wxDC & dc, const wxRect & rect,
|
||||||
|
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo,
|
||||||
bool drawEnvelope, bool bigPoints,
|
bool drawEnvelope, bool bigPoints,
|
||||||
bool dB, bool muted);
|
bool dB, bool muted);
|
||||||
|
|
||||||
void DrawClipSpectrum(WaveTrackCache &cache, WaveClip *clip,
|
void DrawClipSpectrum(WaveTrackCache &cache, WaveClip *clip,
|
||||||
wxDC & dc, const wxRect & rect, const ViewInfo *viewInfo);
|
wxDC & dc, const wxRect & rect,
|
||||||
|
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo);
|
||||||
|
|
||||||
// Waveform utility functions
|
// Waveform utility functions
|
||||||
|
|
||||||
void DrawWaveformBackground(wxDC & dc, const wxRect &rect, const double env[],
|
void DrawWaveformBackground(wxDC & dc, int leftOffset, const wxRect &rect,
|
||||||
|
const double env[],
|
||||||
float zoomMin, float zoomMax, bool dB,
|
float zoomMin, float zoomMax, bool dB,
|
||||||
const ViewInfo &viewInfo, double t0, double rate,
|
const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo,
|
||||||
sampleCount ssel0, sampleCount ssel1,
|
|
||||||
bool drawEnvelope, bool bIsSyncLockSelected);
|
bool drawEnvelope, bool bIsSyncLockSelected);
|
||||||
void DrawMinMaxRMS(wxDC &dc, const wxRect &rect, const double env[],
|
void DrawMinMaxRMS(wxDC &dc, const wxRect & rect, const double env[],
|
||||||
float zoomMin, float zoomMax, bool dB,
|
float zoomMin, float zoomMax, bool dB,
|
||||||
const WaveDisplay &display, bool /* showProgress */, bool muted
|
const float *min, const float *max, const float *rms, const int *bl,
|
||||||
|
bool /* showProgress */, bool muted
|
||||||
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
||||||
, const float gain
|
, const float gain
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
void DrawIndividualSamples(wxDC & dc, const wxRect & rect,
|
void DrawIndividualSamples(wxDC & dc, int leftOffset, const wxRect & rect,
|
||||||
float zoomMin, float zoomMax, bool dB,
|
float zoomMin, float zoomMax, bool dB,
|
||||||
WaveClip *clip,
|
WaveClip *clip,
|
||||||
double t0, double pps, double h,
|
const ZoomInfo &zoomInfo,
|
||||||
bool bigPoints, bool showPoints, bool muted);
|
bool bigPoints, bool showPoints, bool muted);
|
||||||
|
|
||||||
void DrawNegativeOffsetTrackArrows(wxDC & dc, const wxRect & rect);
|
void DrawNegativeOffsetTrackArrows(wxDC & dc, const wxRect & rect);
|
||||||
|
@ -7207,13 +7207,14 @@ void TrackPanel::DrawTracks(wxDC * dc)
|
|||||||
ToolsToolBar *pTtb = mListener->TP_GetToolsToolBar();
|
ToolsToolBar *pTtb = mListener->TP_GetToolsToolBar();
|
||||||
bool bMultiToolDown = pTtb->IsDown(multiTool);
|
bool bMultiToolDown = pTtb->IsDown(multiTool);
|
||||||
bool envelopeFlag = pTtb->IsDown(envelopeTool) || bMultiToolDown;
|
bool envelopeFlag = pTtb->IsDown(envelopeTool) || bMultiToolDown;
|
||||||
bool samplesFlag = pTtb->IsDown(drawTool) || bMultiToolDown;
|
bool bigPointsFlag = pTtb->IsDown(drawTool) || bMultiToolDown;
|
||||||
bool sliderFlag = bMultiToolDown;
|
bool sliderFlag = bMultiToolDown;
|
||||||
|
|
||||||
// The track artist actually draws the stuff inside each track
|
// The track artist actually draws the stuff inside each track
|
||||||
mTrackArtist->DrawTracks(mTracks, GetProject()->GetFirstVisible(),
|
mTrackArtist->DrawTracks(mTracks, GetProject()->GetFirstVisible(),
|
||||||
*dc, region, tracksRect, clip, mViewInfo,
|
*dc, region, tracksRect, clip,
|
||||||
envelopeFlag, samplesFlag, sliderFlag);
|
mViewInfo->selectedRegion, *mViewInfo,
|
||||||
|
envelopeFlag, bigPointsFlag, sliderFlag);
|
||||||
|
|
||||||
DrawEverythingElse(dc, region, clip);
|
DrawEverythingElse(dc, region, clip);
|
||||||
}
|
}
|
||||||
|
@ -2804,7 +2804,8 @@ void EqualizationPanel::OnPaint(wxPaintEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
memDC.SetPen(*wxBLACK_PEN);
|
memDC.SetPen(*wxBLACK_PEN);
|
||||||
if( mEffect->mDraw->GetValue() )
|
if( mEffect->mDraw->GetValue() )
|
||||||
mEffect->mEnvelope->DrawPoints(memDC, mEnvRect, 0.0, mEnvRect.width-1, false, mEffect->mdBMin, mEffect->mdBMax);
|
mEffect->mEnvelope->DrawPoints(memDC, mEnvRect, ZoomInfo(0.0, 1.0, mEnvRect.width-1), false,
|
||||||
|
mEffect->mdBMin, mEffect->mdBMax);
|
||||||
|
|
||||||
dc.Blit(0, 0, mWidth, mHeight,
|
dc.Blit(0, 0, mWidth, mHeight,
|
||||||
&memDC, 0, 0, wxCOPY, FALSE);
|
&memDC, 0, 0, wxCOPY, FALSE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user