1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00

Bug 2497 - Windows: text can be pasted into the project rate box

This commit is contained in:
Leland Lucius 2021-02-16 22:18:23 -06:00
parent 7cc1cf79ea
commit 98561ee0b2
2 changed files with 12 additions and 1 deletions

View File

@ -735,7 +735,9 @@ void SelectionBar::SetRate(double rate)
void SelectionBar::OnRate(wxCommandEvent & WXUNUSED(event))
{
if (mRateBox->GetValue().ToDouble(&mRate) && // is a numeric value
auto value = mRateBox->GetValue();
if (value.ToDouble(&mRate) && // is a numeric value
(mRate != 0.0))
{
NumericTextCtrl ** Ctrls[5] = { &mStartTime, &mEndTime, &mLengthTime, &mCenterTime, &mAudioTime };
@ -744,6 +746,13 @@ void SelectionBar::OnRate(wxCommandEvent & WXUNUSED(event))
if( *Ctrls[i] )
(*Ctrls[i])->SetSampleRate( mRate );
if (mListener) mListener->AS_SetRate(mRate);
mLastValidText = value;
}
else
{
// Bug 2497 - Undo paste into text box if it's not numeric
mRateBox->SetValue(mLastValidText);
}
}

View File

@ -113,6 +113,8 @@ class SelectionBar final : public ToolBar {
wxChoice *mSnapTo;
wxWindow *mRateText;
wxString mLastValidText;
public:
DECLARE_CLASS(SelectionBar)