From 063c56be30eeaf2412da6d21d42d37c35a35cfbc Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 24 Sep 2011 19:15:29 +0200 Subject: [PATCH] Use accelerators from hot keys in place menu, from the Fabrizio's idea --- common/hotkeys_basic.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/common/hotkeys_basic.cpp b/common/hotkeys_basic.cpp index 53908c71a9..6269d3a5b3 100644 --- a/common/hotkeys_basic.cpp +++ b/common/hotkeys_basic.cpp @@ -179,17 +179,20 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound ) * for instance zoom action is ran from the F1 key or the Zoom menu. * a zoom uses the mouse position from a hot key and not from the menu * In this case, the accelerator if Shift+ - * But for some keys, the Shift modifier is not usable, and the accelerator is Alt+ + * But for many keys, the Shift modifier is not usable, and the accelerator is Alt+ */ static void AddModifierToKey( wxString& aFullKey, const wxString & aKey ) { -#if 1 // set to 0 for new behavior, 1 for old +#if 0 // set to 0 for new behavior, 1 for old aFullKey << wxT( " <" ) << aKey << wxT( ">" ); #else - if( aKey.IsSameAs(wxT( "/" ) ) ) - aFullKey << wxT( "\t" ) << MODIFIER_ALT << aKey; - else + if( (aKey.Length() == 1) && (aKey[0] >= 'A') && (aKey[0] <= 'Z')) + // We can use Shift+ as accelerator ans for hot key aFullKey << wxT( "\t" ) << MODIFIER_SHIFT << aKey; + else + // We must use Alt+ as accelerator ans for hot key + aFullKey << wxT( "\t" ) << MODIFIER_ALT << aKey; + #endif }