mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-25 06:45:27 +02:00
Add hits in-progress increased number to Search Progress dialog
Fix #13364, close #13404
This commit is contained in:
parent
7b4e700d49
commit
508b3fabd6
@ -1642,6 +1642,7 @@ Find in all files but exclude all folders log or logs recursively:
|
|||||||
<summary-nbsel1 value=" selected characters ("/>
|
<summary-nbsel1 value=" selected characters ("/>
|
||||||
<summary-nbsel2 value=" bytes) in "/>
|
<summary-nbsel2 value=" bytes) in "/>
|
||||||
<summary-nbrange value=" ranges"/>
|
<summary-nbrange value=" ranges"/>
|
||||||
|
<progress-hits-title value="Hits:"/>
|
||||||
<progress-cancel-button value="Cancel"/>
|
<progress-cancel-button value="Cancel"/>
|
||||||
<progress-cancel-info value="Cancelling operation, please wait..."/>
|
<progress-cancel-info value="Cancelling operation, please wait..."/>
|
||||||
<find-in-files-progress-title value="Find In Files progress..."/>
|
<find-in-files-progress-title value="Find In Files progress..."/>
|
||||||
|
@ -1892,11 +1892,11 @@ bool Notepad_plus::replaceInFilelist(std::vector<generic_string> & fileNames)
|
|||||||
if (i == updateOnCount)
|
if (i == updateOnCount)
|
||||||
{
|
{
|
||||||
updateOnCount += filesPerPercent;
|
updateOnCount += filesPerPercent;
|
||||||
progress.setPercent(int32_t((i * 100) / filesCount), fileNames.at(i).c_str());
|
progress.setPercent(int32_t((i * 100) / filesCount), fileNames.at(i).c_str(), nbTotal);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
progress.setInfo(fileNames.at(i).c_str());
|
progress.setInfo(fileNames.at(i).c_str(), nbTotal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1977,11 +1977,11 @@ bool Notepad_plus::findInFinderFiles(FindersInfo *findInFolderInfo)
|
|||||||
if (i == updateOnCount)
|
if (i == updateOnCount)
|
||||||
{
|
{
|
||||||
updateOnCount += filesPerPercent;
|
updateOnCount += filesPerPercent;
|
||||||
progress.setPercent(int32_t((i * 100) / filesCount), fileNames.at(i).c_str());
|
progress.setPercent(int32_t((i * 100) / filesCount), fileNames.at(i).c_str(), nbTotal);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
progress.setInfo(fileNames.at(i).c_str());
|
progress.setInfo(fileNames.at(i).c_str(), nbTotal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
progress.close();
|
progress.close();
|
||||||
@ -2069,11 +2069,11 @@ bool Notepad_plus::findInFilelist(std::vector<generic_string> & fileNames)
|
|||||||
if (i == updateOnCount)
|
if (i == updateOnCount)
|
||||||
{
|
{
|
||||||
updateOnCount += filesPerPercent;
|
updateOnCount += filesPerPercent;
|
||||||
progress.setPercent(int32_t((i * 100) / filesCount), fileNames.at(i).c_str());
|
progress.setPercent(int32_t((i * 100) / filesCount), fileNames.at(i).c_str(), nbTotal);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
progress.setInfo(fileNames.at(i).c_str());
|
progress.setInfo(fileNames.at(i).c_str(), nbTotal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5573,12 +5573,30 @@ void Progress::close()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Progress::setPercent(unsigned percent, const TCHAR *fileName) const
|
void Progress::setPercent(unsigned percent, const TCHAR* fileName, int nbHitsSoFar) const
|
||||||
{
|
{
|
||||||
if (_hwnd)
|
if (_hwnd)
|
||||||
{
|
{
|
||||||
::PostMessage(_hPBar, PBM_SETPOS, percent, 0);
|
::PostMessage(_hPBar, PBM_SETPOS, percent, 0);
|
||||||
::SendMessage(_hPText, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(fileName));
|
::SendMessage(_hPathText, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(fileName));
|
||||||
|
TCHAR str[16];
|
||||||
|
_itow(nbHitsSoFar, str, 10);
|
||||||
|
::SendMessage(_hRunningHitsText, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(str));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Progress::setInfo(const TCHAR* info, int nbHitsSoFar) const
|
||||||
|
{
|
||||||
|
if (_hwnd)
|
||||||
|
{
|
||||||
|
::SendMessage(_hPathText, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(info));
|
||||||
|
if (nbHitsSoFar != -1)
|
||||||
|
{
|
||||||
|
TCHAR str[16];
|
||||||
|
_itow(nbHitsSoFar, str, 10);
|
||||||
|
::SendMessage(_hRunningHitsText, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(str));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5646,14 +5664,24 @@ int Progress::createProgressWindow()
|
|||||||
int yTextPos = dpiManager.scaleY(5);
|
int yTextPos = dpiManager.scaleY(5);
|
||||||
auto ctrlWidth = width - widthPadding - xStartPos;
|
auto ctrlWidth = width - widthPadding - xStartPos;
|
||||||
|
|
||||||
_hPText = ::CreateWindowEx(0, TEXT("STATIC"), TEXT(""),
|
_hPathText = ::CreateWindowEx(0, TEXT("STATIC"), TEXT(""),
|
||||||
WS_CHILD | WS_VISIBLE | SS_PATHELLIPSIS,
|
WS_CHILD | WS_VISIBLE | SS_PATHELLIPSIS,
|
||||||
xStartPos, yTextPos,
|
xStartPos, yTextPos,
|
||||||
ctrlWidth, textHeight, _hwnd, NULL, _hInst, NULL);
|
ctrlWidth, textHeight, _hwnd, NULL, _hInst, NULL);
|
||||||
|
|
||||||
HFONT hf = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
|
NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
|
||||||
if (hf)
|
generic_string hits = pNativeSpeaker->getLocalizedStrFromID("progress-hits-title", TEXT("Hits:"));
|
||||||
::SendMessage(_hPText, WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0));
|
_hRunningHitsStaticText = ::CreateWindowEx(0, TEXT("STATIC"), hits.c_str(),
|
||||||
|
WS_CHILD | WS_VISIBLE | SS_RIGHT,
|
||||||
|
xStartPos, yTextPos + textHeight * 2,
|
||||||
|
75, textHeight,
|
||||||
|
_hwnd, NULL, _hInst, NULL);
|
||||||
|
|
||||||
|
_hRunningHitsText = ::CreateWindowEx(0, TEXT("STATIC"), TEXT(""),
|
||||||
|
WS_CHILD | WS_VISIBLE,
|
||||||
|
xStartPos + 75 + 2, yTextPos + textHeight * 2,
|
||||||
|
70, textHeight,
|
||||||
|
_hwnd, NULL, _hInst, NULL);
|
||||||
|
|
||||||
_hPBar = ::CreateWindowEx(0, PROGRESS_CLASS, TEXT("Progress Bar"),
|
_hPBar = ::CreateWindowEx(0, PROGRESS_CLASS, TEXT("Progress Bar"),
|
||||||
WS_CHILD | WS_VISIBLE | PBS_SMOOTH,
|
WS_CHILD | WS_VISIBLE | PBS_SMOOTH,
|
||||||
@ -5673,7 +5701,6 @@ int Progress::createProgressWindow()
|
|||||||
::SendMessage(_hPBar, PBM_SETBARCOLOR, 0, static_cast<LPARAM>(NppDarkMode::getDarkerTextColor()));
|
::SendMessage(_hPBar, PBM_SETBARCOLOR, 0, static_cast<LPARAM>(NppDarkMode::getDarkerTextColor()));
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
|
|
||||||
generic_string cancel = pNativeSpeaker->getLocalizedStrFromID("progress-cancel-button", TEXT("Cancel"));
|
generic_string cancel = pNativeSpeaker->getLocalizedStrFromID("progress-cancel-button", TEXT("Cancel"));
|
||||||
|
|
||||||
_hBtn = ::CreateWindowEx(0, TEXT("BUTTON"), cancel.c_str(),
|
_hBtn = ::CreateWindowEx(0, TEXT("BUTTON"), cancel.c_str(),
|
||||||
@ -5682,8 +5709,14 @@ int Progress::createProgressWindow()
|
|||||||
cBTNwidth, cBTNheight,
|
cBTNwidth, cBTNheight,
|
||||||
_hwnd, NULL, _hInst, NULL);
|
_hwnd, NULL, _hInst, NULL);
|
||||||
|
|
||||||
|
HFONT hf = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
|
||||||
if (hf)
|
if (hf)
|
||||||
|
{
|
||||||
|
::SendMessage(_hPathText, WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0));
|
||||||
|
::SendMessage(_hRunningHitsStaticText, WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0));
|
||||||
|
::SendMessage(_hRunningHitsText, WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0));
|
||||||
::SendMessage(_hBtn, WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0));
|
::SendMessage(_hBtn, WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0));
|
||||||
|
}
|
||||||
|
|
||||||
NppDarkMode::autoSubclassAndThemeChildControls(_hwnd);
|
NppDarkMode::autoSubclassAndThemeChildControls(_hwnd);
|
||||||
NppDarkMode::setDarkTitleBar(_hwnd);
|
NppDarkMode::setDarkTitleBar(_hwnd);
|
||||||
|
@ -568,13 +568,8 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInfo(const TCHAR *info) const
|
void setPercent(unsigned percent, const TCHAR* fileName, int nbHitsSoFar) const;
|
||||||
{
|
void setInfo(const TCHAR* info, int nbHitsSoFar = -1) const;
|
||||||
if (_hwnd)
|
|
||||||
::SendMessage(_hPText, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(info));
|
|
||||||
}
|
|
||||||
|
|
||||||
void setPercent(unsigned percent, const TCHAR *fileName) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const TCHAR cClassName[];
|
static const TCHAR cClassName[];
|
||||||
@ -599,7 +594,9 @@ private:
|
|||||||
TCHAR _header[128] = {'\0'};
|
TCHAR _header[128] = {'\0'};
|
||||||
HANDLE _hThread = nullptr;
|
HANDLE _hThread = nullptr;
|
||||||
HANDLE _hActiveState = nullptr;
|
HANDLE _hActiveState = nullptr;
|
||||||
HWND _hPText = nullptr;
|
HWND _hPathText = nullptr;
|
||||||
|
HWND _hRunningHitsStaticText = nullptr;
|
||||||
|
HWND _hRunningHitsText = nullptr;
|
||||||
HWND _hPBar = nullptr;
|
HWND _hPBar = nullptr;
|
||||||
HWND _hBtn = nullptr;
|
HWND _hBtn = nullptr;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user