[NEW] (Author : Darko Martinovic) Add "set find text and find next" feature.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@599 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2010-01-19 21:49:36 +00:00
parent 61a2681597
commit e96e419f74
6 changed files with 37 additions and 5 deletions

View File

@ -3775,6 +3775,28 @@ void Notepad_plus::command(int id)
} }
break; break;
case IDM_SEARCH_SETANDFINDNEXT :
case IDM_SEARCH_SETANDFINDPREV :
{
bool isFirstTime = !_findReplaceDlg.isCreated();
if (isFirstTime)
_findReplaceDlg.doDialog(FIND_DLG, _isRTL, false);
const int strSize = FINDREPLACE_MAXLENGTH;
TCHAR str[strSize];
_pEditView->getGenericSelectedText(str, strSize);
_findReplaceDlg.setSearchText(str);
setFindReplaceFolderFilter(NULL, NULL);
if (isFirstTime)
changeFindReplaceDlgLang();
FindOption op = _findReplaceDlg.getCurrentOptions();
op._whichDirection = (id == IDM_SEARCH_SETANDFINDNEXT?DIR_DOWN:DIR_UP);
_findReplaceDlg.processFindNext(str, &op);
break;
}
case IDM_SEARCH_GOTONEXTFOUND: case IDM_SEARCH_GOTONEXTFOUND:
{ {
_findReplaceDlg.gotoNextFoundResult(); _findReplaceDlg.gotoNextFoundResult();
@ -5377,6 +5399,8 @@ void Notepad_plus::command(int id)
case IDM_EDIT_DELETE: case IDM_EDIT_DELETE:
case IDM_SEARCH_FINDNEXT : case IDM_SEARCH_FINDNEXT :
case IDM_SEARCH_FINDPREV : case IDM_SEARCH_FINDPREV :
case IDM_SEARCH_SETANDFINDNEXT :
case IDM_SEARCH_SETANDFINDPREV :
case IDM_SEARCH_GOTOMATCHINGBRACE : case IDM_SEARCH_GOTOMATCHINGBRACE :
case IDM_SEARCH_TOGGLE_BOOKMARK : case IDM_SEARCH_TOGGLE_BOOKMARK :
case IDM_SEARCH_NEXT_BOOKMARK: case IDM_SEARCH_NEXT_BOOKMARK:

View File

@ -267,6 +267,8 @@ BEGIN
MENUITEM "Find in Files...", IDM_SEARCH_FINDINFILES MENUITEM "Find in Files...", IDM_SEARCH_FINDINFILES
MENUITEM "Find &Next", IDM_SEARCH_FINDNEXT MENUITEM "Find &Next", IDM_SEARCH_FINDNEXT
MENUITEM "Find &Previous", IDM_SEARCH_FINDPREV MENUITEM "Find &Previous", IDM_SEARCH_FINDPREV
MENUITEM "Select and Find Next", IDM_SEARCH_SETANDFINDNEXT
MENUITEM "Select and Find Previous", IDM_SEARCH_SETANDFINDPREV
MENUITEM "Find (Volatile) Next", IDM_SEARCH_VOLATILE_FINDNEXT MENUITEM "Find (Volatile) Next", IDM_SEARCH_VOLATILE_FINDNEXT
MENUITEM "Find (Volatile) Previous", IDM_SEARCH_VOLATILE_FINDPREV MENUITEM "Find (Volatile) Previous", IDM_SEARCH_VOLATILE_FINDPREV
MENUITEM "&Replace...", IDM_SEARCH_REPLACE MENUITEM "&Replace...", IDM_SEARCH_REPLACE

View File

@ -103,8 +103,10 @@ WinMenuKeyDefinition winKeyDefs[] = {
{VK_F, IDM_SEARCH_FINDINFILES, true, false, true, NULL}, {VK_F, IDM_SEARCH_FINDINFILES, true, false, true, NULL},
{VK_F3, IDM_SEARCH_FINDNEXT, false, false, false, NULL}, {VK_F3, IDM_SEARCH_FINDNEXT, false, false, false, NULL},
{VK_F3, IDM_SEARCH_FINDPREV, false, false, true, NULL}, {VK_F3, IDM_SEARCH_FINDPREV, false, false, true, NULL},
{VK_F3, IDM_SEARCH_VOLATILE_FINDNEXT, true, false, false, NULL}, {VK_F3, IDM_SEARCH_VOLATILE_FINDNEXT, true, true, false, NULL},
{VK_F3, IDM_SEARCH_VOLATILE_FINDPREV, true, false, true, NULL}, {VK_F3, IDM_SEARCH_VOLATILE_FINDPREV, true, true, true, NULL},
{VK_F3, IDM_SEARCH_SETANDFINDNEXT, true, false, false, NULL},
{VK_F3, IDM_SEARCH_SETANDFINDPREV, true, false, true, NULL},
{VK_F4, IDM_SEARCH_GOTONEXTFOUND, false, false, false, NULL}, {VK_F4, IDM_SEARCH_GOTONEXTFOUND, false, false, false, NULL},
{VK_F4, IDM_SEARCH_GOTOPREVFOUND, false, false, true, NULL}, {VK_F4, IDM_SEARCH_GOTOPREVFOUND, false, false, true, NULL},
{VK_F7, IDM_FOCUS_ON_FOUND_RESULTS, false, false, false, NULL}, {VK_F7, IDM_FOCUS_ON_FOUND_RESULTS, false, false, false, NULL},

View File

@ -1828,7 +1828,7 @@ void FindReplaceDlg::initOptionsFromDlg()
::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_doMarkLine || _doStyleFoundToken)); ::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_doMarkLine || _doStyleFoundToken));
} }
void FindReplaceDlg::doDialog(DIALOG_TYPE whichType, bool isRTL) void FindReplaceDlg::doDialog(DIALOG_TYPE whichType, bool isRTL, bool toShow)
{ {
if (!isCreated()) if (!isCreated())
{ {
@ -1842,7 +1842,8 @@ void FindReplaceDlg::doDialog(DIALOG_TYPE whichType, bool isRTL)
enableReplaceFunc(whichType == REPLACE_DLG); enableReplaceFunc(whichType == REPLACE_DLG);
::SetFocus(::GetDlgItem(_hSelf, IDFINDWHAT)); ::SetFocus(::GetDlgItem(_hSelf, IDFINDWHAT));
display(); //display();
display(toShow);
} }
LRESULT FAR PASCAL FindReplaceDlg::finderProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT FAR PASCAL FindReplaceDlg::finderProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)

View File

@ -175,7 +175,7 @@ public :
void initOptionsFromDlg(); void initOptionsFromDlg();
void doDialog(DIALOG_TYPE whichType, bool isRTL = false); void doDialog(DIALOG_TYPE whichType, bool isRTL = false, bool toShow = true);
bool processFindNext(const TCHAR *txt2find, FindOption *options = NULL, FindStatus *oFindStatus = NULL); bool processFindNext(const TCHAR *txt2find, FindOption *options = NULL, FindStatus *oFindStatus = NULL);
bool processReplace(const TCHAR *txt2find, const TCHAR *txt2replace, FindOption *options = NULL); bool processReplace(const TCHAR *txt2find, const TCHAR *txt2replace, FindOption *options = NULL);

View File

@ -151,6 +151,9 @@
#define IDM_SEARCH_GOTONEXTFOUND (IDM_SEARCH + 46) #define IDM_SEARCH_GOTONEXTFOUND (IDM_SEARCH + 46)
#define IDM_SEARCH_GOTOPREVFOUND (IDM_SEARCH + 47) #define IDM_SEARCH_GOTOPREVFOUND (IDM_SEARCH + 47)
#define IDM_SEARCH_SETANDFINDNEXT (IDM_SEARCH + 48)
#define IDM_SEARCH_SETANDFINDPREV (IDM_SEARCH + 49)
#define IDM_VIEW (IDM + 4000) #define IDM_VIEW (IDM + 4000)
//#define IDM_VIEW_TOOLBAR_HIDE (IDM_VIEW + 1) //#define IDM_VIEW_TOOLBAR_HIDE (IDM_VIEW + 1)