diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 5f414916e..127b34e22 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -7235,6 +7235,34 @@ void Notepad_plus::showQuote(const QuoteParams* quote) const ::CloseHandle(hThread); } +void Notepad_plus::minimizeDialogs() +{ + static StaticDialog* modelessDlgs[] = {&_findReplaceDlg, &_aboutDlg, &_debugInfoDlg, &_runDlg, &_goToLineDlg, &_colEditorDlg, &_configStyleDlg,\ + &_preference, &_pluginsAdminDlg, &_findCharsInRangeDlg, &_md5FromFilesDlg, &_md5FromTextDlg, &_sha2FromFilesDlg, &_sha2FromTextDlg, &_runMacroDlg}; + + static size_t nbModelessDlg = sizeof(modelessDlgs) / sizeof(StaticDialog*); + + for (size_t i = 0; i < nbModelessDlg; ++i) + { + StaticDialog* pDlg = modelessDlgs[i]; + if (pDlg->isCreated() && pDlg->isVisible()) + { + pDlg->display(false); + _sysTrayHiddenHwnd.push_back(pDlg->getHSelf()); + } + } +} + +void Notepad_plus::restoreMinimizeDialogs() +{ + size_t nbDialogs = _sysTrayHiddenHwnd.size(); + for (int i = (nbDialogs - 1); i >= 0; i--) + { + ::ShowWindow(_sysTrayHiddenHwnd[i], SW_SHOW); + _sysTrayHiddenHwnd.erase(_sysTrayHiddenHwnd.begin() + i); + } +} + void Notepad_plus::launchDocumentBackupTask() { HANDLE hThread = ::CreateThread(NULL, 0, backupDocument, NULL, 0, NULL); diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index 7917361c9..c0c0801cb 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -259,6 +259,9 @@ public: return _pluginsAdminDlg.getPluginListVerStr(); }; + void minimizeDialogs(); + void restoreMinimizeDialogs(); + private: Notepad_plus_Window *_pPublicInterface = nullptr; Window *_pMainWindow = nullptr; @@ -403,6 +406,8 @@ private: DocumentMap* _pDocMap = nullptr; FunctionListPanel* _pFuncList = nullptr; + std::vector _sysTrayHiddenHwnd; + BOOL notify(SCNotification *notification); void command(int id); diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 626e29835..363bb5af3 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -1913,6 +1913,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa _pTrayIco->doTrayIcon(ADD); _dockingManager.showFloatingContainers(false); + minimizeDialogs(); ::ShowWindow(hwnd, SW_HIDE); return TRUE; } @@ -1945,6 +1946,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa _pEditView->getFocus(); ::ShowWindow(hwnd, SW_SHOW); _dockingManager.showFloatingContainers(true); + restoreMinimizeDialogs(); + if (!_pPublicInterface->isPrelaunch()) _pTrayIco->doTrayIcon(REMOVE); ::SendMessage(hwnd, WM_SIZE, 0, 0); diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 27b764756..84706178b 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -3299,6 +3299,7 @@ void Notepad_plus::command(int id) NppGUI & nppGUI = const_cast((NppParameters::getInstance()).getNppGUI()); ::ShowWindow(_pPublicInterface->getHSelf(), nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW); _dockingManager.showFloatingContainers(true); + restoreMinimizeDialogs(); fileNew(); } break; @@ -3308,6 +3309,7 @@ void Notepad_plus::command(int id) NppGUI & nppGUI = const_cast((NppParameters::getInstance()).getNppGUI()); ::ShowWindow(_pPublicInterface->getHSelf(), nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW); _dockingManager.showFloatingContainers(true); + restoreMinimizeDialogs(); // Send sizing info to make window fit (specially to show tool bar. Fixed issue #2600) ::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0); @@ -3319,6 +3321,8 @@ void Notepad_plus::command(int id) NppGUI & nppGUI = const_cast((NppParameters::getInstance()).getNppGUI()); ::ShowWindow(_pPublicInterface->getHSelf(), nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW); _dockingManager.showFloatingContainers(true); + restoreMinimizeDialogs(); + BufferID bufferID = _pEditView->getCurrentBufferID(); Buffer * buf = MainFileManager.getBufferByID(bufferID); if (!buf->isUntitled() || buf->docLength() != 0) @@ -3334,6 +3338,7 @@ void Notepad_plus::command(int id) NppGUI & nppGUI = const_cast((NppParameters::getInstance()).getNppGUI()); ::ShowWindow(_pPublicInterface->getHSelf(), nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW); _dockingManager.showFloatingContainers(true); + restoreMinimizeDialogs(); // Send sizing info to make window fit (specially to show tool bar. Fixed issue #2600) ::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);