From 41d619d9b708ee36623433d02e40f1cad3088a7d Mon Sep 17 00:00:00 2001 From: Udo Hoffmann Date: Mon, 5 Oct 2020 16:40:10 +0200 Subject: [PATCH] Fix Floating dockable panels don't minimize to system tray issue Fixes #8928, close #8953 --- PowerEditor/src/NppBigSwitch.cpp | 2 ++ PowerEditor/src/NppCommands.cpp | 4 ++++ .../src/WinControls/DockingWnd/DockingManager.cpp | 10 ++++++++++ .../src/WinControls/DockingWnd/DockingManager.h | 2 ++ 4 files changed, 18 insertions(+) diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 0bfa4179..626e2983 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -1912,6 +1912,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa _pTrayIco = new trayIconControler(hwnd, IDI_M30ICON, NPPM_INTERNAL_MINIMIZED_TRAY, ::LoadIcon(_pPublicInterface->getHinst(), MAKEINTRESOURCE(IDI_M30ICON)), TEXT("")); _pTrayIco->doTrayIcon(ADD); + _dockingManager.showFloatingContainers(false); ::ShowWindow(hwnd, SW_HIDE); return TRUE; } @@ -1943,6 +1944,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa { _pEditView->getFocus(); ::ShowWindow(hwnd, SW_SHOW); + _dockingManager.showFloatingContainers(true); 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 576f2d7b..27b76475 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -3298,6 +3298,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); fileNew(); } break; @@ -3306,6 +3307,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); // Send sizing info to make window fit (specially to show tool bar. Fixed issue #2600) ::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0); @@ -3316,6 +3318,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); BufferID bufferID = _pEditView->getCurrentBufferID(); Buffer * buf = MainFileManager.getBufferByID(bufferID); if (!buf->isUntitled() || buf->docLength() != 0) @@ -3330,6 +3333,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); // Send sizing info to make window fit (specially to show tool bar. Fixed issue #2600) ::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0); diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp index 6d859c37..b777a0c8 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp @@ -220,6 +220,16 @@ void DockingManager::showContainer(HWND hCont, bool display) } } +void DockingManager::showFloatingContainers(bool show) +{ + for (size_t i=0; i < _vContainer.size(); i++) + { + size_t iElementCnt = _vContainer[i]->getElementCnt(); + if (iElementCnt > 0) + _vContainer[i]->display(show); + } +} + LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingManager.h b/PowerEditor/src/WinControls/DockingWnd/DockingManager.h index ea8d8a48..26bb25f5 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingManager.h +++ b/PowerEditor/src/WinControls/DockingWnd/DockingManager.h @@ -60,6 +60,8 @@ public : onSize(); } + void showFloatingContainers(bool show); + void updateContainerInfo(HWND hClient); void createDockableDlg(tTbData data, int iCont = CONT_LEFT, bool isVisible = false); void setActiveTab(int iCont, int iItem);