Fix dialogs remain issue after minimizing to systemtray

Fix #9044
pull/9051/head
Don HO 4 years ago
parent 41d619d9b7
commit 71ae2cfce6
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

@ -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);

@ -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<HWND> _sysTrayHiddenHwnd;
BOOL notify(SCNotification *notification);
void command(int id);

@ -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);

@ -3299,6 +3299,7 @@ void Notepad_plus::command(int id)
NppGUI & nppGUI = const_cast<NppGUI &>((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<NppGUI &>((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<NppGUI &>((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<NppGUI &>((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);

Loading…
Cancel
Save