[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-ebc06183d4e3remotes/x64
parent
659a938735
commit
761bdc5116
|
@ -1967,10 +1967,26 @@ void FindIncrementDlg::display(bool toShow) const
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SHIFTED 0x8000
|
#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)
|
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 :
|
case WM_COMMAND :
|
||||||
{
|
{
|
||||||
bool isUnicode = (*(_pFRDlg->_ppEditView))->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
|
bool isUnicode = (*(_pFRDlg->_ppEditView))->getCurrentBuffer()->getUnicodeMode() != uni8Bit;
|
||||||
|
|
|
@ -539,7 +539,7 @@ private :
|
||||||
class FindIncrementDlg : public StaticDialog
|
class FindIncrementDlg : public StaticDialog
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
FindIncrementDlg() : _pFRDlg(NULL), _pRebar(NULL) {};
|
FindIncrementDlg() : _pFRDlg(NULL), _pRebar(NULL), _FindStatus(FSFound) {};
|
||||||
void init(HINSTANCE hInst, HWND hPere, FindReplaceDlg *pFRDlg, bool isRTL = false) {
|
void init(HINSTANCE hInst, HWND hPere, FindReplaceDlg *pFRDlg, bool isRTL = false) {
|
||||||
Window::init(hInst, hPere);
|
Window::init(hInst, hPere);
|
||||||
if (!pFRDlg)
|
if (!pFRDlg)
|
||||||
|
@ -583,13 +583,26 @@ public :
|
||||||
TEXT("Reached end of page, continued from top")}; // FSEndReached
|
TEXT("Reached end of page, continued from top")}; // FSEndReached
|
||||||
if (iStatus<0 || iStatus >= sizeof(findStatus)/sizeof(findStatus[0]))
|
if (iStatus<0 || iStatus >= sizeof(findStatus)/sizeof(findStatus[0]))
|
||||||
return; // out of range
|
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]);
|
::SendDlgItemMessage(_hSelf, IDC_INCFINDSTATUS, WM_SETTEXT, 0, (LPARAM)findStatus[iStatus]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FindStatus getFindStatus() {
|
||||||
|
return _FindStatus;
|
||||||
|
}
|
||||||
|
|
||||||
void addToRebar(ReBar * rebar);
|
void addToRebar(ReBar * rebar);
|
||||||
private :
|
private :
|
||||||
bool _isRTL;
|
bool _isRTL;
|
||||||
FindReplaceDlg *_pFRDlg;
|
FindReplaceDlg *_pFRDlg;
|
||||||
|
FindStatus _FindStatus;
|
||||||
|
|
||||||
ReBar * _pRebar;
|
ReBar * _pRebar;
|
||||||
REBARBANDINFO _rbBand;
|
REBARBANDINFO _rbBand;
|
||||||
|
|
|
@ -88,7 +88,7 @@ BEGIN
|
||||||
PUSHBUTTON ">",IDC_INCFINDNXTOK | WS_TABSTOP,243,3,16,14
|
PUSHBUTTON ">",IDC_INCFINDNXTOK | WS_TABSTOP,243,3,16,14
|
||||||
CONTROL "Highlight all", IDC_INCFINDHILITEALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,270,5,65,12
|
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
|
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
|
END
|
||||||
|
|
||||||
IDD_FINDRESULT DIALOGEX 26, 41, 223, 67
|
IDD_FINDRESULT DIALOGEX 26, 41, 223, 67
|
||||||
|
|
Loading…
Reference in New Issue