From 6e65596b477fca63fa6cf3f0536f3b2fd540b719 Mon Sep 17 00:00:00 2001 From: James Crook Date: Sun, 7 May 2017 10:59:50 +0100 Subject: [PATCH] Bug 1641 - Panel navigation accelerators don't appear in the menus This attempted fix applies the 'space' trick to make accelerators invalid, so "Left" is added as " Left" into the menus, and appears normal but does not act as an accelerator. This is now only done for the problematic accelerators rather than for all accelerators. It's believed that doing it for all accelerators caused the problem. In debug builds users will see messages like the one below in the console: "Unrecognized accel key ' right', accel string ignored." This fix additionally adds 0..9 to the specially handled accelerators. This should address: Bug 1260 - Cant type "1" in the Project Rate text box The fix has been developed and tested on Window only. Theoretically the space might cause problems on Mac and if it does the 'space' trick could be applied just on Windows and Linux, since Mac did not seem to have the problem reported in 1260. --- src/commands/CommandManager.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/commands/CommandManager.cpp b/src/commands/CommandManager.cpp index cca72f8f6..83111b886 100644 --- a/src/commands/CommandManager.cpp +++ b/src/commands/CommandManager.cpp @@ -975,9 +975,13 @@ wxString CommandManager::GetLabelWithDisabledAccel(const CommandListEntry *entry { wxString label = entry->label; #if 1 + wxString Accel = ""; do{ if (!entry->key.IsEmpty()) { + // Dummy accelerator that looks Ok in menus but is non functional. + // Note the space before the key. + Accel = wxString("\t ") + entry->key; if( entry->key.StartsWith("Left" )) break; if( entry->key.StartsWith("Right")) break; if( entry->key.StartsWith("Up" )) break; @@ -985,15 +989,29 @@ wxString CommandManager::GetLabelWithDisabledAccel(const CommandListEntry *entry if( entry->key.StartsWith("Return")) break; if( entry->key.StartsWith("Tab")) break; if( entry->key.StartsWith("Shift+Tab")) break; + if( entry->key.StartsWith("0")) break; + if( entry->key.StartsWith("1")) break; + if( entry->key.StartsWith("2")) break; + if( entry->key.StartsWith("3")) break; + if( entry->key.StartsWith("4")) break; + if( entry->key.StartsWith("5")) break; + if( entry->key.StartsWith("6")) break; + if( entry->key.StartsWith("7")) break; + if( entry->key.StartsWith("8")) break; + if( entry->key.StartsWith("9")) break; + // No accelerator. + Accel = ""; //if( entry->key.StartsWith("Space" )) break; -// These ones appear ot be illegal and mess up accelerator processing. + // These ones appear to be illegal and mess up accelerator processing. if( entry->key.StartsWith("NUMPAD_ENTER" )) break; if( entry->key.StartsWith("Backspace" )) break; if( entry->key.StartsWith("Delete" )) break; - label += wxT("\t") + entry->key; //wxLogDebug("Added Accel:[%s][%s]", entry->label, entry->key ); + // Normal accelerator. + Accel = wxString("\t") + entry->key; } } while (false ); + label += Accel; #endif return label; } @@ -1203,6 +1221,16 @@ bool CommandManager::FilterKeyEvent(AudacityProject *project, const wxKeyEvent & case WXK_RETURN: case WXK_NUMPAD_ENTER: case WXK_DELETE: + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': return false; } }