[UPDATE] Added an (hidden) option to make the "Filters" and "Directory" fields follow the current opened document in "Find in files" dialog. The new parameters are located in config.xml and are called: "fifFilterFollowsDoc" and "fifFolderFollowsDoc" (set to "yes"/"no")

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@452 f5eea248-9336-0410-98b8-ebc06183d4e3
pull/343/head^2
yniq 16 years ago
parent 8c21ac903b
commit c924a47560

@ -1657,12 +1657,12 @@ bool Notepad_plus::replaceInFiles()
HANDLE CancelThreadHandle = NULL;
vector<generic_string> patterns2Match;
if (_findReplaceDlg.getFilters() == TEXT(""))
_findReplaceDlg.getPatterns(patterns2Match);
if (patterns2Match.size() == 0)
{
NppParameters *pNppParam = NppParameters::getInstance();
_findReplaceDlg.setFindInFilesDirFilter(pNppParam->getWorkingDir(), TEXT("*.*"));
}
_findReplaceDlg.setFindInFilesDirFilter(NULL, TEXT("*.*"));
_findReplaceDlg.getPatterns(patterns2Match);
}
vector<generic_string> fileNames;
getMatchedFileNames(dir2Search, patterns2Match, fileNames, isRecursive, isInHiddenDir);
@ -1738,14 +1738,13 @@ bool Notepad_plus::findInFiles()
HANDLE CancelThreadHandle = NULL;
vector<generic_string> patterns2Match;
if (_findReplaceDlg.getFilters() == TEXT(""))
_findReplaceDlg.getPatterns(patterns2Match);
if (patterns2Match.size() == 0)
{
NppParameters *pNppParam = NppParameters::getInstance();
_findReplaceDlg.setFindInFilesDirFilter(pNppParam->getWorkingDir(), TEXT("*.*"));
}
_findReplaceDlg.setFindInFilesDirFilter(NULL, TEXT("*.*"));
_findReplaceDlg.getPatterns(patterns2Match);
}
vector<generic_string> fileNames;
getMatchedFileNames(dir2Search, patterns2Match, fileNames, isRecursive, isInHiddenDir);
if (fileNames.size() > 1)
@ -9741,15 +9740,16 @@ void Notepad_plus::setFindReplaceFolderFilter(const TCHAR *dir, const TCHAR *fil
{
generic_string fltr;
NppParameters *pNppParam = NppParameters::getInstance();
FindHistory & findHistory = pNppParam->getFindHistory();
// get current language file extensions in case they are not provided.
if (!dir)
// get current directory in case it's not provided.
if (!dir && findHistory._isFolderFollowDoc)
{
dir = pNppParam->getWorkingDir();
}
if (!filter)
// get current language file extensions in case it's not provided.
if (!filter && findHistory._isFilterFollowDoc)
{
// Get current language file extensions
const TCHAR *ext = NULL;

@ -1552,6 +1552,14 @@ void NppParameters::feedFindHistoryParameters(TiXmlNode *node)
if (boolStr)
_findHistory._isDlgAlwaysVisible = !lstrcmp(TEXT("yes"), boolStr);
boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("fifFilterFollowsDoc"));
if (boolStr)
_findHistory._isFilterFollowDoc = !lstrcmp(TEXT("yes"), boolStr);
boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("fifFolderFollowsDoc"));
if (boolStr)
_findHistory._isFolderFollowDoc = !lstrcmp(TEXT("yes"), boolStr);
int mode = 0;
boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("searchMode"), &mode);
if (boolStr)
@ -4073,6 +4081,8 @@ bool NppParameters::writeFindHistory()
(findHistoryRoot->ToElement())->SetAttribute(TEXT("fifRecuisive"), _findHistory._isFifRecuisive?TEXT("yes"):TEXT("no"));
(findHistoryRoot->ToElement())->SetAttribute(TEXT("fifInHiddenFolder"), _findHistory._isFifInHiddenFolder?TEXT("yes"):TEXT("no"));
(findHistoryRoot->ToElement())->SetAttribute(TEXT("dlgAlwaysVisible"), _findHistory._isDlgAlwaysVisible?TEXT("yes"):TEXT("no"));
(findHistoryRoot->ToElement())->SetAttribute(TEXT("fifFilterFollowsDoc"), _findHistory._isFilterFollowDoc?TEXT("yes"):TEXT("no"));
(findHistoryRoot->ToElement())->SetAttribute(TEXT("fifFolderFollowsDoc"), _findHistory._isFolderFollowDoc?TEXT("yes"):TEXT("no"));
(findHistoryRoot->ToElement())->SetAttribute(TEXT("searchMode"), _findHistory._searchMode);
(findHistoryRoot->ToElement())->SetAttribute(TEXT("transparencyMode"), _findHistory._transparencyMode);

@ -794,6 +794,7 @@ struct FindHistory {
_nbFindHistoryPath(0), _nbFindHistoryFilter(0),_nbFindHistoryFind(0), _nbFindHistoryReplace(0),\
_isMatchWord(false), _isMatchCase(false),_isWrap(true),_isDirectionDown(true),\
_isFifRecuisive(true), _isFifInHiddenFolder(false), _isDlgAlwaysVisible(false),\
_isFilterFollowDoc(false), _isFolderFollowDoc(false),\
_searchMode(normal), _transparencyMode(onLossingFocus), _transparency(150)
{};
@ -825,7 +826,8 @@ struct FindHistory {
int _transparency;
bool _isDlgAlwaysVisible;
bool _isFilterFollowDoc;
bool _isFolderFollowDoc;
};

@ -350,7 +350,7 @@ public :
if (dir)
{
_directory = dir;
//::SetDlgItemText(_hSelf, IDD_FINDINFILES_DIR_COMBO, dir);
::SetDlgItemText(_hSelf, IDD_FINDINFILES_DIR_COMBO, dir);
}
if (filters)
{

Loading…
Cancel
Save