Find previous and next instead of combo direction Down/Up

Add "Find Previous" button and remove "Direction Down/Up combo"

Closes #3339
This commit is contained in:
Tony Karlsson 2017-06-01 19:18:19 +02:00 committed by Don HO
parent 6f84824c2b
commit 9f421eb2a9
3 changed files with 25 additions and 26 deletions

View File

@ -322,9 +322,7 @@ void FindReplaceDlg::fillFindHistory()
::EnableWindow(::GetDlgItem(_hSelf, IDWHOLEWORD), (BOOL)false); ::EnableWindow(::GetDlgItem(_hSelf, IDWHOLEWORD), (BOOL)false);
//regex upward search is disable in v6.3 due to a regression //regex upward search is disable in v6.3 due to a regression
::SendDlgItemMessage(_hSelf, IDDIRECTIONDOWN, BM_SETCHECK, BST_CHECKED, 0); ::EnableWindow(::GetDlgItem(_hSelf, IDC_FINDPREV), (BOOL)false);
::SendDlgItemMessage(_hSelf, IDDIRECTIONUP, BM_SETCHECK, BST_UNCHECKED, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDDIRECTIONUP), (BOOL)false);
// If the search mode from history is regExp then enable the checkbox (. matches newline) // If the search mode from history is regExp then enable the checkbox (. matches newline)
::EnableWindow(GetDlgItem(_hSelf, IDREDOTMATCHNL), true); ::EnableWindow(GetDlgItem(_hSelf, IDREDOTMATCHNL), true);
@ -766,7 +764,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
p = getTopPoint(::GetDlgItem(_hSelf, IDREPLACEALL), !_isRTL); p = getTopPoint(::GetDlgItem(_hSelf, IDREPLACEALL), !_isRTL);
_findInFilesClosePos.left = p.x; _findInFilesClosePos.left = p.x;
_findInFilesClosePos.top = p.y; _findInFilesClosePos.top = p.y-7;
p = getTopPoint(::GetDlgItem(_hSelf, IDCANCEL), !_isRTL); p = getTopPoint(::GetDlgItem(_hSelf, IDCANCEL), !_isRTL);
_findClosePos.left = p.x; _findClosePos.left = p.x;
@ -777,8 +775,8 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
if (tip2show.empty()) if (tip2show.empty())
tip2show = TEXT("Use Shift+Enter to search in the opposite direction."); tip2show = TEXT("Use Shift+Enter to search in the opposite direction.");
_shiftTrickUpTip = CreateToolTip(IDDIRECTIONUP, _hSelf, _hInst, const_cast<PTSTR>(tip2show.c_str())); _shiftTrickUpTip = CreateToolTip(IDOK, _hSelf, _hInst, const_cast<PTSTR>(tip2show.c_str()));
_shiftTrickDownTip = CreateToolTip(IDDIRECTIONDOWN, _hSelf, _hInst, const_cast<PTSTR>(tip2show.c_str())); _shiftTrickDownTip = CreateToolTip(IDC_FINDPREV, _hSelf, _hInst, const_cast<PTSTR>(tip2show.c_str()));
if (_shiftTrickUpTip && _shiftTrickDownTip) if (_shiftTrickUpTip && _shiftTrickDownTip)
{ {
SendMessage(_shiftTrickUpTip, TTM_ACTIVATE, TRUE, 0); SendMessage(_shiftTrickUpTip, TTM_ACTIVATE, TRUE, 0);
@ -914,6 +912,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
setStatusbarMessage(generic_string(), FSNoMessage); setStatusbarMessage(generic_string(), FSNoMessage);
display(false); display(false);
break; break;
case IDC_FINDPREV:
case IDOK : // Find Next : only for FIND_DLG and REPLACE_DLG case IDOK : // Find Next : only for FIND_DLG and REPLACE_DLG
{ {
setStatusbarMessage(generic_string(), FSNoMessage); setStatusbarMessage(generic_string(), FSNoMessage);
@ -926,7 +925,11 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
if (isMacroRecording) if (isMacroRecording)
saveInMacro(wParam, FR_OP_FIND); saveInMacro(wParam, FR_OP_FIND);
bool direction_bak = _options._whichDirection; bool direction_bak = DIR_UP;
if (LOWORD(wParam) == IDOK)
direction_bak = DIR_DOWN;
_options._whichDirection = direction_bak;
// if shift-key is pressed, revert search direction // if shift-key is pressed, revert search direction
// if shift-key is not pressed, use the normal setting // if shift-key is not pressed, use the normal setting
SHORT shift = GetKeyState(VK_SHIFT); SHORT shift = GetKeyState(VK_SHIFT);
@ -1258,15 +1261,13 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
::SendDlgItemMessage(_hSelf, IDWHOLEWORD, BM_SETCHECK, _options._isWholeWord?BST_CHECKED:BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDWHOLEWORD, BM_SETCHECK, _options._isWholeWord?BST_CHECKED:BST_UNCHECKED, 0);
//regex upward search is disable in v6.3 due to a regression //regex upward search is disable in v6.3 due to a regression
::SendDlgItemMessage(_hSelf, IDDIRECTIONDOWN, BM_SETCHECK, BST_CHECKED, 0);
::SendDlgItemMessage(_hSelf, IDDIRECTIONUP, BM_SETCHECK, BST_UNCHECKED, 0);
_options._whichDirection = DIR_DOWN; _options._whichDirection = DIR_DOWN;
} }
::EnableWindow(::GetDlgItem(_hSelf, IDWHOLEWORD), (BOOL)!isRegex); ::EnableWindow(::GetDlgItem(_hSelf, IDWHOLEWORD), (BOOL)!isRegex);
//regex upward search is disable in v6.3 due to a regression //regex upward search is disable in v6.3 due to a regression
::EnableWindow(::GetDlgItem(_hSelf, IDDIRECTIONUP), (BOOL)!isRegex); ::EnableWindow(::GetDlgItem(_hSelf, IDC_FINDPREV), (BOOL)!isRegex);
return TRUE; } return TRUE; }
case IDWRAP : case IDWRAP :
@ -2292,8 +2293,7 @@ void FindReplaceDlg::enableMarkAllControls(bool isEnable)
::ShowWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), hideOrShow); ::ShowWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDC_DIR_STATIC), !hideOrShow); ::ShowWindow(::GetDlgItem(_hSelf, IDC_DIR_STATIC), !hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDDIRECTIONUP), !hideOrShow); ::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDPREV), !hideOrShow);
::ShowWindow(::GetDlgItem(_hSelf, IDDIRECTIONDOWN), !hideOrShow);
} }
void FindReplaceDlg::enableFindInFilesControls(bool isEnable) void FindReplaceDlg::enableFindInFilesControls(bool isEnable)
@ -2312,8 +2312,8 @@ void FindReplaceDlg::enableFindInFilesControls(bool isEnable)
::ShowWindow(::GetDlgItem(_hSelf, IDCMARKALL), isEnable?SW_HIDE:SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDCMARKALL), isEnable?SW_HIDE:SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDC_DIR_STATIC), isEnable?SW_HIDE:SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_DIR_STATIC), isEnable?SW_HIDE:SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDDIRECTIONUP), isEnable?SW_HIDE:SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDPREV), isEnable ? SW_HIDE : SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDDIRECTIONDOWN), isEnable?SW_HIDE:SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACE), isEnable?SW_HIDE:SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDREPLACE), isEnable?SW_HIDE:SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACEINSELECTION), isEnable?SW_HIDE:SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACEINSELECTION), isEnable?SW_HIDE:SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEALL), isEnable?SW_HIDE:SW_SHOW); ::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEALL), isEnable?SW_HIDE:SW_SHOW);
@ -2602,7 +2602,7 @@ void FindReplaceDlg::initOptionsFromDlg()
_options._doPurge = isCheckedOrNot(IDC_PURGE_CHECK); _options._doPurge = isCheckedOrNot(IDC_PURGE_CHECK);
_options._doMarkLine = isCheckedOrNot(IDC_MARKLINE_CHECK); _options._doMarkLine = isCheckedOrNot(IDC_MARKLINE_CHECK);
_options._whichDirection = isCheckedOrNot(IDDIRECTIONDOWN); _options._whichDirection = DIR_DOWN;
_options._isRecursive = isCheckedOrNot(IDD_FINDINFILES_RECURSIVE_CHECK); _options._isRecursive = isCheckedOrNot(IDD_FINDINFILES_RECURSIVE_CHECK);
_options._isInHiddenDir = isCheckedOrNot(IDD_FINDINFILES_INHIDDENDIR_CHECK); _options._isInHiddenDir = isCheckedOrNot(IDD_FINDINFILES_INHIDDENDIR_CHECK);

View File

@ -66,19 +66,17 @@ BEGIN
CONTROL "E&xtended (\\n, \\r, \\t, \\0, \\x...)",IDEXTENDED, CONTROL "E&xtended (\\n, \\r, \\t, \\0, \\x...)",IDEXTENDED,
"Button",BS_AUTORADIOBUTTON,12,155,145,10 "Button",BS_AUTORADIOBUTTON,12,155,145,10
CONTROL "Re&gular expression",IDREGEXP,"Button",BS_AUTORADIOBUTTON,12,167,78,10 CONTROL "Re&gular expression",IDREGEXP,"Button",BS_AUTORADIOBUTTON,12,167,78,10
CONTROL "&Up",IDDIRECTIONUP,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,177,143,64,12 PUSHBUTTON "Find Previous", IDC_FINDPREV, 268, 20, 45, 21, WS_GROUP | BS_MULTILINE
CONTROL "&Down",IDDIRECTIONDOWN,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,177,155,63,12 PUSHBUTTON "Find Next", IDOK, 313, 20, 45, 21, WS_GROUP | BS_MULTILINE
GROUPBOX "Direction",IDC_DIR_STATIC,172,131,74,48,WS_GROUP PUSHBUTTON "Coun&t",IDCCOUNTALL,268,45,90,14
PUSHBUTTON "Find Next",IDOK,268,20,90,14,WS_GROUP PUSHBUTTON "Find All in All &Opened Documents",IDC_FINDALL_OPENEDFILES,268,64,90,21,BS_MULTILINE
PUSHBUTTON "Coun&t",IDCCOUNTALL,268,38,90,14 PUSHBUTTON "Find All in Current Document",IDC_FINDALL_CURRENTFILE,268,87,90,21,BS_MULTILINE
PUSHBUTTON "Find All in All &Opened Documents",IDC_FINDALL_OPENEDFILES,268,56,90,21,BS_MULTILINE PUSHBUTTON "&Replace",IDREPLACE,268,46,90,14
PUSHBUTTON "Find All in Current Document",IDC_FINDALL_CURRENTFILE,268,80,90,21,BS_MULTILINE PUSHBUTTON "Replace &All",IDREPLACEALL,268,63,90,14
PUSHBUTTON "&Replace",IDREPLACE,268,38,90,14 PUSHBUTTON "Replace All in All &Opened Documents",IDC_REPLACE_OPENEDFILES,268,81,90,21,BS_MULTILINE
PUSHBUTTON "Replace &All",IDREPLACEALL,268,56,90,14
PUSHBUTTON "Replace All in All &Opened Documents",IDC_REPLACE_OPENEDFILES,268,74,90,21,BS_MULTILINE
PUSHBUTTON "Find All",IDD_FINDINFILES_FIND_BUTTON,268,20,90,14,WS_GROUP PUSHBUTTON "Find All",IDD_FINDINFILES_FIND_BUTTON,268,20,90,14,WS_GROUP
PUSHBUTTON "&Replace in Files",IDD_FINDINFILES_REPLACEINFILES,268,38,90,14 PUSHBUTTON "&Replace in Files",IDD_FINDINFILES_REPLACEINFILES,268,38,90,14
PUSHBUTTON "Close",IDCANCEL,268,98,90,14 PUSHBUTTON "Close",IDCANCEL,268,105,90,14
GROUPBOX "",IDC_TRANSPARENT_GRPBOX,258,131,99,48 GROUPBOX "",IDC_TRANSPARENT_GRPBOX,258,131,99,48
CONTROL "Transparenc&y",IDC_TRANSPARENT_CHECK,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,254,131,80,10 CONTROL "Transparenc&y",IDC_TRANSPARENT_CHECK,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,254,131,80,10
CONTROL "On losing focus",IDC_TRANSPARENT_LOSSFOCUS_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,268,143,85,10 CONTROL "On losing focus",IDC_TRANSPARENT_LOSSFOCUS_RADIO,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,268,143,85,10

View File

@ -134,5 +134,6 @@
#define IDEXTENDED_FIFOLDER 1718 #define IDEXTENDED_FIFOLDER 1718
#define IDREGEXP_FIFOLDER 1719 #define IDREGEXP_FIFOLDER 1719
#define IDREDOTMATCHNL_FIFOLDER 1720 #define IDREDOTMATCHNL_FIFOLDER 1720
#define IDC_FINDPREV 1721
#endif //FINDREPLACE_DLG_H #endif //FINDREPLACE_DLG_H