mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-03 22:19:07 +02:00
Fix a few accessibility issues pointed out by David.
This commit is contained in:
parent
b093367648
commit
398b5153c7
@ -285,6 +285,10 @@ void KeyConfigPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||||||
if (mViewType == ViewByKey) {
|
if (mViewType == ViewByKey) {
|
||||||
mFilterLabel->SetLabel(_("&Hotkey:"));
|
mFilterLabel->SetLabel(_("&Hotkey:"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Need to layout so that the KeyView is properly sized before populating.
|
||||||
|
// Otherwise, the initial selection is not scrolled into view.
|
||||||
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyConfigPrefs::RefreshBindings()
|
void KeyConfigPrefs::RefreshBindings()
|
||||||
|
@ -560,6 +560,8 @@ KeyView::RefreshBindings(const wxArrayString & names,
|
|||||||
const wxArrayString & labels,
|
const wxArrayString & labels,
|
||||||
const wxArrayString & keys)
|
const wxArrayString & keys)
|
||||||
{
|
{
|
||||||
|
bool firsttime = mNodes.GetCount() == 0;
|
||||||
|
|
||||||
// Start clean
|
// Start clean
|
||||||
mNodes.Clear();
|
mNodes.Clear();
|
||||||
|
|
||||||
@ -750,6 +752,12 @@ KeyView::RefreshBindings(const wxArrayString & names,
|
|||||||
|
|
||||||
// Refresh the view lines
|
// Refresh the view lines
|
||||||
RefreshLines();
|
RefreshLines();
|
||||||
|
|
||||||
|
// Set the selected node if this was the first time through
|
||||||
|
if (firsttime)
|
||||||
|
{
|
||||||
|
SelectNode(LineToIndex(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1387,7 +1395,7 @@ KeyView::OnKeyDown(wxKeyEvent & event)
|
|||||||
int cnt = (int) mLines.GetCount();
|
int cnt = (int) mLines.GetCount();
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
// Search the entire list if not is currently selected
|
// Search the entire list if none is currently selected
|
||||||
if (line == wxNOT_FOUND)
|
if (line == wxNOT_FOUND)
|
||||||
{
|
{
|
||||||
line = cnt;
|
line = cnt;
|
||||||
@ -1742,7 +1750,7 @@ KeyView::GetLineHeight(int line)
|
|||||||
//
|
//
|
||||||
// Returns the value to be presented to accessibility
|
// Returns the value to be presented to accessibility
|
||||||
//
|
//
|
||||||
// Current, the command and key are both provided.
|
// Currently, the command and key are both provided.
|
||||||
//
|
//
|
||||||
wxString
|
wxString
|
||||||
KeyView::GetValue(int line)
|
KeyView::GetValue(int line)
|
||||||
@ -1753,18 +1761,20 @@ KeyView::GetValue(int line)
|
|||||||
wxASSERT(false);
|
wxASSERT(false);
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
int index = LineToIndex(line);
|
||||||
|
KeyNode *node = &mNodes[index];
|
||||||
|
|
||||||
// Get the label and key values
|
// Get the label and key values
|
||||||
wxString value;
|
wxString value;
|
||||||
if (mViewType == ViewByTree)
|
if (mViewType == ViewByTree)
|
||||||
{
|
{
|
||||||
value = GetLabel(LineToIndex(line));
|
value = GetLabel(index);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value = GetFullLabel(LineToIndex(line));
|
value = GetFullLabel(index);
|
||||||
}
|
}
|
||||||
wxString key = GetKey(LineToIndex(line));
|
wxString key = GetKey(index);
|
||||||
|
|
||||||
// Add the key if it isn't empty
|
// Add the key if it isn't empty
|
||||||
if (!key.IsEmpty())
|
if (!key.IsEmpty())
|
||||||
@ -1779,9 +1789,23 @@ KeyView::GetValue(int line)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (node->isparent)
|
||||||
|
{
|
||||||
|
value += wxString::Format(_(" Level %d"), node->depth).c_str();
|
||||||
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Returns the current view type
|
||||||
|
//
|
||||||
|
ViewByType
|
||||||
|
KeyView::GetViewType()
|
||||||
|
{
|
||||||
|
return mViewType;
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Accessibility provider for the KeyView class
|
// Accessibility provider for the KeyView class
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@ -2014,7 +2038,7 @@ KeyViewAx::GetRole(int childId, wxAccRole *role)
|
|||||||
if (childId == wxACC_SELF)
|
if (childId == wxACC_SELF)
|
||||||
{
|
{
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
*role = wxROLE_SYSTEM_OUTLINE;
|
*role = mView->GetViewType() == ViewByTree ? wxROLE_SYSTEM_OUTLINE : wxROLE_SYSTEM_LIST;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__WXMAC__)
|
#if defined(__WXMAC__)
|
||||||
@ -2026,7 +2050,7 @@ KeyViewAx::GetRole(int childId, wxAccRole *role)
|
|||||||
#if defined(__WXMAC__)
|
#if defined(__WXMAC__)
|
||||||
*role = wxROLE_SYSTEM_TEXT;
|
*role = wxROLE_SYSTEM_TEXT;
|
||||||
#else
|
#else
|
||||||
*role = wxROLE_SYSTEM_OUTLINEITEM;
|
*role = mView->GetViewType() == ViewByTree ? wxROLE_SYSTEM_OUTLINEITEM : wxROLE_SYSTEM_LISTITEM;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,6 +141,7 @@ private:
|
|||||||
bool IsExpanded(int line);
|
bool IsExpanded(int line);
|
||||||
wxCoord GetLineHeight(int line);
|
wxCoord GetLineHeight(int line);
|
||||||
wxString GetValue(int line);
|
wxString GetValue(int line);
|
||||||
|
ViewByType GetViewType();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user