Merge pull request #4974 from RaiKoHoff/Dev_Master

+add: opt. to disable animated max./min. window ([Settings2] DrawAnimatedWindow)]
This commit is contained in:
Rainer Kottenhoff 2023-08-28 22:34:57 +02:00 committed by GitHub
commit d8d1ce620b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 14 deletions

View File

@ -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)

View File

@ -33,7 +33,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)'=='15.0'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='16.0'">v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Static</UseOfMfc>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
@ -43,7 +43,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)'=='16.0'">v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Static</UseOfMfc>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
@ -52,7 +52,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)'=='15.0'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)'=='16.0'">v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Static</UseOfMfc>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
@ -62,7 +62,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)'=='16.0'">v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Static</UseOfMfc>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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:

View File

@ -769,6 +769,7 @@ typedef struct SETTINGS2_T {
int WrapAroundTooltipTimeout;
int LargeIconScalePrecent;
int DarkModeHiglightContrast;
bool DrawAnimatedWindow;
float AnalyzeReliableConfidenceLevel;
float LocaleAnsiCodePageAnalysisBonus;