1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-24 16:20:05 +02:00

Spectral Selection ToolBar Accessibility, by David Bailes. (untested by me as I am Jawless)

This commit is contained in:
james.k.crook@gmail.com 2014-11-29 16:50:08 +00:00
parent 125e0f37dd
commit 4ed7396b24
2 changed files with 39 additions and 26 deletions

View File

@ -99,6 +99,7 @@ SpectralSelectionBar::~SpectralSelectionBar()
void SpectralSelectionBar::Create(wxWindow * parent) void SpectralSelectionBar::Create(wxWindow * parent)
{ {
ToolBar::Create(parent); ToolBar::Create(parent);
mHeight = wxWindowBase::GetSizer()->GetSize().GetHeight();
} }
void SpectralSelectionBar::Populate() void SpectralSelectionBar::Populate()
@ -142,7 +143,7 @@ void SpectralSelectionBar::Populate()
// //
wxBoxSizer *subSizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *subSizer = new wxBoxSizer(wxHORIZONTAL);
if (mbCenterAndWidth) {
mCenterCtrl = new NumericTextCtrl( mCenterCtrl = new NumericTextCtrl(
NumericConverter::FREQUENCY, this, OnCenterID, frequencyFormatName, 0.0); NumericConverter::FREQUENCY, this, OnCenterID, frequencyFormatName, 0.0);
mCenterCtrl->SetName(_("Center Frequency:")); mCenterCtrl->SetName(_("Center Frequency:"));
@ -154,8 +155,7 @@ void SpectralSelectionBar::Populate()
mWidthCtrl->SetName(wxString(_("Bandwidth:"))); mWidthCtrl->SetName(wxString(_("Bandwidth:")));
mWidthCtrl->EnableMenu(); mWidthCtrl->EnableMenu();
subSizer->Add(mWidthCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0); subSizer->Add(mWidthCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
}
else {
mLowCtrl = new NumericTextCtrl( mLowCtrl = new NumericTextCtrl(
NumericConverter::FREQUENCY, this, OnLowID, frequencyFormatName, 0.0); NumericConverter::FREQUENCY, this, OnLowID, frequencyFormatName, 0.0);
mLowCtrl->SetName(_("Low Frequency:")); mLowCtrl->SetName(_("Low Frequency:"));
@ -167,7 +167,12 @@ void SpectralSelectionBar::Populate()
mHighCtrl->SetName(wxString(_("High Frequency:"))); mHighCtrl->SetName(wxString(_("High Frequency:")));
mHighCtrl->EnableMenu(); mHighCtrl->EnableMenu();
subSizer->Add(mHighCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0); subSizer->Add(mHighCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
}
mCenterCtrl->Show(mbCenterAndWidth);
mWidthCtrl->Show(mbCenterAndWidth);
mLowCtrl->Show(!mbCenterAndWidth);
mHighCtrl->Show(!mbCenterAndWidth);
mainSizer->Add(subSizer, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0); mainSizer->Add(subSizer, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
mainSizer->Layout(); mainSizer->Layout();
@ -275,9 +280,15 @@ void SpectralSelectionBar::OnChoice(wxCommandEvent &)
mbCenterAndWidth = (0 == mChoice->GetSelection()); mbCenterAndWidth = (0 == mChoice->GetSelection());
gPrefs->Write(preferencePath, mbCenterAndWidth); gPrefs->Write(preferencePath, mbCenterAndWidth);
gPrefs->Flush(); gPrefs->Flush();
ToolBar::ReCreateButtons();
mChoice->SetFocus(); mCenterCtrl->Show(mbCenterAndWidth);
mWidthCtrl->Show(mbCenterAndWidth);
mLowCtrl->Show(!mbCenterAndWidth);
mHighCtrl->Show(!mbCenterAndWidth);
ValuesToControls(); ValuesToControls();
wxWindowBase::GetSizer()->SetMinSize(wxSize(0, mHeight)); // so that height of toolbar does not change
wxWindowBase::GetSizer()->SetSizeHints(this);
Updated(); Updated();
} }

View File

@ -69,6 +69,8 @@ private:
NumericTextCtrl *mCenterCtrl, *mWidthCtrl, *mLowCtrl, *mHighCtrl; NumericTextCtrl *mCenterCtrl, *mWidthCtrl, *mLowCtrl, *mHighCtrl;
wxChoice *mChoice; wxChoice *mChoice;
int mHeight; // height of main sizer after creation - used by OnChoice()
public: public:
DECLARE_CLASS(SpectralSelectionBar); DECLARE_CLASS(SpectralSelectionBar);