diff --git a/src/Project.cpp b/src/Project.cpp index c21dc7a25..665cc67dd 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -172,6 +172,10 @@ scroll information. It also has some status flags. #include "../images/AudacityLogoAlpha.xpm" +#if wxUSE_ACCESSIBILITY +#include "widgets/WindowAccessible.h" +#endif + std::shared_ptr AudacityProject::msClipboard{ TrackList::Create() }; double AudacityProject::msClipT0 = 0.0; double AudacityProject::msClipT1 = 0.0; @@ -947,6 +951,11 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, // field. Currently there are no such help strings, but it they were introduced, then // there would need to be an event handler to send them to the appropriate field. mStatusBar = CreateStatusBar(4); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mStatusBar->SetAccessible(safenew WindowAccessible(mStatusBar)); +#endif + mStatusBar->SetName(wxT("status_line")); // not localized mProjectNo = mProjectCounter++; // Bug 322 wxGetApp().SetMissingAliasedFileWarningShouldShow(true); @@ -990,7 +999,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, this, wxID_ANY, wxDefaultPosition, wxSize{ this->GetSize().GetWidth(), -1 } }; - mTopPanel->SetName( "Top Panel" );// Not localised + mTopPanel->SetLabel( "Top Panel" );// Not localised mTopPanel->SetAutoLayout(true); #ifdef EXPERIMENTAL_DA2 mTopPanel->SetBackgroundColour(theTheme.Colour( clrMedium )); @@ -1040,7 +1049,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, wxDefaultSize, wxNO_BORDER); mMainPanel->SetSizer( safenew wxBoxSizer(wxVERTICAL) ); - mMainPanel->SetName("Main Panel");// Not localised. + mMainPanel->SetLabel("Main Panel");// Not localised. pPage = mMainPanel; // Set the colour here to the track panel background to avoid // flicker when Audacity starts up. @@ -1128,6 +1137,11 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, // several focus problems. mHsbar = safenew ScrollBar(pPage, HSBarID, wxSB_HORIZONTAL); mVsbar = safenew ScrollBar(pPage, VSBarID, wxSB_VERTICAL); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mHsbar->SetAccessible(safenew WindowAccessible(mHsbar)); + mVsbar->SetAccessible(safenew WindowAccessible(mVsbar)); +#endif mHsbar->SetName(_("Horizontal Scrollbar")); mVsbar->SetName(_("Vertical Scrollbar")); diff --git a/src/ShuttleGui.cpp b/src/ShuttleGui.cpp index b8d815d51..23f3a7a81 100644 --- a/src/ShuttleGui.cpp +++ b/src/ShuttleGui.cpp @@ -113,6 +113,10 @@ for registering for changes. #include "widgets/wxPanelWrapper.h" #include "AllThemeResources.h" +#if wxUSE_ACCESSIBILITY +#include "widgets/WindowAccessible.h" +#endif + ShuttleGuiBase::ShuttleGuiBase(wxWindow * pParent, teShuttleMode ShuttleMode ) { wxASSERT( (pParent != NULL ) || ( ShuttleMode != eIsCreating)); @@ -503,6 +507,10 @@ wxSlider * ShuttleGuiBase::AddSlider(const wxString &Prompt, int pos, int Max, i wxDefaultPosition, wxDefaultSize, Style( wxSL_HORIZONTAL | wxSL_LABELS | wxSL_AUTOTICKS ) ); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mpWind->SetAccessible(safenew WindowAccessible(mpWind)); +#endif mpWind->SetName(wxStripMenuCodes(Prompt)); miProp=1; UpdateSizers(); @@ -552,6 +560,10 @@ wxTextCtrl * ShuttleGuiBase::AddTextBox(const wxString &Caption, const wxString mpWind = pTextCtrl = safenew wxTextCtrl(GetParent(), miId, Value, wxDefaultPosition, Size, Style( flags )); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mpWind->SetAccessible(safenew WindowAccessible(mpWind)); +#endif mpWind->SetName(wxStripMenuCodes(Caption)); UpdateSizers(); return pTextCtrl; @@ -583,6 +595,10 @@ wxTextCtrl * ShuttleGuiBase::AddNumericTextBox(const wxString &Caption, const wx wxDefaultPosition, Size, Style( flags ), Validator // It's OK to pass this. It will be cloned. ); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mpWind->SetAccessible(safenew WindowAccessible(mpWind)); +#endif mpWind->SetName(wxStripMenuCodes(Caption)); UpdateSizers(); return pTextCtrl; @@ -598,6 +614,10 @@ wxTextCtrl * ShuttleGuiBase::AddTextWindow(const wxString &Value) SetProportions( 1 ); mpWind = pTextCtrl = safenew wxTextCtrl(GetParent(), miId, Value, wxDefaultPosition, wxDefaultSize, Style( wxTE_MULTILINE )); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mpWind->SetAccessible(safenew WindowAccessible(mpWind)); +#endif UpdateSizers(); // Start off at start of window... pTextCtrl->SetInsertionPoint( 0 ); @@ -2274,6 +2294,10 @@ std::unique_ptr CreateStdButtonSizer(wxWindow *parent, long buttons, wx // bs->AddButton(safenew wxButton(parent, wxID_HELP)); b = safenew wxBitmapButton(parent, wxID_HELP, theTheme.Bitmap( bmpHelpIcon )); b->SetToolTip( _("Help") ); +#if wxUSE_ACCESSIBILITY + b->SetAccessible(safenew WindowAccessible(b)); // so that name can be set on a standard control + b->SetName(_("Help")); +#endif bs->AddButton( b ); } diff --git a/src/prefs/KeyConfigPrefs.cpp b/src/prefs/KeyConfigPrefs.cpp index 396a7a7e7..739295adb 100644 --- a/src/prefs/KeyConfigPrefs.cpp +++ b/src/prefs/KeyConfigPrefs.cpp @@ -43,6 +43,10 @@ KeyConfigPrefs and MousePrefs use. #include "../widgets/KeyView.h" #include "../widgets/ErrorDialog.h" +#if wxUSE_ACCESSIBILITY +#include "../widgets/WindowAccessible.h" +#endif + // // KeyConfigPrefs // @@ -159,6 +163,12 @@ void KeyConfigPrefs::PopulateOrExchange(ShuttleGui & S) if( mViewByName ) mViewByName->SetName(_("View by name")); mViewByKey = S.Id(ViewByKeyID).TieRadioButton(_("&Key"), wxT("key")); if( mViewByKey ) mViewByKey->SetName(_("View by key")); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mViewByTree->SetAccessible(safenew WindowAccessible(mViewByTree)); + mViewByName->SetAccessible(safenew WindowAccessible(mViewByName)); + mViewByKey->SetAccessible(safenew WindowAccessible(mViewByKey)); +#endif } S.EndRadioButtonGroup(); } @@ -224,7 +234,10 @@ void KeyConfigPrefs::PopulateOrExchange(ShuttleGui & S) wxSize(210, -1), #endif wxTE_PROCESS_ENTER); - +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mKey->SetAccessible(safenew WindowAccessible(mKey)); +#endif mKey->SetName(_("Short cut")); mKey->Bind(wxEVT_KEY_DOWN, &KeyConfigPrefs::OnHotkeyKeyDown, diff --git a/src/prefs/PrefsDialog.cpp b/src/prefs/PrefsDialog.cpp index d0f046973..b68bd444a 100644 --- a/src/prefs/PrefsDialog.cpp +++ b/src/prefs/PrefsDialog.cpp @@ -71,6 +71,10 @@ #include "../Theme.h" #include "../widgets/HelpSystem.h" +#if wxUSE_ACCESSIBILITY +#include "../widgets/WindowAccessible.h" +#endif + BEGIN_EVENT_TABLE(PrefsDialog, wxDialogWrapper) EVT_BUTTON(wxID_OK, PrefsDialog::OnOK) EVT_BUTTON(wxID_CANCEL, PrefsDialog::OnCancel) @@ -245,6 +249,10 @@ PrefsDialog::PrefsDialog wxASSERT(factories.size() > 0); if (!uniquePage) { mCategories = safenew wxTreebookExt(this, wxID_ANY, mTitlePrefix); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mCategories->GetTreeCtrl()->SetAccessible(safenew WindowAccessible(mCategories->GetTreeCtrl())); +#endif // RJH: Prevent NVDA from reading "treeCtrl" mCategories->GetTreeCtrl()->SetName(_("Category")); S.StartHorizontalLay(wxALIGN_LEFT | wxEXPAND, true); diff --git a/src/toolbars/DeviceToolBar.cpp b/src/toolbars/DeviceToolBar.cpp index 68c7565ee..319ea8d91 100644 --- a/src/toolbars/DeviceToolBar.cpp +++ b/src/toolbars/DeviceToolBar.cpp @@ -45,6 +45,10 @@ #include "../DeviceManager.h" #include "../widgets/ErrorDialog.h" +#if wxUSE_ACCESSIBILITY +#include "../widgets/WindowAccessible.h" +#endif + IMPLEMENT_CLASS(DeviceToolBar, ToolBar); //////////////////////////////////////////////////////////// @@ -93,7 +97,10 @@ void DeviceToolBar::Populate() wxID_ANY, wxDefaultPosition, wxDefaultSize); - +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mHost->SetAccessible(safenew WindowAccessible(mHost)); +#endif Add(mHost, 0, wxALIGN_CENTER); // Input device @@ -104,12 +111,20 @@ void DeviceToolBar::Populate() wxID_ANY, wxDefaultPosition, wxDefaultSize); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mInput->SetAccessible(safenew WindowAccessible(mInput)); +#endif // Input channels Add(mInput, 0, wxALIGN_CENTER); mInputChannels = safenew wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mInputChannels->SetAccessible(safenew WindowAccessible(mInputChannels)); +#endif Add(mInputChannels, 0, wxALIGN_CENTER); // Output device @@ -120,6 +135,10 @@ void DeviceToolBar::Populate() wxID_ANY, wxDefaultPosition, wxDefaultSize); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mOutput->SetAccessible(safenew WindowAccessible(mOutput)); +#endif Add(mOutput, 0, wxALIGN_CENTER); diff --git a/src/toolbars/SelectionBar.cpp b/src/toolbars/SelectionBar.cpp index ddf40df50..1787f80d5 100644 --- a/src/toolbars/SelectionBar.cpp +++ b/src/toolbars/SelectionBar.cpp @@ -57,6 +57,10 @@ with changes in the SelectionBar. #include "../widgets/NumericTextCtrl.h" #include "../AllThemeResources.h" +#if wxUSE_ACCESSIBILITY +#include "../widgets/WindowAccessible.h" +#endif + IMPLEMENT_CLASS(SelectionBar, ToolBar); const static wxChar *numbers[] = @@ -276,6 +280,10 @@ void SelectionBar::Populate() (this, ChoiceID, wxDefaultPosition, wxDefaultSize, 4, choices, 0, wxDefaultValidator, _("Show")); mChoice->SetSelection(0); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mChoice->SetAccessible(safenew WindowAccessible(mChoice)); +#endif #ifdef __WXGTK__ // Combo boxes are taller on Linux, and if we don't do the following, the selection toolbar will // be three units high. @@ -293,6 +301,10 @@ void SelectionBar::Populate() mRateBox = safenew wxComboBox(this, RateID, wxT(""), wxDefaultPosition, wxSize(80, -1)); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mRateBox->SetAccessible(safenew WindowAccessible(mRateBox)); +#endif mRateBox->SetName(_("Project Rate (Hz)")); //mRateBox->SetForegroundColour( clrText2 ); wxTextValidator vld(wxFILTER_INCLUDE_CHAR_LIST); @@ -352,6 +364,10 @@ void SelectionBar::Populate() mainSizer->Add(mSnapTo, 0, wxALIGN_TOP | wxRIGHT, 5); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mSnapTo->SetAccessible(safenew WindowAccessible(mSnapTo)); +#endif mSnapTo->SetName(_("Snap To")); //mSnapTo->SetForegroundColour( clrText2 ); mSnapTo->SetSelection(mListener ? mListener->AS_GetSnapTo() : SNAP_OFF); diff --git a/src/toolbars/SpectralSelectionBar.cpp b/src/toolbars/SpectralSelectionBar.cpp index bd8a3eb5b..b8c26c793 100644 --- a/src/toolbars/SpectralSelectionBar.cpp +++ b/src/toolbars/SpectralSelectionBar.cpp @@ -59,6 +59,10 @@ with changes in the SpectralSelectionBar. #include "../Experimental.h" #include "../Internat.h" +#if wxUSE_ACCESSIBILITY +#include "../widgets/WindowAccessible.h" +#endif + #ifdef EXPERIMENTAL_SPECTRAL_EDITING IMPLEMENT_CLASS(SpectralSelectionBar, ToolBar); @@ -148,6 +152,10 @@ void SpectralSelectionBar::Populate() (this, OnChoiceID, wxDefaultPosition, wxDefaultSize, 2, choices, 0, wxDefaultValidator, _("Spectral Selection")); mChoice->SetSelection(mbCenterAndWidth ? 0 : 1); +#if wxUSE_ACCESSIBILITY + // so that name can be set on a standard control + mChoice->SetAccessible(safenew WindowAccessible(mChoice)); +#endif #ifdef __WXGTK__ // Combo boxes are taller on Linux, and if we don't do the following, the selection toolbar will // be three units high.