From dd759bfa427a67f69540a394656b6a9325ee093e Mon Sep 17 00:00:00 2001 From: donho Date: Thu, 23 Aug 2007 23:23:02 +0000 Subject: [PATCH] [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 --- .../src/ScitillaComponent/FindReplaceDlg.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index a6a23aeb7..b5a79befa 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -319,14 +319,23 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP case WM_ACTIVATE : { CharacterRange cr = (*_ppEditView)->getSelection(); - bool isSelected = (cr.cpMax - cr.cpMin) != 0; - if (!isSelected) + int nbSelected = cr.cpMax - cr.cpMin; + + int checkVal; + if (nbSelected <= 64) { - ::SendDlgItemMessage(_hSelf, IDC_IN_SELECTION_CHECK, BM_SETCHECK, BST_UNCHECKED, 0); + checkVal = BST_UNCHECKED; _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 (wParam == WA_INACTIVE)