[NEW] (Author: Korikulum) Adds a message showing the total number of matches in the current document to the Incremental Search bar.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1343 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2015-02-14 17:21:09 +00:00
parent deb3b8fcfe
commit 6420dfb67e
2 changed files with 16 additions and 4 deletions

View File

@ -2788,7 +2788,11 @@ BOOL CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{
FindStatus findStatus = FSFound;
bool isFound = _pFRDlg->processFindNext(str2Search.c_str(), &fo, &findStatus);
setFindStatus(findStatus);
fo._str2Search = str2Search;
int nbCounted = _pFRDlg->processAll(ProcessCountAll, &fo);
setFindStatus(findStatus, nbCounted);
// If case-sensitivity changed (to Match=yes), there may have been a matched selection that
// now does not match; so if Not Found, clear selection and put caret at beginning of what was
// selected (no change, if there was no selection)
@ -2845,12 +2849,20 @@ void FindIncrementDlg::markSelectedTextInc(bool enable, FindOption *opt)
_pFRDlg->markAllInc(opt);
}
void FindIncrementDlg::setFindStatus(FindStatus iStatus)
void FindIncrementDlg::setFindStatus(FindStatus iStatus, int nbCounted)
{
static TCHAR *findStatus[] = { TEXT(""), // FSFound
static TCHAR findCount[128] = TEXT("");
static TCHAR *findStatus[] = { findCount, // FSFound
TEXT("Phrase not found"), //FSNotFound
TEXT("Reached top of page, continued from bottom"), // FSTopReached
TEXT("Reached end of page, continued from top")}; // FSEndReached
if (nbCounted <= 0)
findCount[0] = '\0';
else if (nbCounted == 1)
wsprintf(findCount, TEXT("%d match."), nbCounted);
else
wsprintf(findCount, TEXT("%d matches."), nbCounted);
if (iStatus<0 || iStatus >= sizeof(findStatus)/sizeof(findStatus[0]))
return; // out of range

View File

@ -384,7 +384,7 @@ public :
::SendDlgItemMessage(_hSelf, IDC_INCFINDTEXT, WM_SETTEXT, 0, (LPARAM)txt2find);
};
void setFindStatus(FindStatus iStatus);
void setFindStatus(FindStatus iStatus, int nbCounted);
FindStatus getFindStatus() {
return _findStatus;