1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-01 16:19:43 +02: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)
{
// wxHORIZONTAL || wxVERTICAL
@ -303,14 +312,18 @@ void Ruler::SetNumberScale(const NumberScale *pScale)
void Ruler::OfflimitsPixels(int start, int end)
{
if ( mUserBits.empty() ) {
int length = mLength;
if (mOrientation == wxHORIZONTAL)
mLength = mRight-mLeft;
length = mRight - mLeft;
else
mLength = mBottom-mTop;
if( mLength < 0 )
length = mBottom - mTop;
if( length < 0 )
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)
@ -323,6 +336,8 @@ void Ruler::OfflimitsPixels(int start, int end)
for(int i = start; i <= end; i++)
mUserBits[i] = true;
Invalidate();
}
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
// want numbers like "1.6" formatted as "1.6 dB".
void SetUnits(const TranslatableString &units);
void SetDbMirrorValue( const double d ){ mDbMirrorValue = d ; };
void SetDbMirrorValue( const double d );
// Logarithmic
void SetLog(bool log);