1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 08:09:32 +02:00

Implement translation of shortcut key names to Mac special chars

This commit is contained in:
Paul Licameli 2016-06-11 20:26:25 -04:00
parent de8d0e9918
commit 8dfaa4dcf8
2 changed files with 17 additions and 5 deletions

View File

@ -43,13 +43,25 @@ wxString KeyStringNormalize(const wxString & key)
#endif
}
wxString KeyStringDisplay(const wxString & key)
wxString KeyStringDisplay(const wxString & key, bool useSspecialChars)
{
wxString newkey = KeyStringNormalize(key);
#if defined(__WXMAC__)
newkey.Replace(wxT("XCtrl+"), wxT("Control+"));
newkey.Replace(wxT("Alt+"), wxT("Option+"));
newkey.Replace(wxT("Ctrl+"), wxT("Command+"));
if (!useSspecialChars) {
// Compose user-visible keystroke names, all ASCII
newkey.Replace(wxT("XCtrl+"), wxT("Control+"));
newkey.Replace(wxT("Alt+"), wxT("Option+"));
newkey.Replace(wxT("Ctrl+"), wxT("Command+"));
}
else {
// Compuse user-visible keystroke names, with special characters
newkey.Replace(wxT("Shift+"), wxT("\u21e7"));
newkey.Replace(wxT("XCtrl+"), wxT("Control+"));
newkey.Replace(wxT("Alt+"), wxT("\u2325"));
newkey.Replace(wxT("Ctrl+"), wxT("\u2318"));
}
#endif
return newkey;

View File

@ -14,5 +14,5 @@
#include <wx/string.h>
wxString KeyStringNormalize(const wxString & key);
wxString KeyStringDisplay(const wxString & key);
wxString KeyStringDisplay(const wxString & key, bool useSpecialChars = false);
wxString KeyEventToKeyString(const wxKeyEvent & keyEvent);