From 2470432a08208288de2a54bbed15207e202ed6ed Mon Sep 17 00:00:00 2001 From: RaiKoHoff Date: Fri, 10 Jan 2020 14:39:52 +0100 Subject: [PATCH] + chg: replace "save modified file warning" by (silent) custom messagebox if message beeps are muted. + add: infos of sreen/display for "Copy Version Info" button --- Versions/build.txt | 2 +- res/Notepad3.exe.manifest.conf | 2 +- src/Dialogs.c | 31 ++++++++++++++++++++++++++----- src/Helpers.c | 2 +- src/Notepad3.c | 9 +++++++-- src/VersionEx.h | 2 +- 6 files changed, 37 insertions(+), 11 deletions(-) diff --git a/Versions/build.txt b/Versions/build.txt index 39ae71311..efa0ab6fc 100644 --- a/Versions/build.txt +++ b/Versions/build.txt @@ -1 +1 @@ -2701 +2702 diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index a556109fe..c71ecf643 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -3,7 +3,7 @@ Notepad3 BETA diff --git a/src/Dialogs.c b/src/Dialogs.c index 6a907b17b..afde10df7 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -884,6 +884,12 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam WCHAR wchBuf2[128] = { L'\0' }; WCHAR wchVerInfo[2048] = { L'\0' }; + int ResX, ResY; + GetCurrentMonitorResolution(Globals.hwndMain, &ResX, &ResY); + DPI_T const wndDPI = GetCurrentDPI(Globals.hwndMain); + + // -------------------------------------------------------------------- + StringCchCopy(wchVerInfo, COUNTOF(wchVerInfo), _W(_STRG(VERSION_FILEVERSION_LONG))); StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), L"\n" VERSION_COMPILER); @@ -899,16 +905,29 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam break; } } - StringCchPrintf(wchBuf2, ARRAYSIZE(wchBuf2), L"\nLocale: %s (Codepage: '%s')", + StringCchPrintf(wchBuf2, ARRAYSIZE(wchBuf2), L"\nLocale: %s (CP:'%s')", wchBuf, g_Encodings[CPI_ANSI_DEFAULT].wchLabel); StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), wchBuf2); StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), L"\n" VERSION_SCIVERSION); StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), L"\n" VERSION_ONIGURUMA); - StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), L"\n" VERSION_UCHARDET); - StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), L"\n" VERSION_TINYEXPR); - StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), L"\n" VERSION_UTHASH); - StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), (IsProcessElevated() ? + //StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), L"\n" VERSION_UCHARDET); + //StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), L"\n" VERSION_TINYEXPR); + //StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), L"\n" VERSION_UTHASH); + + StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"\nScreen-Resolution = %i x %i [pix].", ResX, ResY); + StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), wchBuf); + + StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"\nDisplay-DPI = %i x %i (Scale: %i%%).", wndDPI.x, wndDPI.y, ScaleIntToCurrentDPI(100)); + StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), wchBuf); + + StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"\nRendering-Technology = %s.", Settings.RenderingTechnology ? L"DIRECT-WRITE" : L"GDI"); + StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), wchBuf); + + StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"\nZoom = %i%%.", SciCall_GetZoom()); + StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), wchBuf); + + StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), (IsProcessElevated() ? L"\nProcess is elevated." : L"\nProcess is not elevated.")); StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), (IsUserInAdminGroup() ? @@ -917,6 +936,8 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), L"\n"); + // -------------------------------------------------------------------- + SetClipboardTextW(Globals.hwndMain, wchVerInfo, StringCchLen(wchVerInfo,0)); } break; diff --git a/src/Helpers.c b/src/Helpers.c index 5e805b733..fce5788a5 100644 --- a/src/Helpers.c +++ b/src/Helpers.c @@ -394,7 +394,7 @@ if (!bSucceed) { //============================================================================= // // GetSystemMetricsEx() -// get system metrix for current DPI +// get system metric for current DPI // https://docs.microsoft.com/de-de/windows/desktop/api/winuser/nf-winuser-getsystemmetricsfordpi // int GetSystemMetricsEx(int nValue) { diff --git a/src/Notepad3.c b/src/Notepad3.c index dbe74134d..970cd9ed2 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -10071,13 +10071,17 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy, bool bP WCHAR tch[MAX_PATH] = { L'\0' }; if (StrIsNotEmpty(Globals.CurrentFile)) { StringCchCopy(tch, COUNTOF(tch), PathFindFileName(Globals.CurrentFile)); + if (Settings.MuteMessageBeep) { PathStripPath(tch); } // need shorter string for custom msgbox } else { GetLngString(IDS_MUI_UNTITLED, tch, COUNTOF(tch)); } + INT_PTR const btn = Settings.MuteMessageBeep ? + InfoBoxLng(MB_YESNOCANCEL | MB_ICONWARNING, NULL, IDS_MUI_ASK_SAVE, tch) : + MessageBoxLng(Globals.hwndMain, MB_YESNOCANCEL | MB_ICONWARNING, IDS_MUI_ASK_SAVE, tch); - switch (MessageBoxLng(Globals.hwndMain, MB_YESNOCANCEL | MB_ICONWARNING, IDS_MUI_ASK_SAVE, tch)) + switch (btn) { case IDCANCEL: return false; @@ -10117,8 +10121,9 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy, bool bP StringCchCopy(tchFile, COUNTOF(tchFile), s_tchLastSaveCopyDir); PathCchAppend(tchFile, COUNTOF(tchFile), PathFindFileName(Globals.CurrentFile)); } - else + else { StringCchCopy(tchFile, COUNTOF(tchFile), Globals.CurrentFile); + } if (SaveFileDlg(Globals.hwndMain, tchFile, COUNTOF(tchFile), tchInitialDir)) { diff --git a/src/VersionEx.h b/src/VersionEx.h index cc71ae146..0c3922029 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -9,7 +9,7 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 20 #define VERSION_REV 110 -#define VERSION_BUILD 2701 +#define VERSION_BUILD 2702 #define SCINTILLA_VER 423 #define ONIGURUMA_REGEX_VER 6.9.4 #define UCHARDET_VER 2018.09.27