reactos/dll/win32/browseui/settings.cpp
Carl J. Bialorucki 43b3dc2034
[BROWSEUI] Refactor settings and sync them between windows (#5496)
This works similarly to how our shell stores its settings from a software design standpoint.

- Add settings.cpp file and ShellSettings structure to load and save settings.
- Add a registry value to hivedef.inf for the locked toolbar state.
  This prevents a bug where the associated registry key cannot be opened or saved to.
- Add new BWM_SETTINGCHANGE window message to refresh the UI on setting changes
  and send it to every open window when saving settings to the registry.
- Add new BWM_GETSETTINGSPTR window message to share the shellbrowser settings
  structure pointer with child windows and toolbars.
2023-08-17 12:14:41 +03:00

37 lines
1.4 KiB
C++

/*
* PROJECT: ReactOS browseui
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Stores settings for the file explorer UI.
* COPYRIGHT: Copyright 2023 Carl Bialorucki <cbialo2@outlook.com>
*/
#include "precomp.h"
BOOL ShellSettings::Save()
{
SHRegSetUSValueW(L"Software\\Microsoft\\Internet Explorer\\Main", L"StatusBarOther",
REG_DWORD, &fStatusBarVisible, sizeof(fStatusBarVisible), SHREGSET_FORCE_HKCU);
SHRegSetUSValueW(L"Software\\Microsoft\\Internet Explorer\\Main", L"ShowGoButton",
REG_DWORD, &fShowGoButton, sizeof(fShowGoButton), SHREGSET_FORCE_HKCU);
SHRegSetUSValueW(L"Software\\Microsoft\\Internet Explorer\\Toolbar", L"Locked",
REG_DWORD, &fLocked, sizeof(fLocked), SHREGSET_FORCE_HKCU);
return TRUE;
}
BOOL ShellSettings::Load()
{
fStatusBarVisible = SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet Explorer\\Main",
L"StatusBarOther", FALSE, FALSE);
fShowGoButton = SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet Explorer\\Main",
L"ShowGoButton", FALSE, TRUE);
fLocked = SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet Explorer\\Toolbar",
L"Locked", FALSE, TRUE);
return TRUE;
}