diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml
index f38816105..daf2346c7 100644
--- a/PowerEditor/installer/nativeLang/english.xml
+++ b/PowerEditor/installer/nativeLang/english.xml
@@ -440,7 +440,7 @@
-
+
@@ -452,7 +452,7 @@
-
+
@@ -512,6 +512,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1003,7 +1063,7 @@ You can define several column markers by using white space to separate the diffe
-
+
@@ -1292,3 +1352,4 @@ Find in all files except exe, obj && log:
+
diff --git a/PowerEditor/installer/nativeLang/english_customizable.xml b/PowerEditor/installer/nativeLang/english_customizable.xml
index d4b8e7d9b..6e191c11f 100644
--- a/PowerEditor/installer/nativeLang/english_customizable.xml
+++ b/PowerEditor/installer/nativeLang/english_customizable.xml
@@ -120,6 +120,7 @@
+
@@ -439,7 +440,7 @@
-
+
@@ -451,7 +452,7 @@
-
+
@@ -511,6 +512,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -756,6 +817,7 @@ You can define several column markers by using white space to separate the diffe
+
@@ -842,6 +904,11 @@ You can define several column markers by using white space to separate the diffe
+
+
+
+
+
@@ -943,14 +1010,13 @@ You can define several column markers by using white space to separate the diffe
-
+
-
@@ -969,17 +1035,17 @@ You can define several column markers by using white space to separate the diffe
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -996,7 +1062,7 @@ You can define several column markers by using white space to separate the diffe
-
+
@@ -1234,6 +1300,10 @@ Find in all files except exe, obj && log:
+
+
+
+
@@ -1268,11 +1338,15 @@ Find in all files except exe, obj && log:
+
+
+
+
diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp
index 6d146a99c..cc7f955ea 100644
--- a/PowerEditor/src/Notepad_plus.cpp
+++ b/PowerEditor/src/Notepad_plus.cpp
@@ -551,28 +551,8 @@ LRESULT Notepad_plus::init(HWND hwnd)
}
}
- //Input all the menu item names into shortcut list
- //This will automatically do all translations, since menu translation has been done already
- vector & shortcuts = nppParam.getUserShortcuts();
- len = shortcuts.size();
+ updateCommandShortcuts();
- for (size_t i = 0; i < len; ++i)
- {
- CommandShortcut & csc = shortcuts[i];
- if (!csc.getName()[0])
- { //no predefined name, get name from menu and use that
- ::GetMenuString(_mainMenuHandle, csc.getID(), menuName, 64, MF_BYCOMMAND);
- csc.setName(purgeMenuItemString(menuName, true).c_str());
- }
- else
- {
- // The menu name is already present (e.g. "Restore recent close file")
- // Now get the localized name if possible
- generic_string localizedMenuName = _nativeLangSpeaker.getNativeLangMenuString(csc.getID());
- if(!localizedMenuName.empty())
- csc.setName(purgeMenuItemString(localizedMenuName.c_str(), true).c_str());
- }
- }
//Translate non-menu shortcuts
_nativeLangSpeaker.changeShortcutLang();
@@ -5779,25 +5759,8 @@ bool Notepad_plus::reloadLang()
}
}
- vector & shortcuts = nppParam.getUserShortcuts();
- len = shortcuts.size();
+ updateCommandShortcuts();
- for (size_t i = 0; i < len; ++i)
- {
- CommandShortcut & csc = shortcuts[i];
- // If menu item is not present (e.g. "Restore recent close file" might not present initially)
- // then fill the localized string directly
- if (::GetMenuString(_mainMenuHandle, csc.getID(), menuName, 64, MF_BYCOMMAND))
- {
- csc.setName(purgeMenuItemString(menuName, true).c_str());
- }
- else
- {
- generic_string localizedMenuName = _nativeLangSpeaker.getNativeLangMenuString(csc.getID());
- if (!localizedMenuName.empty())
- csc.setName(purgeMenuItemString(localizedMenuName.c_str(), true).c_str());
- }
- }
_accelerator.updateFullMenu();
_scintaccelerator.updateKeys();
@@ -7122,3 +7085,58 @@ void Notepad_plus::monitoringStartOrStopAndUpdateUI(Buffer* pBuf, bool isStartin
pBuf->setUserReadOnly(isStarting);
}
}
+
+// Fill names into the shortcut list.
+// Each command shortcut has two names:
+// - The menu name, to be displayed in the menu
+// - The shortcut name, to be displayed in the shortcut list
+//
+// The names are filled in with the following priorities:
+// * Menu name
+// 1. From xml Menu/Main/Commands section
+// 2. From menu resource in Notepad_plus.rc
+// 3. From winKeyDefs[] table in Parameter.cpp
+// We don't use xml ShortCutMapper/MainCommandNames here
+//
+// * Shortcut name
+// 1. From xml ShortCutMapper/MainCommandNames section
+// 2. From xml file Menu/Main/Commands section
+// 3. From the winKeyDefs[] table in Parameter.cpp
+// 4. From the menu resource in Notepad_plus.rc
+
+void Notepad_plus::updateCommandShortcuts()
+{
+ NppParameters& nppParam = NppParameters::getInstance();
+ vector & shortcuts = nppParam.getUserShortcuts();
+ size_t len = shortcuts.size();
+
+ for (size_t i = 0; i < len; ++i)
+ {
+ CommandShortcut & csc = shortcuts[i];
+ unsigned long id = csc.getID();
+ generic_string localizedMenuName = _nativeLangSpeaker.getNativeLangMenuString(id);
+ generic_string menuName = localizedMenuName;
+ generic_string shortcutName = _nativeLangSpeaker.getShortcutNameString(id);
+
+ if (menuName.length() == 0)
+ {
+ TCHAR szMenuName[64];
+ if (::GetMenuString(_mainMenuHandle, csc.getID(), szMenuName, _countof(szMenuName), MF_BYCOMMAND))
+ menuName = purgeMenuItemString(szMenuName, true);
+ else
+ menuName = csc.getShortcutName();
+ }
+
+ if (shortcutName.length() == 0)
+ {
+ if (localizedMenuName.length() > 0)
+ shortcutName = localizedMenuName;
+ else if (csc.getShortcutName()[0])
+ shortcutName = csc.getShortcutName();
+ else
+ shortcutName = menuName;
+ }
+
+ csc.setName(menuName.c_str(), shortcutName.c_str());
+ }
+}
diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h
index 7317b293d..f306b95be 100644
--- a/PowerEditor/src/Notepad_plus.h
+++ b/PowerEditor/src/Notepad_plus.h
@@ -635,6 +635,7 @@ private:
};
void monitoringStartOrStopAndUpdateUI(Buffer* pBuf, bool isStarting);
+ void updateCommandShortcuts();
};
diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp
index 0ffc4a7ea..c22ff5b9c 100644
--- a/PowerEditor/src/Parameters.cpp
+++ b/PowerEditor/src/Parameters.cpp
@@ -81,8 +81,8 @@ static const WinMenuKeyDefinition winKeyDefs[] =
//
{ VK_N, IDM_FILE_NEW, true, false, false, nullptr },
{ VK_O, IDM_FILE_OPEN, true, false, false, nullptr },
- { VK_NULL, IDM_FILE_OPEN_FOLDER, false, false, false, nullptr },
- { VK_NULL, IDM_FILE_OPEN_CMD, false, false, false, nullptr },
+ { VK_NULL, IDM_FILE_OPEN_FOLDER, false, false, false, TEXT("Open containing folder in Explorer") },
+ { VK_NULL, IDM_FILE_OPEN_CMD, false, false, false, TEXT("Open containing folder in Command Prompt") },
{ VK_NULL, IDM_FILE_OPEN_DEFAULT_VIEWER, false, false, false, nullptr },
{ VK_NULL, IDM_FILE_OPENFOLDERASWORSPACE, false, false, false, nullptr },
{ VK_R, IDM_FILE_RELOAD, true, false, false, nullptr },
@@ -154,9 +154,9 @@ static const WinMenuKeyDefinition winKeyDefs[] =
{ VK_SPACE, IDM_EDIT_AUTOCOMPLETE_PATH, true, true, false, nullptr },
{ VK_RETURN, IDM_EDIT_AUTOCOMPLETE_CURRENTFILE, true, false, false, nullptr },
{ VK_SPACE, IDM_EDIT_FUNCCALLTIP, true, false, true, nullptr },
- { VK_NULL, IDM_FORMAT_TODOS, false, false, false, nullptr },
- { VK_NULL, IDM_FORMAT_TOUNIX, false, false, false, nullptr },
- { VK_NULL, IDM_FORMAT_TOMAC, false, false, false, nullptr },
+ { VK_NULL, IDM_FORMAT_TODOS, false, false, false, TEXT("EOL Conversion to Windows (CR LF)") },
+ { VK_NULL, IDM_FORMAT_TOUNIX, false, false, false, TEXT("EOL Conversion to Unix (LF)") },
+ { VK_NULL, IDM_FORMAT_TOMAC, false, false, false, TEXT("EOL Conversion to Macintosh (CR)") },
{ VK_NULL, IDM_EDIT_TRIMTRAILING, false, false, false, nullptr },
{ VK_NULL, IDM_EDIT_TRIMLINEHEAD, false, false, false, nullptr },
{ VK_NULL, IDM_EDIT_TRIM_BOTH, false, false, false, nullptr },
@@ -197,29 +197,29 @@ static const WinMenuKeyDefinition winKeyDefs[] =
{ VK_B, IDM_SEARCH_GOTOMATCHINGBRACE, true, false, false, nullptr },
{ VK_B, IDM_SEARCH_SELECTMATCHINGBRACES, true, true, false, nullptr },
{ VK_M, IDM_SEARCH_MARK, true, false, false, nullptr },
- { VK_NULL, IDM_SEARCH_MARKALLEXT1, false, false, false, nullptr },
- { VK_NULL, IDM_SEARCH_MARKALLEXT2, false, false, false, nullptr },
- { VK_NULL, IDM_SEARCH_MARKALLEXT3, false, false, false, nullptr },
- { VK_NULL, IDM_SEARCH_MARKALLEXT4, false, false, false, nullptr },
- { VK_NULL, IDM_SEARCH_MARKALLEXT5, false, false, false, nullptr },
- { VK_NULL, IDM_SEARCH_UNMARKALLEXT1, false, false, false, nullptr },
- { VK_NULL, IDM_SEARCH_UNMARKALLEXT2, false, false, false, nullptr },
- { VK_NULL, IDM_SEARCH_UNMARKALLEXT3, false, false, false, nullptr },
- { VK_NULL, IDM_SEARCH_UNMARKALLEXT4, false, false, false, nullptr },
- { VK_NULL, IDM_SEARCH_UNMARKALLEXT5, false, false, false, nullptr },
- { VK_NULL, IDM_SEARCH_CLEARALLMARKS, false, false, false, nullptr },
- { VK_1, IDM_SEARCH_GOPREVMARKER1, true, false, true, nullptr },
- { VK_2, IDM_SEARCH_GOPREVMARKER2, true, false, true, nullptr },
- { VK_3, IDM_SEARCH_GOPREVMARKER3, true, false, true, nullptr },
- { VK_4, IDM_SEARCH_GOPREVMARKER4, true, false, true, nullptr },
- { VK_5, IDM_SEARCH_GOPREVMARKER5, true, false, true, nullptr },
- { VK_0, IDM_SEARCH_GOPREVMARKER_DEF, true, false, true, nullptr },
- { VK_1, IDM_SEARCH_GONEXTMARKER1, true, false, false, nullptr },
- { VK_2, IDM_SEARCH_GONEXTMARKER2, true, false, false, nullptr },
- { VK_3, IDM_SEARCH_GONEXTMARKER3, true, false, false, nullptr },
- { VK_4, IDM_SEARCH_GONEXTMARKER4, true, false, false, nullptr },
- { VK_5, IDM_SEARCH_GONEXTMARKER5, true, false, false, nullptr },
- { VK_0, IDM_SEARCH_GONEXTMARKER_DEF, true, false, false, nullptr },
+ { VK_NULL, IDM_SEARCH_MARKALLEXT1, false, false, false, TEXT("Mark search results using 1st style") },
+ { VK_NULL, IDM_SEARCH_MARKALLEXT2, false, false, false, TEXT("Mark search results using 2nd style") },
+ { VK_NULL, IDM_SEARCH_MARKALLEXT3, false, false, false, TEXT("Mark search results using 3rd style") },
+ { VK_NULL, IDM_SEARCH_MARKALLEXT4, false, false, false, TEXT("Mark search results using 4th style") },
+ { VK_NULL, IDM_SEARCH_MARKALLEXT5, false, false, false, TEXT("Mark search results using 5th style") },
+ { VK_NULL, IDM_SEARCH_UNMARKALLEXT1, false, false, false, TEXT("Clear marks using 1st style") },
+ { VK_NULL, IDM_SEARCH_UNMARKALLEXT2, false, false, false, TEXT("Clear marks using 2nd style") },
+ { VK_NULL, IDM_SEARCH_UNMARKALLEXT3, false, false, false, TEXT("Clear marks using 3rd style") },
+ { VK_NULL, IDM_SEARCH_UNMARKALLEXT4, false, false, false, TEXT("Clear marks using 4th style") },
+ { VK_NULL, IDM_SEARCH_UNMARKALLEXT5, false, false, false, TEXT("Clear marks using 5th style") },
+ { VK_NULL, IDM_SEARCH_CLEARALLMARKS, false, false, false, TEXT("Clear marks using any style") },
+ { VK_1, IDM_SEARCH_GOPREVMARKER1, true, false, true, TEXT("Previous mark using 1st style") },
+ { VK_2, IDM_SEARCH_GOPREVMARKER2, true, false, true, TEXT("Previous mark using 2nd style") },
+ { VK_3, IDM_SEARCH_GOPREVMARKER3, true, false, true, TEXT("Previous mark using 3rd style") },
+ { VK_4, IDM_SEARCH_GOPREVMARKER4, true, false, true, TEXT("Previous mark using 4th style") },
+ { VK_5, IDM_SEARCH_GOPREVMARKER5, true, false, true, TEXT("Previous mark using 5th style") },
+ { VK_0, IDM_SEARCH_GOPREVMARKER_DEF, true, false, true, TEXT("Previous mark created with Mark...") },
+ { VK_1, IDM_SEARCH_GONEXTMARKER1, true, false, false, TEXT("Next mark using 1st style") },
+ { VK_2, IDM_SEARCH_GONEXTMARKER2, true, false, false, TEXT("Next mark using 2nd style") },
+ { VK_3, IDM_SEARCH_GONEXTMARKER3, true, false, false, TEXT("Next mark using 3rd style") },
+ { VK_4, IDM_SEARCH_GONEXTMARKER4, true, false, false, TEXT("Next mark using 4th style") },
+ { VK_5, IDM_SEARCH_GONEXTMARKER5, true, false, false, TEXT("Next mark using 5th style") },
+ { VK_0, IDM_SEARCH_GONEXTMARKER_DEF, true, false, false, TEXT("Next mark created with Mark...") },
{ VK_F2, IDM_SEARCH_TOGGLE_BOOKMARK, true, false, false, nullptr },
{ VK_F2, IDM_SEARCH_NEXT_BOOKMARK, false, false, false, nullptr },
@@ -237,10 +237,10 @@ static const WinMenuKeyDefinition winKeyDefs[] =
{ VK_F11, IDM_VIEW_FULLSCREENTOGGLE, false, false, false, nullptr },
{ VK_F12, IDM_VIEW_POSTIT, false, false, false, nullptr },
- { VK_NULL, IDM_VIEW_IN_FIREFOX, false, false, false, nullptr },
- { VK_NULL, IDM_VIEW_IN_CHROME, false, false, false, nullptr },
- { VK_NULL, IDM_VIEW_IN_IE, false, false, false, nullptr },
- { VK_NULL, IDM_VIEW_IN_EDGE, false, false, false, nullptr },
+ { VK_NULL, IDM_VIEW_IN_FIREFOX, false, false, false, TEXT("View current file in Firefox") },
+ { VK_NULL, IDM_VIEW_IN_CHROME, false, false, false, TEXT("View current file in Chrome") },
+ { VK_NULL, IDM_VIEW_IN_IE, false, false, false, TEXT("View current file in IE") },
+ { VK_NULL, IDM_VIEW_IN_EDGE, false, false, false, TEXT("View current file in Edge") },
{ VK_NULL, IDM_VIEW_TAB_SPACE, false, false, false, nullptr },
{ VK_NULL, IDM_VIEW_EOL, false, false, false, nullptr },
@@ -278,30 +278,30 @@ static const WinMenuKeyDefinition winKeyDefs[] =
{ VK_0, IDM_VIEW_TOGGLE_UNFOLDALL, false, true, true, nullptr },
{ VK_F, IDM_VIEW_FOLD_CURRENT, true, true, false, nullptr },
{ VK_F, IDM_VIEW_UNFOLD_CURRENT, true, true, true, nullptr },
- { VK_1, IDM_VIEW_FOLD_1, false, true, false, nullptr },
- { VK_2, IDM_VIEW_FOLD_2, false, true, false, nullptr },
- { VK_3, IDM_VIEW_FOLD_3, false, true, false, nullptr },
- { VK_4, IDM_VIEW_FOLD_4, false, true, false, nullptr },
- { VK_5, IDM_VIEW_FOLD_5, false, true, false, nullptr },
- { VK_6, IDM_VIEW_FOLD_6, false, true, false, nullptr },
- { VK_7, IDM_VIEW_FOLD_7, false, true, false, nullptr },
- { VK_8, IDM_VIEW_FOLD_8, false, true, false, nullptr },
+ { VK_1, IDM_VIEW_FOLD_1, false, true, false, TEXT("Collapse Level 1") },
+ { VK_2, IDM_VIEW_FOLD_2, false, true, false, TEXT("Collapse Level 2") },
+ { VK_3, IDM_VIEW_FOLD_3, false, true, false, TEXT("Collapse Level 3") },
+ { VK_4, IDM_VIEW_FOLD_4, false, true, false, TEXT("Collapse Level 4") },
+ { VK_5, IDM_VIEW_FOLD_5, false, true, false, TEXT("Collapse Level 5") },
+ { VK_6, IDM_VIEW_FOLD_6, false, true, false, TEXT("Collapse Level 6") },
+ { VK_7, IDM_VIEW_FOLD_7, false, true, false, TEXT("Collapse Level 7") },
+ { VK_8, IDM_VIEW_FOLD_8, false, true, false, TEXT("Collapse Level 8") },
- { VK_1, IDM_VIEW_UNFOLD_1, false, true, true, nullptr },
- { VK_2, IDM_VIEW_UNFOLD_2, false, true, true, nullptr },
- { VK_3, IDM_VIEW_UNFOLD_3, false, true, true, nullptr },
- { VK_4, IDM_VIEW_UNFOLD_4, false, true, true, nullptr },
- { VK_5, IDM_VIEW_UNFOLD_5, false, true, true, nullptr },
- { VK_6, IDM_VIEW_UNFOLD_6, false, true, true, nullptr },
- { VK_7, IDM_VIEW_UNFOLD_7, false, true, true, nullptr },
- { VK_8, IDM_VIEW_UNFOLD_8, false, true, true, nullptr },
+ { VK_1, IDM_VIEW_UNFOLD_1, false, true, true, TEXT("Uncollapse Level 1") },
+ { VK_2, IDM_VIEW_UNFOLD_2, false, true, true, TEXT("Uncollapse Level 2") },
+ { VK_3, IDM_VIEW_UNFOLD_3, false, true, true, TEXT("Uncollapse Level 3") },
+ { VK_4, IDM_VIEW_UNFOLD_4, false, true, true, TEXT("Uncollapse Level 4") },
+ { VK_5, IDM_VIEW_UNFOLD_5, false, true, true, TEXT("Uncollapse Level 5") },
+ { VK_6, IDM_VIEW_UNFOLD_6, false, true, true, TEXT("Uncollapse Level 6") },
+ { VK_7, IDM_VIEW_UNFOLD_7, false, true, true, TEXT("Uncollapse Level 7") },
+ { VK_8, IDM_VIEW_UNFOLD_8, false, true, true, TEXT("Uncollapse Level 8") },
{ VK_NULL, IDM_VIEW_SUMMARY, false, false, false, nullptr },
- { VK_NULL, IDM_VIEW_PROJECT_PANEL_1, false, false, false, nullptr },
- { VK_NULL, IDM_VIEW_PROJECT_PANEL_2, false, false, false, nullptr },
- { VK_NULL, IDM_VIEW_PROJECT_PANEL_3, false, false, false, nullptr },
- { VK_NULL, IDM_VIEW_FILEBROWSER, false, false, false, nullptr },
- { VK_NULL, IDM_VIEW_DOC_MAP, false, false, false, nullptr },
- { VK_NULL, IDM_VIEW_FUNC_LIST, false, false, false, nullptr },
+ { VK_NULL, IDM_VIEW_PROJECT_PANEL_1, false, false, false, TEXT("Toggle Project Panel 1") },
+ { VK_NULL, IDM_VIEW_PROJECT_PANEL_2, false, false, false, TEXT("Toggle Project Panel 2") },
+ { VK_NULL, IDM_VIEW_PROJECT_PANEL_3, false, false, false, TEXT("Toggle Project Panel 3") },
+ { VK_NULL, IDM_VIEW_FILEBROWSER, false, false, false, TEXT("Toggle Folder as Workspace") },
+ { VK_NULL, IDM_VIEW_DOC_MAP, false, false, false, TEXT("Toggle Document Map") },
+ { VK_NULL, IDM_VIEW_FUNC_LIST, false, false, false, TEXT("Toggle Function List") },
{ VK_NULL, IDM_VIEW_SYNSCROLLV, false, false, false, nullptr },
{ VK_NULL, IDM_VIEW_SYNSCROLLH, false, false, false, nullptr },
{ VK_R, IDM_EDIT_RTL, true, true, false, nullptr },
@@ -379,7 +379,7 @@ static const WinMenuKeyDefinition winKeyDefs[] =
{ VK_NULL, IDM_SETTING_IMPORTSTYLETHEMS, false, false, false, nullptr },
{ VK_NULL, IDM_SETTING_EDITCONTEXTMENU, false, false, false, nullptr },
- { VK_R, IDC_EDIT_TOGGLEMACRORECORDING, true, false, true, TEXT("Toggle macro record")},
+ { VK_R, IDC_EDIT_TOGGLEMACRORECORDING, true, false, true, TEXT("Toggle macro recording")},
{ VK_NULL, IDM_MACRO_STARTRECORDINGMACRO, false, false, false, nullptr },
{ VK_NULL, IDM_MACRO_STOPRECORDINGMACRO, false, false, false, nullptr },
{ VK_P, IDM_MACRO_PLAYBACKRECORDEDMACRO, true, false, true, nullptr },
@@ -395,8 +395,12 @@ static const WinMenuKeyDefinition winKeyDefs[] =
{ VK_NULL, IDM_FORUM, false, false, false, nullptr },
{ VK_NULL, IDM_ONLINESUPPORT, false, false, false, nullptr },
// { VK_NULL, IDM_PLUGINSHOME, false, false, false, nullptr },
- { VK_NULL, IDM_UPDATE_NPP, false, false, false, nullptr },
- { VK_NULL, IDM_CONFUPDATERPROXY, false, false, false, nullptr },
+
+ // The following two commands are not in menu if (nppGUI._doesExistUpdater == 0).
+ // They cannot be derived from menu then, only for this reason the text is specified here.
+ // In localized environments, the text comes preferably from xml Menu/Main/Commands.
+ { VK_NULL, IDM_UPDATE_NPP, false, false, false, TEXT("Update Notepad++") },
+ { VK_NULL, IDM_CONFUPDATERPROXY, false, false, false, TEXT("Set Updater Proxy...") },
{ VK_NULL, IDM_DEBUGINFO, false, false, false, nullptr },
{ VK_F1, IDM_ABOUT, false, false, false, nullptr }
// { VK_F1, IDM_HELP, false, false, true, nullptr }
diff --git a/PowerEditor/src/WinControls/shortcut/shortcut.cpp b/PowerEditor/src/WinControls/shortcut/shortcut.cpp
index 35227dfcc..1511fad42 100644
--- a/PowerEditor/src/WinControls/shortcut/shortcut.cpp
+++ b/PowerEditor/src/WinControls/shortcut/shortcut.cpp
@@ -168,10 +168,10 @@ generic_string Shortcut::toString() const
return sc;
}
-void Shortcut::setName(const TCHAR * name)
+void Shortcut::setName(const TCHAR * menuName, const TCHAR * shortcutName)
{
- lstrcpyn(_menuName, name, nameLenMax);
- lstrcpyn(_name, name, nameLenMax);
+ lstrcpyn(_menuName, menuName, nameLenMax);
+ TCHAR const * name = shortcutName ? shortcutName : menuName;
int i = 0, j = 0;
while (name[j] != 0 && i < nameLenMax)
{
@@ -386,7 +386,7 @@ INT_PTR CALLBACK Shortcut::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
{
case WM_INITDIALOG :
{
- ::SetDlgItemText(_hSelf, IDC_NAME_EDIT, getMenuName()); //display the menu name, with ampersands
+ ::SetDlgItemText(_hSelf, IDC_NAME_EDIT, _canModifyName ? getMenuName() : getName()); //display the menu name, with ampersands, for macros
if (!_canModifyName)
::SendDlgItemMessage(_hSelf, IDC_NAME_EDIT, EM_SETREADONLY, TRUE, 0);
auto textlen = ::SendDlgItemMessage(_hSelf, IDC_NAME_EDIT, WM_GETTEXTLENGTH, 0, 0);
@@ -1139,6 +1139,7 @@ INT_PTR CALLBACK ScintillaKeyMap::run_dlgProc(UINT Message, WPARAM wParam, LPARA
CommandShortcut::CommandShortcut(const Shortcut& sc, long id) : Shortcut(sc), _id(id)
{
+ _shortcutName = sc.getName();
if ( _id < IDM_EDIT)
_category = TEXT("File");
else if ( _id < IDM_SEARCH)
diff --git a/PowerEditor/src/WinControls/shortcut/shortcut.h b/PowerEditor/src/WinControls/shortcut/shortcut.h
index 38617c8c6..4d048667f 100644
--- a/PowerEditor/src/WinControls/shortcut/shortcut.h
+++ b/PowerEditor/src/WinControls/shortcut/shortcut.h
@@ -99,7 +99,7 @@ public:
};
Shortcut(const Shortcut & sc) {
- setName(sc.getMenuName());
+ setName(sc.getMenuName(), sc.getName());
_keyCombo = sc._keyCombo;
_canModifyName = sc._canModifyName;
}
@@ -112,7 +112,7 @@ public:
//Do not allow setting empty names
//So either we have an empty name or the other name has to be set
if (_name[0] == 0 || sc._name[0] != 0) {
- setName(sc.getMenuName());
+ setName(sc.getMenuName(), sc.getName());
}
_keyCombo = sc._keyCombo;
this->_canModifyName = sc._canModifyName;
@@ -173,7 +173,7 @@ public:
return _menuName;
}
- void setName(const TCHAR * name);
+ void setName(const TCHAR * menuName, const TCHAR * shortcutName = NULL);
void clear(){
_keyCombo._isCtrl = false;
@@ -198,10 +198,12 @@ public:
unsigned long getID() const {return _id;};
void setID(unsigned long id) { _id = id;};
const TCHAR * getCategory() const { return _category.c_str(); };
+ const TCHAR * getShortcutName() const { return _shortcutName.c_str(); };
private :
unsigned long _id;
generic_string _category;
+ generic_string _shortcutName;
};
diff --git a/PowerEditor/src/localization.cpp b/PowerEditor/src/localization.cpp
index 8106a344a..f20d3885f 100644
--- a/PowerEditor/src/localization.cpp
+++ b/PowerEditor/src/localization.cpp
@@ -211,6 +211,40 @@ generic_string NativeLangSpeaker::getNativeLangMenuString(int itemID) const
return TEXT("");
}
+generic_string NativeLangSpeaker::getShortcutNameString(int itemID) const
+{
+ if (!_nativeLangA)
+ return TEXT("");
+
+ TiXmlNodeA *node = _nativeLangA->FirstChild("Dialog");
+ if (!node) return TEXT("");
+
+ node = node->FirstChild("ShortcutMapper");
+ if (!node) return TEXT("");
+
+ node = node->FirstChild("MainCommandNames");
+ if (!node) return TEXT("");
+
+ WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
+
+ for (TiXmlNodeA *childNode = node->FirstChildElement("Item");
+ childNode ;
+ childNode = childNode->NextSibling("Item") )
+ {
+ TiXmlElementA *element = childNode->ToElement();
+ int id;
+ if (element->Attribute("id", &id) && (id == itemID))
+ {
+ const char *name = element->Attribute("name");
+ if (name)
+ {
+ return wmc.char2wchar(name, _nativeLangEncoding);
+ }
+ }
+ }
+ return TEXT("");
+}
+
generic_string NativeLangSpeaker::getLocalizedStrFromID(const char *strID, const generic_string& defaultString) const
{
if (not _nativeLangA)
diff --git a/PowerEditor/src/localization.h b/PowerEditor/src/localization.h
index e0c7b4e3d..2e01c59dc 100644
--- a/PowerEditor/src/localization.h
+++ b/PowerEditor/src/localization.h
@@ -58,6 +58,8 @@ public:
void changeLangTabDrapContextMenu(HMENU hCM);
generic_string getSpecialMenuEntryName(const char *entryName) const;
generic_string getNativeLangMenuString(int itemID) const;
+ generic_string getShortcutNameString(int itemID) const;
+
void changeMenuLang(HMENU menuHandle, generic_string & pluginsTrans, generic_string & windowTrans);
void changeShortcutLang();
void changeStyleCtrlsLang(HWND hDlg, int *idArray, const char **translatedText);