1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-19 09:01:15 +02:00

Bug 521 - Lower half of Waveform (dB) vertical scale does not show dB level.

Added a DbMirrorValue for two sided dB scale on Waveform VRuler when in dB view mode.
This commit is contained in:
James Crook
2018-03-24 20:32:28 +00:00
parent 37541de6be
commit 8ce8e7bcce
3 changed files with 32 additions and 5 deletions

View File

@@ -139,6 +139,7 @@ Ruler::Ruler()
mbTicksAtExtremes = false;
mTickColour = wxColour( theTheme.Colour( clrTrackPanelText ));
mPen.SetColour(mTickColour);
mDbMirrorValue = 0.0;
// Note: the font size is now adjusted automatically whenever
// Invalidate is called on a horizontal Ruler, unless the user
@@ -768,7 +769,7 @@ void Ruler::Tick(int pos, double d, bool major, bool minor)
wxCoord strW, strH, strD, strL;
int strPos, strLen, strLeft, strTop;
// FIXME: We don't draw a tick if of end of our label arrays
// FIXME: We don't draw a tick if off end of our label arrays
// But we shouldn't have an array of labels.
if( mNumMinorMinor >= mLength )
return;
@@ -792,6 +793,9 @@ void Ruler::Tick(int pos, double d, bool major, bool minor)
label->text = wxT("");
mDC->SetFont(major? *mMajorFont: minor? *mMinorFont : *mMinorMinorFont);
// Bug 521. dB view for waveforms needs a 2-sided scale.
if(( mDbMirrorValue > 1.0 ) && ( -d > mDbMirrorValue ))
d = -2*mDbMirrorValue - d;
l = LabelString(d, major);
mDC->GetTextExtent(l, &strW, &strH, &strD, &strL);

View File

@@ -81,6 +81,7 @@ class AUDACITY_DLL_API Ruler {
// Specify the name of the units (like "dB") if you
// want numbers like "1.6" formatted as "1.6 dB".
void SetUnits(const wxString &units);
void SetDbMirrorValue( const double d ){ mDbMirrorValue = d ; };
// Logarithmic
void SetLog(bool log);
@@ -223,6 +224,7 @@ private:
private:
int mOrientation;
int mSpacing;
double mDbMirrorValue;
bool mHasSetSpacing;
bool mLabelEdges;
RulerFormat mFormat;