Disable controls on unshown tabs of Find dialog

Fix #8696, close #8760
This commit is contained in:
Scott Sumner 2020-08-22 20:48:06 -04:00 committed by Don HO
parent 5bcbd9e5ab
commit 8f3d7c1026
5 changed files with 160 additions and 106 deletions

View File

@ -391,7 +391,7 @@
<Item id="1624" name="Search mode"/> <Item id="1624" name="Search mode"/>
<Item id="1625" name="&amp;Normal"/> <Item id="1625" name="&amp;Normal"/>
<Item id="1626" name="E&amp;xtended (\n, \r, \t, \0, \x...)"/> <Item id="1626" name="E&amp;xtended (\n, \r, \t, \0, \x...)"/>
<Item id="1660" name="&amp;Replace in Files"/> <Item id="1660" name="Replace in Files"/>
<Item id="1661" name="Follow current doc."/> <Item id="1661" name="Follow current doc."/>
<Item id="1641" name="Find All in Current Document"/> <Item id="1641" name="Find All in Current Document"/>
<Item id="1686" name="Transparenc&amp;y"/> <Item id="1686" name="Transparenc&amp;y"/>

View File

@ -391,7 +391,7 @@
<Item id="1624" name="Search mode"/> <Item id="1624" name="Search mode"/>
<Item id="1625" name="&amp;Normal"/> <Item id="1625" name="&amp;Normal"/>
<Item id="1626" name="E&amp;xtended (\n, \r, \t, \0, \x...)"/> <Item id="1626" name="E&amp;xtended (\n, \r, \t, \0, \x...)"/>
<Item id="1660" name="&amp;Replace in Files"/> <Item id="1660" name="Replace in Files"/>
<Item id="1661" name="Follow current doc."/> <Item id="1661" name="Follow current doc."/>
<Item id="1641" name="Find All in Current Document"/> <Item id="1641" name="Find All in Current Document"/>
<Item id="1686" name="Transparenc&amp;y"/> <Item id="1686" name="Transparenc&amp;y"/>

View File

@ -350,34 +350,34 @@ void FindReplaceDlg::fillFindHistory()
{ {
//regex doesn't allow wholeword //regex doesn't allow wholeword
::SendDlgItemMessage(_hSelf, IDWHOLEWORD, BM_SETCHECK, BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDWHOLEWORD, BM_SETCHECK, BST_UNCHECKED, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDWHOLEWORD), (BOOL)false); enableFindDlgItem(IDWHOLEWORD, false);
// regex upward search is disabled // regex upward search is disabled
::SendDlgItemMessage(_hSelf, IDC_BACKWARDDIRECTION, BM_SETCHECK, BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_BACKWARDDIRECTION, BM_SETCHECK, BST_UNCHECKED, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_BACKWARDDIRECTION), nppParams.regexBackward4PowerUser() ? TRUE : FALSE); enableFindDlgItem(IDC_BACKWARDDIRECTION, nppParams.regexBackward4PowerUser());
::EnableWindow(::GetDlgItem(_hSelf, IDC_FINDPREV), nppParams.regexBackward4PowerUser() ? TRUE : FALSE); enableFindDlgItem(IDC_FINDPREV, nppParams.regexBackward4PowerUser());
// 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); enableFindDlgItem(IDREDOTMATCHNL);
} }
if (nppParams.isTransparentAvailable()) if (nppParams.isTransparentAvailable())
{ {
::ShowWindow(::GetDlgItem(_hSelf, IDC_TRANSPARENT_CHECK), SW_SHOW); showFindDlgItem(IDC_TRANSPARENT_CHECK);
::ShowWindow(::GetDlgItem(_hSelf, IDC_TRANSPARENT_GRPBOX), SW_SHOW); showFindDlgItem(IDC_TRANSPARENT_GRPBOX);
::ShowWindow(::GetDlgItem(_hSelf, IDC_TRANSPARENT_LOSSFOCUS_RADIO), SW_SHOW); showFindDlgItem(IDC_TRANSPARENT_LOSSFOCUS_RADIO);
::ShowWindow(::GetDlgItem(_hSelf, IDC_TRANSPARENT_ALWAYS_RADIO), SW_SHOW); showFindDlgItem(IDC_TRANSPARENT_ALWAYS_RADIO);
::ShowWindow(::GetDlgItem(_hSelf, IDC_PERCENTAGE_SLIDER), SW_SHOW); showFindDlgItem(IDC_PERCENTAGE_SLIDER);
::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_SETRANGE, FALSE, MAKELONG(20, 200)); ::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_SETRANGE, FALSE, MAKELONG(20, 200));
::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_SETPOS, TRUE, findHistory._transparency); ::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_SETPOS, TRUE, findHistory._transparency);
if (findHistory._transparencyMode == FindHistory::none) if (findHistory._transparencyMode == FindHistory::none)
{ {
::EnableWindow(::GetDlgItem(_hSelf, IDC_TRANSPARENT_GRPBOX), FALSE); enableFindDlgItem(IDC_TRANSPARENT_GRPBOX, false);
::EnableWindow(::GetDlgItem(_hSelf, IDC_TRANSPARENT_LOSSFOCUS_RADIO), FALSE); enableFindDlgItem(IDC_TRANSPARENT_LOSSFOCUS_RADIO, false);
::EnableWindow(::GetDlgItem(_hSelf, IDC_TRANSPARENT_ALWAYS_RADIO), FALSE); enableFindDlgItem(IDC_TRANSPARENT_ALWAYS_RADIO, false);
::EnableWindow(::GetDlgItem(_hSelf, IDC_PERCENTAGE_SLIDER), FALSE); enableFindDlgItem(IDC_PERCENTAGE_SLIDER, false);
} }
else else
{ {
@ -1027,7 +1027,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_options._isInSelection = false; _options._isInSelection = false;
nbSelected = 0; nbSelected = 0;
} }
::EnableWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), nbSelected); enableFindDlgItem(IDC_IN_SELECTION_CHECK, nbSelected != 0);
// uncheck if the control is disable // uncheck if the control is disable
if (!nbSelected) if (!nbSelected)
{ {
@ -1054,11 +1054,11 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
// In that case, ". Matches newline" should be disabled as it applicable only for Regex // In that case, ". Matches newline" should be disabled as it applicable only for Regex
if (isCheckedOrNot(IDREGEXP)) if (isCheckedOrNot(IDREGEXP))
{ {
::EnableWindow(GetDlgItem(_hSelf, IDREDOTMATCHNL), true); enableFindDlgItem(IDREDOTMATCHNL);
} }
else else
{ {
::EnableWindow(GetDlgItem(_hSelf, IDREDOTMATCHNL), false); enableFindDlgItem(IDREDOTMATCHNL, false);
} }
return TRUE; return TRUE;
} }
@ -1079,9 +1079,9 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
bool is2ButtonsMode = isCheckedOrNot(IDC_2_BUTTONS_MODE); bool is2ButtonsMode = isCheckedOrNot(IDC_2_BUTTONS_MODE);
findHistory._isSearch2ButtonsMode = is2ButtonsMode; findHistory._isSearch2ButtonsMode = is2ButtonsMode;
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDPREV), is2ButtonsMode ? SW_SHOW : SW_HIDE); showFindDlgItem(IDC_FINDPREV, is2ButtonsMode);
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDNEXT), is2ButtonsMode ? SW_SHOW : SW_HIDE); showFindDlgItem(IDC_FINDNEXT, is2ButtonsMode);
::ShowWindow(::GetDlgItem(_hSelf, IDOK), is2ButtonsMode ? SW_HIDE : SW_SHOW); showFindDlgItem(IDOK, !is2ButtonsMode);
} }
break; break;
@ -1470,19 +1470,19 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{ {
_options._searchType = FindRegex; _options._searchType = FindRegex;
findHistory._searchMode = FindHistory::regExpr; findHistory._searchMode = FindHistory::regExpr;
::EnableWindow(GetDlgItem(_hSelf, IDREDOTMATCHNL), true); enableFindDlgItem(IDREDOTMATCHNL);
} }
else if (isCheckedOrNot(IDEXTENDED)) else if (isCheckedOrNot(IDEXTENDED))
{ {
_options._searchType = FindExtended; _options._searchType = FindExtended;
findHistory._searchMode = FindHistory::extended; findHistory._searchMode = FindHistory::extended;
::EnableWindow(GetDlgItem(_hSelf, IDREDOTMATCHNL), false); enableFindDlgItem(IDREDOTMATCHNL, false);
} }
else else
{ {
_options._searchType = FindNormal; _options._searchType = FindNormal;
findHistory._searchMode = FindHistory::normal; findHistory._searchMode = FindHistory::normal;
::EnableWindow(GetDlgItem(_hSelf, IDREDOTMATCHNL), false); enableFindDlgItem(IDREDOTMATCHNL, false);
} }
bool isRegex = (_options._searchType == FindRegex); bool isRegex = (_options._searchType == FindRegex);
@ -1500,7 +1500,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
} }
} }
::EnableWindow(::GetDlgItem(_hSelf, IDWHOLEWORD), (BOOL)!isRegex); enableFindDlgItem(IDWHOLEWORD, !isRegex);
// regex upward search is disabled // regex upward search is disabled
BOOL doEnable = TRUE; BOOL doEnable = TRUE;
@ -1508,8 +1508,8 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{ {
doEnable = FALSE; doEnable = FALSE;
} }
::EnableWindow(::GetDlgItem(_hSelf, IDC_BACKWARDDIRECTION), doEnable); enableFindDlgItem(IDC_BACKWARDDIRECTION, doEnable);
::EnableWindow(::GetDlgItem(_hSelf, IDC_FINDPREV), doEnable); enableFindDlgItem(IDC_FINDPREV, doEnable);
return TRUE; } return TRUE; }
@ -1547,10 +1547,10 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{ {
bool isChecked = isCheckedOrNot(IDC_TRANSPARENT_CHECK); bool isChecked = isCheckedOrNot(IDC_TRANSPARENT_CHECK);
::EnableWindow(::GetDlgItem(_hSelf, IDC_TRANSPARENT_GRPBOX), isChecked); enableFindDlgItem(IDC_TRANSPARENT_GRPBOX, isChecked);
::EnableWindow(::GetDlgItem(_hSelf, IDC_TRANSPARENT_LOSSFOCUS_RADIO), isChecked); enableFindDlgItem(IDC_TRANSPARENT_LOSSFOCUS_RADIO, isChecked);
::EnableWindow(::GetDlgItem(_hSelf, IDC_TRANSPARENT_ALWAYS_RADIO), isChecked); enableFindDlgItem(IDC_TRANSPARENT_ALWAYS_RADIO, isChecked);
::EnableWindow(::GetDlgItem(_hSelf, IDC_PERCENTAGE_SLIDER), isChecked); enableFindDlgItem(IDC_PERCENTAGE_SLIDER, isChecked);
if (isChecked) if (isChecked)
{ {
@ -2560,10 +2560,63 @@ void FindReplaceDlg::setSearchText(TCHAR * txt2find)
::SendMessage(hCombo, CB_SETEDITSEL, 0, MAKELPARAM(0, -1)); // select all text - fast edit ::SendMessage(hCombo, CB_SETEDITSEL, 0, MAKELPARAM(0, -1)); // select all text - fast edit
} }
void FindReplaceDlg::enableReplaceFunc(bool isEnable) void FindReplaceDlg::enableFindDlgItem(int dlgItemID, bool isEnable /* = true*/)
{
HWND h = ::GetDlgItem(_hSelf, dlgItemID);
if (!h) return;
if (::IsWindowVisible(h))
{
::EnableWindow(h, isEnable ? TRUE : FALSE);
}
// remember the real state of this control being enabled/disabled
_controlEnableMap[dlgItemID] = isEnable;
}
void FindReplaceDlg::showFindDlgItem(int dlgItemID, bool isShow /* = true*/)
{
HWND h = ::GetDlgItem(_hSelf, dlgItemID);
if (!h) return;
::ShowWindow(h, isShow ? SW_SHOW : SW_HIDE);
// when hiding a control to make it user-inaccessible, it can still be manipulated via a keyboard accelerator!
// so disable it in addition to hiding it to prevent such user interaction
// but that causes trouble when unhiding it; we don't know if it should be enabled or disabled,
// so used the remembered state when we last enabled/disabled this control to determine it
if (dlgItemID == IDOK)
{
// do not disable the standard Find-Next button (IDOK);
// keeping it enabled allows Enter (and Shift+Enter) to work when in 2-button-find-mode
// and IDC_FINDNEXT does not have focus
return;
}
int enable = isShow ? TRUE : FALSE;
if (isShow)
{
const auto iter = _controlEnableMap.find(dlgItemID);
if (iter == _controlEnableMap.end())
{
// if control's state was never previously recorded, assume it was enabled
enable = TRUE;
_controlEnableMap[dlgItemID] = true;
}
else
{
enable = iter->second ? TRUE : FALSE;
}
}
::EnableWindow(h, enable);
}
void FindReplaceDlg::enableReplaceFunc(bool isEnable)
{ {
_currentStatus = isEnable?REPLACE_DLG:FIND_DLG; _currentStatus = isEnable?REPLACE_DLG:FIND_DLG;
int hideOrShow = isEnable?SW_SHOW:SW_HIDE;
RECT *pClosePos = isEnable ? &_replaceClosePos : &_findClosePos; RECT *pClosePos = isEnable ? &_replaceClosePos : &_findClosePos;
RECT *pInSelectionFramePos = isEnable ? &_replaceInSelFramePos : &_countInSelFramePos; RECT *pInSelectionFramePos = isEnable ? &_replaceInSelFramePos : &_countInSelFramePos;
RECT *pInSectionCheckPos = isEnable ? &_replaceInSelCheckPos : &_countInSelCheckPos; RECT *pInSectionCheckPos = isEnable ? &_replaceInSelCheckPos : &_countInSelCheckPos;
@ -2571,25 +2624,25 @@ void FindReplaceDlg::enableReplaceFunc(bool isEnable)
enableFindInFilesControls(false); enableFindInFilesControls(false);
enableMarkAllControls(false); enableMarkAllControls(false);
// replace controls // replace controls
::ShowWindow(::GetDlgItem(_hSelf, ID_STATICTEXT_REPLACE),hideOrShow); showFindDlgItem(ID_STATICTEXT_REPLACE, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACE),hideOrShow); showFindDlgItem(IDREPLACE, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEWITH),hideOrShow); showFindDlgItem(IDREPLACEWITH, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEALL),hideOrShow); showFindDlgItem(IDREPLACEALL, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEINSEL),hideOrShow); showFindDlgItem(IDREPLACEINSEL, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACE_OPENEDFILES),hideOrShow); showFindDlgItem(IDC_REPLACE_OPENEDFILES, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACEINSELECTION), SW_SHOW); showFindDlgItem(IDC_REPLACEINSELECTION);
::ShowWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), SW_SHOW); showFindDlgItem(IDC_IN_SELECTION_CHECK);
::ShowWindow(::GetDlgItem(_hSelf, IDC_2_BUTTONS_MODE), SW_SHOW); showFindDlgItem(IDC_2_BUTTONS_MODE);
bool is2ButtonMode = isCheckedOrNot(IDC_2_BUTTONS_MODE); bool is2ButtonMode = isCheckedOrNot(IDC_2_BUTTONS_MODE);
::ShowWindow(::GetDlgItem(_hSelf, IDOK), is2ButtonMode ? SW_HIDE : SW_SHOW); showFindDlgItem(IDOK, !is2ButtonMode);
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDPREV), !is2ButtonMode ? SW_HIDE : SW_SHOW); showFindDlgItem(IDC_FINDPREV, is2ButtonMode);
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDNEXT), !is2ButtonMode ? SW_HIDE : SW_SHOW); showFindDlgItem(IDC_FINDNEXT, is2ButtonMode);
// find controls // find controls
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_OPENEDFILES), !hideOrShow); showFindDlgItem(IDC_FINDALL_OPENEDFILES, !isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDCCOUNTALL),!hideOrShow); showFindDlgItem(IDCCOUNTALL, !isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_CURRENTFILE),!hideOrShow); showFindDlgItem(IDC_FINDALL_CURRENTFILE, !isEnable);
gotoCorrectTab(); gotoCorrectTab();
@ -2606,69 +2659,65 @@ void FindReplaceDlg::enableReplaceFunc(bool isEnable)
void FindReplaceDlg::enableMarkAllControls(bool isEnable) void FindReplaceDlg::enableMarkAllControls(bool isEnable)
{ {
int hideOrShow = isEnable?SW_SHOW:SW_HIDE; showFindDlgItem(IDCMARKALL, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDCMARKALL),hideOrShow); showFindDlgItem(IDC_MARKLINE_CHECK, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDC_MARKLINE_CHECK),hideOrShow); showFindDlgItem(IDC_PURGE_CHECK, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDC_PURGE_CHECK),hideOrShow); showFindDlgItem(IDC_CLEAR_ALL, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDC_CLEAR_ALL),hideOrShow); showFindDlgItem(IDC_IN_SELECTION_CHECK, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), hideOrShow);
} }
void FindReplaceDlg::enableFindInFilesControls(bool isEnable) void FindReplaceDlg::enableFindInFilesControls(bool isEnable)
{ {
// Hide Items // Hide Items
::ShowWindow(::GetDlgItem(_hSelf, IDC_BACKWARDDIRECTION), isEnable?SW_HIDE:SW_SHOW); showFindDlgItem(IDC_BACKWARDDIRECTION, !isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDWRAP), isEnable?SW_HIDE:SW_SHOW); showFindDlgItem(IDWRAP, !isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDCCOUNTALL), isEnable?SW_HIDE:SW_SHOW); showFindDlgItem(IDCCOUNTALL, !isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_OPENEDFILES), isEnable?SW_HIDE:SW_SHOW); showFindDlgItem(IDC_FINDALL_OPENEDFILES, !isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_CURRENTFILE), isEnable?SW_HIDE:SW_SHOW); showFindDlgItem(IDC_FINDALL_CURRENTFILE, !isEnable);
if (isEnable) if (isEnable)
{ {
::ShowWindow(::GetDlgItem(_hSelf, IDC_2_BUTTONS_MODE), SW_HIDE); showFindDlgItem(IDC_2_BUTTONS_MODE, false);
::ShowWindow(::GetDlgItem(_hSelf, IDOK), SW_HIDE); showFindDlgItem(IDOK, false);
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDPREV), SW_HIDE); showFindDlgItem(IDC_FINDPREV, false);
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDNEXT), SW_HIDE); showFindDlgItem(IDC_FINDNEXT, false);
} }
else else
{ {
::ShowWindow(::GetDlgItem(_hSelf, IDC_2_BUTTONS_MODE), SW_SHOW); showFindDlgItem(IDC_2_BUTTONS_MODE);
bool is2ButtonMode = isCheckedOrNot(IDC_2_BUTTONS_MODE); bool is2ButtonMode = isCheckedOrNot(IDC_2_BUTTONS_MODE);
showFindDlgItem(IDOK, !is2ButtonMode);
::ShowWindow(::GetDlgItem(_hSelf, IDOK), is2ButtonMode ? SW_HIDE : SW_SHOW); showFindDlgItem(IDC_FINDPREV, is2ButtonMode);
showFindDlgItem(IDC_FINDNEXT, is2ButtonMode);
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDPREV), !is2ButtonMode ? SW_HIDE : SW_SHOW);
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDNEXT), !is2ButtonMode ? SW_HIDE : SW_SHOW);
} }
::ShowWindow(::GetDlgItem(_hSelf, IDC_MARKLINE_CHECK), isEnable?SW_HIDE:SW_SHOW); showFindDlgItem(IDC_MARKLINE_CHECK, !isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDC_PURGE_CHECK), isEnable?SW_HIDE:SW_SHOW); showFindDlgItem(IDC_PURGE_CHECK, !isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), isEnable?SW_HIDE:SW_SHOW); showFindDlgItem(IDC_IN_SELECTION_CHECK, !isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDC_CLEAR_ALL), isEnable?SW_HIDE:SW_SHOW); showFindDlgItem(IDC_CLEAR_ALL, !isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDCMARKALL), isEnable?SW_HIDE:SW_SHOW); showFindDlgItem(IDCMARKALL, !isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACE), isEnable?SW_HIDE:SW_SHOW); showFindDlgItem(IDREPLACE, !isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACEINSELECTION), isEnable?SW_HIDE:SW_SHOW); showFindDlgItem(IDC_REPLACEINSELECTION, !isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEALL), isEnable?SW_HIDE:SW_SHOW); showFindDlgItem(IDREPLACEALL, !isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACE_OPENEDFILES), isEnable?SW_HIDE:SW_SHOW); showFindDlgItem(IDC_REPLACE_OPENEDFILES, !isEnable);
// Show Items // Show Items
if (isEnable) if (isEnable)
{ {
::ShowWindow(::GetDlgItem(_hSelf, ID_STATICTEXT_REPLACE), SW_SHOW); showFindDlgItem(ID_STATICTEXT_REPLACE);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEWITH), SW_SHOW); showFindDlgItem(IDREPLACEWITH);
} }
::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_REPLACEINFILES), isEnable?SW_SHOW:SW_HIDE); showFindDlgItem(IDD_FINDINFILES_REPLACEINFILES, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_FILTERS_STATIC), isEnable?SW_SHOW:SW_HIDE); showFindDlgItem(IDD_FINDINFILES_FILTERS_STATIC, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_FILTERS_COMBO), isEnable?SW_SHOW:SW_HIDE); showFindDlgItem(IDD_FINDINFILES_FILTERS_COMBO, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_DIR_STATIC), isEnable?SW_SHOW:SW_HIDE); showFindDlgItem(IDD_FINDINFILES_DIR_STATIC, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_DIR_COMBO), isEnable?SW_SHOW:SW_HIDE); showFindDlgItem(IDD_FINDINFILES_DIR_COMBO, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_BROWSE_BUTTON), isEnable?SW_SHOW:SW_HIDE); showFindDlgItem(IDD_FINDINFILES_BROWSE_BUTTON, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_FIND_BUTTON), isEnable?SW_SHOW:SW_HIDE); showFindDlgItem(IDD_FINDINFILES_FIND_BUTTON, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_GOBACK_BUTTON), isEnable?SW_SHOW:SW_HIDE); showFindDlgItem(IDD_FINDINFILES_RECURSIVE_CHECK, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_RECURSIVE_CHECK), isEnable?SW_SHOW:SW_HIDE); showFindDlgItem(IDD_FINDINFILES_INHIDDENDIR_CHECK, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_INHIDDENDIR_CHECK), isEnable?SW_SHOW:SW_HIDE); showFindDlgItem(IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK, isEnable);
::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK), isEnable?SW_SHOW:SW_HIDE);
} }
void FindReplaceDlg::getPatterns(vector<generic_string> & patternVect) void FindReplaceDlg::getPatterns(vector<generic_string> & patternVect)
@ -3180,22 +3229,22 @@ void FindReplaceDlg::enableMarkFunc()
enableMarkAllControls(true); enableMarkAllControls(true);
// Replace controls to hide // Replace controls to hide
::ShowWindow(::GetDlgItem(_hSelf, ID_STATICTEXT_REPLACE),SW_HIDE); showFindDlgItem(ID_STATICTEXT_REPLACE, false);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACE),SW_HIDE); showFindDlgItem(IDREPLACE, false);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEWITH),SW_HIDE); showFindDlgItem(IDREPLACEWITH, false);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEALL),SW_HIDE); showFindDlgItem(IDREPLACEALL, false);
::ShowWindow(::GetDlgItem(_hSelf, IDREPLACEINSEL),SW_HIDE); showFindDlgItem(IDREPLACEINSEL, false);
::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACE_OPENEDFILES),SW_HIDE); showFindDlgItem(IDC_REPLACE_OPENEDFILES, false);
::ShowWindow(::GetDlgItem(_hSelf, IDC_REPLACEINSELECTION),SW_HIDE); showFindDlgItem(IDC_REPLACEINSELECTION, false);
// find controls to hide // find controls to hide
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_OPENEDFILES), SW_HIDE); showFindDlgItem(IDC_FINDALL_OPENEDFILES, false);
::ShowWindow(::GetDlgItem(_hSelf, IDCCOUNTALL),SW_HIDE); showFindDlgItem(IDCCOUNTALL, false);
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDALL_CURRENTFILE),SW_HIDE); showFindDlgItem(IDC_FINDALL_CURRENTFILE, false);
::ShowWindow(::GetDlgItem(_hSelf, IDOK),SW_HIDE); showFindDlgItem(IDOK, false);
::ShowWindow(::GetDlgItem(_hSelf, IDC_2_BUTTONS_MODE), SW_HIDE); showFindDlgItem(IDC_2_BUTTONS_MODE, false);
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDPREV), SW_HIDE); showFindDlgItem(IDC_FINDPREV, false);
::ShowWindow(::GetDlgItem(_hSelf, IDC_FINDNEXT), SW_HIDE); showFindDlgItem(IDC_FINDNEXT, false);
_currentStatus = MARK_DLG; _currentStatus = MARK_DLG;
gotoCorrectTab(); gotoCorrectTab();

View File

@ -28,6 +28,7 @@
#pragma once #pragma once
#include <map>
#include "FindReplaceDlg_rc.h" #include "FindReplaceDlg_rc.h"
#include "ScintillaEditView.h" #include "ScintillaEditView.h"
#include "DockingDlgInterface.h" #include "DockingDlgInterface.h"
@ -388,6 +389,11 @@ private :
HFONT _hMonospaceFont = nullptr; HFONT _hMonospaceFont = nullptr;
std::map<int, bool> _controlEnableMap;
void enableFindDlgItem(int dlgItemID, bool isEnable = true);
void showFindDlgItem(int dlgItemID, bool isShow = true);
void enableReplaceFunc(bool isEnable); void enableReplaceFunc(bool isEnable);
void enableFindInFilesControls(bool isEnable = true); void enableFindInFilesControls(bool isEnable = true);
void enableFindInFilesFunc(); void enableFindInFilesFunc();

View File

@ -91,7 +91,6 @@
#define IDD_FINDINFILES_FILTERS_STATIC 1654 #define IDD_FINDINFILES_FILTERS_STATIC 1654
#define IDD_FINDINFILES_DIR_STATIC 1655 #define IDD_FINDINFILES_DIR_STATIC 1655
#define IDD_FINDINFILES_FIND_BUTTON 1656 #define IDD_FINDINFILES_FIND_BUTTON 1656
#define IDD_FINDINFILES_GOBACK_BUTTON 1657
#define IDD_FINDINFILES_RECURSIVE_CHECK 1658 #define IDD_FINDINFILES_RECURSIVE_CHECK 1658
#define IDF_FINDINFILES_RECURSIVE_CHECK 32 #define IDF_FINDINFILES_RECURSIVE_CHECK 32
#define IDD_FINDINFILES_INHIDDENDIR_CHECK 1659 #define IDD_FINDINFILES_INHIDDENDIR_CHECK 1659