mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+ upd: gerpWinNP3 to current gerpWin development
This commit is contained in:
parent
f84fbac21a
commit
75bbcfd796
@ -105,6 +105,11 @@
|
||||
<arg value="bin\release\grepWin.exe" />
|
||||
<arg value="translations\Spanish.lang" />
|
||||
</exec>
|
||||
<exec program="tools\restext.exe" >
|
||||
<arg value="extract" />
|
||||
<arg value="bin\release\grepWin.exe" />
|
||||
<arg value="translations\Spanish Mexican.lang" />
|
||||
</exec>
|
||||
<exec program="tools\restext.exe" >
|
||||
<arg value="extract" />
|
||||
<arg value="bin\release\grepWin.exe" />
|
||||
@ -165,6 +170,16 @@
|
||||
<arg value="bin\release\grepWin.exe" />
|
||||
<arg value="translations\Swedish.lang" />
|
||||
</exec>
|
||||
<exec program="tools\restext.exe" >
|
||||
<arg value="extract" />
|
||||
<arg value="bin\release\grepWin.exe" />
|
||||
<arg value="translations\Afrikaans.lang" />
|
||||
</exec>
|
||||
<exec program="tools\restext.exe" >
|
||||
<arg value="extract" />
|
||||
<arg value="bin\release\grepWin.exe" />
|
||||
<arg value="translations\Korean.lang" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="grepWin" depends="VersionInfo">
|
||||
|
||||
@ -266,7 +266,7 @@ LRESULT CSearchDlg::DlgFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||
ret = ::GetLongPathName(m_searchpath.c_str(), NULL, 0);
|
||||
if (ret)
|
||||
{
|
||||
std::unique_ptr<TCHAR[]> pathbuf(new TCHAR[ret + 2]);
|
||||
auto pathbuf = std::make_unique<wchar_t[]>(ret + 2);
|
||||
ret = ::GetLongPathName(m_searchpath.c_str(), pathbuf.get(), ret + 1);
|
||||
m_searchpath = std::wstring(pathbuf.get(), ret);
|
||||
}
|
||||
@ -337,7 +337,7 @@ LRESULT CSearchDlg::DlgFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||
}
|
||||
}
|
||||
|
||||
TCHAR buf[MAX_PATH] = {0};
|
||||
wchar_t buf[MAX_PATH] = {0};
|
||||
if (m_bSizeC && (m_lSize != (uint64_t)-1))
|
||||
{
|
||||
_stprintf_s(buf, _countof(buf), L"%I64u", m_lSize);
|
||||
@ -582,21 +582,18 @@ LRESULT CSearchDlg::DlgFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||
if (m_updateCheckThread.joinable())
|
||||
m_updateCheckThread.join();
|
||||
#endif
|
||||
if (!DWORD(CRegStdDWORD(L"Software\\grepWinNP3\\escclose", FALSE)))
|
||||
if (IsEvaluationThreadRunning())
|
||||
InterlockedExchange(&s_Cancelled, TRUE);
|
||||
else
|
||||
{
|
||||
if (IsEvaluationThreadRunning())
|
||||
InterlockedExchange(&s_Cancelled, TRUE);
|
||||
else
|
||||
{
|
||||
SaveSettings();
|
||||
m_AutoCompleteFilePatterns.Save();
|
||||
m_AutoCompleteSearchPatterns.Save();
|
||||
m_AutoCompleteReplacePatterns.Save();
|
||||
m_AutoCompleteSearchPaths.Save();
|
||||
EndDialog(*this, IDCANCEL);
|
||||
}
|
||||
SaveSettings();
|
||||
m_AutoCompleteFilePatterns.Save();
|
||||
m_AutoCompleteSearchPatterns.Save();
|
||||
m_AutoCompleteReplacePatterns.Save();
|
||||
m_AutoCompleteSearchPaths.Save();
|
||||
EndDialog(*this, IDCANCEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
CTheme::Instance().RemoveRegisteredCallback(m_themeCallbackId);
|
||||
@ -638,7 +635,7 @@ LRESULT CSearchDlg::DlgFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||
{
|
||||
auto buf = GetDlgItemText(IDC_SEARCHPATH);
|
||||
bool bIsDir = !!PathIsDirectory(buf.get());
|
||||
if ((!bIsDir) && _tcschr(buf.get(), '|'))
|
||||
if ((!bIsDir) && wcschr(buf.get(), '|'))
|
||||
bIsDir = true; // assume directories in case of multiple paths
|
||||
|
||||
auto sInverseSearch = TranslatedString(hResource, IDS_INVERSESEARCH);
|
||||
@ -797,7 +794,7 @@ LRESULT CSearchDlg::DlgFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||
SetDlgItemText(hwndDlg, IDC_SEARCHTEXT, m_searchString.c_str());
|
||||
}
|
||||
|
||||
g_startTime = GetTickCount();
|
||||
g_startTime = GetTickCount64();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1023,8 +1020,8 @@ LRESULT CSearchDlg::DoCommand(int id, int msg)
|
||||
if (id == IDC_CAPTURESEARCH)
|
||||
{
|
||||
m_bCaptureSearch = true;
|
||||
m_bNOTSearch = false;
|
||||
m_bReplace = false;
|
||||
m_bNOTSearch = false;
|
||||
m_bReplace = false;
|
||||
}
|
||||
|
||||
SetDlgItemText(*this, IDOK, TranslatedString(hResource, IDS_STOP).c_str());
|
||||
@ -1097,7 +1094,10 @@ LRESULT CSearchDlg::DoCommand(int id, int msg)
|
||||
if (m_updateCheckThread.joinable())
|
||||
m_updateCheckThread.join();
|
||||
#endif
|
||||
if (DWORD(CRegStdDWORD(L"Software\\grepWinNP3\\escclose", FALSE)))
|
||||
bool const escClose = bPortable ? g_iniFile.GetBoolValue(L"settings", L"escclose", false) :
|
||||
!!DWORD(CRegStdDWORD(L"Software\\grepWinNP3\\escclose", FALSE));
|
||||
|
||||
if (escClose)
|
||||
{
|
||||
if (IsEvaluationThreadRunning())
|
||||
InterlockedExchange(&s_Cancelled, TRUE);
|
||||
@ -1164,7 +1164,7 @@ LRESULT CSearchDlg::DoCommand(int id, int msg)
|
||||
break;
|
||||
}
|
||||
|
||||
std::unique_ptr<WCHAR[]> pathbuf(new WCHAR[MAX_PATH_NEW]);
|
||||
auto pathbuf = std::make_unique<wchar_t[]>(MAX_PATH_NEW);
|
||||
wcscpy_s(pathbuf.get(), MAX_PATH_NEW, path.get());
|
||||
browse.SetInfo(TranslatedString(hResource, IDS_SELECTPATHTOSEARCH).c_str());
|
||||
if (browse.Show(*this, pathbuf.get(), MAX_PATH_NEW, m_searchpath.c_str()) == CBrowseFolder::OK)
|
||||
@ -1183,7 +1183,7 @@ LRESULT CSearchDlg::DoCommand(int id, int msg)
|
||||
int len = GetDlgItemTextLength(IDC_SEARCHTEXT);
|
||||
auto buf = GetDlgItemText(IDC_SEARCHPATH);
|
||||
bool bIsDir = !!PathIsDirectory(buf.get());
|
||||
if ((!bIsDir) && _tcschr(buf.get(), '|'))
|
||||
if ((!bIsDir) && wcschr(buf.get(), '|'))
|
||||
bIsDir = true; // assume directories in case of multiple paths
|
||||
bool bIncludeSubfolders = (IsDlgButtonChecked(*this, IDC_INCLUDESUBFOLDERS) == BST_CHECKED);
|
||||
DialogEnableWindow(IDC_ALLSIZERADIO, bIsDir);
|
||||
@ -1200,9 +1200,9 @@ LRESULT CSearchDlg::DoCommand(int id, int msg)
|
||||
DialogEnableWindow(IDC_FILEPATTERNTEXT, bIsDir);
|
||||
|
||||
// change the dialog title to "grepWinNP3 : search/path"
|
||||
TCHAR compactPath[100] = {0};
|
||||
wchar_t compactPath[100] = {0};
|
||||
PathCompactPathEx(compactPath, buf.get(), 40, 0);
|
||||
TCHAR titleBuf[MAX_PATH] = {0};
|
||||
wchar_t titleBuf[MAX_PATH] = {0};
|
||||
_stprintf_s(titleBuf, _countof(titleBuf), L"grepWinNP3 : %s", compactPath);
|
||||
SetWindowText(*this, titleBuf);
|
||||
}
|
||||
@ -1215,7 +1215,7 @@ LRESULT CSearchDlg::DoCommand(int id, int msg)
|
||||
auto buf = GetDlgItemText(IDC_SEARCHPATH);
|
||||
bool bIncludeSubfolders = (IsDlgButtonChecked(*this, IDC_INCLUDESUBFOLDERS) == BST_CHECKED);
|
||||
bool bIsDir = !!PathIsDirectory(buf.get());
|
||||
if ((!bIsDir) && _tcschr(buf.get(), '|'))
|
||||
if ((!bIsDir) && wcschr(buf.get(), '|'))
|
||||
bIsDir = true; // assume directories in case of multiple paths
|
||||
DialogEnableWindow(IDC_EXCLUDEDIRSPATTERN, bIsDir || bIncludeSubfolders);
|
||||
}
|
||||
@ -1237,9 +1237,9 @@ LRESULT CSearchDlg::DoCommand(int id, int msg)
|
||||
{
|
||||
if (msg == EN_CHANGE)
|
||||
{
|
||||
TCHAR buf[20] = {0};
|
||||
wchar_t buf[20] = {0};
|
||||
::GetDlgItemText(*this, IDC_SIZEEDIT, buf, _countof(buf));
|
||||
if (_tcslen(buf))
|
||||
if (wcslen(buf))
|
||||
{
|
||||
if (IsDlgButtonChecked(*this, IDC_ALLSIZERADIO) == BST_CHECKED)
|
||||
{
|
||||
@ -1477,6 +1477,8 @@ LRESULT CSearchDlg::DoCommand(int id, int msg)
|
||||
|
||||
// Show the save file dialog
|
||||
hr = pfd->Show(*this);
|
||||
if (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED))
|
||||
break;
|
||||
if (FailedShowMessage(hr))
|
||||
break;
|
||||
IShellItemPtr psiResult = nullptr;
|
||||
@ -1573,11 +1575,11 @@ LRESULT CSearchDlg::DoCommand(int id, int msg)
|
||||
exportlinenumbers = includeMatchLineNumbers ? 1 : 0;
|
||||
exportlinecontent = includeMatchLineTexts ? 1 : 0;
|
||||
}
|
||||
SHELLEXECUTEINFO sei = { 0 };
|
||||
sei.cbSize = sizeof(SHELLEXECUTEINFO);
|
||||
sei.lpVerb = TEXT("open");
|
||||
sei.lpFile = path.c_str();
|
||||
sei.nShow = SW_SHOWNORMAL;
|
||||
SHELLEXECUTEINFO sei = {0};
|
||||
sei.cbSize = sizeof(SHELLEXECUTEINFO);
|
||||
sei.lpVerb = TEXT("open");
|
||||
sei.lpFile = path.c_str();
|
||||
sei.nShow = SW_SHOWNORMAL;
|
||||
ShellExecuteEx(&sei);
|
||||
}
|
||||
}
|
||||
@ -1622,7 +1624,7 @@ void CSearchDlg::SaveWndPosition()
|
||||
void CSearchDlg::UpdateInfoLabel()
|
||||
{
|
||||
std::wstring sText;
|
||||
TCHAR buf[1024] = {0};
|
||||
wchar_t buf[1024] = {0};
|
||||
_stprintf_s(buf, _countof(buf), TranslatedString(hResource, IDS_INFOLABEL).c_str(),
|
||||
m_searchedItems, m_totalitems-m_searchedItems, m_totalmatches, m_items.size());
|
||||
sText = buf;
|
||||
@ -2130,11 +2132,15 @@ void CSearchDlg::DoListNotify(LPNMITEMACTIVATE lpNMItemActivate)
|
||||
else
|
||||
{
|
||||
auto filepart = pInfo->filepath.substr(pInfo->filepath.find_last_of('\\'));
|
||||
auto len = pInfo->filepath.size() - m_searchpath.size() - filepart.size();
|
||||
auto len = pInfo->filepath.size() - m_searchpath.size() - filepart.size();
|
||||
if (len > 0)
|
||||
--len;
|
||||
if (m_searchpath.size() < pInfo->filepath.size())
|
||||
{
|
||||
wcsncpy_s(pItem->pszText, pItem->cchTextMax, pInfo->filepath.substr(m_searchpath.size() + 1, len).c_str(), pItem->cchTextMax - 1);
|
||||
if (pItem->pszText[0] == 0)
|
||||
wcscpy_s(pItem->pszText, pItem->cchTextMax, L"\\.");
|
||||
}
|
||||
else
|
||||
wcsncpy_s(pItem->pszText, pItem->cchTextMax, pInfo->filepath.c_str(), pItem->cchTextMax - 1);
|
||||
}
|
||||
@ -2328,14 +2334,14 @@ void CSearchDlg::OpenFileAtListIndex(int listIndex)
|
||||
bool filelist = (IsDlgButtonChecked(*this, IDC_RESULTFILES) == BST_CHECKED);
|
||||
if (!filelist)
|
||||
{
|
||||
HWND hListControl = GetDlgItem(*this, IDC_RESULTLIST);
|
||||
TCHAR textlinebuf[MAX_PATH] = { 0 };
|
||||
LVITEM lv = { 0 };
|
||||
lv.iItem = listIndex;
|
||||
lv.iSubItem = 1; // line number
|
||||
lv.mask = LVIF_TEXT;
|
||||
lv.pszText = textlinebuf;
|
||||
lv.cchTextMax = _countof(textlinebuf);
|
||||
HWND hListControl = GetDlgItem(*this, IDC_RESULTLIST);
|
||||
wchar_t textlinebuf[MAX_PATH] = {0};
|
||||
LVITEM lv = {0};
|
||||
lv.iItem = listIndex;
|
||||
lv.iSubItem = 1; // line number
|
||||
lv.mask = LVIF_TEXT;
|
||||
lv.pszText = textlinebuf;
|
||||
lv.cchTextMax = _countof(textlinebuf);
|
||||
if (ListView_GetItem(hListControl, &lv))
|
||||
SearchReplace(cmd, L"%line%", textlinebuf);
|
||||
}
|
||||
@ -2369,7 +2375,7 @@ void CSearchDlg::OpenFileAtListIndex(int listIndex)
|
||||
SecureZeroMemory(&startupInfo, sizeof(startupInfo));
|
||||
startupInfo.cb = sizeof(STARTUPINFO);
|
||||
SecureZeroMemory(&processInfo, sizeof(processInfo));
|
||||
CreateProcess(nullptr, const_cast<TCHAR*>(cmd.c_str()), nullptr, nullptr, FALSE, CREATE_NEW_PROCESS_GROUP, nullptr, nullptr, &startupInfo, &processInfo);
|
||||
CreateProcess(NULL, const_cast<wchar_t*>(cmd.c_str()), NULL, NULL, FALSE, 0, 0, NULL, &startupInfo, &processInfo);
|
||||
CloseHandle(processInfo.hThread);
|
||||
CloseHandle(processInfo.hProcess);
|
||||
return;
|
||||
@ -2385,13 +2391,13 @@ void CSearchDlg::OpenFileAtListIndex(int listIndex)
|
||||
return;
|
||||
}
|
||||
|
||||
AssocQueryString(ASSOCF_INIT_DEFAULTTOSTAR, ASSOCSTR_COMMAND, ext.c_str(), nullptr, nullptr, &buflen);
|
||||
std::unique_ptr<TCHAR[]> cmdbuf(new TCHAR[buflen + 1]);
|
||||
AssocQueryString(ASSOCF_INIT_DEFAULTTOSTAR, ASSOCSTR_COMMAND, ext.c_str(), nullptr, cmdbuf.get(), &buflen);
|
||||
AssocQueryString(ASSOCF_INIT_DEFAULTTOSTAR, ASSOCSTR_COMMAND, ext.c_str(), NULL, NULL, &buflen);
|
||||
auto cmdbuf = std::make_unique<wchar_t[]>(buflen + 1);
|
||||
AssocQueryString(ASSOCF_INIT_DEFAULTTOSTAR, ASSOCSTR_COMMAND, ext.c_str(), NULL, cmdbuf.get(), &buflen);
|
||||
std::wstring application = cmdbuf.get();
|
||||
// normalize application path
|
||||
DWORD len = ExpandEnvironmentStrings(application.c_str(), nullptr, 0);
|
||||
cmdbuf = std::unique_ptr<TCHAR[]>(new TCHAR[len + 1]);
|
||||
DWORD len = ExpandEnvironmentStrings(application.c_str(), NULL, 0);
|
||||
cmdbuf = std::make_unique<wchar_t[]>(buflen + 1);
|
||||
ExpandEnvironmentStrings(application.c_str(), cmdbuf.get(), len);
|
||||
application = cmdbuf.get();
|
||||
|
||||
@ -2402,7 +2408,7 @@ void CSearchDlg::OpenFileAtListIndex(int listIndex)
|
||||
bool filelist = (IsDlgButtonChecked(*this, IDC_RESULTFILES) == BST_CHECKED);
|
||||
std::wstring linenumberparam_before;
|
||||
std::wstring linenumberparam;
|
||||
TCHAR textlinebuf[MAX_PATH] = { 0 };
|
||||
wchar_t textlinebuf[MAX_PATH] = {0};
|
||||
if (!filelist)
|
||||
{
|
||||
HWND hListControl = GetDlgItem(*this, IDC_RESULTLIST);
|
||||
@ -2422,6 +2428,8 @@ void CSearchDlg::OpenFileAtListIndex(int listIndex)
|
||||
// use the first matching line in this file
|
||||
swprintf_s(textlinebuf, L"%ld", inf.matchlinesnumbers[0]);
|
||||
}
|
||||
if (textlinebuf[0] == 0)
|
||||
wcscpy_s(textlinebuf, L"0");
|
||||
std::wstring appname = application;
|
||||
std::transform(appname.begin(), appname.end(), appname.begin(), ::towlower);
|
||||
|
||||
@ -2480,7 +2488,7 @@ void CSearchDlg::OpenFileAtListIndex(int listIndex)
|
||||
{
|
||||
// Visual Studio Code
|
||||
linenumberparam_before = L"--goto";
|
||||
linenumberparam = CStringUtils::Format(L":%s", textlinebuf);
|
||||
linenumberparam = CStringUtils::Format(L":%s", textlinebuf);
|
||||
}
|
||||
|
||||
// replace "%1" with %1
|
||||
@ -2523,7 +2531,7 @@ void CSearchDlg::OpenFileAtListIndex(int listIndex)
|
||||
startupInfo.cb = sizeof(STARTUPINFO);
|
||||
|
||||
SecureZeroMemory(&processInfo, sizeof(processInfo));
|
||||
CreateProcess(nullptr, const_cast<TCHAR*>(application.c_str()), nullptr, nullptr, FALSE, 0, nullptr, nullptr, &startupInfo, &processInfo);
|
||||
CreateProcess(NULL, const_cast<wchar_t*>(application.c_str()), NULL, NULL, FALSE, 0, 0, NULL, &startupInfo, &processInfo);
|
||||
CloseHandle(processInfo.hThread);
|
||||
CloseHandle(processInfo.hProcess);
|
||||
}
|
||||
@ -2563,12 +2571,12 @@ bool CSearchDlg::SaveSettings()
|
||||
|
||||
// split the pattern string into single patterns and
|
||||
// add them to an array
|
||||
TCHAR * pBuf = buf.get();
|
||||
size_t pos = 0;
|
||||
auto pBuf = buf.get();
|
||||
size_t pos = 0;
|
||||
m_patterns.clear();
|
||||
do
|
||||
{
|
||||
pos = _tcscspn(pBuf, L"|");
|
||||
pos = wcscspn(pBuf, L"|");
|
||||
std::wstring s = std::wstring(pBuf, pos);
|
||||
if (!s.empty())
|
||||
{
|
||||
@ -2821,7 +2829,7 @@ bool CSearchDlg::ExtCompareDesc(const CSearchInfo& Entry1, const CSearchInfo& En
|
||||
return StrCmpLogicalW(ext1.c_str(), ext2.c_str()) > 0;
|
||||
}
|
||||
|
||||
bool grepWin_match_i(const std::wstring& the_regex, const TCHAR *pText)
|
||||
bool grepWin_match_i(const std::wstring& the_regex, const wchar_t* pText)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -2842,7 +2850,7 @@ DWORD CSearchDlg::SearchThread()
|
||||
{
|
||||
ProfileTimer profile(L"SearchThread");
|
||||
|
||||
std::unique_ptr<TCHAR[]> pathbuf(new TCHAR[MAX_PATH_NEW]);
|
||||
auto pathbuf = std::make_unique<wchar_t[]>(MAX_PATH_NEW);
|
||||
|
||||
DWORD const nMaxNumOfWorker = std::thread::hardware_concurrency() << 2;
|
||||
DWORD const nOfWorker = max(min(bPortable ? g_iniFile.GetLongValue(L"global", L"MaxNumOfWorker", nMaxNumOfWorker >> 1) :
|
||||
@ -2853,12 +2861,12 @@ DWORD CSearchDlg::SearchThread()
|
||||
|
||||
// split the path string into single paths and
|
||||
// add them to an array
|
||||
const TCHAR * pBufSearchPath = m_searchpath.c_str();
|
||||
size_t pos = 0;
|
||||
const auto* pBufSearchPath = m_searchpath.c_str();
|
||||
size_t pos = 0;
|
||||
std::vector<std::wstring> pathvector;
|
||||
do
|
||||
{
|
||||
pos = _tcscspn(pBufSearchPath, L"|");
|
||||
pos = wcscspn(pBufSearchPath, L"|");
|
||||
std::wstring s = std::wstring(pBufSearchPath, pos);
|
||||
if (!s.empty())
|
||||
{
|
||||
@ -2937,13 +2945,13 @@ DWORD CSearchDlg::SearchThread()
|
||||
|
||||
while ((fileEnumerator.NextFile(sPath, &bIsDirectory, bRecurse) || bAlwaysSearch) && !IsCancelled())
|
||||
{
|
||||
if (bAlwaysSearch && _wcsicmp(searchpath.c_str(), sPath.c_str()))
|
||||
bAlwaysSearch = false;
|
||||
|
||||
if (s_BackupAndTmpFiles.contains(sPath))
|
||||
continue; // don't search own backup files
|
||||
|
||||
if (bAlwaysSearch && _wcsicmp(searchpath.c_str(), sPath.c_str()))
|
||||
bAlwaysSearch = false;
|
||||
|
||||
_tcscpy_s(pathbuf.get(), MAX_PATH_NEW, sPath.c_str());
|
||||
wcscpy_s(pathbuf.get(), MAX_PATH_NEW, sPath.c_str());
|
||||
if (!bIsDirectory)
|
||||
{
|
||||
bool bSearch = false;
|
||||
@ -2952,8 +2960,8 @@ DWORD CSearchDlg::SearchThread()
|
||||
FILETIME ft = {0};
|
||||
if (bAlwaysSearch)
|
||||
{
|
||||
_tcscpy_s(pathbuf.get(), MAX_PATH_NEW, searchpath.c_str());
|
||||
CAutoFile hFile = CreateFile(searchpath.c_str(), FILE_READ_EA, FILE_SHARE_DELETE|FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
wcscpy_s(pathbuf.get(), MAX_PATH_NEW, searchpath.c_str());
|
||||
CAutoFile hFile = CreateFile(searchpath.c_str(), FILE_READ_EA, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (hFile)
|
||||
{
|
||||
BY_HANDLE_FILE_INFORMATION bhfi = {0};
|
||||
@ -3237,8 +3245,8 @@ bool CSearchDlg::MatchPath(LPCTSTR pathbuf)
|
||||
{
|
||||
bool bPattern = false;
|
||||
// find start of pathname
|
||||
const TCHAR * pName = _tcsrchr(pathbuf, '\\');
|
||||
if (pName == nullptr)
|
||||
const auto* pName = wcsrchr(pathbuf, '\\');
|
||||
if (pName == NULL)
|
||||
pName = pathbuf;
|
||||
else
|
||||
pName++; // skip the last '\\' char
|
||||
@ -3312,7 +3320,7 @@ int CSearchDlg::SearchFile(std::shared_ptr<CSearchInfo> sinfoPtr, const std::wst
|
||||
}
|
||||
}
|
||||
|
||||
CTextFile textfile;
|
||||
CTextFile textfile;
|
||||
CTextFile::UnicodeType type = CTextFile::AUTOTYPE;
|
||||
bool bLoadResult = false;
|
||||
if (searchFlags.bForceBinary)
|
||||
@ -3606,9 +3614,9 @@ int CSearchDlg::SearchFile(std::shared_ptr<CSearchInfo> sinfoPtr, const std::wst
|
||||
} while (!hFile && retrycounter < 5);
|
||||
if (hFile)
|
||||
{
|
||||
std::unique_ptr<char[]> fbuf(new char[4096]);
|
||||
DWORD bytesread = 0;
|
||||
size_t pos = 0;
|
||||
auto fbuf = std::make_unique<char[]>(4096);
|
||||
DWORD bytesread = 0;
|
||||
size_t pos = 0;
|
||||
while (ReadFile(hFile, fbuf.get(), 4096, &bytesread, NULL))
|
||||
{
|
||||
if (bytesread == 0)
|
||||
@ -3722,7 +3730,7 @@ int CSearchDlg::SearchFile(std::shared_ptr<CSearchInfo> sinfoPtr, const std::wst
|
||||
}
|
||||
|
||||
|
||||
void CSearchDlg::formatDate(TCHAR date_native[], const FILETIME& filetime, bool force_short_fmt)
|
||||
void CSearchDlg::formatDate(wchar_t date_native[], const FILETIME& filetime, bool force_short_fmt)
|
||||
{
|
||||
date_native[0] = '\0';
|
||||
|
||||
@ -3737,8 +3745,8 @@ void CSearchDlg::formatDate(TCHAR date_native[], const FILETIME& filetime, bool
|
||||
SYSTEMTIME localsystime;
|
||||
SystemTimeToTzSpecificLocalTime(&timeZone, &systemtime,&localsystime);
|
||||
|
||||
TCHAR timebuf[GREPWIN_DATEBUFFER] = {0};
|
||||
TCHAR datebuf[GREPWIN_DATEBUFFER] = {0};
|
||||
wchar_t timebuf[GREPWIN_DATEBUFFER] = {0};
|
||||
wchar_t datebuf[GREPWIN_DATEBUFFER] = {0};
|
||||
|
||||
LCID locale = MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), SORT_DEFAULT);
|
||||
|
||||
@ -3746,17 +3754,17 @@ void CSearchDlg::formatDate(TCHAR date_native[], const FILETIME& filetime, bool
|
||||
|
||||
DWORD flags = force_short_fmt ? DATE_SHORTDATE : DATE_LONGDATE;
|
||||
|
||||
GetDateFormat(locale, flags, &localsystime, nullptr, datebuf, GREPWIN_DATEBUFFER);
|
||||
GetTimeFormat(locale, 0, &localsystime, nullptr, timebuf, GREPWIN_DATEBUFFER);
|
||||
_tcsncat_s(date_native, GREPWIN_DATEBUFFER, datebuf, GREPWIN_DATEBUFFER);
|
||||
_tcsncat_s(date_native, GREPWIN_DATEBUFFER, L" ", GREPWIN_DATEBUFFER);
|
||||
_tcsncat_s(date_native, GREPWIN_DATEBUFFER, timebuf, GREPWIN_DATEBUFFER);
|
||||
GetDateFormat(locale, flags, &localsystime, NULL, datebuf, GREPWIN_DATEBUFFER);
|
||||
GetTimeFormat(locale, 0, &localsystime, NULL, timebuf, GREPWIN_DATEBUFFER);
|
||||
wcsncat_s(date_native, GREPWIN_DATEBUFFER, datebuf, GREPWIN_DATEBUFFER);
|
||||
wcsncat_s(date_native, GREPWIN_DATEBUFFER, L" ", GREPWIN_DATEBUFFER);
|
||||
wcsncat_s(date_native, GREPWIN_DATEBUFFER, timebuf, GREPWIN_DATEBUFFER);
|
||||
}
|
||||
|
||||
int CSearchDlg::CheckRegex()
|
||||
{
|
||||
auto buf = GetDlgItemText(IDC_SEARCHTEXT);
|
||||
auto len = (int)_tcslen(buf.get());
|
||||
auto len = (int)wcslen(buf.get());
|
||||
if (IsDlgButtonChecked(*this, IDC_REGEXRADIO) == BST_CHECKED)
|
||||
{
|
||||
m_bUseRegex = true;
|
||||
@ -3818,10 +3826,10 @@ int CSearchDlg::CheckRegex()
|
||||
|
||||
void CSearchDlg::AutoSizeAllColumns()
|
||||
{
|
||||
HWND hListControl = GetDlgItem(*this, IDC_RESULTLIST);
|
||||
auto headerCtrl = ListView_GetHeader(hListControl);
|
||||
auto nItemCount = ListView_GetItemCount(hListControl);
|
||||
TCHAR textbuf[MAX_PATH*4] = { 0 };
|
||||
HWND hListControl = GetDlgItem(*this, IDC_RESULTLIST);
|
||||
auto headerCtrl = ListView_GetHeader(hListControl);
|
||||
int nItemCount = ListView_GetItemCount(hListControl);
|
||||
wchar_t textbuf[MAX_PATH * 4] = {0};
|
||||
if (headerCtrl)
|
||||
{
|
||||
int maxcol = Header_GetItemCount(headerCtrl) - 1;
|
||||
|
||||
@ -127,7 +127,7 @@ protected:
|
||||
void UpdateInfoLabel();
|
||||
bool SaveSettings();
|
||||
void SaveWndPosition();
|
||||
void formatDate(TCHAR date_native[], const FILETIME& filetime, bool force_short_fmt);
|
||||
void formatDate(wchar_t date_native[], const FILETIME& filetime, bool force_short_fmt);
|
||||
int CheckRegex();
|
||||
bool MatchPath(LPCTSTR pathbuf);
|
||||
void AutoSizeAllColumns();
|
||||
|
||||
@ -6,13 +6,13 @@
|
||||
|
||||
//#pragma message(__LOC__"Run the NAnt script to get proper version info")
|
||||
|
||||
#define FILEVER 2, 1, 3, 24
|
||||
#define PRODUCTVER 2, 1, 3, 24
|
||||
#define STRFILEVER "2.1.3.24\0"
|
||||
#define STRPRODUCTVER "2.1.3.24\0"
|
||||
#define FILEVER 2, 1, 3, 25
|
||||
#define PRODUCTVER 2, 1, 3, 25
|
||||
#define STRFILEVER "2.1.3.25\0"
|
||||
#define STRPRODUCTVER "2.1.3.25\0"
|
||||
|
||||
#define GREPWIN_VERMAJOR 2
|
||||
#define GREPWIN_VERMINOR 1
|
||||
#define GREPWIN_VERMICRO 3
|
||||
#define GREPWIN_VERBUILD 24
|
||||
#define GREPWIN_VERDATE "2020-08-12"
|
||||
#define GREPWIN_VERBUILD 25
|
||||
#define GREPWIN_VERDATE "2020-08-16"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user