[NEW_FEATURE] Auto check "In selection" in Find Replace dialog while there's a selection in the text zone.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@13 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2007-08-23 23:23:02 +00:00
parent 894c4dcffd
commit dd759bfa42

View File

@ -319,14 +319,23 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
case WM_ACTIVATE : case WM_ACTIVATE :
{ {
CharacterRange cr = (*_ppEditView)->getSelection(); CharacterRange cr = (*_ppEditView)->getSelection();
bool isSelected = (cr.cpMax - cr.cpMin) != 0; int nbSelected = cr.cpMax - cr.cpMin;
if (!isSelected)
int checkVal;
if (nbSelected <= 64)
{ {
::SendDlgItemMessage(_hSelf, IDC_IN_SELECTION_CHECK, BM_SETCHECK, BST_UNCHECKED, 0); checkVal = BST_UNCHECKED;
_isInSelection = false; _isInSelection = false;
} }
::EnableWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), isSelected); else
{
checkVal = BST_CHECKED;
_isInSelection = true;
}
::SendDlgItemMessage(_hSelf, IDC_IN_SELECTION_CHECK, BM_SETCHECK, checkVal, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), nbSelected);
if (isCheckedOrNot(IDC_TRANSPARENT_LOSSFOCUS_RADIO)) if (isCheckedOrNot(IDC_TRANSPARENT_LOSSFOCUS_RADIO))
{ {
if (wParam == WA_INACTIVE) if (wParam == WA_INACTIVE)