|
|
|
@ -1840,7 +1840,7 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (posFind == -1)
|
|
|
|
|
{
|
|
|
|
|
{ // not found
|
|
|
|
|
if (oFindStatus)
|
|
|
|
|
*oFindStatus = FSNotFound;
|
|
|
|
|
//failed, or failed twice with wrap
|
|
|
|
@ -1866,11 +1866,22 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (posFind == -2) // Invalid Regular expression
|
|
|
|
|
{
|
|
|
|
|
else if (posFind < -1)
|
|
|
|
|
{ // error
|
|
|
|
|
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
|
|
|
|
|
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-invalid-re", TEXT("Find: Invalid regular expression"));
|
|
|
|
|
setStatusbarMessage(msg, FSNotFound);
|
|
|
|
|
generic_string msgGeneral;
|
|
|
|
|
if (posFind == -2)
|
|
|
|
|
{
|
|
|
|
|
msgGeneral = pNativeSpeaker->getLocalizedStrFromID("find-status-invalid-re", TEXT("Find: Invalid regular expression"));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
msgGeneral = pNativeSpeaker->getLocalizedStrFromID("find-status-search-failed", TEXT("Find: Search failed"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char szMsg [511] = "";
|
|
|
|
|
(*_ppEditView)->execute (SCI_GETBOOSTREGEXERRMSG, _countof (szMsg), reinterpret_cast<LPARAM>(szMsg));
|
|
|
|
|
setStatusbarMessage(msgGeneral, FSNotFound, szMsg);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2202,7 +2213,7 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
|
|
|
|
|
|
|
|
|
|
bool findAllFileNameAdded = false;
|
|
|
|
|
|
|
|
|
|
while (targetStart != -1 && targetStart != -2)
|
|
|
|
|
while (targetStart >= 0)
|
|
|
|
|
{
|
|
|
|
|
targetStart = pEditView->searchInTarget(pTextFind, stringSizeFind, findReplaceInfo._startRange, findReplaceInfo._endRange);
|
|
|
|
|
|
|
|
|
@ -2899,8 +2910,15 @@ void FindReplaceDlg::saveInMacro(size_t cmd, int cmdType)
|
|
|
|
|
::SendMessage(_hParent, WM_FRSAVE_INT, IDC_FRCOMMAND_EXEC, cmd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FindReplaceDlg::setStatusbarMessage(const generic_string & msg, FindStatus staus)
|
|
|
|
|
void FindReplaceDlg::setStatusbarMessage(const generic_string & msg, FindStatus staus, char const *pTooltipMsg)
|
|
|
|
|
{
|
|
|
|
|
if (_statusbarTooltipWnd)
|
|
|
|
|
{
|
|
|
|
|
::DestroyWindow(_statusbarTooltipWnd);
|
|
|
|
|
_statusbarTooltipWnd = nullptr;
|
|
|
|
|
}
|
|
|
|
|
_statusbarTooltipMsg = (pTooltipMsg && (*pTooltipMsg)) ? s2ws(pTooltipMsg) : TEXT("");
|
|
|
|
|
|
|
|
|
|
if (staus == FSNotFound)
|
|
|
|
|
{
|
|
|
|
|
if (!NppParameters::getInstance().getNppGUI()._muteSounds)
|
|
|
|
@ -3599,6 +3617,41 @@ void FindReplaceDlg::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
|
|
|
|
|
RECT rect;
|
|
|
|
|
_statusBar.getClientRect(rect);
|
|
|
|
|
::DrawText(lpDrawItemStruct->hDC, ptStr, lstrlen(ptStr), &rect, DT_SINGLELINE | DT_VCENTER | DT_LEFT);
|
|
|
|
|
|
|
|
|
|
if (_statusbarTooltipMsg.length() == 0) return;
|
|
|
|
|
|
|
|
|
|
SIZE size;
|
|
|
|
|
::GetTextExtentPoint32(lpDrawItemStruct->hDC, ptStr, lstrlen(ptStr), &size);
|
|
|
|
|
int s = (rect.bottom - rect.top) & 0x70; // limit s to available icon sizes and avoid uneven scalings
|
|
|
|
|
if (s > 0)
|
|
|
|
|
{
|
|
|
|
|
if (_statusbarTooltipIcon && (_statusbarTooltipIconSize != s))
|
|
|
|
|
{
|
|
|
|
|
DestroyIcon (_statusbarTooltipIcon);
|
|
|
|
|
_statusbarTooltipIcon = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!_statusbarTooltipIcon)
|
|
|
|
|
_statusbarTooltipIcon = (HICON)::LoadImage(_hInst, MAKEINTRESOURCE(IDI_MORE_ON_TOOLTIP), IMAGE_ICON, s, s, 0);
|
|
|
|
|
|
|
|
|
|
if (_statusbarTooltipIcon)
|
|
|
|
|
{
|
|
|
|
|
_statusbarTooltipIconSize = s;
|
|
|
|
|
rect.left = rect.left + size.cx + s / 2;
|
|
|
|
|
rect.top = (rect.top + rect.bottom - s) / 2;
|
|
|
|
|
DrawIconEx (lpDrawItemStruct->hDC, rect.left, rect.top, _statusbarTooltipIcon, s, s, 0, NULL, DI_NORMAL);
|
|
|
|
|
if (!_statusbarTooltipWnd)
|
|
|
|
|
{
|
|
|
|
|
rect.right = rect.left + s;
|
|
|
|
|
rect.bottom = rect.top + s;
|
|
|
|
|
_statusbarTooltipWnd = CreateToolTipRect(1, _statusBar.getHSelf(), _hInst, const_cast<PTSTR>(_statusbarTooltipMsg.c_str()), rect);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_statusbarTooltipIconSize = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool FindReplaceDlg::replaceInFilesConfirmCheck(generic_string directory, generic_string fileTypes)
|
|
|
|
|