mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-22 07:10:06 +02:00
Spectral selection toolbar refinements
Delete key in center/width spectral selection toolbar works Delete key, not - key, in the spectral selection bar maks frequency undefined.
This commit is contained in:
commit
910e7f87bd
@ -146,12 +146,14 @@ void SpectralSelectionBar::Populate()
|
||||
|
||||
mCenterCtrl = new NumericTextCtrl(
|
||||
NumericConverter::FREQUENCY, this, OnCenterID, frequencyFormatName, 0.0);
|
||||
mCenterCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency);
|
||||
mCenterCtrl->SetName(_("Center Frequency:"));
|
||||
mCenterCtrl->EnableMenu();
|
||||
subSizer->Add(mCenterCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||
|
||||
mWidthCtrl = new NumericTextCtrl(
|
||||
NumericConverter::BANDWIDTH, this, OnWidthID, bandwidthFormatName, 0.0);
|
||||
mWidthCtrl->SetInvalidValue(-1.0);
|
||||
mWidthCtrl->SetName(wxString(_("Bandwidth:")));
|
||||
mWidthCtrl->EnableMenu();
|
||||
subSizer->Add(mWidthCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
|
||||
@ -228,7 +230,11 @@ void SpectralSelectionBar::ModifySpectralSelection(bool done)
|
||||
if (mbCenterAndWidth) {
|
||||
mCenter = mCenterCtrl->GetValue();
|
||||
mWidth = mWidthCtrl->GetValue();
|
||||
if (mCenter < 0 && mWidth < 0)
|
||||
if ((mCenter < 0 || mWidth < 0) &&
|
||||
(mLow >= 0 || mHigh >= 0))
|
||||
// Transition from defined spectral selection to undefined
|
||||
bottom = top = SelectedRegion::UndefinedFrequency;
|
||||
else if (mCenter < 0 && mWidth < 0)
|
||||
bottom = top = SelectedRegion::UndefinedFrequency;
|
||||
else {
|
||||
if (mCenter < 0) {
|
||||
|
@ -1612,7 +1612,7 @@ void NumericTextCtrl::OnCaptureKey(wxCommandEvent &event)
|
||||
case WXK_TAB:
|
||||
case WXK_RETURN:
|
||||
case WXK_NUMPAD_ENTER:
|
||||
case '-':
|
||||
case WXK_DELETE:
|
||||
return;
|
||||
|
||||
default:
|
||||
@ -1635,7 +1635,7 @@ void NumericTextCtrl::OnKeyUp(wxKeyEvent &event)
|
||||
keyCode -= WXK_NUMPAD0 - '0';
|
||||
|
||||
if ((keyCode >= '0' && keyCode <= '9') ||
|
||||
(keyCode == '-') ||
|
||||
(keyCode == WXK_DELETE) ||
|
||||
(keyCode == WXK_BACK) ||
|
||||
(keyCode == WXK_UP) ||
|
||||
(keyCode == WXK_DOWN)) {
|
||||
@ -1680,7 +1680,7 @@ void NumericTextCtrl::OnKeyDown(wxKeyEvent &event)
|
||||
Updated();
|
||||
}
|
||||
|
||||
else if (!mReadOnly && keyCode == '-') {
|
||||
else if (!mReadOnly && keyCode == WXK_DELETE) {
|
||||
if (mAllowInvalidValue)
|
||||
SetValue(mInvalidValue);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user