1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-27 15:08:39 +01:00

Use a type distinction for key strings in normalized form...

... Such are not for display to the user.  They are appended to menu item
names to identify accelerators, and wxWidgets transforms them appropriately
for the operating system.
This commit is contained in:
Paul Licameli
2018-02-08 21:16:13 -05:00
parent 19014f22b7
commit e5052a1973
10 changed files with 256 additions and 236 deletions

View File

@@ -913,14 +913,14 @@ HitTestPreview SelectHandle::Preview
if (bMultiToolMode) {
// Look up the current key binding for Preferences.
// (Don't assume it's the default!)
wxString keyStr
(pProject->GetCommandManager()->GetKeyFromName(wxT("Preferences")));
if (keyStr.IsEmpty())
auto keyStr =
pProject->GetCommandManager()->GetKeyFromName(wxT("Preferences"))
.Display( true );
if (keyStr.empty())
// No keyboard preference defined for opening Preferences dialog
/* i18n-hint: These are the names of a menu and a command in that menu */
keyStr = _("Edit, Preferences...");
else
keyStr = KeyStringDisplay(keyStr);
/* i18n-hint: %s is usually replaced by "Ctrl+P" for Windows/Linux, "Command+," for Mac */
tip = wxString::Format(
_("Multi-Tool Mode: %s for Mouse and Keyboard Preferences."),

View File

@@ -125,30 +125,31 @@ BEGIN_POPUP_MENU(TrackMenuTable)
POPUP_MENU_ITEM(OnSetNameID, _("&Name..."), OnSetName)
POPUP_MENU_SEPARATOR()
POPUP_MENU_ITEM(
// It is not correct to use KeyStringDisplay here -- wxWidgets will apply
// its equivalent to the key names passed to menu functions.
// It is not correct to use NormalizedKeyString::Display here --
// wxWidgets will apply its equivalent to the key names passed to menu
// functions.
OnMoveUpID,
_("Move Track &Up") + wxT("\t") +
(GetActiveProject()->GetCommandManager()->
GetKeyFromName(wxT("TrackMoveUp"))),
GetKeyFromName(wxT("TrackMoveUp")).Raw()),
OnMoveTrack)
POPUP_MENU_ITEM(
OnMoveDownID,
_("Move Track &Down") + wxT("\t") +
(GetActiveProject()->GetCommandManager()->
GetKeyFromName(wxT("TrackMoveDown"))),
GetKeyFromName(wxT("TrackMoveDown")).Raw()),
OnMoveTrack)
POPUP_MENU_ITEM(
OnMoveTopID,
_("Move Track to &Top") + wxT("\t") +
(GetActiveProject()->GetCommandManager()->
GetKeyFromName(wxT("TrackMoveTop"))),
GetKeyFromName(wxT("TrackMoveTop")).Raw()),
OnMoveTrack)
POPUP_MENU_ITEM(
OnMoveBottomID,
_("Move Track to &Bottom") + wxT("\t") +
(GetActiveProject()->GetCommandManager()->
GetKeyFromName(wxT("TrackMoveBottom"))),
GetKeyFromName(wxT("TrackMoveBottom")).Raw()),
OnMoveTrack)
END_POPUP_MENU()