[NEW_FEATURE] Add new feature in Incremental Search : show pink background when text not found (like Firefox).

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@516 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2009-08-03 23:21:08 +00:00
parent 659a938735
commit 761bdc5116
3 changed files with 32 additions and 3 deletions

View File

@ -1967,10 +1967,26 @@ void FindIncrementDlg::display(bool toShow) const
}
#define SHIFTED 0x8000
#define BCKGRD_COLOR (RGB(255,102,102))
#define TXT_COLOR (RGB(255,255,255))
BOOL CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{
switch (message)
switch (message)
{
case WM_CTLCOLOREDIT :
{
// if the text not found modify the background color of the editor
static HBRUSH hBrushBackground = CreateSolidBrush(BCKGRD_COLOR);
if (FSNotFound != getFindStatus())
return FALSE; // text found, use the default color
// text not found
SetTextColor((HDC)wParam, TXT_COLOR);
SetBkColor((HDC)wParam, BCKGRD_COLOR);
return (LRESULT)hBrushBackground;
}
case WM_COMMAND :
{
bool isUnicode = (*(_pFRDlg->_ppEditView))->getCurrentBuffer()->getUnicodeMode() != uni8Bit;

View File

@ -539,7 +539,7 @@ private :
class FindIncrementDlg : public StaticDialog
{
public :
FindIncrementDlg() : _pFRDlg(NULL), _pRebar(NULL) {};
FindIncrementDlg() : _pFRDlg(NULL), _pRebar(NULL), _FindStatus(FSFound) {};
void init(HINSTANCE hInst, HWND hPere, FindReplaceDlg *pFRDlg, bool isRTL = false) {
Window::init(hInst, hPere);
if (!pFRDlg)
@ -583,13 +583,26 @@ public :
TEXT("Reached end of page, continued from top")}; // FSEndReached
if (iStatus<0 || iStatus >= sizeof(findStatus)/sizeof(findStatus[0]))
return; // out of range
_FindStatus = iStatus;
// get the HWND of the editor
HWND hEditor = ::GetDlgItem(_hSelf, IDC_INCFINDTEXT);
// invalidate the editor rect
::InvalidateRect(hEditor, NULL, TRUE);
::SendDlgItemMessage(_hSelf, IDC_INCFINDSTATUS, WM_SETTEXT, 0, (LPARAM)findStatus[iStatus]);
}
FindStatus getFindStatus() {
return _FindStatus;
}
void addToRebar(ReBar * rebar);
private :
bool _isRTL;
FindReplaceDlg *_pFRDlg;
FindStatus _FindStatus;
ReBar * _pRebar;
REBARBANDINFO _rbBand;

View File

@ -88,7 +88,7 @@ BEGIN
PUSHBUTTON ">",IDC_INCFINDNXTOK | WS_TABSTOP,243,3,16,14
CONTROL "Highlight all", IDC_INCFINDHILITEALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,270,5,65,12
CONTROL "Match case", IDC_INCFINDMATCHCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,335,5,60,12
LTEXT "Find Status",IDC_INCFINDSTATUS,400,6,180,12
LTEXT "",IDC_INCFINDSTATUS,400,6,180,12
END
IDD_FINDRESULT DIALOGEX 26, 41, 223, 67