mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-21 16:11:11 +01:00
Bug 2497 - Windows: text can be pasted into the project rate box
This commit is contained in:
@@ -735,7 +735,9 @@ void SelectionBar::SetRate(double rate)
|
|||||||
|
|
||||||
void SelectionBar::OnRate(wxCommandEvent & WXUNUSED(event))
|
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))
|
(mRate != 0.0))
|
||||||
{
|
{
|
||||||
NumericTextCtrl ** Ctrls[5] = { &mStartTime, &mEndTime, &mLengthTime, &mCenterTime, &mAudioTime };
|
NumericTextCtrl ** Ctrls[5] = { &mStartTime, &mEndTime, &mLengthTime, &mCenterTime, &mAudioTime };
|
||||||
@@ -744,6 +746,13 @@ void SelectionBar::OnRate(wxCommandEvent & WXUNUSED(event))
|
|||||||
if( *Ctrls[i] )
|
if( *Ctrls[i] )
|
||||||
(*Ctrls[i])->SetSampleRate( mRate );
|
(*Ctrls[i])->SetSampleRate( mRate );
|
||||||
if (mListener) mListener->AS_SetRate(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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,6 +113,8 @@ class SelectionBar final : public ToolBar {
|
|||||||
wxChoice *mSnapTo;
|
wxChoice *mSnapTo;
|
||||||
wxWindow *mRateText;
|
wxWindow *mRateText;
|
||||||
|
|
||||||
|
wxString mLastValidText;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DECLARE_CLASS(SelectionBar)
|
DECLARE_CLASS(SelectionBar)
|
||||||
|
|||||||
Reference in New Issue
Block a user