1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-27 15:53:49 +01:00

Fix off by one in accessibility.

Fix moving to next entry when pressing a key.
Fix hotkey edit box not accepting "RETURN" key
This commit is contained in:
lllucius
2013-10-02 16:36:53 +00:00
parent 55384ff5e0
commit 3d0bbdf787
2 changed files with 27 additions and 15 deletions

View File

@@ -237,10 +237,12 @@ void KeyConfigPrefs::PopulateOrExchange(ShuttleGui & S)
wxT(""), wxT(""),
wxDefaultPosition, wxDefaultPosition,
#if defined(__WXMAC__) #if defined(__WXMAC__)
wxSize(300, -1)); wxSize(300, -1),
#else #else
wxSize(210, -1)); wxSize(210, -1),
#endif #endif
wxTE_PROCESS_ENTER);
mKey->SetName(_("Short cut")); mKey->SetName(_("Short cut"));
mKey->Connect(wxEVT_KEY_DOWN, mKey->Connect(wxEVT_KEY_DOWN,
wxKeyEventHandler(KeyConfigPrefs::OnHotkeyKeyDown), wxKeyEventHandler(KeyConfigPrefs::OnHotkeyKeyDown),

View File

@@ -913,7 +913,7 @@ KeyView::RefreshLines()
} }
// Now, reassign the line numbers // Now, reassign the line numbers
for (int i = 0; i < mLines.GetCount(); i++) for (int i = 0; i < (int) mLines.GetCount(); i++)
{ {
mLines[i]->line = i; mLines[i]->line = i;
} }
@@ -1366,17 +1366,22 @@ KeyView::OnKeyDown(wxKeyEvent & event)
wxString label; wxString label;
// Get the string to search based on view type // Get the string to search based on view type
if (mViewType == ViewByKey) if (mViewType == ViewByTree)
{ {
label = GetKey(LineToIndex(i)); label = GetLabel(LineToIndex(i));
} }
else else if (mViewType == ViewByName)
{ {
label = GetFullLabel(LineToIndex(i)); label = GetFullLabel(LineToIndex(i));
} }
else if (mViewType == ViewByKey)
{
label = GetKey(LineToIndex(i));
}
// Move selection if they match // Move selection if they match
if (label.Left(1).IsSameAs(keycode, false)) { if (label.Left(1).IsSameAs(keycode, false))
{
SelectNode(LineToIndex(i)); SelectNode(LineToIndex(i));
found = true; found = true;
@@ -1395,17 +1400,22 @@ KeyView::OnKeyDown(wxKeyEvent & event)
wxString label; wxString label;
// Get the string to search based on view type // Get the string to search based on view type
if (mViewType == ViewByKey) if (mViewType == ViewByTree)
{ {
label = GetKey(LineToIndex(i)); label = GetLabel(LineToIndex(i));
} }
else else if (mViewType == ViewByName)
{ {
label = GetFullLabel(LineToIndex(i)); label = GetFullLabel(LineToIndex(i));
} }
else if (mViewType == ViewByKey)
{
label = GetKey(LineToIndex(i));
}
// Move selection if they match // Move selection if they match
if (label.Left(1).IsSameAs(keycode, false)) { if (label.Left(1).IsSameAs(keycode, false))
{
SelectNode(LineToIndex(i)); SelectNode(LineToIndex(i));
found = true; found = true;
@@ -1592,7 +1602,7 @@ KeyView::CmpKeyNodeByName(KeyNode ***n1, KeyNode ***n2)
// This will force them to the end, but still allow them to be sorted in // This will force them to the end, but still allow them to be sorted in
// ascending order. // ascending order.
// //
// This assigned entries simply get sorted as normal. // The assigned entries simply get sorted as normal.
// //
int int
KeyView::CmpKeyNodeByKey(KeyNode ***n1, KeyNode ***n2) KeyView::CmpKeyNodeByKey(KeyNode ***n1, KeyNode ***n2)
@@ -1770,7 +1780,7 @@ KeyViewAx::SetCurrentLine(int line)
if (line != wxNOT_FOUND) if (line != wxNOT_FOUND)
{ {
// Convert line number to childId // Convert line number to childId
LineToId(line + 1, mLastId); LineToId(line, mLastId);
// Send notifications that the line has focus // Send notifications that the line has focus
NotifyEvent(wxACC_EVENT_OBJECT_FOCUS, NotifyEvent(wxACC_EVENT_OBJECT_FOCUS,
@@ -1811,7 +1821,7 @@ bool
KeyViewAx::LineToId(int line, int & childId) KeyViewAx::LineToId(int line, int & childId)
{ {
// Convert to line // Convert to line
childId = line - 1; childId = line + 1;
return true; return true;
} }
@@ -1898,7 +1908,7 @@ KeyViewAx::GetLocation(wxRect & rect, int elementId)
rectLine.width = mView->GetClientSize().GetWidth(); rectLine.width = mView->GetClientSize().GetWidth();
// iterate over all visible lines // iterate over all visible lines
for (int i = 0; i <= line; i++) for (int i = 0; i < line; i++)
{ {
wxCoord hLine = mView->GetLineHeight(i); wxCoord hLine = mView->GetLineHeight(i);