[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
This commit is contained in:
Katayama Hirofumi MZ 2023-03-18 17:19:56 +09:00
parent 5ed7db5acb
commit 1c7c0fa7a7
4 changed files with 19 additions and 2 deletions

View File

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

View File

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

View File

@ -42,6 +42,7 @@ public:
DWORD ShowTextTool;
DWORD ShowStatusBar;
DWORD ShowPalette;
DWORD ShowToolBox;
enum WallpaperStyle {
TILED,

View File

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