Commit 063c56be authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Use accelerators from hot keys in place menu, from the Fabrizio's idea

parent 2d761f30
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -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+<hotkey>
 * But for some keys, the Shift modifier is not usable, and the accelerator is Alt+<hotkey>
 * But for many keys, the Shift modifier is not usable, and the accelerator is Alt+<hotkey>
 */
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+<key> as accelerator ans <key> for hot key
        aFullKey << wxT( "\t" ) << MODIFIER_SHIFT << aKey;
    else
        // We must use Alt+<key> as accelerator ans <key> for hot key
        aFullKey << wxT( "\t" ) << MODIFIER_ALT << aKey;

#endif
}