https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1c7c0fa7a76c395ecbe97…
commit 1c7c0fa7a76c395ecbe979f066fa150ac618e65c
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sat Mar 18 17:19:56 2023 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Sat Mar 18 17:20:43 2023 +0900
[MSPAINT] Save ToolBox visibility (#5167)
According to my registry analysis, the target value is
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Applets\Paint\General-Bar3:Visible.
- Add ShowToolBox registry setting.
CORE-18867
---
base/applications/mspaint/main.cpp | 4 +++-
base/applications/mspaint/registry.cpp | 13 +++++++++++++
base/applications/mspaint/registry.h | 1 +
base/applications/mspaint/winproc.cpp | 3 ++-
4 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/base/applications/mspaint/main.cpp b/base/applications/mspaint/main.cpp
index 75e80757a39..933ef86cf6e 100644
--- a/base/applications/mspaint/main.cpp
+++ b/base/applications/mspaint/main.cpp
@@ -193,7 +193,9 @@ _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR
lpszArgument
haccel = LoadAccelerators(hThisInstance, MAKEINTRESOURCE(800));
RECT toolBoxContainerPos = {2, 2, 2 + 52, 2 + 350};
- toolBoxContainer.Create(hwnd, toolBoxContainerPos, NULL, WS_CHILD | WS_VISIBLE);
+ toolBoxContainer.Create(hwnd, toolBoxContainerPos, NULL, WS_CHILD);
+ if (registrySettings.ShowToolBox)
+ toolBoxContainer.ShowWindow(SW_SHOWNOACTIVATE);
/* creating the tool settings child window */
RECT toolSettingsWindowPos = {5, 208, 5 + 42, 208 + 140};
toolSettingsWindow.Create(toolBoxContainer.m_hWnd, toolSettingsWindowPos, NULL,
WS_CHILD | WS_VISIBLE);
diff --git a/base/applications/mspaint/registry.cpp
b/base/applications/mspaint/registry.cpp
index f23ce12e8f4..bb97301a11b 100644
--- a/base/applications/mspaint/registry.cpp
+++ b/base/applications/mspaint/registry.cpp
@@ -73,6 +73,7 @@ void RegistrySettings::LoadPresets(INT nCmdShow)
ShowTextTool = TRUE;
ShowStatusBar = TRUE;
ShowPalette = TRUE;
+ ShowToolBox = TRUE;
LOGFONT lf;
GetObject(GetStockObject(DEFAULT_GUI_FONT), sizeof(lf), &lf);
@@ -139,6 +140,12 @@ void RegistrySettings::Load(INT nCmdShow)
ReadString(text, _T("TypeFaceName"), strFontName, strFontName);
}
+ CRegKey bar3;
+ if (bar3.Open(paint, _T("General-Bar3"), KEY_READ) == ERROR_SUCCESS)
+ {
+ ReadDWORD(bar3, _T("Visible"), ShowToolBox);
+ }
+
CRegKey bar4;
if (bar4.Open(paint, _T("General-Bar4"), KEY_READ) == ERROR_SUCCESS)
{
@@ -202,6 +209,12 @@ void RegistrySettings::Store()
text.SetStringValue(_T("TypeFaceName"), strFontName);
}
+ CRegKey bar3;
+ if (bar3.Create(paint, _T("General-Bar3")) == ERROR_SUCCESS)
+ {
+ bar3.SetDWORDValue(_T("Visible"), ShowToolBox);
+ }
+
CRegKey bar4;
if (bar4.Create(paint, _T("General-Bar4")) == ERROR_SUCCESS)
{
diff --git a/base/applications/mspaint/registry.h b/base/applications/mspaint/registry.h
index ce932a1c773..d70e82ede48 100644
--- a/base/applications/mspaint/registry.h
+++ b/base/applications/mspaint/registry.h
@@ -42,6 +42,7 @@ public:
DWORD ShowTextTool;
DWORD ShowStatusBar;
DWORD ShowPalette;
+ DWORD ShowToolBox;
enum WallpaperStyle {
TILED,
diff --git a/base/applications/mspaint/winproc.cpp
b/base/applications/mspaint/winproc.cpp
index fc99822f5ee..e121a4f53cf 100644
--- a/base/applications/mspaint/winproc.cpp
+++ b/base/applications/mspaint/winproc.cpp
@@ -749,7 +749,8 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM
lParam, BOOL& bH
break;
case IDM_VIEWTOOLBOX:
- toolBoxContainer.ShowWindow(::IsWindowVisible(toolBoxContainer) ? SW_HIDE :
SW_SHOW);
+ registrySettings.ShowToolBox = !toolBoxContainer.IsWindowVisible();
+ toolBoxContainer.ShowWindow(registrySettings.ShowToolBox ? SW_SHOWNOACTIVATE
: SW_HIDE);
alignChildrenToMainWindow();
break;
case IDM_VIEWCOLORPALETTE: