1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-01-13 08:05:52 +01:00

Invalidate Ruler, whenever anything the Updater uses is reassigned

This commit is contained in:
Paul Licameli
2020-01-22 13:30:25 -05:00
parent edba1b5b28
commit ec723466ba
2 changed files with 24 additions and 9 deletions

View File

@@ -172,6 +172,15 @@ void Ruler::SetUnits(const TranslatableString &units)
} }
} }
void Ruler::SetDbMirrorValue( const double d )
{
if (mDbMirrorValue != d) {
mDbMirrorValue = d;
Invalidate();
}
}
void Ruler::SetOrientation(int orient) void Ruler::SetOrientation(int orient)
{ {
// wxHORIZONTAL || wxVERTICAL // wxHORIZONTAL || wxVERTICAL
@@ -303,14 +312,18 @@ void Ruler::SetNumberScale(const NumberScale *pScale)
void Ruler::OfflimitsPixels(int start, int end) void Ruler::OfflimitsPixels(int start, int end)
{ {
if ( mUserBits.empty() ) { int length = mLength;
if (mOrientation == wxHORIZONTAL) if (mOrientation == wxHORIZONTAL)
mLength = mRight-mLeft; length = mRight - mLeft;
else else
mLength = mBottom-mTop; length = mBottom - mTop;
if( mLength < 0 ) if( length < 0 )
return; return;
mUserBits.resize( static_cast<size_t>( mLength + 1 ), false );
auto size = static_cast<size_t>( length + 1 );
if ( mUserBits.size() < size ) {
mLength = length;
mUserBits.resize( size, false );
} }
if (end < start) if (end < start)
@@ -323,6 +336,8 @@ void Ruler::OfflimitsPixels(int start, int end)
for(int i = start; i <= end; i++) for(int i = start; i <= end; i++)
mUserBits[i] = true; mUserBits[i] = true;
Invalidate();
} }
void Ruler::SetBounds(int left, int top, int right, int bottom) void Ruler::SetBounds(int left, int top, int right, int bottom)

View File

@@ -76,7 +76,7 @@ class AUDACITY_DLL_API Ruler {
// Specify the name of the units (like "dB") if you // Specify the name of the units (like "dB") if you
// want numbers like "1.6" formatted as "1.6 dB". // want numbers like "1.6" formatted as "1.6 dB".
void SetUnits(const TranslatableString &units); void SetUnits(const TranslatableString &units);
void SetDbMirrorValue( const double d ){ mDbMirrorValue = d ; }; void SetDbMirrorValue( const double d );
// Logarithmic // Logarithmic
void SetLog(bool log); void SetLog(bool log);