|
|
|
@ -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)
|
|
|
|
|
{
|
|
|
|
|
::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);
|
|
|
|
|
auto ctrlWidth = width - widthPadding - xStartPos;
|
|
|
|
|
|
|
|
|
|
_hPText = ::CreateWindowEx(0, TEXT("STATIC"), TEXT(""),
|
|
|
|
|
_hPathText = ::CreateWindowEx(0, TEXT("STATIC"), TEXT(""),
|
|
|
|
|
WS_CHILD | WS_VISIBLE | SS_PATHELLIPSIS,
|
|
|
|
|
xStartPos, yTextPos,
|
|
|
|
|
ctrlWidth, textHeight, _hwnd, NULL, _hInst, NULL);
|
|
|
|
|
|
|
|
|
|
HFONT hf = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
|
|
|
|
|
if (hf)
|
|
|
|
|
::SendMessage(_hPText, WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0));
|
|
|
|
|
NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
|
|
|
|
|
generic_string hits = pNativeSpeaker->getLocalizedStrFromID("progress-hits-title", TEXT("Hits:"));
|
|
|
|
|
_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"),
|
|
|
|
|
WS_CHILD | WS_VISIBLE | PBS_SMOOTH,
|
|
|
|
@ -5673,7 +5701,6 @@ int Progress::createProgressWindow()
|
|
|
|
|
::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"));
|
|
|
|
|
|
|
|
|
|
_hBtn = ::CreateWindowEx(0, TEXT("BUTTON"), cancel.c_str(),
|
|
|
|
@ -5682,8 +5709,14 @@ int Progress::createProgressWindow()
|
|
|
|
|
cBTNwidth, cBTNheight,
|
|
|
|
|
_hwnd, NULL, _hInst, NULL);
|
|
|
|
|
|
|
|
|
|
HFONT hf = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
|
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NppDarkMode::autoSubclassAndThemeChildControls(_hwnd);
|
|
|
|
|
NppDarkMode::setDarkTitleBar(_hwnd);
|
|
|
|
|