2013-01-06 10:08:10 +00:00
|
|
|
/*
|
|
|
|
* ReactOS Explorer
|
|
|
|
*
|
|
|
|
* Copyright 2013 - Edijs Kolesnikovics
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2013-01-24 23:00:42 +00:00
|
|
|
#include "precomp.h"
|
2013-01-06 10:08:10 +00:00
|
|
|
|
2017-10-30 15:39:12 +00:00
|
|
|
TaskbarSettings g_TaskbarSettings;
|
2013-01-06 10:08:10 +00:00
|
|
|
|
2017-10-30 15:39:12 +00:00
|
|
|
BOOL TaskbarSettings::Save()
|
2013-01-06 10:08:10 +00:00
|
|
|
{
|
2017-10-30 15:39:12 +00:00
|
|
|
SHSetValueW(hkExplorer, NULL, L"EnableAutotray", REG_DWORD, &bHideInactiveIcons, sizeof(bHideInactiveIcons));
|
2023-07-08 22:04:45 +00:00
|
|
|
SHSetValueW(hkExplorer, L"Advanced", L"PreferDateOverWeekday", REG_DWORD, &bPreferDate, sizeof(bPreferDate));
|
2017-10-30 15:39:12 +00:00
|
|
|
SHSetValueW(hkExplorer, L"Advanced", L"ShowSeconds", REG_DWORD, &bShowSeconds, sizeof(bShowSeconds));
|
|
|
|
SHSetValueW(hkExplorer, L"Advanced", L"TaskbarGlomming", REG_DWORD, &bGroupButtons, sizeof(bGroupButtons));
|
|
|
|
BOOL bAllowSizeMove = !bLock;
|
|
|
|
SHSetValueW(hkExplorer, L"Advanced", L"TaskbarSizeMove", REG_DWORD, &bAllowSizeMove, sizeof(bAllowSizeMove));
|
|
|
|
sr.cbSize = sizeof(sr);
|
2023-07-22 15:24:28 +00:00
|
|
|
SHSetValueW(hkExplorer, L"Advanced", L"TaskbarSmallIcons", REG_DWORD, &bSmallIcons, sizeof(bSmallIcons));
|
2023-08-10 15:06:55 +00:00
|
|
|
SHSetValueW(hkExplorer, L"Advanced", L"TaskbarSd", REG_DWORD, &bShowDesktopButton, sizeof(bShowDesktopButton));
|
2017-10-30 15:39:12 +00:00
|
|
|
SHSetValueW(hkExplorer, L"StuckRects2", L"Settings", REG_BINARY, &sr, sizeof(sr));
|
2013-01-06 10:08:10 +00:00
|
|
|
|
2017-10-30 15:39:12 +00:00
|
|
|
/* TODO: AutoHide writes something to HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\0 figure out what and why */
|
|
|
|
return TRUE;
|
2013-01-06 10:08:10 +00:00
|
|
|
}
|
|
|
|
|
2017-10-30 15:39:12 +00:00
|
|
|
BOOL TaskbarSettings::Load()
|
2017-04-14 18:08:34 +00:00
|
|
|
{
|
2017-10-30 15:39:12 +00:00
|
|
|
DWORD dwRet, cbSize, dwValue = NULL;
|
2017-05-08 15:27:33 +00:00
|
|
|
|
2017-10-30 15:39:12 +00:00
|
|
|
cbSize = sizeof(dwValue);
|
|
|
|
dwRet = SHGetValueW(hkExplorer, L"Advanced", L"TaskbarSizeMove", NULL, &dwValue, &cbSize);
|
|
|
|
bLock = (dwRet == ERROR_SUCCESS) ? (dwValue == 0) : TRUE;
|
2021-09-13 01:33:14 +00:00
|
|
|
|
2023-07-08 22:04:45 +00:00
|
|
|
dwRet = SHGetValueW(hkExplorer, L"Advanced", L"PreferDateOverWeekday", NULL, &dwValue, &cbSize);
|
|
|
|
bPreferDate = (dwRet == ERROR_SUCCESS) ? (dwValue != 0) : FALSE; /* This is opt-in setting */
|
|
|
|
|
2017-10-30 15:39:12 +00:00
|
|
|
dwRet = SHGetValueW(hkExplorer, L"Advanced", L"ShowSeconds", NULL, &dwValue, &cbSize);
|
|
|
|
bShowSeconds = (dwRet == ERROR_SUCCESS) ? (dwValue != 0) : FALSE;
|
2017-05-08 15:27:33 +00:00
|
|
|
|
2017-10-30 15:39:12 +00:00
|
|
|
dwRet = SHGetValueW(hkExplorer, L"Advanced", L"TaskbarGlomming", NULL, &dwValue, &cbSize);
|
|
|
|
bGroupButtons = (dwRet == ERROR_SUCCESS) ? (dwValue != 0) : FALSE;
|
2017-04-14 18:08:34 +00:00
|
|
|
|
2017-10-30 15:39:12 +00:00
|
|
|
dwRet = SHGetValueW(hkExplorer, NULL, L"EnableAutotray", NULL, &dwValue, &cbSize);
|
|
|
|
bHideInactiveIcons = (dwRet == ERROR_SUCCESS) ? (dwValue != 0) : FALSE;
|
2013-01-06 10:08:10 +00:00
|
|
|
|
2023-07-22 15:24:28 +00:00
|
|
|
dwRet = SHGetValueW(hkExplorer, L"Advanced", L"TaskbarSmallIcons", NULL, &dwValue, &cbSize);
|
|
|
|
bSmallIcons = (dwRet == ERROR_SUCCESS) ? (dwValue != 0) : TRUE;
|
|
|
|
|
2023-08-04 11:20:19 +00:00
|
|
|
dwRet = SHGetValueW(hkExplorer, L"Advanced", L"CompactTrayIcons", NULL, &dwValue, &cbSize);
|
2023-12-23 20:21:12 +00:00
|
|
|
if (dwRet == ERROR_SUCCESS && dwValue <= TIM_Max)
|
|
|
|
eCompactTrayIcons = static_cast<TrayIconsMode>(dwValue);
|
|
|
|
else
|
|
|
|
eCompactTrayIcons = TIM_Default;
|
2023-08-04 11:20:19 +00:00
|
|
|
|
2023-08-10 15:06:55 +00:00
|
|
|
dwRet = SHGetValueW(hkExplorer, L"Advanced", L"TaskbarSd", NULL, &dwValue, &cbSize);
|
|
|
|
bShowDesktopButton = (dwRet == ERROR_SUCCESS) ? (dwValue != 0) : TRUE;
|
|
|
|
|
2017-10-30 15:39:12 +00:00
|
|
|
cbSize = sizeof(sr);
|
|
|
|
dwRet = SHGetValueW(hkExplorer, L"StuckRects2", L"Settings", NULL, &sr, &cbSize);
|
2013-01-06 10:08:10 +00:00
|
|
|
|
2017-10-30 15:39:12 +00:00
|
|
|
/* Make sure we have correct values here */
|
|
|
|
if (dwRet != ERROR_SUCCESS || sr.cbSize != sizeof(sr) || cbSize != sizeof(sr))
|
|
|
|
{
|
|
|
|
sr.Position = ABE_BOTTOM;
|
|
|
|
sr.AutoHide = FALSE;
|
|
|
|
sr.AlwaysOnTop = TRUE;
|
2024-03-22 12:15:22 +00:00
|
|
|
sr.SmSmallIcons = FALSE;
|
2017-10-30 15:39:12 +00:00
|
|
|
sr.HideClock = FALSE;
|
|
|
|
sr.Rect.left = sr.Rect.top = 0;
|
|
|
|
sr.Rect.bottom = sr.Rect.right = 1;
|
|
|
|
sr.Size.cx = sr.Size.cy = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sr.Position > ABE_BOTTOM)
|
|
|
|
sr.Position = ABE_BOTTOM;
|
2013-01-06 10:08:10 +00:00
|
|
|
}
|
|
|
|
|
2017-10-30 15:39:12 +00:00
|
|
|
return TRUE;
|
2013-01-06 10:08:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|