diff --git a/Build/Notepad3.ini b/Build/Notepad3.ini index 39450b638..752473d94 100644 --- a/Build/Notepad3.ini +++ b/Build/Notepad3.ini @@ -12,6 +12,7 @@ SettingsVersion=5 ;DefaultDirectory= ;DefaultExtension=txt ;DenyVirtualSpaceAccess=0 +;DrawAnimatedWindow=true ;filebrowser.exe=minipath.exe ;grepWin.exe=grepWinNP3.exe ;FileCheckInterval=2000 ;(min: 200[msec] - if equal or less, notify immediately) diff --git a/np3encrypt/np3encrypt.vcxproj b/np3encrypt/np3encrypt.vcxproj index b02b29edc..82be7eb2e 100644 --- a/np3encrypt/np3encrypt.vcxproj +++ b/np3encrypt/np3encrypt.vcxproj @@ -33,7 +33,7 @@ v141 v142 Unicode - Static + false v143 @@ -43,7 +43,7 @@ v142 true Unicode - Static + false v143 @@ -52,7 +52,7 @@ v141 v142 Unicode - Static + false v143 @@ -62,7 +62,7 @@ v142 true Unicode - Static + false v143 diff --git a/src/Config/Config.cpp b/src/Config/Config.cpp index 3b573c250..2c3c59041 100644 --- a/src/Config/Config.cpp +++ b/src/Config/Config.cpp @@ -1316,6 +1316,8 @@ void LoadSettings() Settings2.IMEInteraction = ((codePage == 949 || codePage == 1361) ? SC_IME_INLINE : SC_IME_WINDOWED); } + Settings2.DrawAnimatedWindow = IniSectionGetBool(IniSecSettings2, L"DrawAnimatedWindow", true); + Settings2.LaunchInstanceWndPosOffset = clampi(IniSectionGetInt(IniSecSettings2, L"LaunchInstanceWndPosOffset", 28), -10000, 10000); Settings2.LaunchInstanceFullVisible = IniSectionGetBool(IniSecSettings2, L"LaunchInstanceFullVisible", true); diff --git a/src/Dialogs.c b/src/Dialogs.c index ef5e90b51..ab900b68c 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -674,19 +674,30 @@ static bool GetTrayWndRect(LPRECT lpTrayRect) { return false; } -// Check to see if the animation has been disabled -/*static */ bool GetDoAnimateMinimize(VOID) { - ANIMATIONINFO ai; +// Check to see if the animation has been disabled +bool GetSetDoAnimateMinimize(const int flag) +{ + ANIMATIONINFO ai; ai.cbSize = sizeof(ai); SystemParametersInfo(SPI_GETANIMATION, sizeof(ai), &ai, 0); - - return ai.iMinAnimate ? true : false; + bool const bRes = ai.iMinAnimate ? true : false; + if (flag == 0 && bRes) { + ai.iMinAnimate = 0; + SystemParametersInfo(SPI_SETANIMATION, sizeof(ai), &ai, 0); + } + else if (flag > 0 && !bRes) { + ai.iMinAnimate = 1; + SystemParametersInfo(SPI_SETANIMATION, sizeof(ai), &ai, 0); + } + return bRes; } + + void MinimizeWndToTray(HWND hWnd) { - bool const bAnimate = GetDoAnimateMinimize(); + bool const bAnimate = GetSetDoAnimateMinimize(-1); if (bAnimate) { @@ -714,7 +725,7 @@ void MinimizeWndToTray(HWND hWnd) { void RestoreWndFromTray(HWND hWnd) { - if (GetDoAnimateMinimize()) { + if (GetSetDoAnimateMinimize(-1)) { // Get the rect of the tray and the window. Note that the window rect // is still valid even though the window is hidden @@ -4740,7 +4751,7 @@ void SnapToWinInfoPos(HWND hwnd, const WININFO winInfo, SCREEN_MODE mode, UINT n } else { WINDOWPLACEMENT wndpl = WindowPlacementFromInfo(hwnd, &winInfo, mode, nCmdShow); - if (GetDoAnimateMinimize() && wndpl.showCmd) { + if (GetSetDoAnimateMinimize(-1) && wndpl.showCmd) { DrawAnimatedRects(hwnd, IDANI_CAPTION, &rcCurrent, &wndpl.rcNormalPosition); } SetWindowPlacement(hwnd, &wndpl); // 1st set correct screen (DPI Aware) @@ -4761,7 +4772,7 @@ void SnapToWinInfoPos(HWND hwnd, const WININFO winInfo, SCREEN_MODE mode, UINT n GetMonitorInfo(MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY), &mi); SetWindowLong(hwnd, GWL_STYLE, dwStyle & ~dwRmvFScrStyle); WINDOWPLACEMENT const wndpl = WindowPlacementFromInfo(hwnd, NULL, mode, nCmdShow); - if (GetDoAnimateMinimize() && wndpl.showCmd) { + if (GetSetDoAnimateMinimize(-1) && wndpl.showCmd) { DrawAnimatedRects(hwnd, IDANI_CAPTION, &rcCurrent, &wndpl.rcNormalPosition); } SetWindowPlacement(hwnd, &wndpl); diff --git a/src/Dialogs.h b/src/Dialogs.h index efcf35df1..2f87658f8 100644 --- a/src/Dialogs.h +++ b/src/Dialogs.h @@ -40,7 +40,7 @@ // ---------------------------------------------------------------------------- // === MinimizeToTray Functions - see comments in Dialogs.c === -bool GetDoAnimateMinimize(); +bool GetSetDoAnimateMinimize(const int flag); void MinimizeWndToTray(HWND hWnd); void RestoreWndFromTray(HWND hWnd); diff --git a/src/Notepad3.c b/src/Notepad3.c index 3f84787a5..d04d2e8a5 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -1936,6 +1936,8 @@ HWND InitInstance(const HINSTANCE hInstance, int nCmdShow) // initial set text in front of ShowWindow() EditSetNewText(Globals.hwndEdit, "", 0, false, false); + GetSetDoAnimateMinimize(Settings2.DrawAnimatedWindow ? 1 : 0); + ShowWindowAsync(s_hwndEditFrame, SW_SHOWDEFAULT); ShowWindowAsync(Globals.hwndEdit, SW_SHOWDEFAULT); //~SnapToWinInfoPos(hwndMain, g_IniWinInfo, SCR_NORMAL, SW_HIDE); ~ instead set all needed properties here: diff --git a/src/TypeDefs.h b/src/TypeDefs.h index af2591c58..7859bf19c 100644 --- a/src/TypeDefs.h +++ b/src/TypeDefs.h @@ -769,6 +769,7 @@ typedef struct SETTINGS2_T { int WrapAroundTooltipTimeout; int LargeIconScalePrecent; int DarkModeHiglightContrast; + bool DrawAnimatedWindow; float AnalyzeReliableConfidenceLevel; float LocaleAnsiCodePageAnalysisBonus;