Fix Find in found results dialog launch failure after macro execution

The solution is to find a new better parent for Finder dockable panel.

Fix #8199, close #9158
This commit is contained in:
Udo Hoffmann 2020-11-15 00:38:25 +01:00 committed by Don HO
parent 94673532cf
commit b7d148f493
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
2 changed files with 11 additions and 13 deletions

View File

@ -544,7 +544,7 @@ void Finder::gotoFoundLine()
const FoundInfo fInfo = *(_pMainFoundInfos->begin() + lno); const FoundInfo fInfo = *(_pMainFoundInfos->begin() + lno);
// Switch to another document // Switch to another document
if (!::SendMessage(::GetParent(_hParent), WM_DOOPEN, 0, reinterpret_cast<LPARAM>(fInfo._fullPath.c_str()))) return; if (!::SendMessage(_hParent, WM_DOOPEN, 0, reinterpret_cast<LPARAM>(fInfo._fullPath.c_str()))) return;
(*_ppEditView)->_positionRestoreNeeded = false; (*_ppEditView)->_positionRestoreNeeded = false;
Searching::displaySectionCentered(fInfo._start, fInfo._end, *_ppEditView); Searching::displaySectionCentered(fInfo._start, fInfo._end, *_ppEditView);
@ -2355,7 +2355,7 @@ void FindReplaceDlg::findAllIn(InWhat op)
if (!_pFinder) if (!_pFinder)
{ {
_pFinder = new Finder(); _pFinder = new Finder();
_pFinder->init(_hInst, _hSelf, _ppEditView); _pFinder->init(_hInst, (*_ppEditView)->getHParent(), _ppEditView);
_pFinder->setVolatiled(false); _pFinder->setVolatiled(false);
tTbData data = {0}; tTbData data = {0};
@ -2418,8 +2418,7 @@ void FindReplaceDlg::findAllIn(InWhat op)
_pFinder->_scintView.setMakerStyle(FOLDER_STYLE_SIMPLE); _pFinder->_scintView.setMakerStyle(FOLDER_STYLE_SIMPLE);
_pFinder->_scintView.display(); _pFinder->_scintView.display();
_pFinder->display(); _pFinder->display(false);
::SendMessage(_hParent, NPPM_DMMHIDE, 0, reinterpret_cast<LPARAM>(_pFinder->getHSelf()));
::UpdateWindow(_hParent); ::UpdateWindow(_hParent);
justCreated = true; justCreated = true;
} }
@ -2459,7 +2458,7 @@ void FindReplaceDlg::findAllIn(InWhat op)
else else
{ {
// Show finder // Show finder
::SendMessage(_hParent, NPPM_DMMSHOW, 0, reinterpret_cast<LPARAM>(_pFinder->getHSelf())); _pFinder->display();
getFocus(); // no hits getFocus(); // no hits
} }
} }
@ -2471,7 +2470,7 @@ Finder * FindReplaceDlg::createFinder()
{ {
Finder *pFinder = new Finder(); Finder *pFinder = new Finder();
pFinder->init(_hInst, _hSelf, _ppEditView); pFinder->init(_hInst, (*_ppEditView)->getHParent(), _ppEditView);
tTbData data = { 0 }; tTbData data = { 0 };
pFinder->create(&data, false); pFinder->create(&data, false);
@ -2532,7 +2531,6 @@ Finder * FindReplaceDlg::createFinder()
pFinder->_scintView.setMakerStyle(FOLDER_STYLE_SIMPLE); pFinder->_scintView.setMakerStyle(FOLDER_STYLE_SIMPLE);
pFinder->_scintView.display(); pFinder->_scintView.display();
pFinder->display();
::UpdateWindow(_hParent); ::UpdateWindow(_hParent);
pFinder->setFinderStyle(); pFinder->setFinderStyle();
@ -2547,7 +2545,7 @@ Finder * FindReplaceDlg::createFinder()
::SendMessage(pFinder->getHSelf(), WM_SIZE, 0, 0); ::SendMessage(pFinder->getHSelf(), WM_SIZE, 0, 0);
// Show finder // Show finder
::SendMessage(_hParent, NPPM_DMMSHOW, 0, reinterpret_cast<LPARAM>(pFinder->getHSelf())); pFinder->display();
pFinder->_scintView.getFocus(); pFinder->_scintView.getFocus();
return pFinder; return pFinder;
@ -3214,7 +3212,7 @@ LRESULT FAR PASCAL FindReplaceDlg::finderProc(HWND hwnd, UINT message, WPARAM wP
if (wParam == VK_RETURN) if (wParam == VK_RETURN)
pFinder->gotoFoundLine(); pFinder->gotoFoundLine();
else if (wParam == VK_ESCAPE) else if (wParam == VK_ESCAPE)
::SendMessage(::GetParent(pFinder->getHParent()), NPPM_DMMHIDE, 0, reinterpret_cast<LPARAM>(pFinder->getHSelf())); pFinder->display(false);
else // VK_DELETE else // VK_DELETE
pFinder->deleteResult(); pFinder->deleteResult();
return 0; return 0;
@ -3578,7 +3576,7 @@ void Finder::openAll()
for (size_t i = 0; i < sz; ++i) for (size_t i = 0; i < sz; ++i)
{ {
::SendMessage(::GetParent(_hParent), WM_DOOPEN, 0, reinterpret_cast<LPARAM>(_pMainFoundInfos->at(i)._fullPath.c_str())); ::SendMessage(_hParent, WM_DOOPEN, 0, reinterpret_cast<LPARAM>(_pMainFoundInfos->at(i)._fullPath.c_str()));
} }
} }
@ -3774,7 +3772,7 @@ INT_PTR CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{ {
case NPPM_INTERNAL_FINDINFINDERDLG: case NPPM_INTERNAL_FINDINFINDERDLG:
{ {
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_FINDINFINDERDLG, reinterpret_cast<WPARAM>(this), 0); ::SendMessage(_hParent, NPPM_INTERNAL_FINDINFINDERDLG, reinterpret_cast<WPARAM>(this), 0);
return TRUE; return TRUE;
} }
@ -3782,7 +3780,7 @@ INT_PTR CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{ {
if (_canBeVolatiled) if (_canBeVolatiled)
{ {
::SendMessage(::GetParent(_hParent), NPPM_DMMHIDE, 0, reinterpret_cast<LPARAM>(_hSelf)); ::SendMessage(_hParent, NPPM_DMMHIDE, 0, reinterpret_cast<LPARAM>(_hSelf));
setClosed(true); setClosed(true);
} }
return TRUE; return TRUE;

View File

@ -316,7 +316,7 @@ public :
// Show finder and set focus // Show finder and set focus
if (_pFinder) if (_pFinder)
{ {
::SendMessage(_hParent, NPPM_DMMSHOW, 0, reinterpret_cast<LPARAM>(_pFinder->getHSelf())); _pFinder->display();
_pFinder->_scintView.getFocus(); _pFinder->_scintView.getFocus();
} }
}; };