mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-26 06:31:13 +01:00
Applied accessibility patch from David that I missed.
From David's message: "solution to the problem of getting jaws to read the updated name after choosing start/stop monitoring on the menu"
This commit is contained in:
@@ -233,7 +233,8 @@ Meter::Meter(AudacityProject *project,
|
||||
mNumBars(0),
|
||||
mLayoutValid(false),
|
||||
mBitmap(NULL),
|
||||
mIcon(NULL)
|
||||
mIcon(NULL),
|
||||
mAccSilent(false)
|
||||
{
|
||||
mStyle = mDesiredStyle;
|
||||
|
||||
@@ -1913,8 +1914,22 @@ void Meter::ShowMenu(const wxPoint & pos)
|
||||
|
||||
menu->Append(OnPreferencesID, _("Preferences..."));
|
||||
|
||||
mAccSilent = true; // temporarily make screen readers say (close to) nothing on focus events
|
||||
|
||||
PopupMenu(menu, pos);
|
||||
|
||||
/* if stop/start monitoring was chosen in the menu, then by this point
|
||||
OnMonitoring has been called and variables which affect the accessibility
|
||||
name have been updated so it's now ok for screen readers to read the name of
|
||||
the button */
|
||||
mAccSilent = false;
|
||||
#if wxUSE_ACCESSIBILITY
|
||||
GetAccessible()->NotifyEvent(wxACC_EVENT_OBJECT_FOCUS,
|
||||
this,
|
||||
wxOBJID_CLIENT,
|
||||
wxACC_SELF);
|
||||
#endif
|
||||
|
||||
delete menu;
|
||||
}
|
||||
|
||||
@@ -2195,6 +2210,13 @@ wxAccStatus MeterAx::GetName(int WXUNUSED(childId), wxString* name)
|
||||
{
|
||||
Meter *m = wxDynamicCast(GetWindow(), Meter);
|
||||
|
||||
if (m->mAccSilent)
|
||||
{
|
||||
*name = wxT(""); // Jaws reads nothing, and nvda reads "unknown"
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
*name = m->GetName();
|
||||
if (name->IsEmpty())
|
||||
{
|
||||
@@ -2234,6 +2256,7 @@ wxAccStatus MeterAx::GetName(int WXUNUSED(childId), wxString* name)
|
||||
{
|
||||
*name += wxString::Format(_(" Clipped "));
|
||||
}
|
||||
}
|
||||
|
||||
return wxACC_OK;
|
||||
}
|
||||
@@ -2241,6 +2264,11 @@ wxAccStatus MeterAx::GetName(int WXUNUSED(childId), wxString* name)
|
||||
// Returns a role constant.
|
||||
wxAccStatus MeterAx::GetRole(int WXUNUSED(childId), wxAccRole* role)
|
||||
{
|
||||
Meter *m = wxDynamicCast(GetWindow(), Meter);
|
||||
|
||||
if (m->mAccSilent)
|
||||
*role = wxROLE_NONE; // Jaws and nvda both read nothing
|
||||
else
|
||||
*role = wxROLE_SYSTEM_BUTTONDROPDOWN;
|
||||
|
||||
return wxACC_OK;
|
||||
|
||||
@@ -274,6 +274,8 @@ class Meter : public wxPanel
|
||||
bool mHadKeyDown;
|
||||
#endif
|
||||
|
||||
bool mAccSilent;
|
||||
|
||||
friend class MeterAx;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
Reference in New Issue
Block a user