1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-22 14:32:58 +02:00

Selection toolbars use a little less idle time after commit f0ae4c3

This commit is contained in:
Paul Licameli
2019-07-05 13:59:47 -04:00
parent 8c59f66583
commit ce31e2f35e
2 changed files with 17 additions and 13 deletions

View File

@@ -676,13 +676,15 @@ void SelectionBar::ValuesToControls()
// A time has been set. Update the control values. // A time has been set. Update the control values.
void SelectionBar::SetTimes(double start, double end, double audio) void SelectionBar::SetTimes(double start, double end, double audio)
{ {
mStart = start; if ( start != mStart || end != mEnd || audio != mAudio) {
mEnd = end; mStart = start;
mLength = end-start; mEnd = end;
mCenter = (end+start)/2.0; mLength = end-start;
mAudio = audio; mCenter = (end+start)/2.0;
mAudio = audio;
ValuesToControls(); ValuesToControls();
}
} }
void SelectionBar::SetSnapTo(int snap) void SelectionBar::SetSnapTo(int snap)

View File

@@ -465,15 +465,17 @@ void SpectralSelectionBar::SetBounds()
void SpectralSelectionBar::SetFrequencies(double bottom, double top) void SpectralSelectionBar::SetFrequencies(double bottom, double top)
{ {
mLow = bottom; if ( mLow != bottom || mHigh != top ) {
mHigh = top; mLow = bottom;
mHigh = top;
if (bottom > 0 && top >= bottom) if (bottom > 0 && top >= bottom)
mWidth = log(top / bottom), mCenter = sqrt(top * bottom); mWidth = log(top / bottom), mCenter = sqrt(top * bottom);
else else
mWidth = mCenter = -1.0; mWidth = mCenter = -1.0;
ValuesToControls(); ValuesToControls();
}
} }
void SpectralSelectionBar::SetFrequencySelectionFormatName(const NumericFormatSymbol & formatName) void SpectralSelectionBar::SetFrequencySelectionFormatName(const NumericFormatSymbol & formatName)