Author: rnaumann Date: Fri Apr 14 18:08:34 2017 New Revision: 74307 URL: http://svn.reactos.org/svn/reactos?rev=74307&view=rev Log: [EXPLORER] start reworking some code for loading/saving settings implementation CORE-11498
- Rename the settings structure to something more meaningful for using it for all taskbar related settings - define some default settings - check checkboxes with settings values in the properties window - move saving the settings to an own function which will be implemented later Modified: trunk/reactos/base/shell/explorer/explorer.cpp trunk/reactos/base/shell/explorer/precomp.h trunk/reactos/base/shell/explorer/settings.cpp trunk/reactos/base/shell/explorer/trayntfy.cpp trunk/reactos/base/shell/explorer/trayprop.cpp Modified: trunk/reactos/base/shell/explorer/explorer.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/explorer.cpp?rev=74307&r1=74306&r2=74307&view=diff ============================================================================== --- trunk/reactos/base/shell/explorer/explorer.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/explorer.cpp [iso-8859-1] Fri Apr 14 18:08:34 2017 @@ -132,7 +132,7 @@ hExplorerInstance = hInstance; hProcessHeap = GetProcessHeap(); - LoadAdvancedSettings(); + LoadTaskBarSettings(); InitCommonControls(); OleInitialize(NULL); Modified: trunk/reactos/base/shell/explorer/precomp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/precomp.h?rev=74307&r1=74306&r2=74307&view=diff ============================================================================== --- trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] Fri Apr 14 18:08:34 2017 @@ -176,16 +176,25 @@ */ /* Structure to hold non-default options*/ -typedef struct _ADVANCED_SETTINGS -{ +typedef struct _TASKBAR_SETTINGS +{ + BOOL bLock; + BOOL bAutoHide; + BOOL bAlwaysOnTop; + BOOL bGroupButtons; + BOOL bShowQuickLaunch; + BOOL bShowClock; BOOL bShowSeconds; -} ADVANCED_SETTINGS, *PADVANCED_SETTINGS; - -extern ADVANCED_SETTINGS AdvancedSettings; -extern const TCHAR szAdvancedSettingsKey []; - -VOID -LoadAdvancedSettings(VOID); + BOOL bHideInactiveIcons; +} TASKBAR_SETTINGS, *PTASKBAR_SETTINGS; + +extern TASKBAR_SETTINGS TaskBarSettings; + +VOID +LoadTaskBarSettings(VOID); + +VOID +SaveTaskBarSettings(VOID); BOOL SaveSettingDword(IN LPCWSTR pszKeyName, Modified: trunk/reactos/base/shell/explorer/settings.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/settings.cpp?rev=74307&r1=74306&r2=74307&view=diff ============================================================================== --- trunk/reactos/base/shell/explorer/settings.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/settings.cpp [iso-8859-1] Fri Apr 14 18:08:34 2017 @@ -20,16 +20,23 @@ #include "precomp.h" -ADVANCED_SETTINGS AdvancedSettings; +TASKBAR_SETTINGS TaskBarSettings; const WCHAR szAdvancedSettingsKey[] = L"Software\\ReactOS\\Features\\Explorer"; VOID -LoadAdvancedSettings(VOID) +LoadTaskBarSettings(VOID) { HKEY hKey; /* Set defaults */ - AdvancedSettings.bShowSeconds = FALSE; + TaskBarSettings.bLock = TRUE; + TaskBarSettings.bAutoHide = FALSE; + TaskBarSettings.bAlwaysOnTop = FALSE; + TaskBarSettings.bGroupButtons = TRUE; + TaskBarSettings.bShowQuickLaunch = TRUE; + TaskBarSettings.bShowClock = TRUE; + TaskBarSettings.bShowSeconds = FALSE; + TaskBarSettings.bHideInactiveIcons = TRUE; /* Check registry */ if (RegOpenKeyW(HKEY_CURRENT_USER, szAdvancedSettingsKey, &hKey) == ERROR_SUCCESS) @@ -38,10 +45,16 @@ dwValueLength = sizeof(dwValue); if (RegQueryValueExW(hKey, L"ShowSeconds", NULL, &dwType, (PBYTE)&dwValue, &dwValueLength) == ERROR_SUCCESS && dwType == REG_DWORD) - AdvancedSettings.bShowSeconds = dwValue != 0; + TaskBarSettings.bShowSeconds = dwValue != 0; RegCloseKey(hKey); } +} + +VOID +SaveTaskBarSettings(VOID) +{ + SaveSettingDword(szAdvancedSettingsKey, TEXT("ShowSeconds"), TaskBarSettings.bShowSeconds); } BOOL Modified: trunk/reactos/base/shell/explorer/trayntfy.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/trayntfy.cpp?rev=74307&r1=74306&r2=74307&view=diff ============================================================================== --- trunk/reactos/base/shell/explorer/trayntfy.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/trayntfy.cpp [iso-8859-1] Fri Apr 14 18:08:34 2017 @@ -867,7 +867,7 @@ if (ClockWndFormats[i].IsTime) { iRet = GetTimeFormat(LOCALE_USER_DEFAULT, - AdvancedSettings.bShowSeconds ? ClockWndFormats[i].dwFormatFlags : TIME_NOSECONDS, + TaskBarSettings.bShowSeconds ? ClockWndFormats[i].dwFormatFlags : TIME_NOSECONDS, &LocalTime, ClockWndFormats[i].lpFormat, szLines[i], @@ -939,7 +939,7 @@ /* Calculate the due time */ GetLocalTime(&LocalTime); uiDueTime = 1000 - (UINT) LocalTime.wMilliseconds; - if (AdvancedSettings.bShowSeconds) + if (TaskBarSettings.bShowSeconds) uiDueTime += (UINT) LocalTime.wSecond * 100; else uiDueTime += (59 - (UINT) LocalTime.wSecond) * 1000; @@ -997,7 +997,7 @@ uiDueTime = CalculateDueTime(); - if (AdvancedSettings.bShowSeconds) + if (TaskBarSettings.bShowSeconds) { uiWait1 = 1000 - 200; uiWait2 = 1000; Modified: trunk/reactos/base/shell/explorer/trayprop.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/trayprop.cpp?rev=74307&r1=74306&r2=74307&view=diff ============================================================================== --- trunk/reactos/base/shell/explorer/trayprop.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/trayprop.cpp [iso-8859-1] Fri Apr 14 18:08:34 2017 @@ -240,8 +240,14 @@ pPropInfo->hTaskbarWnd = hwnd; - // FIXME: check buttons - CheckDlgButton(hwnd, IDC_TASKBARPROP_SECONDS, AdvancedSettings.bShowSeconds ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd, IDC_TASKBARPROP_SECONDS, TaskBarSettings.bLock ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd, IDC_TASKBARPROP_SECONDS, TaskBarSettings.bAutoHide ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd, IDC_TASKBARPROP_SECONDS, TaskBarSettings.bAlwaysOnTop ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd, IDC_TASKBARPROP_SECONDS, TaskBarSettings.bGroupButtons ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd, IDC_TASKBARPROP_SECONDS, TaskBarSettings.bShowQuickLaunch ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd, IDC_TASKBARPROP_SECONDS, TaskBarSettings.bShowClock ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd, IDC_TASKBARPROP_SECONDS, TaskBarSettings.bShowSeconds ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd, IDC_TASKBARPROP_SECONDS, TaskBarSettings.bHideInactiveIcons ? BST_CHECKED : BST_UNCHECKED); UpdateBitmaps(pPropInfo); } @@ -313,8 +319,8 @@ break; case PSN_APPLY: - AdvancedSettings.bShowSeconds = IsDlgButtonChecked(hwndDlg, IDC_TASKBARPROP_SECONDS); - SaveSettingDword(szAdvancedSettingsKey, TEXT("ShowSeconds"), AdvancedSettings.bShowSeconds); + TaskBarSettings.bShowSeconds = IsDlgButtonChecked(hwndDlg, IDC_TASKBARPROP_SECONDS); + SaveTaskBarSettings(); break; }