https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9ff9295a2267c94076fbc…
commit 9ff9295a2267c94076fbc095093b39b08bfed41d
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sat Mar 11 11:41:52 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sat Mar 11 11:41:52 2023 +0900
[MSPAINT] Remember status bar visibility (#5145)
- Add ShowStatusBar registry setting.
- Save ShowStatusBar status and restore the status on startup.
CORE-18867
---
base/applications/mspaint/main.cpp | 4 +++-
base/applications/mspaint/registry.cpp | 3 +++
base/applications/mspaint/registry.h | 1 +
base/applications/mspaint/winproc.cpp | 3 ++-
4 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/base/applications/mspaint/main.cpp b/base/applications/mspaint/main.cpp
index f040ad7d300..4b8ed0c5fbe 100644
--- a/base/applications/mspaint/main.cpp
+++ b/base/applications/mspaint/main.cpp
@@ -239,9 +239,11 @@ _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR
lpszArgument
/* creating the status bar */
hStatusBar =
- CreateWindowEx(0, STATUSCLASSNAME, NULL, SBARS_SIZEGRIP | WS_CHILD | WS_VISIBLE,
0, 0, 0, 0, hwnd,
+ CreateWindowEx(0, STATUSCLASSNAME, NULL, SBARS_SIZEGRIP | WS_CHILD, 0, 0, 0, 0,
hwnd,
NULL, hThisInstance, NULL);
SendMessage(hStatusBar, SB_SETMINHEIGHT, 21, 0);
+ if (registrySettings.ShowStatusBar)
+ ShowWindow(hStatusBar, SW_SHOWNOACTIVATE);
RECT scrlClientWindowPos = {0, 0, 0 + 500, 0 + 500};
scrlClientWindow.Create(scrollboxWindow.m_hWnd, scrlClientWindowPos, NULL, WS_CHILD |
WS_VISIBLE);
diff --git a/base/applications/mspaint/registry.cpp
b/base/applications/mspaint/registry.cpp
index fd83a4b3243..1702c8d2c01 100644
--- a/base/applications/mspaint/registry.cpp
+++ b/base/applications/mspaint/registry.cpp
@@ -74,6 +74,7 @@ void RegistrySettings::LoadPresets()
FontsPositionX = 0;
FontsPositionY = 0;
ShowTextTool = TRUE;
+ ShowStatusBar = TRUE;
LOGFONT lf;
GetObject(GetStockObject(DEFAULT_GUI_FONT), sizeof(lf), &lf);
@@ -100,6 +101,7 @@ void RegistrySettings::Load()
ReadDWORD(view, _T("ThumbXPos"), ThumbXPos, TRUE);
ReadDWORD(view, _T("ThumbYPos"), ThumbYPos, TRUE);
ReadDWORD(view, _T("UnitSetting"), UnitSetting, FALSE);
+ ReadDWORD(view, _T("ShowStatusBar"), ShowStatusBar, FALSE);
ULONG pnBytes = sizeof(WINDOWPLACEMENT);
view.QueryBinaryValue(_T("WindowPlacement"), &WindowPlacement,
&pnBytes);
@@ -152,6 +154,7 @@ void RegistrySettings::Store()
view.SetDWORDValue(_T("ThumbXPos"), ThumbXPos);
view.SetDWORDValue(_T("ThumbYPos"), ThumbYPos);
view.SetDWORDValue(_T("UnitSetting"), UnitSetting);
+ view.SetDWORDValue(_T("ShowStatusBar"), ShowStatusBar);
view.SetBinaryValue(_T("WindowPlacement"), &WindowPlacement,
sizeof(WINDOWPLACEMENT));
}
diff --git a/base/applications/mspaint/registry.h b/base/applications/mspaint/registry.h
index 33c1be4054b..be90c104d9c 100644
--- a/base/applications/mspaint/registry.h
+++ b/base/applications/mspaint/registry.h
@@ -41,6 +41,7 @@ public:
DWORD FontsPositionX;
DWORD FontsPositionY;
DWORD ShowTextTool;
+ DWORD ShowStatusBar;
enum WallpaperStyle {
TILED,
diff --git a/base/applications/mspaint/winproc.cpp
b/base/applications/mspaint/winproc.cpp
index 779db8ff51d..3a064799c40 100644
--- a/base/applications/mspaint/winproc.cpp
+++ b/base/applications/mspaint/winproc.cpp
@@ -729,7 +729,8 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM
lParam, BOOL& bH
alignChildrenToMainWindow();
break;
case IDM_VIEWSTATUSBAR:
- ::ShowWindow(hStatusBar, ::IsWindowVisible(hStatusBar) ? SW_HIDE : SW_SHOW);
+ registrySettings.ShowStatusBar = !::IsWindowVisible(hStatusBar);
+ ::ShowWindow(hStatusBar, (registrySettings.ShowStatusBar ? SW_SHOWNOACTIVATE
: SW_HIDE));
alignChildrenToMainWindow();
break;
case IDM_FORMATICONBAR: