Browse Source

Add "Minimize / Close to" option for System tray

Fix #15771, close #15785
pull/15810/head
pawelzwronek 1 week ago committed by Don Ho
parent
commit
eeb4753044
  1. 1
      PowerEditor/installer/nativeLang/english.xml
  2. 1
      PowerEditor/installer/nativeLang/english_customizable.xml
  3. 1
      PowerEditor/installer/nativeLang/polish.xml
  4. 2
      PowerEditor/src/Notepad_plus.cpp
  5. 7
      PowerEditor/src/NppBigSwitch.cpp
  6. 2
      PowerEditor/src/Parameters.cpp
  7. 2
      PowerEditor/src/Parameters.h
  8. 3
      PowerEditor/src/WinControls/Preference/preferenceDlg.cpp

1
PowerEditor/installer/nativeLang/english.xml

@ -1317,6 +1317,7 @@ Translation note:
<Element name="No action to"/>
<Element name="Minimize to"/>
<Element name="Close to"/>
<Element name="Minimize / Close to"/>
</ComboBox>
<Item id="6308" name="system tray"/>
<Item id="6312" name="File Status Auto-Detection"/>

1
PowerEditor/installer/nativeLang/english_customizable.xml

@ -1315,6 +1315,7 @@ Translation note:
<Element name="No action to"/>
<Element name="Minimize to"/>
<Element name="Close to"/>
<Element name="Minimize / Close to"/>
</ComboBox>
<Item id="6308" name="system tray"/>
<Item id="6312" name="File Status Auto-Detection"/>

1
PowerEditor/installer/nativeLang/polish.xml

@ -1326,6 +1326,7 @@ Translation note:
<Element name="Bez akcji do"/>
<Element name="Minimalizuj do"/>
<Element name="Zamykaj do"/>
<Element name="Minimalizuj / Zamykaj do"/>
</ComboBox>
<Item id="6308" name="zasobnika systemowego"/>
<Item id="6312" name="Autowykrywanie stanu pliku"/>

2
PowerEditor/src/Notepad_plus.cpp

@ -453,7 +453,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
_dockingManager.init(_pPublicInterface->getHinst(), hwnd, &_pMainWindow);
if ((nppGUI._isMinimizedToTray == sta_minimize || nppGUI._isMinimizedToTray == sta_close) && _pTrayIco == nullptr)
if (nppGUI._isMinimizedToTray != sta_none && _pTrayIco == nullptr)
{
HICON icon = nullptr;
Notepad_plus_Window::loadTrayIcon(_pPublicInterface->getHinst(), &icon);

7
PowerEditor/src/NppBigSwitch.cpp

@ -2835,9 +2835,10 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case WM_SYSCOMMAND:
{
const NppGUI & nppgui = (nppParam.getNppGUI());
if (((nppgui._isMinimizedToTray == sta_minimize || _pPublicInterface->isPrelaunch()) && (wParam == SC_MINIMIZE)) ||
(nppgui._isMinimizedToTray == sta_close && wParam == SC_CLOSE)
const NppGUI & nppgui = nppParam.getNppGUI();
auto toTray = nppgui._isMinimizedToTray;
if (((toTray == sta_minimize || toTray == sta_minimize_close || _pPublicInterface->isPrelaunch()) && (wParam == SC_MINIMIZE)) ||
((toTray == sta_close || toTray == sta_minimize_close) && wParam == SC_CLOSE)
)
{
if (nullptr == _pTrayIco)

2
PowerEditor/src/Parameters.cpp

@ -5037,6 +5037,8 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
_nppGUI._isMinimizedToTray = sta_minimize;
else if (lstrcmp(val, L"2") == 0)
_nppGUI._isMinimizedToTray = sta_close;
else if (lstrcmp(val, L"3") == 0)
_nppGUI._isMinimizedToTray = sta_minimize_close;
}
}
}

2
PowerEditor/src/Parameters.h

@ -122,7 +122,7 @@ enum urlMode {urlDisable = 0, urlNoUnderLineFg, urlUnderLineFg, urlNoUnderLineBg
urlMax = urlUnderLineBg};
enum AutoIndentMode { autoIndent_none = 0, autoIndent_advanced = 1, autoIndent_basic = 2 };
enum SysTrayAction { sta_none = 0, sta_minimize = 1, sta_close = 2 };
enum SysTrayAction { sta_none = 0, sta_minimize = 1, sta_close = 2, sta_minimize_close = 3 };
const int LANG_INDEX_INSTR = 0;
const int LANG_INDEX_INSTR2 = 1;

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

@ -2425,8 +2425,9 @@ intptr_t CALLBACK MiscSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_COMBO_SYSTRAY_ACTION_HOICE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"No action to"));
::SendDlgItemMessage(_hSelf, IDC_COMBO_SYSTRAY_ACTION_HOICE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Minimize to"));
::SendDlgItemMessage(_hSelf, IDC_COMBO_SYSTRAY_ACTION_HOICE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Close to"));
::SendDlgItemMessage(_hSelf, IDC_COMBO_SYSTRAY_ACTION_HOICE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Minimize / Close to"));
if (nppGUI._isMinimizedToTray < 0 || nppGUI._isMinimizedToTray > sta_close)
if (nppGUI._isMinimizedToTray < 0 || nppGUI._isMinimizedToTray > sta_minimize_close)
nppGUI._isMinimizedToTray = sta_none;
::SendDlgItemMessage(_hSelf, IDC_COMBO_SYSTRAY_ACTION_HOICE, CB_SETCURSEL, nppGUI._isMinimizedToTray, 0);

Loading…
Cancel
Save