From 526606fc29dd9abe5efcd8d6a4a3cdefeb2c0084 Mon Sep 17 00:00:00 2001 From: David Bailes Date: Tue, 10 Apr 2018 13:43:50 +0100 Subject: [PATCH] Fix more accessibility names after the move to wx 3.1.1 This is a follow up to commit f9ee3cd. --- src/FreqWindow.cpp | 12 ++++++++++++ src/PluginManager.cpp | 20 ++++++++++++++++++++ src/effects/Contrast.cpp | 9 +++++++-- src/effects/VST/VSTEffect.cpp | 8 ++++++++ src/effects/ladspa/LadspaEffect.cpp | 10 +++++++++- src/effects/nyquist/Nyquist.cpp | 5 ++++- 6 files changed, 60 insertions(+), 4 deletions(-) diff --git a/src/FreqWindow.cpp b/src/FreqWindow.cpp index 89065d270..cb222e957 100644 --- a/src/FreqWindow.cpp +++ b/src/FreqWindow.cpp @@ -85,6 +85,10 @@ and in the spectrogram spectral selection. #include "./widgets/HelpSystem.h" #include "widgets/ErrorDialog.h" +#if wxUSE_ACCESSIBILITY +#include "widgets/WindowAccessible.h" +#endif + DEFINE_EVENT_TYPE(EVT_FREQWINDOW_RECALC); enum { @@ -309,6 +313,10 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id, { mPanScroller = safenew wxScrollBar(this, FreqPanScrollerID, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mPanScroller->SetAccessible(safenew WindowAccessible(mPanScroller)); +#endif mPanScroller->SetName(_("Scroll")); S.Prop(1); S.AddWindow(mPanScroller, wxALIGN_LEFT | wxTOP); @@ -326,6 +334,10 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL); S.Prop(1); S.AddWindow(mZoomSlider, wxALIGN_CENTER_HORIZONTAL); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mZoomSlider->SetAccessible(safenew WindowAccessible(mZoomSlider)); +#endif mZoomSlider->SetName(_("Zoom")); S.AddSpace(5); diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp index 335f8fdb6..670416875 100644 --- a/src/PluginManager.cpp +++ b/src/PluginManager.cpp @@ -48,6 +48,10 @@ for shared and private configs - which need to move out. #include "widgets/ErrorDialog.h" #include "widgets/ProgressDialog.h" +#if wxUSE_ACCESSIBILITY +#include "widgets/WindowAccessible.h" +#endif + #include "PluginManager.h" #include "Experimental.h" @@ -540,15 +544,31 @@ void PluginRegistrationDialog::PopulateOrExchange(ShuttleGui &S) S.AddPrompt(_("Show:")); /* i18n-hint: Radio button to show all effects */ rb = S.Id(ID_ShowAll).AddRadioButton(_("&All")); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + rb->SetAccessible(safenew WindowAccessible(rb)); +#endif rb->SetName(_("Show all")); /* i18n-hint: Radio button to show just the currently disabled effects */ rb = S.Id(ID_ShowDisabled).AddRadioButtonToGroup(_("D&isabled")); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + rb->SetAccessible(safenew WindowAccessible(rb)); +#endif rb->SetName(_("Show disabled")); /* i18n-hint: Radio button to show just the currently enabled effects */ rb = S.Id(ID_ShowEnabled).AddRadioButtonToGroup(_("E&nabled")); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + rb->SetAccessible(safenew WindowAccessible(rb)); +#endif rb->SetName(_("Show enabled")); /* i18n-hint: Radio button to show just the newly discovered effects */ rb = S.Id(ID_ShowNew).AddRadioButtonToGroup(_("Ne&w")); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + rb->SetAccessible(safenew WindowAccessible(rb)); +#endif rb->SetName(_("Show new")); } S.EndHorizontalLay(); diff --git a/src/effects/Contrast.cpp b/src/effects/Contrast.cpp index a3d950def..535b1e373 100644 --- a/src/effects/Contrast.cpp +++ b/src/effects/Contrast.cpp @@ -292,12 +292,17 @@ ContrastDialog::ContrastDialog(wxWindow * parent, wxWindowID id, { S.StartMultiColumn(3, wxCENTER); { - S.AddFixedText(_("Co&ntrast Result:")); + wxString label = _("Co&ntrast Result:"); + S.AddFixedText(label); mPassFailText = S.Id(ID_RESULTS_TEXT).AddTextBox( {}, wxT(""), 50); + mPassFailText->SetName(wxStripMenuCodes(label)); mPassFailText->Bind(wxEVT_KEY_DOWN, OnChar); m_pButton_Reset = S.Id(ID_BUTTON_RESET).AddButton(_("R&eset")); - S.AddFixedText(_("&Difference:")); + + label = _("&Difference:"); + S.AddFixedText(label); mDiffText = S.Id(ID_RESULTSDB_TEXT).AddTextBox( {}, wxT(""), 50); + mDiffText->SetName(wxStripMenuCodes(label)); mDiffText->Bind(wxEVT_KEY_DOWN, OnChar); m_pButton_Export = S.Id(ID_BUTTON_EXPORT).AddButton(_("E&xport...")); } diff --git a/src/effects/VST/VSTEffect.cpp b/src/effects/VST/VSTEffect.cpp index a61f468bc..65bfb6004 100644 --- a/src/effects/VST/VSTEffect.cpp +++ b/src/effects/VST/VSTEffect.cpp @@ -94,6 +94,10 @@ #include "../../xml/XMLFileReader.h" #include "../../xml/XMLWriter.h" +#if wxUSE_ACCESSIBILITY +#include "../../widgets/WindowAccessible.h" +#endif + #include "audacity/ConfigInterface.h" #include "VSTEffect.h" @@ -2932,6 +2936,10 @@ void VSTEffect::BuildPlain() wxDefaultPosition, wxSize(200, -1)); gridSizer->Add(mSliders[i], 0, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL, 5); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mSliders[i]->SetAccessible(safenew WindowAccessible(mSliders[i])); +#endif mDisplays[i] = safenew wxStaticText(scroller, wxID_ANY, diff --git a/src/effects/ladspa/LadspaEffect.cpp b/src/effects/ladspa/LadspaEffect.cpp index 70cdbdacd..8c04d399c 100644 --- a/src/effects/ladspa/LadspaEffect.cpp +++ b/src/effects/ladspa/LadspaEffect.cpp @@ -54,6 +54,10 @@ effects from this one class. #include "../../widgets/valnum.h" #include "../../widgets/wxPanelWrapper.h" +#if wxUSE_ACCESSIBILITY +#include "../../widgets/WindowAccessible.h" +#endif + // ============================================================================ // List of effects that ship with Audacity. These will be autoregistered. // ============================================================================ @@ -1328,6 +1332,10 @@ bool LadspaEffect::PopulateUI(wxWindow *parent) 0, 0, 1000, wxDefaultPosition, wxSize(200, -1)); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mSliders[p]->SetAccessible(safenew WindowAccessible(mSliders[p])); +#endif mSliders[p]->SetName(labelText); gridSizer->Add(mSliders[p], 0, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL, 5); @@ -1450,7 +1458,7 @@ bool LadspaEffect::PopulateUI(wxWindow *parent) mInputControls[p] = roundf(mInputControls[p] * 1000000.0) / 1000000.0; mMeters[p] = safenew LadspaEffectMeter(w, mOutputControls[p], lower, upper); - mMeters[p]->SetName(labelText); + mMeters[p]->SetLabel(labelText); // for screen readers gridSizer->Add(mMeters[p], 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 5); } diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index af12d8232..040d04bb8 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -2443,7 +2443,8 @@ void NyquistEffect::BuildEffectWindow(ShuttleGui & S) { NyqControl & ctrl = mControls[i]; - S.AddPrompt(ctrl.name + wxT(":")); + wxString prompt = ctrl.name + wxT(" "); + S.AddPrompt(prompt); if (ctrl.type == NYQ_CTRL_STRING) { @@ -2451,6 +2452,7 @@ void NyquistEffect::BuildEffectWindow(ShuttleGui & S) wxTextCtrl *item = S.Id(ID_Text + i).AddTextBox( {}, wxT(""), 12); item->SetValidator(wxGenericValidator(&ctrl.valStr)); + item->SetName(prompt); } else if (ctrl.type == NYQ_CTRL_CHOICE) { @@ -2471,6 +2473,7 @@ void NyquistEffect::BuildEffectWindow(ShuttleGui & S) wxTextCtrl *item = S.Id(ID_Text+i).AddTextBox( {}, wxT(""), (ctrl.type == NYQ_CTRL_INT_TEXT || ctrl.type == NYQ_CTRL_FLOAT_TEXT) ? 25 : 12); + item->SetName(prompt); double range = ctrl.high - ctrl.low;