diff --git a/Versions/build.txt b/Versions/build.txt
index 0cfbf0888..00750edc0 100644
--- a/Versions/build.txt
+++ b/Versions/build.txt
@@ -1 +1 @@
-2
+3
diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf
index c43ffbb15..6685f4693 100644
--- a/res/Notepad3.exe.manifest.conf
+++ b/res/Notepad3.exe.manifest.conf
@@ -3,7 +3,7 @@
Notepad3 RC3
diff --git a/src/Dialogs.c b/src/Dialogs.c
index 24387d664..cfa36678e 100644
--- a/src/Dialogs.c
+++ b/src/Dialogs.c
@@ -685,53 +685,65 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
GetLngStringA(IDS_MUI_ABOUT_RTF_6, pAboutRes, COUNTOF(pAboutRes));
StringCchCatA(pAboutResource, COUNTOF(pAboutResource), pAboutRes);
+ // paint richedit box
pAboutInfo = pAboutResource;
EDITSTREAM editStreamIn = { (DWORD_PTR)&pAboutInfo, 0, _LoadRtfCallback };
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_STREAMIN, SF_RTF, (LPARAM)&editStreamIn);
CenterDlgInParent(hwnd, NULL);
}
- // fall-through
+ break;
+
case WM_DPICHANGED:
{
- // get current richedit box format
- CHARFORMAT2 currentFormat; ZeroMemory(¤tFormat, sizeof(CHARFORMAT2)); currentFormat.cbSize = sizeof(CHARFORMAT2);
- currentFormat.dwMask = CFM_ALL2; // CFM_SIZE | CFM_FACE | CFM_CHARSET | CFM_LCID; CFM_ALL; CFM_ALL2;
- SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_GETCHARFORMAT, SCF_DEFAULT, (LPARAM)¤tFormat);
-
UpdateWindowLayoutForDPI(hwnd, 0, 0, 0, 0);
- // --- keep original font size ---
- CHARFORMAT dpiCharFmt; ZeroMemory(&dpiCharFmt, sizeof(CHARFORMAT)); dpiCharFmt.cbSize = sizeof(CHARFORMAT);
- dpiCharFmt.dwMask = CFM_SIZE; //~ | CFM_FACE;
- dpiCharFmt.yHeight = currentFormat.yHeight; // keep size
- //~StringCchCopy(dpiCharFmt.szFaceName, COUNTOF(dpiCharFmt.szFaceName), L"Consolas");
- SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&dpiCharFmt);
+ DPI_T const dpi = GetCurrentDPI(hwnd);
+ SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_SETZOOM, (WPARAM)dpi.y, (LPARAM)USER_DEFAULT_SCREEN_DPI);
- // --- larger bold version string
+ //~~// get current richedit box format
+ //~~CHARFORMAT2 currentFormat; ZeroMemory(¤tFormat, sizeof(CHARFORMAT2)); currentFormat.cbSize = sizeof(CHARFORMAT2);
+ //~~currentFormat.dwMask = CFM_ALL2; // CFM_SIZE | CFM_FACE | CFM_CHARSET | CFM_LCID; CFM_ALL; CFM_ALL2;
+ //~~SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_GETCHARFORMAT, SCF_DEFAULT, (LPARAM)¤tFormat);
+ //~~
+ //~~//CHARFORMAT dpiCharFmt; ZeroMemory(&dpiCharFmt, sizeof(CHARFORMAT)); dpiCharFmt.cbSize = sizeof(CHARFORMAT);
+ //~~//dpiCharFmt.dwMask = CFM_ALL; CFM_SIZE; //~ | CFM_FACE;
+ //~~CHARFORMAT2 dpiCharFmt = currentFormat;
+ //~~dpiCharFmt.yHeight = (currentFormat.yHeight == 180) ? ScaleIntToDPI_Y(hwnd, 180) : currentFormat.yHeight; // keep size
+ //~~//~StringCchCopy(dpiCharFmt.szFaceName, COUNTOF(dpiCharFmt.szFaceName), L"Segoe UI");
+ //~~SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&dpiCharFmt);
+ }
+ break;
+
+
+ case WM_PAINT:
+ {
+ if (Globals.hIcon128) {
+ int const iconSize = 128;
+ int const dpiScaledWidth = ScaleIntToDPI_X(hwnd, iconSize);
+ int const dpiScaledHeight = ScaleIntToDPI_Y(hwnd, iconSize);
+ HDC const hdc = GetWindowDC(hwnd);
+ DrawIconEx(hdc, ScaleIntToDPI_X(hwnd, 22), ScaleIntToDPI_Y(hwnd, 44),
+ Globals.hIcon128, dpiScaledWidth, dpiScaledHeight, 0, NULL, DI_NORMAL);
+ ReleaseDC(hwnd, hdc);
+ }
+
+ // --- larger bold condensed version string
if (hVersionFont) { DeleteObject(hVersionFont); }
if ((hVersionFont = (HFONT)SendDlgItemMessage(hwnd, IDC_VERSION, WM_GETFONT, 0, 0)) == NULL) {
hVersionFont = GetStockObject(DEFAULT_GUI_FONT);
}
LOGFONT lf; GetObject(hVersionFont, sizeof(LOGFONT), &lf);
lf.lfWeight = FW_BOLD;
- lf.lfWidth = ScaleIntFontSizeW(hwnd, 8);
- lf.lfHeight = ScaleIntFontSizeH(hwnd, 22);
- // lf.lfQuality = ANTIALIASED_QUALITY;
+ lf.lfWidth = ScaleIntToDPI_X(hwnd, 8);
+ lf.lfHeight = ScaleIntToDPI_Y(hwnd, 22);
+ //StringCchCopy(lf.lfFaceName, LF_FACESIZE, L"Segoe UI");
hVersionFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hwnd, IDC_VERSION, WM_SETFONT, (WPARAM)hVersionFont, true);
- }
- return true;
-
- case WM_PAINT:
- if (Globals.hIcon128) {
- RECT rt;
- GetWindowRect(hwnd, &rt);
- HDC hdc = GetWindowDC(hwnd);
- DrawIconEx(hdc, 22, 44, Globals.hIcon128, 128, 128, 0, NULL, DI_NORMAL);
- ReleaseDC(hwnd, hdc);
+ // rich edit control
+ SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_SETZOOM, 0, 0);
}
return false;
@@ -833,7 +845,7 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), wchBuf);
DPI_T dpi = GetCurrentDPI(hwnd);
- StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"\n- Display-DPI = %i x %i (Scale: %i%%).", dpi.x, dpi.y, ScaleIntToCurrentDPIX(hwnd, 100));
+ StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"\n- Display-DPI = %i x %i (Scale: %i%%).", dpi.x, dpi.y, ScaleIntToDPI_X(hwnd, 100));
StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), wchBuf);
StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"\n- Rendering-Technology = '%s'", Settings.RenderingTechnology ? L"DIRECT-WRITE" : L"GDI");
@@ -3963,8 +3975,6 @@ void StatusSetText(HWND hwnd, UINT nPart, LPCWSTR lpszText)
}
}
-
-
//=============================================================================
//
// StatusSetTextID()
diff --git a/src/Helpers.c b/src/Helpers.c
index 753e7c9fb..b55f65eb8 100644
--- a/src/Helpers.c
+++ b/src/Helpers.c
@@ -400,7 +400,7 @@ if (!bSucceed) {
//
int GetSystemMetricsEx(HWND hwnd, int nValue) {
- return ScaleIntToCurrentDPIY(hwnd, GetSystemMetrics(nValue));
+ return ScaleIntToDPI_Y(hwnd, GetSystemMetrics(nValue));
}
diff --git a/src/Helpers.h b/src/Helpers.h
index 719fef76c..d456a10c9 100644
--- a/src/Helpers.h
+++ b/src/Helpers.h
@@ -223,8 +223,9 @@ DPI_T GetCurrentPPI(HWND hwnd);
void UpdateWindowLayoutForDPI(HWND hWnd, int x_96dpi, int y_96dpi, int w_96dpi, int h_96dpi);
HBITMAP ResizeImageForCurrentDPI(HWND hwnd, HBITMAP hbmp);
-inline int ScaleIntToCurrentDPIX(HWND hwnd, int val) { DPI_T const dpi = GetCurrentDPI(hwnd); return MulDiv((val), dpi.x, USER_DEFAULT_SCREEN_DPI); }
-inline int ScaleIntToCurrentDPIY(HWND hwnd, int val) { DPI_T const dpi = GetCurrentDPI(hwnd); return MulDiv((val), dpi.y, USER_DEFAULT_SCREEN_DPI); }
+
+inline int ScaleIntToDPI_X(HWND hwnd, int val) { DPI_T const dpi = GetCurrentDPI(hwnd); return MulDiv((val), dpi.x, USER_DEFAULT_SCREEN_DPI); }
+inline int ScaleIntToDPI_Y(HWND hwnd, int val) { DPI_T const dpi = GetCurrentDPI(hwnd); return MulDiv((val), dpi.y, USER_DEFAULT_SCREEN_DPI); }
inline int ScaleToCurrentDPIX(HWND hwnd, float fVal) { DPI_T const dpi = GetCurrentDPI(hwnd); return float2int((fVal * dpi.x) / (float)USER_DEFAULT_SCREEN_DPI); }
inline int ScaleToCurrentDPIY(HWND hwnd, float fVal) { DPI_T const dpi = GetCurrentDPI(hwnd); return float2int((fVal * dpi.y) / (float)USER_DEFAULT_SCREEN_DPI); }
inline int ScaleIntFontSizeW(HWND hwnd, int val) { DPI_T const dpi = GetCurrentDPI(hwnd); DPI_T const ppi = GetCurrentPPI(hwnd); return MulDiv((val), dpi.x, ppi.x); }
diff --git a/src/Notepad3.c b/src/Notepad3.c
index d0c2f0050..2bf3d8ec6 100644
--- a/src/Notepad3.c
+++ b/src/Notepad3.c
@@ -155,8 +155,6 @@ static int s_iExprError = -1;
static WIN32_FIND_DATA s_fdCurFile;
-static HMODULE s_hRichEdit = INVALID_HANDLE_VALUE;
-
static int const INISECTIONBUFCNT = 32; // .ini file load buffer in KB
static TBBUTTON s_tbbMainWnd[] = {
@@ -765,11 +763,6 @@ static void _CleanUpResources(const HWND hwnd, bool bIsInitialized)
FreeLanguageResources();
- if (s_hRichEdit) {
- FreeLibrary(s_hRichEdit);
- s_hRichEdit = INVALID_HANDLE_VALUE;
- }
-
if (bIsInitialized) {
UnregisterClass(s_wchWndClass, Globals.hInstance);
}
@@ -862,6 +855,9 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
Scintilla_RegisterClasses(hInstance);
+ //SetProcessDPIAware(); -> .manifest
+ //SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE);
+
// ----------------------------------------------------
// MultiLingual
//
@@ -869,11 +865,6 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
// ----------------------------------------------------
- if (s_hRichEdit == INVALID_HANDLE_VALUE) {
- //s_hRichEdit = LoadLibrary(L"RICHED20.DLL"); // Use RICHEDIT_CONTROL_VER for control in common_res.h
- s_hRichEdit = LoadLibrary(L"MSFTEDIT.DLL"); // Use "RichEdit50W" for control in common_res.h
- }
-
int const cxs = GetSystemMetrics(SM_CXSMICON);
int const cys = GetSystemMetrics(SM_CYSMICON);
@@ -1223,7 +1214,7 @@ HWND InitInstance(HINSTANCE hInstance,LPCWSTR pszCmdLine,int nCmdShow)
if ((Settings.AlwaysOnTop || s_flagAlwaysOnTop == 2) && s_flagAlwaysOnTop != 1) {
SetWindowPos(Globals.hwndMain, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
- //UpdateWindowLayoutForDPI(Globals.hwndMain, 0, 0, 0, 0);
+ //~UpdateWindowLayoutForDPI(Globals.hwndMain, 0, 0, 0, 0);
if (Globals.hIcon128) {
SendMessage(Globals.hwndMain, WM_SETICON, ICON_BIG, (LPARAM)Globals.hIcon128);
@@ -2188,7 +2179,7 @@ static HIMAGELIST CreateScaledImageListFromBitmap(HWND hWnd, HBITMAP hBmp)
int const cx = (bmp.bmWidth - mod) / NUMTOOLBITMAPS;
int const cy = bmp.bmHeight;
- HIMAGELIST himl = ImageList_Create(cx, cy, ILC_COLOR32 | ILC_MASK, 0, 0);
+ HIMAGELIST himl = ImageList_Create(cx, cy, ILC_COLOR32 | ILC_MASK, NUMTOOLBITMAPS, NUMTOOLBITMAPS);
ImageList_AddMasked(himl, hBmp, CLR_DEFAULT);
DPI_T dpi = GetCurrentDPI(hWnd);
@@ -2200,10 +2191,10 @@ static HIMAGELIST CreateScaledImageListFromBitmap(HWND hWnd, HBITMAP hBmp)
// Scale button icons/images
- int const scx = ScaleIntToCurrentDPIX(hWnd, cx);
- int const scy = ScaleIntToCurrentDPIX(hWnd, cy);
+ int const scx = ScaleIntToDPI_X(hWnd, cx);
+ int const scy = ScaleIntToDPI_Y(hWnd, cy);
- HIMAGELIST hsciml = ImageList_Create(scx, scy, ILC_COLOR32 | ILC_MASK | ILC_HIGHQUALITYSCALE, 0, 0);
+ HIMAGELIST hsciml = ImageList_Create(scx, scy, ILC_COLOR32 | ILC_MASK | ILC_HIGHQUALITYSCALE, NUMTOOLBITMAPS, NUMTOOLBITMAPS);
for (int i = 0; i < NUMTOOLBITMAPS; ++i)
{
@@ -3375,7 +3366,6 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam)
CheckCmd(hmenu, IDM_VIEW_STATUSBAR, Settings.ShowStatusbar);
CheckCmd(hmenu, IDM_VIEW_DPISCALETB, Settings.DpiScaleToolBar);
-
//i = SciCall_GetLexer();
//EnableCmd(hmenu,IDM_VIEW_AUTOCLOSETAGS,(i == SCLEX_HTML || i == SCLEX_XML));
CheckCmd(hmenu, IDM_VIEW_AUTOCLOSETAGS, Settings.AutoCloseTags /*&& (i == SCLEX_HTML || i == SCLEX_XML)*/);
@@ -3543,7 +3533,6 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
MarkAllOccurrences(Settings2.UpdateDelayMarkAllOccurrences, false);
break;
-
case IDT_TIMER_UPDATE_STATUSBAR:
_UpdateStatusbarDelayed((bool)lParam);
break;
@@ -5604,7 +5593,14 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
break;
case IDM_HELP_ABOUT:
+ {
+ //~HMODULE hRichEdit = LoadLibrary(L"RICHED20.DLL"); // Use RICHEDIT_CONTROL_VER for control in common_res.h
+ HMODULE hRichEdit = LoadLibrary(L"MSFTEDIT.DLL"); // Use "RichEdit50W" for control in common_res.h;
+ if (hRichEdit != INVALID_HANDLE_VALUE) {
ThemedDialogBox(Globals.hLngResContainer, MAKEINTRESOURCE(IDD_MUI_ABOUT), hwnd, AboutDlgProc);
+ FreeLibrary(hRichEdit);
+ }
+ }
break;
case IDM_SETPASS:
@@ -8824,7 +8820,6 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
StatusSetText(Globals.hwndStatus, cnt++, tchStatusBar[id]);
}
}
- //InvalidateRect(Globals.hwndStatus,NULL,true);
}
// --------------------------------------------------------------------------
@@ -9336,9 +9331,10 @@ bool FileIO(bool fLoad,LPWSTR pszFileName,
{
WCHAR tch[MAX_PATH + 40];
FormatLngStringW(tch, COUNTOF(tch), (fLoad) ? IDS_MUI_LOADFILE : IDS_MUI_SAVEFILE, PathFindFileName(pszFileName));
+ bool fSuccess = false;
+
BeginWaitCursor(tch);
- bool fSuccess = false;
if (fLoad) {
fSuccess = EditLoadFile(Globals.hwndEdit,pszFileName,bSkipUnicodeDetect,bSkipANSICPDetection,bForceEncDetection,bSetSavePoint,status);
}
@@ -9689,6 +9685,7 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload,
}
EndWaitCursor();
+
UpdateAllBars(true);
return fSuccess;
diff --git a/src/Styles.c b/src/Styles.c
index 45f40afda..77d575d78 100644
--- a/src/Styles.c
+++ b/src/Styles.c
@@ -1639,7 +1639,7 @@ void Style_HighlightCurrentLine(HWND hwnd, int iHiLitCurLn)
if (!Style_StrGetSizeInt(szValue, &iFrameSize)) {
iFrameSize = 2;
}
- iFrameSize = max_i(1, ScaleIntToCurrentDPIY(hwnd, iFrameSize));
+ iFrameSize = max_i(1, ScaleIntToDPI_Y(hwnd, iFrameSize));
SendMessage(hwnd, SCI_SETCARETLINEFRAME, iFrameSize, 0);
}
diff --git a/src/VersionEx.h b/src/VersionEx.h
index 98f652625..7f27f89eb 100644
--- a/src/VersionEx.h
+++ b/src/VersionEx.h
@@ -9,11 +9,11 @@
#define VERSION_MAJOR 5
#define VERSION_MINOR 20
#define VERSION_REV 309
-#define VERSION_BUILD 2
+#define VERSION_BUILD 3
#define SCINTILLA_VER 432
#define ONIGURUMA_REGEX_VER 6.9.4
#define UCHARDET_VER 2018.09.27
#define TINYEXPR_VER 2018.05.11
#define UTHASH_VER 2.1.0
#define VERSION_PATCH RC3
-#define VERSION_COMMIT_ID dkt1-amr
+#define VERSION_COMMIT_ID nebukadn