[ENHANCEMENT] Add "End Reached" and "Top Reached" status in find/replace dialog StatusBar.
Make "Error", "End Reached" and "Top Reached" status visible (flash main window) if find/replace dialog is hidden. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1047 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
b0f47da58b
commit
71234725a1
@ -510,8 +510,12 @@ void Notepad_plus::command(int id)
|
||||
FindOption op = _findReplaceDlg.getCurrentOptions();
|
||||
op._whichDirection = (id == IDM_SEARCH_FINDNEXT?DIR_DOWN:DIR_UP);
|
||||
generic_string s = _findReplaceDlg.getText2search();
|
||||
|
||||
_findReplaceDlg.processFindNext(s.c_str(), &op);
|
||||
FindStatus status = FSNoMessage;
|
||||
_findReplaceDlg.processFindNext(s.c_str(), &op, &status);
|
||||
if (status == FSEndReached)
|
||||
_findReplaceDlg.setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the top. The end of document has been reached."), FSEndReached);
|
||||
else if (status == FSTopReached)
|
||||
_findReplaceDlg.setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the bottom. The begin of document has been reached."), FSTopReached);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -535,7 +539,12 @@ void Notepad_plus::command(int id)
|
||||
FindOption op = _findReplaceDlg.getCurrentOptions();
|
||||
op._whichDirection = (id == IDM_SEARCH_SETANDFINDNEXT?DIR_DOWN:DIR_UP);
|
||||
|
||||
_findReplaceDlg.processFindNext(str, &op);
|
||||
FindStatus status = FSNoMessage;
|
||||
_findReplaceDlg.processFindNext(str, &op, &status);
|
||||
if (status == FSEndReached)
|
||||
_findReplaceDlg.setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the top. The end of document has been reached."), FSEndReached);
|
||||
else if (status == FSTopReached)
|
||||
_findReplaceDlg.setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the bottom. The begin of document has been reached."), FSTopReached);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -568,7 +577,14 @@ void Notepad_plus::command(int id)
|
||||
FindOption op;
|
||||
op._isWholeWord = false;
|
||||
op._whichDirection = (id == IDM_SEARCH_VOLATILE_FINDNEXT?DIR_DOWN:DIR_UP);
|
||||
_findReplaceDlg.processFindNext(text2Find, &op);
|
||||
|
||||
FindStatus status = FSNoMessage;
|
||||
_findReplaceDlg.processFindNext(text2Find, &op, &status);
|
||||
if (status == FSEndReached)
|
||||
_findReplaceDlg.setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the top. The end of document has been reached."), FSEndReached);
|
||||
else if (status == FSTopReached)
|
||||
_findReplaceDlg.setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the bottom. The begin of document has been reached."), FSTopReached);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -694,10 +694,10 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
||||
|
||||
FindStatus findStatus = FSFound;
|
||||
processFindNext(_options._str2Search.c_str(), _env, &findStatus);
|
||||
if(findStatus == FSEndReached)
|
||||
setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the top. The end of document has been reached."), FSMessage);
|
||||
else if(findStatus == FSTopReached)
|
||||
setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the bottom. The begin of document has been reached."), FSMessage);
|
||||
if (findStatus == FSEndReached)
|
||||
setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the top. The end of document has been reached."), FSEndReached);
|
||||
else if (findStatus == FSTopReached)
|
||||
setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the bottom. The begin of document has been reached."), FSTopReached);
|
||||
|
||||
nppParamInst->_isFindReplacing = false;
|
||||
}
|
||||
@ -1373,13 +1373,11 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl
|
||||
|
||||
if (status == FSEndReached)
|
||||
{
|
||||
setStatusbarMessage(TEXT("Replace: Replaced the 1st occurrence from the top. The end of document has been reached."), FSMessage);
|
||||
//displayMsgDone = true;
|
||||
setStatusbarMessage(TEXT("Replace: Replaced the 1st occurrence from the top. The end of document has been reached."), FSEndReached);
|
||||
}
|
||||
else if (status == FSTopReached)
|
||||
{
|
||||
setStatusbarMessage(TEXT("Replace: Replaced the 1st occurrence from the bottom. The begin of document has been reached."), FSMessage);
|
||||
//displayMsgDone = true;
|
||||
setStatusbarMessage(TEXT("Replace: Replaced the 1st occurrence from the bottom. The begin of document has been reached."), FSTopReached);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1973,10 +1971,20 @@ void FindReplaceDlg::setStatusbarMessage(const generic_string & msg, FindStatus
|
||||
if (staus == FSNotFound)
|
||||
{
|
||||
::MessageBeep(0xFFFFFFFF);
|
||||
FlashWindow(_hSelf, TRUE);
|
||||
HWND hwnd2Flash = isVisible()?_hSelf:GetParent(_hSelf);
|
||||
FlashWindow(hwnd2Flash, TRUE);
|
||||
}
|
||||
else if (staus == FSTopReached || staus == FSEndReached)
|
||||
{
|
||||
if (!isVisible())
|
||||
FlashWindow(::GetParent(_hSelf), TRUE);
|
||||
}
|
||||
|
||||
if (isVisible())
|
||||
{
|
||||
_statusbarFindStatus = staus;
|
||||
_statusBar.setOwnerDrawText(msg.c_str());
|
||||
}
|
||||
_statusbarFindStatus = staus;
|
||||
_statusBar.setOwnerDrawText(msg.c_str());
|
||||
}
|
||||
|
||||
void FindReplaceDlg::execSavedCommand(int cmd, int intValue, generic_string stringValue)
|
||||
@ -2311,6 +2319,10 @@ void FindReplaceDlg::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
|
||||
{
|
||||
fgColor = RGB(0, 0, 0xFF); // blue
|
||||
}
|
||||
else if (_statusbarFindStatus == FSTopReached || _statusbarFindStatus == FSEndReached)
|
||||
{
|
||||
fgColor = RGB(0, 166, 0); // green
|
||||
}
|
||||
else if (_statusbarFindStatus == FSNoMessage)
|
||||
{
|
||||
ptStr = TEXT("");
|
||||
|
Loading…
Reference in New Issue
Block a user