From e4975230a469ea26a17727fa1985ae55379bf897 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Thu, 21 May 2009 16:59:34 +0000 Subject: [PATCH] [NEW] Add "follow current doc" checkbox in Find in file dialog. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@477 f5eea248-9336-0410-98b8-ebc06183d4e3 --- .../src/ScitillaComponent/FindReplaceDlg.cpp | 22 +++++++++++++++++-- .../src/ScitillaComponent/FindReplaceDlg.rc | 6 +++-- .../src/ScitillaComponent/FindReplaceDlg_rc.h | 1 + .../WinControls/Preference/preferenceDlg.cpp | 2 +- .../src/tools/xmlUpdater/xmlUpdater.cpp | 2 +- 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index 9d4c66ffa..46522aa58 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -316,7 +316,8 @@ void FindReplaceDlg::fillFindHistory() ::SendDlgItemMessage(_hSelf, IDD_FINDINFILES_INHIDDENDIR_CHECK, BM_SETCHECK, findHistory._isFifInHiddenFolder, 0); ::SendDlgItemMessage(_hSelf, IDD_FINDINFILES_RECURSIVE_CHECK, BM_SETCHECK, findHistory._isFifRecuisive, 0); - + ::SendDlgItemMessage(_hSelf, IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK, BM_SETCHECK, findHistory._isFolderFollowDoc, 0); + ::SendDlgItemMessage(_hSelf, IDNORMAL, BM_SETCHECK, findHistory._searchMode == FindHistory::normal, 0); ::SendDlgItemMessage(_hSelf, IDEXTENDED, BM_SETCHECK, findHistory._searchMode == FindHistory::extended, 0); ::SendDlgItemMessage(_hSelf, IDREGEXP, BM_SETCHECK, findHistory._searchMode == FindHistory::regExpr, 0); @@ -683,7 +684,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP if (isCheckedOrNot(IDC_TRANSPARENT_LOSSFOCUS_RADIO)) { - if (LOWORD(wParam) == WA_INACTIVE && Window::isVisible()) + if (LOWORD(wParam) == WA_INACTIVE && isVisible()) { int percent = ::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0); (NppParameters::getInstance())->SetTransparent(_hSelf, percent); @@ -1047,6 +1048,22 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP } return TRUE; + + case IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK : + { + if (_currentStatus == FINDINFILES_DLG) + findHistory._isFolderFollowDoc = isCheckedOrNot(IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK); + + if (findHistory._isFolderFollowDoc) + { + NppParameters *pNppParam = NppParameters::getInstance(); + const TCHAR * dir = pNppParam->getWorkingDir(); + ::SetDlgItemText(_hSelf, IDD_FINDINFILES_DIR_COMBO, dir); + } + + } + return TRUE; + case IDD_FINDINFILES_BROWSE_BUTTON : { if (_currentStatus == FINDINFILES_DLG) @@ -1707,6 +1724,7 @@ void FindReplaceDlg::enableFindInFilesControls(bool isEnable) ::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_GOBACK_BUTTON), isEnable?SW_SHOW:SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_RECURSIVE_CHECK), isEnable?SW_SHOW:SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_INHIDDENDIR_CHECK), isEnable?SW_SHOW:SW_HIDE); + ::ShowWindow(::GetDlgItem(_hSelf, IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK), isEnable?SW_SHOW:SW_HIDE); } void FindReplaceDlg::getPatterns(vector & patternVect) diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.rc b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.rc index fbcb5d15d..4372d463d 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.rc +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.rc @@ -45,8 +45,10 @@ BEGIN RTEXT "Dir&ectory :",IDD_FINDINFILES_DIR_STATIC,7,76,40,8 COMBOBOX IDD_FINDINFILES_DIR_COMBO,49,74,141,150,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP PUSHBUTTON "...",IDD_FINDINFILES_BROWSE_BUTTON,193,74,15,13 - CONTROL "In all su&b-folders",IDD_FINDINFILES_RECURSIVE_CHECK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,218,73,94,15 - CONTROL "In &hidden folders",IDD_FINDINFILES_INHIDDENDIR_CHECK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,218,87,94,15 + CONTROL "Follow current doc",IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,218,73,94,15 + CONTROL "In all su&b-folders",IDD_FINDINFILES_RECURSIVE_CHECK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,218,87,94,15 + CONTROL "In &hidden folders",IDD_FINDINFILES_INHIDDENDIR_CHECK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,218,101,94,15 + CONTROL "Match &whole word only",IDWHOLEWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,88,140,15 CONTROL "Match &case",IDMATCHCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,100,140,15 CONTROL "Wra&p around",IDWRAP,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,6,112,110,15 diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg_rc.h b/PowerEditor/src/ScitillaComponent/FindReplaceDlg_rc.h index 6c93f6a9e..2a8fa27e5 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg_rc.h +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg_rc.h @@ -58,6 +58,7 @@ #define IDD_FINDINFILES_RECURSIVE_CHECK 1658 #define IDD_FINDINFILES_INHIDDENDIR_CHECK 1659 #define IDD_FINDINFILES_REPLACEINFILES 1660 +#define IDD_FINDINFILES_FOLDERFOLLOWSDOC_CHECK 1661 #define IDD_FINDRESULT 1670 diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 876925260..347b7bf70 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -1402,7 +1402,7 @@ BOOL CALLBACK PrintSettings2Dlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM varList.push_back(strCouple(TEXT("Full file name path"), TEXT("$(FULL_CURRENT_PATH)"))); varList.push_back(strCouple(TEXT("File name"), TEXT("$(FILE_NAME)"))); - varList.push_back(strCouple(TEXT("File directory"), TEXT("$(FULL_CURRENT_PATH)"))); + varList.push_back(strCouple(TEXT("File directory"), TEXT("$(CURRENT_DIRECTORY)"))); varList.push_back(strCouple(TEXT("Page"), TEXT("$(CURRENT_PRINTING_PAGE)"))); varList.push_back(strCouple(TEXT("Short date format"), TEXT("$(SHORT_DATE)"))); varList.push_back(strCouple(TEXT("Long date format"), TEXT("$(LONG_DATE)"))); diff --git a/PowerEditor/src/tools/xmlUpdater/xmlUpdater.cpp b/PowerEditor/src/tools/xmlUpdater/xmlUpdater.cpp index e02319814..ef9a72303 100644 --- a/PowerEditor/src/tools/xmlUpdater/xmlUpdater.cpp +++ b/PowerEditor/src/tools/xmlUpdater/xmlUpdater.cpp @@ -198,7 +198,7 @@ int main(int argc, char *argv[]) if (pXmlSrc) delete pXmlSrc; if (pXmlDest) delete pXmlDest; - printf("Update Failure"); + printf(msg); return -1; }