GUI enhancement: hide right menu shorcuts on the fly

Make the option "Hide right shortcuts + ▼ ✕" (in Preferences->General->Menu) hide right menu shortcuts immediately.
This commit is contained in:
Don Ho 2025-01-14 11:19:07 +01:00
parent c2d1ec6c85
commit 3921812175
9 changed files with 74 additions and 42 deletions

View File

@ -972,8 +972,8 @@ Translation note:
<Item id="6134" name="Hide"/>
<Item id="6131" name="Menu"/>
<Item id="6122" name="Hide menu bar (use Alt or F10 key to toggle)"/>
<Item id="6132" name="Hide right shortcuts ▼ ✕ from the menu bar (Need to restart Notepad++)"/>
<Item id="6122" name="Hide (use Alt or F10 key to toggle)"/>
<Item id="6132" name="Hide right shortcuts ▼ ✕"/>
<Item id="6123" name="Localization"/>
</Global>
@ -1525,8 +1525,8 @@ Do you want to launch Notepad++ in Administrator mode?"/>
<ExitToUpdatePlugins title="Notepad++ is about to exit" message="If you click YES, you will quit Notepad++ to continue the operations.
Notepad++ will be restarted after all the operations are terminated.
Continue?"/>
<NeedToRestartToLoadPlugins title="Notepad++ need to be relaunched" message="You have to restart Notepad++ to load plugins you installed."/><!-- HowToReproduce: Import a plugin via menu "Settings->Import->Import Plugin(s)...". -->
<ChangeHistoryEnabledWarning title="Notepad++ need to be relaunched" message="You have to restart Notepad++ to enable Change History."/><!-- HowToReproduce: uncheck "Display Change History" via Preferences dialog "Marges/Border/Edge. -->
<NeedToRestartToLoadPlugins title="Notepad++ needs to be relaunched" message="You have to restart Notepad++ to load plugins you installed."/><!-- HowToReproduce: Import a plugin via menu "Settings->Import->Import Plugin(s)...". -->
<ChangeHistoryEnabledWarning title="Notepad++ needs to be relaunched" message="You have to restart Notepad++ to enable Change History."/><!-- HowToReproduce: uncheck "Display Change History" via Preferences dialog "Marges/Border/Edge. -->
<WindowsSessionExit title="Notepad++ - Windows session exit" message="Windows session is about to be terminated but you have some data unsaved. Do you want to exit Notepad++ now?"/>
<LanguageMenuCompactWarning title="Compact Language Menu" message="This option will be changed on the next launch."/><!-- HowToReproduce: toggle "Make language menu compact" via Preferences dialog "Language/Language Menu. -->
<SwitchUnsavedThemeWarning title="$STR_REPLACE$" message="Unsaved changes are about to be discarded!
@ -1558,6 +1558,7 @@ If you require the backward regex searching feature, consult the user manual for
<PrintError title="0" message="Cannot start printer document."/><!-- Use title="0" to use Windows OS default translated "Error" title. -->
<FindAutoChangeOfInSelectionWarning title="Search warning" message="The &quot;In selection&quot; checkbox state has been automatically modified.
Please verify the search condition before performing the action."/> <!-- HowToReproduce: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/14897#issuecomment-2564316224 -->
<Need2Restart2ShowMenuShortcuts title="Notepad++ needs to be restarted" message="Notepad++ needs to be restarted to show right menu shorcuts."/>
</MessageBox>
<ClipboardHistory>
<PanelTitle name="Clipboard History"/>

View File

@ -356,7 +356,7 @@ Translation note:
<Item id="10005" name="Move to Start"/>
<Item id="10006" name="Move to End"/>
<Item id="46001" name="Style Configurator..."/>
<Item id="46016" name="None (NormalText)"/>
<Item id="46016" name="None (Normal Text)"/>
<Item id="46250" name="Define your language..."/>
<Item id="46300" name="Open User Defined Language folder..."/>
<Item id="46301" name="Notepad++ User Defined Languages Collection"/>
@ -412,8 +412,8 @@ Translation note:
<Item id="11005" name="Path Z to A"/>
<Item id="11006" name="Type A to Z"/>
<Item id="11007" name="Type Z to A"/>
<Item id="11008" name="Size Smaller to Larger"/>
<Item id="11009" name="Size Larger to Smaller"/>
<Item id="11008" name="Content Length Ascending"/>
<Item id="11009" name="Content Length Descending"/>
</Commands>
</Main>
<TabBar>
@ -750,14 +750,14 @@ Translation note:
<Item id="44113" name="Apply Tab Color 3"/>
<Item id="44114" name="Apply Tab Color 4"/>
<Item id="44115" name="Apply Tab Color 5"/>
<Item id="11002" name="Sort By Name A to Z"/>
<Item id="11003" name="Sort By Name Z to A"/>
<Item id="11004" name="Sort By Path A to Z"/>
<Item id="11005" name="Sort By Path Z to A"/>
<Item id="11006" name="Sort By Type A to Z"/>
<Item id="11007" name="Sort By Type Z to A"/>
<Item id="11008" name="Sort By Size Smaller to Larger"/>
<Item id="11009" name="Sort By Size Larger to Smaller"/>
<Item id="11002" name="Sort by Name A to Z"/>
<Item id="11003" name="Sort by Name Z to A"/>
<Item id="11004" name="Sort by Path A to Z"/>
<Item id="11005" name="Sort by Path Z to A"/>
<Item id="11006" name="Sort by Type A to Z"/>
<Item id="11007" name="Sort by Type Z to A"/>
<Item id="11008" name="Sort by Content Length Ascending"/>
<Item id="11009" name="Sort by Content Length Descending"/>
</MainCommandNames>
</ShortcutMapper>
<ShortcutMapperSubDialg title="Shortcut">
@ -961,6 +961,7 @@ Translation note:
<Item id="6111" name="Show buttons on inactive tabs"/>
<Item id="6112" name="Show close button"/>
<Item id="6113" name="Double click to close document"/>
<Item id="6115" name="Enable pin tab feature"/>
<Item id="6118" name="Hide"/>
<Item id="6119" name="Multi-line"/>
<Item id="6120" name="Vertical"/>
@ -971,8 +972,8 @@ Translation note:
<Item id="6134" name="Hide"/>
<Item id="6131" name="Menu"/>
<Item id="6122" name="Hide menu bar (use Alt or F10 key to toggle)"/>
<Item id="6132" name="Hide right shortcuts ▼ ✕ from the menu bar (Need to restart Notepad++)"/>
<Item id="6122" name="Hide (use Alt or F10 key to toggle)"/>
<Item id="6132" name="Hide right shortcuts ▼ ✕"/>
<Item id="6123" name="Localization"/>
</Global>
@ -1101,6 +1102,7 @@ Translation note:
<Item id="4010" name="Registered extensions:"/>
</FileAssoc>
<Language title="Language">
<Item id="6505" name="Available items"/>
<Item id="6506" name="Disabled items"/>
@ -1523,8 +1525,8 @@ Do you want to launch Notepad++ in Administrator mode?"/>
<ExitToUpdatePlugins title="Notepad++ is about to exit" message="If you click YES, you will quit Notepad++ to continue the operations.
Notepad++ will be restarted after all the operations are terminated.
Continue?"/>
<NeedToRestartToLoadPlugins title="Notepad++ need to be relaunched" message="You have to restart Notepad++ to load plugins you installed."/><!-- HowToReproduce: Import a plugin via menu "Settings->Import->Import Plugin(s)...". -->
<ChangeHistoryEnabledWarning title="Notepad++ need to be relaunched" message="You have to restart Notepad++ to enable Change History."/><!-- HowToReproduce: uncheck "Display Change History" via Preferences dialog "Marges/Border/Edge. -->
<NeedToRestartToLoadPlugins title="Notepad++ needs to be relaunched" message="You have to restart Notepad++ to load plugins you installed."/><!-- HowToReproduce: Import a plugin via menu "Settings->Import->Import Plugin(s)...". -->
<ChangeHistoryEnabledWarning title="Notepad++ needs to be relaunched" message="You have to restart Notepad++ to enable Change History."/><!-- HowToReproduce: uncheck "Display Change History" via Preferences dialog "Marges/Border/Edge. -->
<WindowsSessionExit title="Notepad++ - Windows session exit" message="Windows session is about to be terminated but you have some data unsaved. Do you want to exit Notepad++ now?"/>
<LanguageMenuCompactWarning title="Compact Language Menu" message="This option will be changed on the next launch."/><!-- HowToReproduce: toggle "Make language menu compact" via Preferences dialog "Language/Language Menu. -->
<SwitchUnsavedThemeWarning title="$STR_REPLACE$" message="Unsaved changes are about to be discarded!
@ -1556,6 +1558,7 @@ If you require the backward regex searching feature, consult the user manual for
<PrintError title="0" message="Cannot start printer document."/><!-- Use title="0" to use Windows OS default translated "Error" title. -->
<FindAutoChangeOfInSelectionWarning title="Search warning" message="The &quot;In selection&quot; checkbox state has been automatically modified.
Please verify the search condition before performing the action."/> <!-- HowToReproduce: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/14897#issuecomment-2564316224 -->
<Need2Restart2ShowMenuShortcuts title="Notepad++ needs to be restarted" message="Notepad++ needs to be restarted to show right menu shorcuts."/>
</MessageBox>
<ClipboardHistory>
<PanelTitle name="Clipboard History"/>
@ -1691,7 +1694,7 @@ Find in all files but exclude folders tests, bin &amp;&amp; bin64:
Find in all files but exclude all folders log or logs recursively:
*.* !+\log*"/><!-- HowToReproduce: Tip of mouse hovered on "Filters" label in "Find in Files" section of Find dialog. -->
<find-in-files-select-folder value="Select a folder to search from"/><!-- HowToReproduce: Search > Find in Files > [...] -->
<find-in-files-dir-from-active-doc-tip value="Fill directory field based on active document"/><!-- HowToReproduce: Search > Find in Files > [<<] -->
<find-in-files-dir-from-active-doc-tip value="Fill Directory field based on active document"/><!-- HowToReproduce: Search > Find in Files > [<<] -->
<find-status-top-reached value="Find: Reached document beginning, first occurrence from the bottom found."/>
<find-status-end-reached value="Find: Reached document end, first occurrence from the top found."/>
<find-status-replaceinfiles-1-replaced value="Replace in Files: 1 occurrence was replaced"/>
@ -1827,6 +1830,7 @@ Click on &quot;?&quot; button on right to open website with User Manual."/>
C, C++, Java, C#, Objective-C, PHP, JavaScript, JSP, CSS, Perl, Rust, PowerShell and JSON.
If you select advanced mode but do not edit files in the aforementioned languages, the indentation will remain in basic mode."/>
<!-- Don't translate "Global override" and "Default Style" -->
<global-override-tip value="Enabling &quot;Global override&quot; here will override that parameter in all language styles. What you probably really want is to use the &quot;Default Style&quot; settings instead"/>
</MiscStrings>
</Native-Langue>

View File

@ -972,7 +972,7 @@ Translation note:
<Item id="6131" name="Menu"/>
<Item id="6122" name="Cacher (Alt ou F10 pour basculer)"/>
<Item id="6132" name="Cacher ▼ ✕ depuis le menu (nécessité de redémarrage)"/>
<Item id="6132" name="Cacher ▼ ✕"/>
<Item id="6123" name="Langue"/>
</Global>
@ -1549,6 +1549,7 @@ REMARQUE : Si vous choisissez de ne pas créer despaces réservés ou de les
Appuyez sur le bouton OK pour ouvrir la boîte de dialogue de recherche ou lui donner la priorité.
Si vous avez besoin de la fonction de recherche dexpression régulière inversée, consultez le manuel de lutilisateur pour savoir comment lactiver."/>
<Need2Restart2ShowMenuShortcuts title="Redémarrer Notepad++" message="Vous avez besoins de redémarrer Notepad++ afin d'afficher menu ▼ ✕ "/>
</MessageBox>
<ClipboardHistory>
<PanelTitle name="Historique du presse-papier"/>

View File

@ -927,7 +927,7 @@
<Item id="6121" name="關閉最後一個文件時關閉程式"/>
<Item id="6131" name="選單"/>
<Item id="6122" name="隱藏(用 Alt 或 F10 切換)"/>
<Item id="6132" name="隱藏選單中右邊的 ▼ ✕ 捷徑(需要重新啟動 Notepad++"/>
<Item id="6132" name="隱藏選單中右邊的 ▼ ✕ 捷徑"/>
<Item id="6123" name="語言"/>
<Item id="6125" name="文件切換器"/>
<Item id="6127" name="停用副檔名欄"/>
@ -1428,6 +1428,7 @@
請注意,如果你選擇不創建佔位欄或稍後關閉它們,工作階段檔案將在 Notepad++ 關閉時被修改。我們建議你現在備份工作階段檔案 &quot;session.xml&quot; 。"/>
<RTLvsDirectWrite title="無法執行「文字由右至左」指令" message="「文字由右至左」指令與「直接寫入」模式不相容。 請在偏好設定對話框的「其他」中停用「直接寫入」模式,然後重新​​啟動 Notepad++ 。"/>
<FileMemoryAllocationFailed title="例外狀況:檔案記憶體分配失敗" message="可能沒有足夠的連續可用記憶體供 Notepad++ 載入檔案。"/>
<Need2Restart2ShowMenuShortcuts title="重新啟動 Notepad++" message="Notepad++ 需要重新啟動才能顯示選單右邊捷徑。"/>
</MessageBox>
<ClipboardHistory>
<PanelTitle name="剪貼簿記錄"/>

View File

@ -791,23 +791,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
//Hide or show the right shortcuts "" "▼" "✕" of main menu bar
if (nppGUI._hideMenuRightShortcuts)
{
int nbRemoved = 0;
const int bufferSize = 64;
wchar_t buffer[bufferSize];
int nbItem = GetMenuItemCount(_mainMenuHandle);
for (int i = nbItem - 1; i >= 0; --i)
{
::GetMenuStringW(_mainMenuHandle, i, buffer, bufferSize, MF_BYPOSITION);
if (lstrcmp(buffer, L"") == 0 || lstrcmp(buffer, L"") == 0 || lstrcmp(buffer, L"") == 0)
{
::RemoveMenu(_mainMenuHandle, i, MF_BYPOSITION);
++nbRemoved;
}
if (nbRemoved == 3)
break;
}
if (nbRemoved > 0)
::DrawMenuBar(hwnd);
::SendMessage(_pPublicInterface->getHSelf(), NPPM_INTERNAL_HIDEMENURIGHTSHORTCUTS, 0, 0);
}
//

View File

@ -4100,6 +4100,30 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return TRUE;
}
case NPPM_INTERNAL_HIDEMENURIGHTSHORTCUTS:
{
if (nppParam.getNppGUI()._hideMenuRightShortcuts)
{
int nbRemoved = 0;
const int bufferSize = 64;
wchar_t buffer[bufferSize];
int nbItem = GetMenuItemCount(_mainMenuHandle);
for (int i = nbItem - 1; i >= 0; --i)
{
::GetMenuStringW(_mainMenuHandle, i, buffer, bufferSize, MF_BYPOSITION);
if (lstrcmp(buffer, L"") == 0 || lstrcmp(buffer, L"") == 0 || lstrcmp(buffer, L"") == 0)
{
::RemoveMenu(_mainMenuHandle, i, MF_BYPOSITION);
++nbRemoved;
}
if (nbRemoved == 3)
break;
}
if (nbRemoved > 0)
::DrawMenuBar(hwnd);
}
return TRUE;
}
default:
{

View File

@ -3117,7 +3117,7 @@ void Notepad_plus::command(int id)
pNativeSpeaker->messageBox("NeedToRestartToLoadPlugins",
_pPublicInterface->getHSelf(),
L"You have to restart Notepad++ to load plugins you installed.",
L"Notepad++ need to be relaunched",
L"Notepad++ needs to be relaunched",
MB_OK | MB_APPLMODAL);
}
break;

View File

@ -701,6 +701,22 @@ intptr_t CALLBACK GeneralSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_HIDERIGHTSHORTCUTSOFMENUBAR, BM_GETCHECK, 0, 0));
NppGUI& nppGUI = nppParam.getNppGUI();
nppGUI._hideMenuRightShortcuts = isChecked;
static bool isFirstShow = true;
if (isChecked)
{
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_HIDEMENURIGHTSHORTCUTS, 0, isChecked ? TRUE : FALSE);
}
else if (isFirstShow)
{
NativeLangSpeaker* pNativeSpeaker = nppParam.getNativeLangSpeaker();
pNativeSpeaker->messageBox("Need2Restart2ShowMenuShortcuts",
_hSelf,
L"Notepad++ needs to be restarted to show right menu shorcuts.",
L"Notepad++ need to be restarted",
MB_OK | MB_APPLMODAL);
isFirstShow = false;
}
}
return TRUE;
@ -2300,7 +2316,7 @@ intptr_t CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wPar
pNativeSpeaker->messageBox("ChangeHistoryEnabledWarning",
_hSelf,
L"You have to restart Notepad++ to enable Change History.",
L"Notepad++ need to be relaunched",
L"Notepad++ needs to be relaunched",
MB_OK | MB_APPLMODAL);
changeHistoryWarningHasBeenGiven = true;
@ -2332,7 +2348,7 @@ intptr_t CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wPar
pNativeSpeaker->messageBox("ChangeHistoryEnabledWarning",
_hSelf,
L"You have to restart Notepad++ to enable Change History.",
L"Notepad++ need to be relaunched",
L"Notepad++ needs to be relaunched",
MB_OK | MB_APPLMODAL);
changeHistoryWarningHasBeenGiven = true;

View File

@ -743,6 +743,7 @@
#define NPPM_INTERNAL_LWALIGN (NOTEPADPLUS_USER_INTERNAL + 104)
#define NPPM_INTERNAL_LWINDENT (NOTEPADPLUS_USER_INTERNAL + 105)
#define NPPM_INTERNAL_CHECKDOCSTATUS (NOTEPADPLUS_USER_INTERNAL + 106)
#define NPPM_INTERNAL_HIDEMENURIGHTSHORTCUTS (NOTEPADPLUS_USER_INTERNAL + 187)