Add an option for hiding the + ▼ ✕ from the menu bar

Fix #11945
This commit is contained in:
Don Ho 2022-07-30 02:26:27 +02:00
parent 6077604380
commit 7d5516e0a8
9 changed files with 74 additions and 26 deletions

View File

@ -864,7 +864,9 @@ The comments are here for explanation, it's not necessary to translate them.
<Item id="6120" name="Vertical"/> <Item id="6120" name="Vertical"/>
<Item id="6121" name="Exit on close the last tab"/> <Item id="6121" name="Exit on close the last tab"/>
<Item id="6131" name="Menu"/>
<Item id="6122" name="Hide menu bar (use Alt or F10 key to toggle)"/> <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="6123" name="Localization"/> <Item id="6123" name="Localization"/>
<Item id="6128" name="Alternate icons"/> <Item id="6128" name="Alternate icons"/>

View File

@ -863,8 +863,9 @@ The comments are here for explanation, it's not necessary to translate them.
<Item id="6119" name="Multiligne"/> <Item id="6119" name="Multiligne"/>
<Item id="6120" name="Verticale"/> <Item id="6120" name="Verticale"/>
<Item id="6121" name="Quitter lors de la fermeture du dernier onglet"/> <Item id="6121" name="Quitter lors de la fermeture du dernier onglet"/>
<Item id="6131" name="Menu"/>
<Item id="6122" name="Cacher (Alt ou F10 pour basculer)"/> <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="6123" name="Langue"/> <Item id="6123" name="Langue"/>
<Item id="6128" name="Icônes alternatives"/> <Item id="6128" name="Icônes alternatives"/>

View File

@ -854,7 +854,9 @@
<Item id="6119" name="多行"/> <Item id="6119" name="多行"/>
<Item id="6120" name="直式"/> <Item id="6120" name="直式"/>
<Item id="6121" name="關閉最後一個文件時關閉程式"/> <Item id="6121" name="關閉最後一個文件時關閉程式"/>
<Item id="6131" name="選單"/>
<Item id="6122" name="隱藏(用 Alt 或 F10 切換)"/> <Item id="6122" name="隱藏(用 Alt 或 F10 切換)"/>
<Item id="6132" name="隱藏選單中右邊的 ▼ ✕ 捷徑(需要重新啟動 Notepad++"/>
<Item id="6123" name="語言"/> <Item id="6123" name="語言"/>
<Item id="6125" name="文件切換器"/> <Item id="6125" name="文件切換器"/>
<Item id="6127" name="停用副檔名欄"/> <Item id="6127" name="停用副檔名欄"/>

View File

@ -686,6 +686,28 @@ LRESULT Notepad_plus::init(HWND hwnd)
checkMenuItem(IDM_LANG_USER_DLG, uddShow); checkMenuItem(IDM_LANG_USER_DLG, uddShow);
_toolBar.setCheck(IDM_LANG_USER_DLG, uddShow); _toolBar.setCheck(IDM_LANG_USER_DLG, uddShow);
//Hide or show the right shortcuts "" "▼" "✕" of main menu bar
if (nppGUI._hideMenuRightShortcuts)
{
int nbRemoved = 0;
const int bufferSize = 64;
TCHAR 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);
}
// //
// Initialize the default foreground & background color // Initialize the default foreground & background color
// //

View File

@ -5543,6 +5543,10 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
const TCHAR * optEnableFoldCmdToggable = element->Attribute(TEXT("enableFoldCmdToggable")); const TCHAR * optEnableFoldCmdToggable = element->Attribute(TEXT("enableFoldCmdToggable"));
if (optEnableFoldCmdToggable) if (optEnableFoldCmdToggable)
_nppGUI._enableFoldCmdToggable = lstrcmp(optEnableFoldCmdToggable, TEXT("yes")) == 0; _nppGUI._enableFoldCmdToggable = lstrcmp(optEnableFoldCmdToggable, TEXT("yes")) == 0;
const TCHAR * hideMenuRightShortcuts = element->Attribute(TEXT("hideMenuRightShortcuts"));
if (hideMenuRightShortcuts)
_nppGUI._hideMenuRightShortcuts = lstrcmp(hideMenuRightShortcuts, TEXT("yes")) == 0;
} }
else if (!lstrcmp(nm, TEXT("commandLineInterpreter"))) else if (!lstrcmp(nm, TEXT("commandLineInterpreter")))
{ {
@ -6665,6 +6669,7 @@ void NppParameters::createXmlTreeFromGUIParams()
GUIConfigElement->SetAttribute(TEXT("saveDlgExtFilterToAllTypes"), _nppGUI._setSaveDlgExtFiltToAllTypes ? TEXT("yes") : TEXT("no")); GUIConfigElement->SetAttribute(TEXT("saveDlgExtFilterToAllTypes"), _nppGUI._setSaveDlgExtFiltToAllTypes ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("muteSounds"), _nppGUI._muteSounds ? TEXT("yes") : TEXT("no")); GUIConfigElement->SetAttribute(TEXT("muteSounds"), _nppGUI._muteSounds ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("enableFoldCmdToggable"), _nppGUI._enableFoldCmdToggable ? TEXT("yes") : TEXT("no")); GUIConfigElement->SetAttribute(TEXT("enableFoldCmdToggable"), _nppGUI._enableFoldCmdToggable ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("hideMenuRightShortcuts"), _nppGUI._hideMenuRightShortcuts ? TEXT("yes") : TEXT("no"));
} }
// <GUIConfig name="Searching" "monospacedFontFindDlg"="no" stopFillingFindField="no" findDlgAlwaysVisible="no" confirmReplaceOpenDocs="yes" confirmMacroReplaceOpenDocs="yes" confirmReplaceInFiles="yes" confirmMacroReplaceInFiles="yes" replaceStopsWithoutFindingNext="no"/> // <GUIConfig name="Searching" "monospacedFontFindDlg"="no" stopFillingFindField="no" findDlgAlwaysVisible="no" confirmReplaceOpenDocs="yes" confirmMacroReplaceOpenDocs="yes" confirmReplaceInFiles="yes" confirmMacroReplaceInFiles="yes" replaceStopsWithoutFindingNext="no"/>

View File

@ -806,6 +806,7 @@ struct NppGUI final
bool _replaceStopsWithoutFindingNext = false; bool _replaceStopsWithoutFindingNext = false;
bool _muteSounds = false; bool _muteSounds = false;
bool _enableFoldCmdToggable = false; bool _enableFoldCmdToggable = false;
bool _hideMenuRightShortcuts = false;
writeTechnologyEngine _writeTechnologyEngine = defaultTechnology; writeTechnologyEngine _writeTechnologyEngine = defaultTechnology;
bool _isWordCharDefault = true; bool _isWordCharDefault = true;
std::string _customWordChars; std::string _customWordChars;

View File

@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#pragma code_page(65001)
#include <windows.h> #include <windows.h>
#include "preference_rc.h" #include "preference_rc.h"
@ -28,38 +29,40 @@ EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE
CAPTION "Preferences" CAPTION "Preferences"
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
LISTBOX IDC_LIST_DLGTITLE,10,10,80,185,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP LISTBOX IDC_LIST_DLGTITLE,10,10,80,203,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
PUSHBUTTON "Close",IDC_BUTTON_CLOSE,255,215,45,14 PUSHBUTTON "Close",IDC_BUTTON_CLOSE,255,215,45,14
END END
IDD_PREFERENCE_SUB_GENRAL DIALOGEX 0, 0, 455, 185 IDD_PREFERENCE_SUB_GENRAL DIALOGEX 0, 0, 455, 203
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
RTEXT "Localization:",IDC_LOCALIZATION_GB_STATIC,2,7,78,8 RTEXT "Localization:",IDC_LOCALIZATION_GB_STATIC,2,10,78,8
COMBOBOX IDC_COMBO_LOCALIZATION,83,5,119,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_LOCALIZATION,83,8,119,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Toolbar",IDC_TOOLBAR_GB_STATIC,57,22,147,97,BS_CENTER GROUPBOX "Toolbar",IDC_TOOLBAR_GB_STATIC,27,59,147,97,BS_CENTER
CONTROL "Hide",IDC_CHECK_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,64,30,94,10 CONTROL "Hide",IDC_CHECK_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,34,67,94,10
CONTROL "Fluent UI: small",IDC_RADIO_SMALLICON,"Button",BS_AUTORADIOBUTTON,64,45,114,10 CONTROL "Fluent UI: small",IDC_RADIO_SMALLICON,"Button",BS_AUTORADIOBUTTON,34,82,114,10
CONTROL "Fluent UI: large",IDC_RADIO_BIGICON,"Button",BS_AUTORADIOBUTTON,64,59,109,10 CONTROL "Fluent UI: large",IDC_RADIO_BIGICON,"Button",BS_AUTORADIOBUTTON,34,96,109,10
CONTROL "Filled Fluent UI: small",IDC_RADIO_SMALLICON2,"Button",BS_AUTORADIOBUTTON,64,73,114,10 CONTROL "Filled Fluent UI: small",IDC_RADIO_SMALLICON2,"Button",BS_AUTORADIOBUTTON,34,110,114,10
CONTROL "Filled Fluent UI: large",IDC_RADIO_BIGICON2,"Button",BS_AUTORADIOBUTTON,64,87,109,10 CONTROL "Filled Fluent UI: large",IDC_RADIO_BIGICON2,"Button",BS_AUTORADIOBUTTON,34,124,109,10
CONTROL "Standard icons: small",IDC_RADIO_STANDARD,"Button",BS_AUTORADIOBUTTON,64,101,119,10 CONTROL "Standard icons: small",IDC_RADIO_STANDARD,"Button",BS_AUTORADIOBUTTON,34,138,119,10
GROUPBOX "Tab Bar",IDC_TABBAR_GB_STATIC,223,6,176,156,BS_CENTER GROUPBOX "Tab Bar",IDC_TABBAR_GB_STATIC,223,0,176,156,BS_CENTER
CONTROL "Hide",IDC_CHECK_TAB_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,15,108,10 CONTROL "Hide",IDC_CHECK_TAB_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,9,108,10
CONTROL "Multi-line",IDC_CHECK_TAB_MULTILINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,29,134,10 CONTROL "Multi-line",IDC_CHECK_TAB_MULTILINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,23,134,10
CONTROL "Vertical",IDC_CHECK_TAB_VERTICAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,41,134,10 CONTROL "Vertical",IDC_CHECK_TAB_VERTICAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,35,134,10
CONTROL "Reduce",IDC_CHECK_REDUCE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,54,108,10 CONTROL "Reduce",IDC_CHECK_REDUCE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,48,108,10
CONTROL "Alternate icons",IDC_CHECK_TAB_ALTICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,67,164,10 CONTROL "Alternate icons",IDC_CHECK_TAB_ALTICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,61,164,10
CONTROL "Lock (no drag and drop)",IDC_CHECK_LOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,80,134,10 CONTROL "Lock (no drag and drop)",IDC_CHECK_LOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,74,134,10
CONTROL "Darken inactive tabs",IDC_CHECK_DRAWINACTIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,93,134,10 CONTROL "Darken inactive tabs",IDC_CHECK_DRAWINACTIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,87,134,10
CONTROL "Draw a coloured bar on active tab",IDC_CHECK_ORANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,106,137,10 CONTROL "Draw a coloured bar on active tab",IDC_CHECK_ORANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,100,137,10
CONTROL "Show close button on each tab",IDC_CHECK_ENABLETABCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,119,133,10 CONTROL "Show close button on each tab",IDC_CHECK_ENABLETABCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,113,133,10
CONTROL "Double click to close document",IDC_CHECK_DBCLICK2CLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,132,133,10 CONTROL "Double click to close document",IDC_CHECK_DBCLICK2CLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,126,133,10
CONTROL "Exit on close the last tab",IDC_CHECK_TAB_LAST_EXIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,145,165,10 CONTROL "Exit on close the last tab",IDC_CHECK_TAB_LAST_EXIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,139,165,10
CONTROL "Show status bar",IDC_CHECK_SHOWSTATUSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,64,132,130,10 CONTROL "Show status bar",IDC_CHECK_SHOWSTATUSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,28,37,130,10
CONTROL "Hide menu bar (use Alt or F10 key to toggle)",IDC_CHECK_HIDEMENUBAR,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,223,169,218,10 GROUPBOX "Menu",IDC_MENU_GB_STATIC,27,160,373,42,BS_CENTER
CONTROL "Hide menu bar (use Alt or F10 key to toggle)",IDC_CHECK_HIDEMENUBAR,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,34,173,218,10
CONTROL "Hide right shortcuts ▼ ✕ from the menu bar (Need to restart Notepad++)",IDC_CHECK_HIDERIGHTSHORTCUTSOFMENUBAR,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,34,185,350,10
END END

View File

@ -454,6 +454,7 @@ intptr_t CALLBACK GeneralSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
bool showTool = nppGUI._toolbarShow; bool showTool = nppGUI._toolbarShow;
bool showStatus = nppGUI._statusBarShow; bool showStatus = nppGUI._statusBarShow;
bool showMenu = nppGUI._menuBarShow; bool showMenu = nppGUI._menuBarShow;
bool hideRightShortcutsFromMenu = nppGUI._hideMenuRightShortcuts;
::SendDlgItemMessage(_hSelf, IDC_CHECK_HIDE, BM_SETCHECK, showTool?BST_UNCHECKED:BST_CHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_HIDE, BM_SETCHECK, showTool?BST_UNCHECKED:BST_CHECKED, 0);
int ID2Check = 0; int ID2Check = 0;
@ -492,6 +493,7 @@ intptr_t CALLBACK GeneralSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
::SendMessage(_hSelf, WM_COMMAND, IDC_CHECK_TAB_HIDE, 0); ::SendMessage(_hSelf, WM_COMMAND, IDC_CHECK_TAB_HIDE, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_SHOWSTATUSBAR, BM_SETCHECK, showStatus, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_SHOWSTATUSBAR, BM_SETCHECK, showStatus, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_HIDEMENUBAR, BM_SETCHECK, !showMenu, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_HIDEMENUBAR, BM_SETCHECK, !showMenu, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_HIDERIGHTSHORTCUTSOFMENUBAR, BM_SETCHECK, hideRightShortcutsFromMenu, 0);
LocalizationSwitcher & localizationSwitcher = nppParam.getLocalizationSwitcher(); LocalizationSwitcher & localizationSwitcher = nppParam.getLocalizationSwitcher();
@ -560,6 +562,14 @@ intptr_t CALLBACK GeneralSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
} }
return TRUE; return TRUE;
case IDC_CHECK_HIDERIGHTSHORTCUTSOFMENUBAR:
{
bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_HIDERIGHTSHORTCUTSOFMENUBAR, BM_GETCHECK, 0, 0));
NppGUI& nppGUI = nppParam.getNppGUI();
nppGUI._hideMenuRightShortcuts = isChecked;
}
return TRUE;
case IDC_CHECK_TAB_HIDE : case IDC_CHECK_TAB_HIDE :
{ {
bool toBeHidden = (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_TAB_HIDE), BM_GETCHECK, 0, 0)); bool toBeHidden = (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_TAB_HIDE), BM_GETCHECK, 0, 0));

View File

@ -54,6 +54,8 @@
#define IDC_CHECK_TAB_ALTICONS (IDD_PREFERENCE_SUB_GENRAL + 28) #define IDC_CHECK_TAB_ALTICONS (IDD_PREFERENCE_SUB_GENRAL + 28)
#define IDC_RADIO_SMALLICON2 (IDD_PREFERENCE_SUB_GENRAL + 29) #define IDC_RADIO_SMALLICON2 (IDD_PREFERENCE_SUB_GENRAL + 29)
#define IDC_RADIO_BIGICON2 (IDD_PREFERENCE_SUB_GENRAL + 30) #define IDC_RADIO_BIGICON2 (IDD_PREFERENCE_SUB_GENRAL + 30)
#define IDC_MENU_GB_STATIC (IDD_PREFERENCE_SUB_GENRAL + 31)
#define IDC_CHECK_HIDERIGHTSHORTCUTSOFMENUBAR (IDD_PREFERENCE_SUB_GENRAL + 32)
#define IDD_PREFERENCE_SUB_MULTIINSTANCE 6150 //(IDD_PREFERENCE_BOX + 150) #define IDD_PREFERENCE_SUB_MULTIINSTANCE 6150 //(IDD_PREFERENCE_BOX + 150)
#define IDC_MULTIINST_GB_STATIC (IDD_PREFERENCE_SUB_MULTIINSTANCE + 1) #define IDC_MULTIINST_GB_STATIC (IDD_PREFERENCE_SUB_MULTIINSTANCE + 1)