From bab1575d2b942487a6bc4155ba080dd30636823b Mon Sep 17 00:00:00 2001 From: Don Ho Date: Mon, 9 Feb 2015 08:33:01 +0000 Subject: [PATCH] [BUG_FIXED] (Author: Mike Cowperthwaite) Restore focus to editor when a panel is closed. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1337 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 10 +++++----- PowerEditor/src/Notepad_plus.h | 1 - PowerEditor/src/Notepad_plus_Window.cpp | 2 +- PowerEditor/src/NppCommands.cpp | 1 - .../src/WinControls/DockingWnd/DockingManager.cpp | 5 ++++- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 432c5ba1..2607342b 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -2572,11 +2572,11 @@ void Notepad_plus::specialCmd(int id) } } -BOOL Notepad_plus::processIncrFindAccel(MSG *msg) const -{ - if (!::IsChild(_incrementFindDlg.getHSelf(), ::GetFocus())) - return FALSE; - return ::TranslateAccelerator(_incrementFindDlg.getHSelf(), _accelerator.getIncrFindAccTable(), msg); +BOOL Notepad_plus::processIncrFindAccel(MSG *msg) const +{ + if (!::IsChild(_incrementFindDlg.getHSelf(), ::GetFocus())) + return FALSE; + return ::TranslateAccelerator(_incrementFindDlg.getHSelf(), _accelerator.getIncrFindAccTable(), msg); } void Notepad_plus::setLanguage(LangType langType) { diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index 62d7d7a8..7cb6ac25 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -514,7 +514,6 @@ private: void setDisplayFormat(formatType f); int getCmdIDFromEncoding(int encoding) const; void setUniModeText(); - void checkLangsMenu(int id) const ; void setLanguage(LangType langType); enum LangType menuID2LangType(int cmdID); diff --git a/PowerEditor/src/Notepad_plus_Window.cpp b/PowerEditor/src/Notepad_plus_Window.cpp index afaae5dd..b089b60e 100644 --- a/PowerEditor/src/Notepad_plus_Window.cpp +++ b/PowerEditor/src/Notepad_plus_Window.cpp @@ -269,7 +269,7 @@ bool Notepad_plus_Window::isDlgsMsg(MSG *msg) const { for (size_t i = 0, len = _notepad_plus_plus_core._hModelessDlgs.size(); i < len; ++i) { - if (_notepad_plus_plus_core.processIncrFindAccel(msg)) + if (_notepad_plus_plus_core.processIncrFindAccel(msg)) return true; if (::IsDialogMessageW(_notepad_plus_plus_core._hModelessDlgs[i], msg)) diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 1cdcd3be..9baee30b 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -443,7 +443,6 @@ void Notepad_plus::command(int id) _pDocMap->setClosed(true); checkMenuItem(IDM_VIEW_DOC_MAP, false); _toolBar.setCheck(IDM_VIEW_DOC_MAP, false); - _pEditView->getFocus(); } else { diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp index f93efb7b..b56a14ac 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp @@ -353,7 +353,10 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l case DMM_CLOSE: { tTbData TbData = *((DockingCont*)lParam)->getDataOfActiveTb(); - return SendNotify(TbData.hClient, DMN_CLOSE); + LRESULT res = SendNotify(TbData.hClient, DMN_CLOSE); // Be sure the active item is OK with closing + if (res == 0) // Item will be closing? + ::PostMessage(_hParent, WM_ACTIVATE, WA_ACTIVE, 0); // Tell editor to take back focus + return res; } case DMM_FLOATALL: {