Improve some ambiguous commands naming in Shortcut Mapper

Separate command shortcut names and menu names.

Fix #8689, close #8690
This commit is contained in:
Udo Hoffmann 2020-08-11 16:27:03 +02:00 committed by Don HO
parent 03eebf8496
commit ddd2e5fd23
9 changed files with 319 additions and 122 deletions

View File

@ -440,7 +440,7 @@
<Item id="1934" name="Copy to Clipboard"/>
<Item id="2" name="Close"/>
</MD5FromTextDlg>
<SHA256FromFilesDlg title="Generate SHA-256 digest from files">
<Item id="1922" name="Choose files to generate SHA-256..."/>
<Item id="1924" name="Copy to Clipboard"/>
@ -452,7 +452,7 @@
<Item id="1934" name="Copy to Clipboard"/>
<Item id="2" name="Close"/>
</SHA256FromTextDlg>
<PluginsAdminDlg title="Plugins Admin" titleAvailable = "Available" titleUpdates = "Updates" titleInstalled = "Installed">
<ColumnPlugin name="Plugin"/>
<ColumnVersion name="Version"/>
@ -512,6 +512,66 @@
<ScintillaCommandsTab name="Scintilla commands"/>
<ConflictInfoOk name="No shortcut conflicts for this item."/>
<ConflictInfoEditing name="No conflicts . . ."/>
<MainCommandNames>
<Item id="41019" name="Open containing folder in Explorer"/>
<Item id="41020" name="Open containing folder in Command Prompt"/>
<Item id="41021" name="Restore Recent Closed File"/>
<Item id="45001" name="EOL Conversion to Windows (CR LF)"/>
<Item id="45002" name="EOL Conversion to Unix (LF)"/>
<Item id="45003" name="EOL Conversion to Macintosh (CR)"/>
<Item id="43022" name="Mark search results using 1st style"/>
<Item id="43024" name="Mark search results using 2nd style"/>
<Item id="43026" name="Mark search results using 3rd style"/>
<Item id="43028" name="Mark search results using 4th style"/>
<Item id="43030" name="Mark search results using 5th style"/>
<Item id="43023" name="Clear marks using 1st style"/>
<Item id="43025" name="Clear marks using 2nd style"/>
<Item id="43027" name="Clear marks using 3rd style"/>
<Item id="43029" name="Clear marks using 4th style"/>
<Item id="43031" name="Clear marks using 5th style"/>
<Item id="43032" name="Clear marks using any style"/>
<Item id="43033" name="Previous mark using 1st style"/>
<Item id="43034" name="Previous mark using 2nd style"/>
<Item id="43035" name="Previous mark using 3rd style"/>
<Item id="43036" name="Previous mark using 4th style"/>
<Item id="43037" name="Previous mark using 5th style"/>
<Item id="43038" name="Previous mark created with Mark..."/>
<Item id="43039" name="Next mark using 1st style"/>
<Item id="43040" name="Next mark using 2nd style"/>
<Item id="43041" name="Next mark using 3rd style"/>
<Item id="43042" name="Next mark using 4th style"/>
<Item id="43043" name="Next mark using 5th style"/>
<Item id="43044" name="Next mark created with Mark..."/>
<Item id="44100" name="View current file in Firefox"/>
<Item id="44101" name="View current file in Chrome"/>
<Item id="44103" name="View current file in IE"/>
<Item id="44102" name="View current file in Edge"/>
<Item id="50003" name="Switch to previous document"/>
<Item id="50004" name="Switch to next document"/>
<Item id="44051" name="Collapse Level 1"/>
<Item id="44052" name="Collapse Level 2"/>
<Item id="44053" name="Collapse Level 3"/>
<Item id="44054" name="Collapse Level 4"/>
<Item id="44055" name="Collapse Level 5"/>
<Item id="44056" name="Collapse Level 6"/>
<Item id="44057" name="Collapse Level 7"/>
<Item id="44058" name="Collapse Level 8"/>
<Item id="44061" name="Uncollapse Level 1"/>
<Item id="44062" name="Uncollapse Level 2"/>
<Item id="44063" name="Uncollapse Level 3"/>
<Item id="44064" name="Uncollapse Level 4"/>
<Item id="44065" name="Uncollapse Level 5"/>
<Item id="44066" name="Uncollapse Level 6"/>
<Item id="44067" name="Uncollapse Level 7"/>
<Item id="44068" name="Uncollapse Level 8"/>
<Item id="44081" name="Toggle Project Panel 1"/>
<Item id="44082" name="Toggle Project Panel 2"/>
<Item id="44083" name="Toggle Project Panel 3"/>
<Item id="44085" name="Toggle Folder as Workspace"/>
<Item id="44080" name="Toggle Document Map"/>
<Item id="44084" name="Toggle Function List"/>
<Item id="50005" name="Toggle macro recording"/>
</MainCommandNames>
</ShortcutMapper>
<ShortcutMapperSubDialg title="Shortcut">
<Item id="1" name="OK"/>
@ -1003,7 +1063,7 @@ You can define several column markers by using white space to separate the diffe
<Item id="1718" name="E&amp;xtended (\n, \r, \t, \0, \x...)"/>
<Item id="1720" name="&amp;. matches newline"/>
</FindInFinder>
<DoSaveOrNot title="Save">
<DoSaveOrNot title="Save">
<Item id="1761" name="Save file &quot;$STR_REPLACE$&quot; ?"/>
<Item id="6" name="&amp;Yes"/>
<Item id="7" name="&amp;No"/>
@ -1292,3 +1352,4 @@ Find in all files except exe, obj &amp;&amp; log:
</MiscStrings>
</Native-Langue>
</NotepadPlus>

View File

@ -120,6 +120,7 @@
<Item id="42064" name="Sort Lines As Decimals (Comma) Descending"/>
<Item id="42065" name="Sort Lines As Decimals (Dot) Ascending"/>
<Item id="42066" name="Sort Lines As Decimals (Dot) Descending"/>
<Item id="42078" name="Sort Lines Randomly"/>
<Item id="42016" name="&amp;UPPERCASE"/>
<Item id="42017" name="&amp;lowercase"/>
<Item id="42067" name="&amp;Proper Case"/>
@ -439,7 +440,7 @@
<Item id="1934" name="Copy to Clipboard"/>
<Item id="2" name="Close"/>
</MD5FromTextDlg>
<SHA256FromFilesDlg title="Generate SHA-256 digest from files">
<Item id="1922" name="Choose files to generate SHA-256..."/>
<Item id="1924" name="Copy to Clipboard"/>
@ -451,7 +452,7 @@
<Item id="1934" name="Copy to Clipboard"/>
<Item id="2" name="Close"/>
</SHA256FromTextDlg>
<PluginsAdminDlg title="Plugins Admin" titleAvailable = "Available" titleUpdates = "Updates" titleInstalled = "Installed">
<ColumnPlugin name="Plugin"/>
<ColumnVersion name="Version"/>
@ -511,6 +512,66 @@
<ScintillaCommandsTab name="Scintilla commands"/>
<ConflictInfoOk name="No shortcut conflicts for this item."/>
<ConflictInfoEditing name="No conflicts . . ."/>
<MainCommandNames>
<Item id="41019" name="Open containing folder in Explorer"/>
<Item id="41020" name="Open containing folder in Command Prompt"/>
<Item id="41021" name="Restore Recent Closed File"/>
<Item id="45001" name="EOL Conversion to Windows (CR LF)"/>
<Item id="45002" name="EOL Conversion to Unix (LF)"/>
<Item id="45003" name="EOL Conversion to Macintosh (CR)"/>
<Item id="43022" name="Mark search results using 1st style"/>
<Item id="43024" name="Mark search results using 2nd style"/>
<Item id="43026" name="Mark search results using 3rd style"/>
<Item id="43028" name="Mark search results using 4th style"/>
<Item id="43030" name="Mark search results using 5th style"/>
<Item id="43023" name="Clear marks using 1st style"/>
<Item id="43025" name="Clear marks using 2nd style"/>
<Item id="43027" name="Clear marks using 3rd style"/>
<Item id="43029" name="Clear marks using 4th style"/>
<Item id="43031" name="Clear marks using 5th style"/>
<Item id="43032" name="Clear marks using any style"/>
<Item id="43033" name="Previous mark using 1st style"/>
<Item id="43034" name="Previous mark using 2nd style"/>
<Item id="43035" name="Previous mark using 3rd style"/>
<Item id="43036" name="Previous mark using 4th style"/>
<Item id="43037" name="Previous mark using 5th style"/>
<Item id="43038" name="Previous mark created with Mark..."/>
<Item id="43039" name="Next mark using 1st style"/>
<Item id="43040" name="Next mark using 2nd style"/>
<Item id="43041" name="Next mark using 3rd style"/>
<Item id="43042" name="Next mark using 4th style"/>
<Item id="43043" name="Next mark using 5th style"/>
<Item id="43044" name="Next mark created with Mark..."/>
<Item id="44100" name="View current file in Firefox"/>
<Item id="44101" name="View current file in Chrome"/>
<Item id="44103" name="View current file in IE"/>
<Item id="44102" name="View current file in Edge"/>
<Item id="50003" name="Switch to previous document"/>
<Item id="50004" name="Switch to next document"/>
<Item id="44051" name="Collapse Level 1"/>
<Item id="44052" name="Collapse Level 2"/>
<Item id="44053" name="Collapse Level 3"/>
<Item id="44054" name="Collapse Level 4"/>
<Item id="44055" name="Collapse Level 5"/>
<Item id="44056" name="Collapse Level 6"/>
<Item id="44057" name="Collapse Level 7"/>
<Item id="44058" name="Collapse Level 8"/>
<Item id="44061" name="Uncollapse Level 1"/>
<Item id="44062" name="Uncollapse Level 2"/>
<Item id="44063" name="Uncollapse Level 3"/>
<Item id="44064" name="Uncollapse Level 4"/>
<Item id="44065" name="Uncollapse Level 5"/>
<Item id="44066" name="Uncollapse Level 6"/>
<Item id="44067" name="Uncollapse Level 7"/>
<Item id="44068" name="Uncollapse Level 8"/>
<Item id="44081" name="Toggle Project Panel 1"/>
<Item id="44082" name="Toggle Project Panel 2"/>
<Item id="44083" name="Toggle Project Panel 3"/>
<Item id="44085" name="Toggle Folder as Workspace"/>
<Item id="44080" name="Toggle Document Map"/>
<Item id="44084" name="Toggle Function List"/>
<Item id="50005" name="Toggle macro recording"/>
</MainCommandNames>
</ShortcutMapper>
<ShortcutMapperSubDialg title="Shortcut">
<Item id="1" name="OK"/>
@ -756,6 +817,7 @@ You can define several column markers by using white space to separate the diffe
<Item id="6231" name="Border Width"/>
<Item id="6235" name="No edge"/>
<Item id="6236" name="Enable scrolling beyond last line"/>
<Item id="6239" name="Keep selection when right-click outside of selection"/>
</Scintillas>
<NewDoc title="New Document">
@ -842,6 +904,11 @@ You can define several column markers by using white space to separate the diffe
<Item id="6728" name="Header and Footer"/>
</Print>
<Searching title="Searching">
<Item id="6901" name="Don't fill find field in Find dialog with selected word"/>
<Item id="6902" name="Use monospaced font in Find dialog (Need to restart Notepad++)"/>
</Searching>
<RecentFilesHistory title="Recent Files History">
<Item id="6304" name="Recent Files History"/>
<Item id="6306" name="Max. number of entries :"/>
@ -943,14 +1010,13 @@ You can define several column markers by using white space to separate the diffe
<Item id="6324" name="Document Switcher (Ctrl+TAB)"/>
<Item id="6331" name="Show only filename in title bar"/>
<Item id="6334" name="Autodetect character encoding"/>
<Item id="6314" name="Use monospaced font in Find dialog (Need to restart Notepad++)"/>
<Item id="6349" name="Use DirectWrite (May improve rendering special characters, need to restart Notepad++)"/>
<Item id="6337" name="Workspace file ext.:"/>
<Item id="6114" name="Enable"/>
<Item id="6117" name="Enable MRU behaviour"/>
<Item id="6344" name="Document Peeker"/>
<Item id="6345" name="Peek on tab"/>
<Item id="6346" name="Peek on document map"/>
<Item id="6348" name="Don't fill find field in Find dialog with selected word"/>
</MISC>
</Preference>
<MultiMacro title="Run a Macro Multiple Times">
@ -969,17 +1035,17 @@ You can define several column markers by using white space to separate the diffe
<Item id="7004" name="Sort &amp;tabs"/>
</Window>
<ColumnEditor title="Column Editor">
<Item id="2023" name="Text to Insert"/>
<Item id="2033" name="Number to Insert"/>
<Item id="2030" name="Initial number :"/>
<Item id="2031" name="Increase by :"/>
<Item id="2035" name="Leading zeros"/>
<Item id="2036" name="Repeat :"/>
<Item id="2032" name="Format"/>
<Item id="2024" name="Dec"/>
<Item id="2025" name="Oct"/>
<Item id="2026" name="Hex"/>
<Item id="2027" name="Bin"/>
<Item id="2023" name="&amp;Text to Insert"/>
<Item id="2033" name="&amp;Number to Insert"/>
<Item id="2030" name="&amp;Initial number :"/>
<Item id="2031" name="Increase b&amp;y :"/>
<Item id="2035" name="Leading &amp;zeros"/>
<Item id="2036" name="&amp;Repeat :"/>
<Item id="2032" name="&amp;Format"/>
<Item id="2024" name="&amp;Dec"/>
<Item id="2025" name="&amp;Oct"/>
<Item id="2026" name="&amp;Hex"/>
<Item id="2027" name="&amp;Bin"/>
<Item id="1" name="OK"/>
<Item id="2" name="Cancel"/>
</ColumnEditor>
@ -996,7 +1062,7 @@ You can define several column markers by using white space to separate the diffe
<Item id="1718" name="E&amp;xtended (\n, \r, \t, \0, \x...)"/>
<Item id="1720" name="&amp;. matches newline"/>
</FindInFinder>
<DoSaveOrNot title="Save">
<DoSaveOrNot title="Save">
<Item id="1761" name="Save file &quot;$STR_REPLACE$&quot; ?"/>
<Item id="6" name="&amp;Yes"/>
<Item id="7" name="&amp;No"/>
@ -1234,6 +1300,10 @@ Find in all files except exe, obj &amp;&amp; log:
<find-status-replace-not-found value="Replace: no occurrence was found"/>
<find-status-replace-readonly value="Replace: Cannot replace text. The current document is read only"/>
<find-status-cannot-find value="Find: Can't find the text &quot;$STR_REPLACE$&quot;"/>
<find-status-scope-selection value="in selected text"/>
<find-status-scope-all value="in entire file"/>
<find-status-scope-backward value="from start-of-file to caret"/>
<find-status-scope-forward value="from caret to end-of-file"/>
<finder-find-in-finder value="Find in this found results..."/>
<finder-close-this value="Close this finder"/>
<finder-collapse-all value="Collapse all"/>
@ -1268,11 +1338,15 @@ Find in all files except exe, obj &amp;&amp; log:
<replace-in-files-confirm-title value="Are you sure?"/>
<replace-in-files-confirm-directory value="Are you sure you want to replace all occurrences in :"/>
<replace-in-files-confirm-filetype value="For file type :"/>
<replace-in-open-docs-confirm-title value="Are you sure?"/>
<replace-in-open-docs-confirm-message value="Are you sure you want to replace all occurrences in all open documents?"/>
<find-result-caption value="Find result"/>
<find-result-title value="Search"/>
<find-result-title-info value="($INT_REPLACE1$ hits in $INT_REPLACE2$ files of $INT_REPLACE3$ searched)"/>
<find-result-title-info-selections value="($INT_REPLACE1$ hits in $INT_REPLACE2$ selections of $INT_REPLACE3$ searched)"/>
<find-result-title-info-extra value=" - Line Filter Mode: only display the filtered results"/>
<find-result-hits value="($INT_REPLACE$ hits)"/>
<find-regex-zero-length-match value="zero length match" />
</MiscStrings>
</Native-Langue>
</NotepadPlus>

View File

@ -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<CommandShortcut> & 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<CommandShortcut> & 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<CommandShortcut> & 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());
}
}

View File

@ -635,6 +635,7 @@ private:
};
void monitoringStartOrStopAndUpdateUI(Buffer* pBuf, bool isStarting);
void updateCommandShortcuts();
};

View File

@ -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 }

View File

@ -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)

View File

@ -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;
};

View File

@ -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)

View File

@ -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);