Browse Source

Add "Close to system tray" in MISC preference

Fix #4075, fix #11627, close #15617
pull/15691/head
p@pawel-pc 2 months ago committed by Don Ho
parent
commit
035ef19b17
  1. 2
      PowerEditor/installer/nativeLang/english.xml
  2. 2
      PowerEditor/installer/nativeLang/english_customizable.xml
  3. 2
      PowerEditor/installer/nativeLang/polish.xml
  4. 2
      PowerEditor/installer/nativeLang/russian.xml
  5. 4
      PowerEditor/src/Notepad_plus.cpp
  6. 6
      PowerEditor/src/NppBigSwitch.cpp
  7. 17
      PowerEditor/src/Parameters.cpp
  8. 1
      PowerEditor/src/Parameters.h
  9. 13
      PowerEditor/src/WinControls/Preference/preference.rc
  10. 5
      PowerEditor/src/WinControls/Preference/preferenceDlg.cpp
  11. 1
      PowerEditor/src/WinControls/Preference/preference_rc.h

2
PowerEditor/installer/nativeLang/english.xml

@ -1312,6 +1312,7 @@ Translation note:
<Element name="Disable"/>
</ComboBox>
<Item id="6308" name="Minimize to system tray"/>
<Item id="6362" name="Close to system tray"/>
<Item id="6312" name="File Status Auto-Detection"/>
<Item id="6313" name="Update silently"/>
<Item id="6325" name="Scroll to the last line after update"/>
@ -1817,4 +1818,3 @@ If you select advanced mode but do not edit files in the aforementioned language
</MiscStrings>
</Native-Langue>
</NotepadPlus>

2
PowerEditor/installer/nativeLang/english_customizable.xml

@ -1311,6 +1311,7 @@ Translation note:
<Element name="Disable"/>
</ComboBox>
<Item id="6308" name="Minimize to system tray"/>
<Item id="6362" name="Close to system tray"/>
<Item id="6312" name="File Status Auto-Detection"/>
<Item id="6313" name="Update silently"/>
<Item id="6325" name="Scroll to the last line after update"/>
@ -1816,4 +1817,3 @@ If you select advanced mode but do not edit files in the aforementioned language
</MiscStrings>
</Native-Langue>
</NotepadPlus>

2
PowerEditor/installer/nativeLang/polish.xml

@ -1314,6 +1314,7 @@ Translation note:
<Element name="Wyłącz"/>
</ComboBox>
<Item id="6308" name="Minimalizuj do zasobnika systemowego"/>
<Item id="6362" name="Zamknij do zasobnika systemowego"/>
<Item id="6312" name="Autowykrywanie stanu pliku"/>
<Item id="6313" name="Uaktualniaj po cichu"/>
<Item id="6325" name="Przewiń na koniec po uaktualnieniu"/>
@ -1807,4 +1808,3 @@ Kliknij na przycisk „?” po prawej aby otworzyć stronę z dokumentacją."/>
</MiscStrings>
</Native-Langue>
</NotepadPlus>

2
PowerEditor/installer/nativeLang/russian.xml

@ -1268,8 +1268,6 @@ Updated to v8.7.0:
<Item id="6349" name="Использ. DirectWrite (может улучшить отображение спецсимволов, необходим перезапуск)"/>
<Item id="6360" name="Отключить все звуки"/>
<Item id="6361" name="Запрашивать подтверждение для команды 'Сохранить Все'"/>
<Item id="6362" name="Список Функций"/>
<Item id="6363" name="Сортировать функции по имени"/>
</MISC>
<MultiInstance title="Режим Откр. и Дата">
<Item id="6151" name="Режим Открытия Файлов*"/>

4
PowerEditor/src/Notepad_plus.cpp

@ -1,4 +1,4 @@
// This file is part of Notepad++ project
// This file is part of Notepad++ project
// Copyright (C)2021 Don HO <don.h@free.fr>
// This program is free software: you can redistribute it and/or modify
@ -448,7 +448,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
_dockingManager.init(_pPublicInterface->getHinst(), hwnd, &_pMainWindow);
if (nppGUI._isMinimizedToTray && _pTrayIco == nullptr)
if ((nppGUI._isMinimizedToTray || nppGUI._isClosedToTray) && _pTrayIco == nullptr)
{
HICON icon = nullptr;
Notepad_plus_Window::loadTrayIcon(_pPublicInterface->getHinst(), &icon);

6
PowerEditor/src/NppBigSwitch.cpp

@ -1,4 +1,4 @@
// This file is part of Notepad++ project
// This file is part of Notepad++ project
// Copyright (C)2021 Don HO <don.h@free.fr>
// This program is free software: you can redistribute it and/or modify
@ -2852,7 +2852,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case WM_SYSCOMMAND:
{
const NppGUI & nppgui = (nppParam.getNppGUI());
if ((nppgui._isMinimizedToTray || _pPublicInterface->isPrelaunch()) && (wParam == SC_MINIMIZE))
if (((nppgui._isMinimizedToTray || _pPublicInterface->isPrelaunch()) && (wParam == SC_MINIMIZE)) ||
(nppgui._isClosedToTray && wParam == SC_CLOSE)
)
{
if (nullptr == _pTrayIco)
{

17
PowerEditor/src/Parameters.cpp

@ -5018,6 +5018,18 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
}
}
}
else if (!lstrcmp(nm, L"CloseToTray"))
{
TiXmlNode *n = childNode->FirstChild();
if (n)
{
const wchar_t* val = n->Value();
if (val)
{
_nppGUI._isClosedToTray = (lstrcmp(val, L"yes") == 0);
}
}
}
else if (!lstrcmp(nm, L"RememberLastSession"))
{
TiXmlNode *n = childNode->FirstChild();
@ -7382,6 +7394,11 @@ void NppParameters::createXmlTreeFromGUIParams()
insertGUIConfigBoolNode(newGUIRoot, L"TrayIcon", _nppGUI._isMinimizedToTray);
}
// <GUIConfig name="CloseToTray">no</GUIConfig>
{
insertGUIConfigBoolNode(newGUIRoot, L"CloseToTray", _nppGUI._isClosedToTray);
}
// <GUIConfig name="MaintainIndent">yes</GUIConfig>
{
//insertGUIConfigBoolNode(newGUIRoot, L"MaintainIndent", _nppGUI._maintainIndent);

1
PowerEditor/src/Parameters.h

@ -822,6 +822,7 @@ struct NppGUI final
bool _isMaximized = false;
bool _isMinimizedToTray = false;
bool _isClosedToTray = false;
bool _rememberLastSession = true; // remember next session boolean will be written in the settings
bool _keepSessionAbsentFileEntries = false;
bool _isCmdlineNosessionActivated = false; // used for if -nosession is indicated on the launch time

13
PowerEditor/src/WinControls/Preference/preference.rc

@ -598,12 +598,13 @@ BEGIN
// "Enable Notepad++ auto-updater" should be always the 1st item, because it'll be hidden if GUP.exe is absent
CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,94,210,10
CONTROL "Mute all sounds",IDC_CHECK_MUTE_SOUNDS,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,37,109,190,10
CONTROL "Autodetect character encoding",IDC_CHECK_DETECTENCODING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,124,217,10
CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,139,217,10
CONTROL "Show only filename in title bar",IDC_CHECK_SHORTTITLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,154,217,10
CONTROL "Use DirectWrite (May improve rendering special characters, need to restart Notepad++)",IDC_CHECK_DIRECTWRITE_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,169,377,10
CONTROL "Enable Save All confirm dialog",IDC_CHECK_SAVEALLCONFIRM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,184,217,10
CONTROL "Mute all sounds",IDC_CHECK_MUTE_SOUNDS,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,37,108,190,10
CONTROL "Autodetect character encoding",IDC_CHECK_DETECTENCODING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,122,217,10
CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,136,217,10
CONTROL "Close to system tray",IDC_CHECK_CLOSE2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,150,217,10
CONTROL "Show only filename in title bar",IDC_CHECK_SHORTTITLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,164,217,10
CONTROL "Use DirectWrite (May improve rendering special characters, need to restart Notepad++)",IDC_CHECK_DIRECTWRITE_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,178,377,10
CONTROL "Enable Save All confirm dialog",IDC_CHECK_SAVEALLCONFIRM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,192,217,10
RTEXT "Session file ext.:",IDC_SESSIONFILEEXT_STATIC,270,130,108,8
EDITTEXT IDC_EDIT_SESSIONFILEEXT,380,127,34,12,ES_AUTOHSCROLL

5
PowerEditor/src/WinControls/Preference/preferenceDlg.cpp

@ -2417,6 +2417,7 @@ intptr_t CALLBACK MiscSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_CHECK_UPDATEGOTOEOF, BM_SETCHECK, bCheck ? BST_CHECKED : BST_UNCHECKED, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_MIN2SYSTRAY, BM_SETCHECK, nppGUI._isMinimizedToTray, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_CLOSE2SYSTRAY, BM_SETCHECK, nppGUI._isClosedToTray, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_DETECTENCODING, BM_SETCHECK, nppGUI._detectEncoding, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_SAVEALLCONFIRM, BM_SETCHECK, nppGUI._saveAllConfirm, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_AUTOUPDATE, BM_SETCHECK, nppGUI._autoUpdateOpt._doAutoUpdate, 0);
@ -2522,6 +2523,10 @@ intptr_t CALLBACK MiscSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
nppGUI._isMinimizedToTray = isCheckedOrNot(static_cast<int32_t>(wParam));
return TRUE;
case IDC_CHECK_CLOSE2SYSTRAY:
nppGUI._isClosedToTray = isCheckedOrNot(static_cast<int32_t>(wParam));
return TRUE;
case IDC_CHECK_DETECTENCODING:
nppGUI._detectEncoding = isCheckedOrNot(static_cast<int32_t>(wParam));
return TRUE;

1
PowerEditor/src/WinControls/Preference/preference_rc.h

@ -265,6 +265,7 @@
#define IDC_SMARTHILITEMATCHING_STATIC (IDD_PREFERENCE_SUB_MISC + 54)
#define IDC_CHECK_MUTE_SOUNDS (IDD_PREFERENCE_SUB_MISC + 60)
#define IDC_CHECK_SAVEALLCONFIRM (IDD_PREFERENCE_SUB_MISC + 61)
#define IDC_CHECK_CLOSE2SYSTRAY (IDD_PREFERENCE_SUB_MISC + 62)
#define IDD_PREFERENCE_SUB_NEWDOCUMENT 6400 //(IDD_PREFERENCE_BOX + 400)
#define IDC_FORMAT_GB_STATIC (IDD_PREFERENCE_SUB_NEWDOCUMENT + 1)

Loading…
Cancel
Save