+chg: Win10 Release-ID as string (allows 20H2 or 21H1)

+fix:  F/R Dialog regression: allow replace in selection (if selection not empty)
This commit is contained in:
Rainer Kottenhoff 2021-05-29 12:05:42 +02:00
parent 0434a1a9a2
commit 88ac6cce9b
2 changed files with 21 additions and 20 deletions

View File

@ -5899,11 +5899,9 @@ static void _ShowZeroLengthCallTip(DocPos iPosition)
//
static bool _EnableFRDlgCtrls(HWND hwnd) {
//bool const bEmptyFnd = (ComboBox_GetTextLengthEx(hwnd, IDC_FINDTEXT) == 0 || ComboBox_GetCurSelEx(hwnd, IDC_FINDTEXT) != CB_ERR);
//bool const bEmptyRpl = (ComboBox_GetTextLengthEx(hwnd, IDC_REPLACETEXT) == 0 || ComboBox_GetCurSelEx(hwnd, IDC_REPLACETEXT) != CB_ERR);
bool const bEmptyFnd = ComboBox_GetTextLengthEx(hwnd, IDC_FINDTEXT) == 0;
bool const bEmptyRpl = ComboBox_GetTextLengthEx(hwnd, IDC_REPLACETEXT) == 0;
bool const bEmptySel = !(SciCall_IsSelectionEmpty() || Sci_IsMultiOrRectangleSelection());
bool const bEmptyFnd = ComboBox_GetTextLengthEx(hwnd, IDC_FINDTEXT) == 0 /*|| ComboBox_GetCurSelEx(hwnd, IDC_FINDTEXT) != CB_ERR)*/;
bool const bEmptyRpl = ComboBox_GetTextLengthEx(hwnd, IDC_REPLACETEXT) == 0 /*|| ComboBox_GetCurSelEx(hwnd, IDC_REPLACETEXT) != CB_ERR)*/;
bool const bEmptySel = (SciCall_IsSelectionEmpty() || Sci_IsMultiOrRectangleSelection());
DialogEnableControl(hwnd, IDOK, !bEmptyFnd);
DialogEnableControl(hwnd, IDC_FINDPREV, !bEmptyFnd);

View File

@ -213,32 +213,35 @@ static void _GetTrueWindowsVersion()
#endif
// ----------------------------------------------------------------------------
// https://docs.microsoft.com/en-us/windows/release-information/
// https://docs.microsoft.com/en-US/windows/release-health/release-information
// ----------------------------------------------------------------------------
static DWORD _Win10BuildToReleaseId(DWORD build)
static LPCWSTR _Win10BuildToReleaseId(DWORD build)
{
if (build >= 19042) {
return 2009;
static LPCWSTR _wchpReleaseID = L"1507"; // 10240
if (build >= 19043) {
_wchpReleaseID = L"21H1";
} else if (build >= 19042) {
_wchpReleaseID = L"20H2";
} else if (build >= 19041) {
return 2004;
_wchpReleaseID = L"2004";
} else if (build >= 18363) {
return 1909;
_wchpReleaseID = L"1909";
} else if (build >= 18362) {
return 1903;
_wchpReleaseID = L"1903 (EoS)";
} else if (build >= 17763) {
return 1809;
_wchpReleaseID = L"1809";
} else if (build >= 17134) {
return 1803;
_wchpReleaseID = L"1803 (EoS)";
} else if (build >= 16299) {
return 1709;
_wchpReleaseID = L"1709 (EoS)";
} else if (build >= 15063) {
return 1809;
_wchpReleaseID = L"1703 (EoS)";
} else if (build >= 14393) {
return 1607;
_wchpReleaseID = L"1607";
} else if (build >= 10586) {
return 1511;
_wchpReleaseID = L"1511 (EoS)";
}
return 0; // 10240
return _wchpReleaseID;
}
// ----------------------------------------------------------------------------
@ -262,7 +265,7 @@ void GetWinVersionString(LPWSTR szVersionStr, size_t cchVersionStr)
if (IsWindows10OrGreater()) {
WCHAR win10ver[80] = { L'\0' };
StringCchPrintf(win10ver, COUNTOF(win10ver), L" Version %i (Build %i)",
StringCchPrintf(win10ver, COUNTOF(win10ver), L" Version %s (Build %lu)",
_Win10BuildToReleaseId(Globals.WindowsBuildNumber), Globals.WindowsBuildNumber);
StringCchCat(szVersionStr, cchVersionStr, win10ver);
}