mirror of
https://github.com/reactos/reactos.git
synced 2025-04-26 16:40:27 +00:00
[EXPLORER] -Rewrite taskbar settings routines and dialog
- Rewrite the taskbar settings and start menu settings property sheets. - All settings in the taskbar settings property sheet can be loaded and saved properly except for the quick launch one which will be implemented later. - Implement toggling lock, autohide and always on top. The rest will be implemented later.
This commit is contained in:
parent
cc578af6df
commit
2ed535da8a
9 changed files with 402 additions and 613 deletions
|
@ -1,7 +1,7 @@
|
|||
PROJECT(SHELL)
|
||||
|
||||
set_cpp(WITH_RUNTIME)
|
||||
|
||||
add_definitions(-D_ATL_NO_EXCEPTIONS)
|
||||
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl)
|
||||
|
||||
list(APPEND SOURCE
|
||||
|
|
|
@ -127,7 +127,8 @@ StartWithDesktop(IN HINSTANCE hInstance)
|
|||
hExplorerInstance = hInstance;
|
||||
hProcessHeap = GetProcessHeap();
|
||||
|
||||
LoadTaskBarSettings();
|
||||
g_TaskbarSettings.Load();
|
||||
|
||||
InitCommonControls();
|
||||
OleInitialize(NULL);
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <atlbase.h>
|
||||
#include <atlcom.h>
|
||||
#include <atlwin.h>
|
||||
#include <atlstr.h>
|
||||
#include <shellapi.h>
|
||||
#include <shlobj.h>
|
||||
#include <shlwapi.h>
|
||||
|
@ -40,6 +41,7 @@
|
|||
#include <undocshell.h>
|
||||
|
||||
#include <rosctrls.h>
|
||||
#include <rosdlgs.h>
|
||||
#include <shellutils.h>
|
||||
|
||||
#include "tmschema.h"
|
||||
|
@ -125,6 +127,7 @@ HRESULT WINAPI _CBandSite_CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void
|
|||
*/
|
||||
|
||||
#define TWM_OPENSTARTMENU (WM_USER + 260)
|
||||
#define TWM_SETTINGSCHANGED (WM_USER + 300)
|
||||
|
||||
extern const GUID IID_IShellDesktopTray;
|
||||
|
||||
|
@ -181,35 +184,39 @@ TrayMessageLoop(IN OUT ITrayWindow *Tray);
|
|||
* settings.c
|
||||
*/
|
||||
|
||||
/* Structure to hold non-default options*/
|
||||
typedef struct _TASKBAR_SETTINGS
|
||||
typedef struct _TW_STUCKRECTS2
|
||||
{
|
||||
DWORD cbSize;
|
||||
LONG Unknown;
|
||||
union
|
||||
{
|
||||
DWORD dwFlags;
|
||||
struct
|
||||
{
|
||||
DWORD AutoHide : 1;
|
||||
DWORD AlwaysOnTop : 1;
|
||||
DWORD SmallIcons : 1;
|
||||
DWORD HideClock : 1;
|
||||
};
|
||||
};
|
||||
DWORD Position;
|
||||
SIZE Size;
|
||||
RECT Rect;
|
||||
} TW_STRUCKRECTS2, *PTW_STUCKRECTS2;
|
||||
|
||||
struct TaskbarSettings
|
||||
{
|
||||
BOOL bLock;
|
||||
BOOL bAutoHide;
|
||||
BOOL bAlwaysOnTop;
|
||||
BOOL bGroupButtons;
|
||||
BOOL bShowQuickLaunch;
|
||||
BOOL bShowClock;
|
||||
BOOL bShowSeconds;
|
||||
BOOL bHideInactiveIcons;
|
||||
} TASKBAR_SETTINGS, *PTASKBAR_SETTINGS;
|
||||
TW_STRUCKRECTS2 sr;
|
||||
|
||||
extern TASKBAR_SETTINGS TaskBarSettings;
|
||||
BOOL Load();
|
||||
BOOL Save();
|
||||
};
|
||||
|
||||
VOID
|
||||
LoadTaskBarSettings(VOID);
|
||||
|
||||
VOID
|
||||
SaveTaskBarSettings(VOID);
|
||||
|
||||
BOOL
|
||||
LoadSettingDword(IN LPCWSTR pszKeyName,
|
||||
IN LPCWSTR pszValueName,
|
||||
OUT DWORD &dwValue);
|
||||
BOOL
|
||||
SaveSettingDword(IN LPCWSTR pszKeyName,
|
||||
IN LPCWSTR pszValueName,
|
||||
IN DWORD dwValue);
|
||||
extern TaskbarSettings g_TaskbarSettings;
|
||||
|
||||
/*
|
||||
* shellservice.cpp
|
||||
|
@ -229,7 +236,7 @@ ProcessStartupItems(VOID);
|
|||
*/
|
||||
|
||||
VOID
|
||||
DisplayTrayProperties(IN HWND hwndOwner);
|
||||
DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar);
|
||||
|
||||
/*
|
||||
* desktop.cpp
|
||||
|
@ -344,7 +351,7 @@ VOID
|
|||
UnregisterTrayNotifyWndClass(VOID);
|
||||
|
||||
HWND
|
||||
CreateTrayNotifyWnd(IN OUT ITrayWindow *TrayWindow, IN BOOL bHideClock, CTrayNotifyWnd** ppTrayNotify);
|
||||
CreateTrayNotifyWnd(IN OUT ITrayWindow *TrayWindow, CTrayNotifyWnd** ppTrayNotify);
|
||||
|
||||
BOOL
|
||||
TrayNotify_NotifyIconCmd(CTrayNotifyWnd* pTrayNotify, IN WPARAM wParam, IN LPARAM lParam);
|
||||
|
|
|
@ -107,6 +107,7 @@
|
|||
\*******************************************************************************/
|
||||
|
||||
/* Taskbar Page */
|
||||
#define IDC_TASKBARPROP_FIRST_CMD 1000
|
||||
#define IDC_TASKBARPROP_HIDEICONS 1000
|
||||
#define IDC_TASKBARPROP_ICONCUST 1007
|
||||
#define IDC_TASKBARPROP_ONTOP 1101
|
||||
|
@ -116,6 +117,7 @@
|
|||
#define IDC_TASKBARPROP_LOCK 1105
|
||||
#define IDC_TASKBARPROP_SECONDS 1106
|
||||
#define IDC_TASKBARPROP_SHOWQL 1107
|
||||
#define IDC_TASKBARPROP_LAST_CMD 1107
|
||||
#define IDC_TASKBARPROP_TASKBARBITMAP 1111
|
||||
#define IDC_TASKBARPROP_NOTIFICATIONBITMAP 1112
|
||||
|
||||
|
|
|
@ -20,85 +20,61 @@
|
|||
|
||||
#include "precomp.h"
|
||||
|
||||
TASKBAR_SETTINGS TaskBarSettings;
|
||||
const WCHAR szSettingsKey[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer";
|
||||
const WCHAR szAdvancedSettingsKey[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced";
|
||||
TaskbarSettings g_TaskbarSettings;
|
||||
|
||||
VOID
|
||||
LoadTaskBarSettings(VOID)
|
||||
BOOL TaskbarSettings::Save()
|
||||
{
|
||||
DWORD dwValue = NULL;
|
||||
|
||||
LoadSettingDword(szAdvancedSettingsKey, L"TaskbarSizeMove", dwValue);
|
||||
TaskBarSettings.bLock = (dwValue == 0);
|
||||
|
||||
LoadSettingDword(szAdvancedSettingsKey, L"ShowSeconds", dwValue);
|
||||
TaskBarSettings.bShowSeconds = (dwValue != 0);
|
||||
|
||||
LoadSettingDword(szSettingsKey, L"EnableAutotray", dwValue);
|
||||
TaskBarSettings.bHideInactiveIcons = (dwValue != 0);
|
||||
|
||||
LoadSettingDword(szAdvancedSettingsKey, L"TaskbarGlomming", dwValue);
|
||||
TaskBarSettings.bGroupButtons = (dwValue != 0);
|
||||
|
||||
TaskBarSettings.bShowQuickLaunch = TRUE; //FIXME: Where is this stored, and how?
|
||||
|
||||
/* FIXME: The following settings are stored in stuckrects2, do they have to be load here too? */
|
||||
TaskBarSettings.bShowClock = TRUE;
|
||||
TaskBarSettings.bAutoHide = FALSE;
|
||||
TaskBarSettings.bAlwaysOnTop = FALSE;
|
||||
SHSetValueW(hkExplorer, NULL, L"EnableAutotray", REG_DWORD, &bHideInactiveIcons, sizeof(bHideInactiveIcons));
|
||||
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);
|
||||
SHSetValueW(hkExplorer, L"StuckRects2", L"Settings", REG_BINARY, &sr, sizeof(sr));
|
||||
|
||||
/* TODO: AutoHide writes something to HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\0 figure out what and why */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
VOID
|
||||
SaveTaskBarSettings(VOID)
|
||||
BOOL TaskbarSettings::Load()
|
||||
{
|
||||
SaveSettingDword(szAdvancedSettingsKey, L"TaskbarSizeMove", TaskBarSettings.bLock);
|
||||
SaveSettingDword(szAdvancedSettingsKey, L"ShowSeconds", TaskBarSettings.bShowSeconds);
|
||||
SaveSettingDword(szSettingsKey, L"EnableAutotray", TaskBarSettings.bHideInactiveIcons);
|
||||
SaveSettingDword(szAdvancedSettingsKey, L"TaskbarGlomming", TaskBarSettings.bGroupButtons);
|
||||
|
||||
/* FIXME: Show Clock, AutoHide and Always on top are stored in the stuckrects2 key but are not written to it with a click on apply. How is this done instead?
|
||||
AutoHide writes something to HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\0 figure out what and why */
|
||||
}
|
||||
DWORD dwRet, cbSize, dwValue = NULL;
|
||||
|
||||
BOOL
|
||||
LoadSettingDword(IN LPCWSTR pszKeyName,
|
||||
IN LPCWSTR pszValueName,
|
||||
OUT DWORD &dwValue)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
HKEY hKey;
|
||||
cbSize = sizeof(dwValue);
|
||||
dwRet = SHGetValueW(hkExplorer, L"Advanced", L"TaskbarSizeMove", NULL, &dwValue, &cbSize);
|
||||
bLock = (dwRet == ERROR_SUCCESS) ? (dwValue == 0) : TRUE;
|
||||
|
||||
if (RegOpenKeyW(HKEY_CURRENT_USER, pszKeyName, &hKey) == ERROR_SUCCESS)
|
||||
dwRet = SHGetValueW(hkExplorer, L"Advanced", L"ShowSeconds", NULL, &dwValue, &cbSize);
|
||||
bShowSeconds = (dwRet == ERROR_SUCCESS) ? (dwValue != 0) : FALSE;
|
||||
|
||||
dwRet = SHGetValueW(hkExplorer, L"Advanced", L"TaskbarGlomming", NULL, &dwValue, &cbSize);
|
||||
bGroupButtons = (dwRet == ERROR_SUCCESS) ? (dwValue != 0) : FALSE;
|
||||
|
||||
dwRet = SHGetValueW(hkExplorer, NULL, L"EnableAutotray", NULL, &dwValue, &cbSize);
|
||||
bHideInactiveIcons = (dwRet == ERROR_SUCCESS) ? (dwValue != 0) : FALSE;
|
||||
|
||||
cbSize = sizeof(sr);
|
||||
dwRet = SHGetValueW(hkExplorer, L"StuckRects2", L"Settings", NULL, &sr, &cbSize);
|
||||
|
||||
/* Make sure we have correct values here */
|
||||
if (dwRet != ERROR_SUCCESS || sr.cbSize != sizeof(sr) || cbSize != sizeof(sr))
|
||||
{
|
||||
DWORD dwValueLength, dwType;
|
||||
|
||||
dwValueLength = sizeof(dwValue);
|
||||
ret = RegQueryValueExW(hKey, pszValueName, NULL, &dwType, (PBYTE)&dwValue, &dwValueLength) == ERROR_SUCCESS && dwType == REG_DWORD;
|
||||
|
||||
RegCloseKey(hKey);
|
||||
sr.Position = ABE_BOTTOM;
|
||||
sr.AutoHide = FALSE;
|
||||
sr.AlwaysOnTop = TRUE;
|
||||
sr.SmallIcons = TRUE;
|
||||
sr.HideClock = FALSE;
|
||||
sr.Rect.left = sr.Rect.top = 0;
|
||||
sr.Rect.bottom = sr.Rect.right = 1;
|
||||
sr.Size.cx = sr.Size.cy = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL
|
||||
SaveSettingDword(IN LPCWSTR pszKeyName,
|
||||
IN LPCWSTR pszValueName,
|
||||
IN DWORD dwValue)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
HKEY hKey;
|
||||
|
||||
if (RegCreateKeyW(HKEY_CURRENT_USER, pszKeyName, &hKey) == ERROR_SUCCESS)
|
||||
else
|
||||
{
|
||||
ret = RegSetValueExW(hKey, pszValueName, 0, REG_DWORD, (PBYTE)&dwValue, sizeof(dwValue)) == ERROR_SUCCESS;
|
||||
|
||||
RegCloseKey(hKey);
|
||||
if (sr.Position > ABE_BOTTOM)
|
||||
sr.Position = ABE_BOTTOM;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1735,6 +1735,18 @@ public:
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
LRESULT OnTaskbarSettingsChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
TaskbarSettings* newSettings = (TaskbarSettings*)lParam;
|
||||
if (newSettings->bGroupButtons != g_TaskbarSettings.bGroupButtons)
|
||||
{
|
||||
/* TODO: Toggle grouping */
|
||||
g_TaskbarSettings.bGroupButtons = newSettings->bGroupButtons;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
LRESULT Ret = 0;
|
||||
|
@ -1828,6 +1840,7 @@ public:
|
|||
MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
|
||||
MESSAGE_HANDLER(TSWM_ENABLEGROUPING, OnEnableGrouping)
|
||||
MESSAGE_HANDLER(TSWM_UPDATETASKBARPOS, OnUpdateTaskbarPos)
|
||||
MESSAGE_HANDLER(TWM_SETTINGSCHANGED, OnTaskbarSettingsChanged)
|
||||
MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
|
||||
MESSAGE_HANDLER(WM_TIMER, OnTimer)
|
||||
MESSAGE_HANDLER(WM_SETFONT, OnSetFont)
|
||||
|
|
|
@ -916,7 +916,7 @@ public:
|
|||
if (ClockWndFormats[i].IsTime)
|
||||
{
|
||||
iRet = GetTimeFormat(LOCALE_USER_DEFAULT,
|
||||
TaskBarSettings.bShowSeconds ? ClockWndFormats[i].dwFormatFlags : TIME_NOSECONDS,
|
||||
g_TaskbarSettings.bShowSeconds ? ClockWndFormats[i].dwFormatFlags : TIME_NOSECONDS,
|
||||
&LocalTime,
|
||||
ClockWndFormats[i].lpFormat,
|
||||
szLines[i],
|
||||
|
@ -988,7 +988,7 @@ public:
|
|||
/* Calculate the due time */
|
||||
GetLocalTime(&LocalTime);
|
||||
uiDueTime = 1000 - (UINT) LocalTime.wMilliseconds;
|
||||
if (TaskBarSettings.bShowSeconds)
|
||||
if (g_TaskbarSettings.bShowSeconds)
|
||||
uiDueTime += (UINT) LocalTime.wSecond * 100;
|
||||
else
|
||||
uiDueTime += (59 - (UINT) LocalTime.wSecond) * 1000;
|
||||
|
@ -1046,7 +1046,7 @@ public:
|
|||
|
||||
uiDueTime = CalculateDueTime();
|
||||
|
||||
if (TaskBarSettings.bShowSeconds)
|
||||
if (g_TaskbarSettings.bShowSeconds)
|
||||
{
|
||||
uiWait1 = 1000 - 200;
|
||||
uiWait2 = 1000;
|
||||
|
@ -1310,15 +1310,7 @@ class CTrayNotifyWnd :
|
|||
SIZE szTrayClockMin;
|
||||
SIZE szTrayNotify;
|
||||
MARGINS ContentMargin;
|
||||
union
|
||||
{
|
||||
DWORD dwFlags;
|
||||
struct
|
||||
{
|
||||
DWORD HideClock : 1;
|
||||
DWORD IsHorizontal : 1;
|
||||
};
|
||||
};
|
||||
BOOL IsHorizontal;
|
||||
|
||||
public:
|
||||
CTrayNotifyWnd() :
|
||||
|
@ -1326,7 +1318,7 @@ public:
|
|||
m_pager(NULL),
|
||||
m_clock(NULL),
|
||||
TrayTheme(NULL),
|
||||
dwFlags(0)
|
||||
IsHorizontal(FALSE)
|
||||
{
|
||||
ZeroMemory(&szTrayClockMin, sizeof(szTrayClockMin));
|
||||
ZeroMemory(&szTrayNotify, sizeof(szTrayNotify));
|
||||
|
@ -1377,10 +1369,10 @@ public:
|
|||
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
m_clock = new CTrayClockWnd();
|
||||
m_clock->_Init(m_hWnd, !HideClock);
|
||||
m_clock->_Init(m_hWnd, !g_TaskbarSettings.sr.HideClock);
|
||||
|
||||
m_pager = new CSysPagerWnd();
|
||||
m_pager->_Init(m_hWnd, !HideClock);
|
||||
m_pager->_Init(m_hWnd, !g_TaskbarSettings.sr.HideClock);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1390,7 +1382,7 @@ public:
|
|||
SIZE szClock = { 0, 0 };
|
||||
SIZE szTray = { 0, 0 };
|
||||
|
||||
if (!HideClock)
|
||||
if (!g_TaskbarSettings.sr.HideClock)
|
||||
{
|
||||
if (IsHorizontal)
|
||||
{
|
||||
|
@ -1430,7 +1422,7 @@ public:
|
|||
{
|
||||
pSize->cx = 2 * TRAY_NOTIFY_WND_SPACING_X;
|
||||
|
||||
if (!HideClock)
|
||||
if (!g_TaskbarSettings.sr.HideClock)
|
||||
pSize->cx += TRAY_NOTIFY_WND_SPACING_X + szTrayClockMin.cx;
|
||||
|
||||
pSize->cx += szTray.cx;
|
||||
|
@ -1439,7 +1431,7 @@ public:
|
|||
{
|
||||
pSize->cy = 2 * TRAY_NOTIFY_WND_SPACING_Y;
|
||||
|
||||
if (!HideClock)
|
||||
if (!g_TaskbarSettings.sr.HideClock)
|
||||
pSize->cy += TRAY_NOTIFY_WND_SPACING_Y + szTrayClockMin.cy;
|
||||
|
||||
pSize->cy += szTray.cy;
|
||||
|
@ -1453,7 +1445,7 @@ public:
|
|||
|
||||
VOID Size(IN const SIZE *pszClient)
|
||||
{
|
||||
if (!HideClock)
|
||||
if (!g_TaskbarSettings.sr.HideClock)
|
||||
{
|
||||
POINT ptClock;
|
||||
SIZE szClock;
|
||||
|
@ -1600,17 +1592,35 @@ public:
|
|||
|
||||
LRESULT OnShowClock(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
BOOL PrevHidden = HideClock;
|
||||
HideClock = (wParam == 0);
|
||||
BOOL PrevHidden = g_TaskbarSettings.sr.HideClock;
|
||||
g_TaskbarSettings.sr.HideClock = (wParam == 0);
|
||||
|
||||
if (m_clock != NULL && PrevHidden != HideClock)
|
||||
if (m_clock != NULL && PrevHidden != g_TaskbarSettings.sr.HideClock)
|
||||
{
|
||||
m_clock->ShowWindow(HideClock ? SW_HIDE : SW_SHOW);
|
||||
m_clock->ShowWindow(g_TaskbarSettings.sr.HideClock ? SW_HIDE : SW_SHOW);
|
||||
}
|
||||
|
||||
return (LRESULT) (!PrevHidden);
|
||||
}
|
||||
|
||||
LRESULT OnTaskbarSettingsChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
TaskbarSettings* newSettings = (TaskbarSettings*)lParam;
|
||||
if (newSettings->bShowSeconds != g_TaskbarSettings.bShowSeconds)
|
||||
{
|
||||
g_TaskbarSettings.bShowSeconds = newSettings->bShowSeconds;
|
||||
/* TODO: Toggle showing seconds */
|
||||
}
|
||||
|
||||
if (newSettings->sr.HideClock != g_TaskbarSettings.sr.HideClock)
|
||||
{
|
||||
g_TaskbarSettings.sr.HideClock = newSettings->sr.HideClock;
|
||||
/* TODO: Toggle hiding the clock */
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
const NMHDR *nmh = (const NMHDR *) lParam;
|
||||
|
@ -1665,9 +1675,10 @@ public:
|
|||
MESSAGE_HANDLER(TNWM_GETMINIMUMSIZE, OnGetMinimumSize)
|
||||
MESSAGE_HANDLER(TNWM_UPDATETIME, OnUpdateTime)
|
||||
MESSAGE_HANDLER(TNWM_SHOWCLOCK, OnShowClock)
|
||||
MESSAGE_HANDLER(TWM_SETTINGSCHANGED, OnTaskbarSettingsChanged)
|
||||
END_MSG_MAP()
|
||||
|
||||
HWND _Init(IN OUT ITrayWindow *TrayWindow, IN BOOL bHideClock)
|
||||
HWND _Init(IN OUT ITrayWindow *TrayWindow)
|
||||
{
|
||||
HWND hWndTrayWindow;
|
||||
|
||||
|
@ -1676,7 +1687,6 @@ public:
|
|||
return NULL;
|
||||
|
||||
this->TrayWindow = TrayWindow;
|
||||
this->HideClock = bHideClock;
|
||||
this->hWndNotify = hWndTrayWindow;
|
||||
|
||||
DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
|
||||
|
@ -1684,13 +1694,13 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
HWND CreateTrayNotifyWnd(IN OUT ITrayWindow *Tray, BOOL bHideClock, CTrayNotifyWnd** ppinstance)
|
||||
HWND CreateTrayNotifyWnd(IN OUT ITrayWindow *Tray, CTrayNotifyWnd** ppinstance)
|
||||
{
|
||||
CTrayNotifyWnd * pTrayNotify = new CTrayNotifyWnd();
|
||||
// TODO: Destroy after the window is destroyed
|
||||
*ppinstance = pTrayNotify;
|
||||
|
||||
return pTrayNotify->_Init(Tray, bHideClock);
|
||||
return pTrayNotify->_Init(Tray);
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
|
|
@ -21,441 +21,254 @@
|
|||
|
||||
#include "precomp.h"
|
||||
|
||||
typedef struct _PROPSHEET_INFO
|
||||
static void SetBitmap(HWND hwnd, HBITMAP* hbmp, UINT uImageId)
|
||||
{
|
||||
HWND hTaskbarWnd;
|
||||
HWND hStartWnd;
|
||||
if (*hbmp)
|
||||
DeleteObject(*hbmp);
|
||||
|
||||
HBITMAP hTaskbarBitmap;
|
||||
HBITMAP hTrayBitmap;
|
||||
HBITMAP hStartBitmap;
|
||||
} PROPSHEET_INFO, *PPROPSHEET_INFO;
|
||||
*hbmp = (HBITMAP)LoadImageW(hExplorerInstance,
|
||||
MAKEINTRESOURCEW(uImageId),
|
||||
IMAGE_BITMAP,
|
||||
0,
|
||||
0,
|
||||
LR_DEFAULTCOLOR);
|
||||
|
||||
|
||||
static BOOL
|
||||
UpdateBitmaps(PPROPSHEET_INFO pPropInfo)
|
||||
{
|
||||
HWND hwndLock, hwndHide, hwndGroup, hwndShowQL, hwndClock, hwndSeconds, hwndHideInactive, hwndModernStart, hwndClassicStart;
|
||||
HWND hwndTaskbarBitmap, hwndTrayBitmap, hwndStartBitmap;
|
||||
HWND hwndCustomizeNotifyButton, hwndCustomizeClassicStartButton, hwndCustomizeModernStartButton;
|
||||
BOOL bLock, bHide, bGroup, bShowQL, bShowClock, bShowSeconds, bHideInactive;
|
||||
LPTSTR lpTaskBarImageName = NULL, lpTrayImageName = NULL, lpStartImageName = NULL;
|
||||
BOOL bRet = FALSE;
|
||||
|
||||
hwndLock = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_LOCK);
|
||||
hwndHide = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_HIDE);
|
||||
hwndGroup = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_GROUP);
|
||||
hwndShowQL = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_SHOWQL);
|
||||
|
||||
hwndClock = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_CLOCK);
|
||||
hwndSeconds = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_SECONDS);
|
||||
hwndHideInactive = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_HIDEICONS);
|
||||
|
||||
hwndCustomizeNotifyButton = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_ICONCUST);
|
||||
|
||||
hwndModernStart = GetDlgItem(pPropInfo->hStartWnd, IDC_TASKBARPROP_STARTMENU);
|
||||
hwndClassicStart = GetDlgItem(pPropInfo->hStartWnd, IDC_TASKBARPROP_STARTMENUCLASSIC);
|
||||
|
||||
hwndCustomizeClassicStartButton = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_STARTMENUCLASSICCUST);
|
||||
hwndCustomizeModernStartButton = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_STARTMENUCUST);
|
||||
|
||||
|
||||
|
||||
if (hwndLock && hwndHide && hwndGroup && hwndShowQL && hwndClock && hwndSeconds && hwndHideInactive)
|
||||
if (*hbmp && hwnd)
|
||||
{
|
||||
bLock = (SendMessage(hwndLock, BM_GETCHECK, 0, 0) == BST_CHECKED);
|
||||
bHide = (SendMessage(hwndHide, BM_GETCHECK, 0, 0) == BST_CHECKED);
|
||||
bGroup = (SendMessage(hwndGroup, BM_GETCHECK, 0, 0) == BST_CHECKED);
|
||||
bShowQL = (SendMessage(hwndShowQL, BM_GETCHECK, 0, 0) == BST_CHECKED);
|
||||
|
||||
bShowClock = (SendMessage(hwndClock, BM_GETCHECK, 0, 0) == BST_CHECKED);
|
||||
bShowSeconds = (SendMessage(hwndSeconds, BM_GETCHECK, 0, 0) == BST_CHECKED);
|
||||
bHideInactive = (SendMessage(hwndHideInactive, BM_GETCHECK, 0, 0) == BST_CHECKED);
|
||||
BITMAP bm;
|
||||
GetObject(*hbmp, sizeof(bm), &bm);
|
||||
::SetWindowPos(hwnd, NULL, 0, 0, bm.bmWidth + 2, bm.bmHeight + 2,
|
||||
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
|
||||
SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)*hbmp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CTaskBarSettingsPage : public CPropertyPageImpl<CTaskBarSettingsPage>
|
||||
{
|
||||
private:
|
||||
HBITMAP m_hbmpTaskbar;
|
||||
HBITMAP m_hbmpTray;
|
||||
HWND m_hwndTaskbar;
|
||||
|
||||
void UpdateDialog()
|
||||
{
|
||||
BOOL bLock = IsDlgButtonChecked(IDC_TASKBARPROP_LOCK);
|
||||
BOOL bHide = IsDlgButtonChecked(IDC_TASKBARPROP_HIDE);
|
||||
BOOL bGroup = IsDlgButtonChecked(IDC_TASKBARPROP_GROUP);
|
||||
BOOL bShowQL = IsDlgButtonChecked(IDC_TASKBARPROP_SHOWQL);
|
||||
BOOL bShowClock = IsDlgButtonChecked(IDC_TASKBARPROP_CLOCK);
|
||||
BOOL bShowSeconds = IsDlgButtonChecked(IDC_TASKBARPROP_SECONDS);
|
||||
BOOL bHideInactive = IsDlgButtonChecked(IDC_TASKBARPROP_HIDEICONS);
|
||||
UINT uImageId;
|
||||
|
||||
HWND hwndCustomizeNotifyButton = GetDlgItem(IDC_TASKBARPROP_ICONCUST);
|
||||
HWND hwndSeconds = GetDlgItem(IDC_TASKBARPROP_SECONDS);
|
||||
HWND hwndTaskbarBitmap = GetDlgItem(IDC_TASKBARPROP_TASKBARBITMAP);
|
||||
HWND hwndTrayBitmap = GetDlgItem(IDC_TASKBARPROP_NOTIFICATIONBITMAP);
|
||||
|
||||
if (bHide)
|
||||
lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_AUTOHIDE);
|
||||
uImageId = IDB_TASKBARPROP_AUTOHIDE;
|
||||
else if (bLock && bGroup && bShowQL)
|
||||
lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_LOCK_GROUP_QL);
|
||||
uImageId = IDB_TASKBARPROP_LOCK_GROUP_QL;
|
||||
else if (bLock && !bGroup && !bShowQL)
|
||||
lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_LOCK_NOGROUP_NOQL);
|
||||
uImageId = IDB_TASKBARPROP_LOCK_NOGROUP_NOQL;
|
||||
else if (bLock && bGroup && !bShowQL)
|
||||
lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_LOCK_GROUP_NOQL);
|
||||
uImageId = IDB_TASKBARPROP_LOCK_GROUP_NOQL;
|
||||
else if (bLock && !bGroup && bShowQL)
|
||||
lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_LOCK_NOGROUP_QL);
|
||||
uImageId = IDB_TASKBARPROP_LOCK_NOGROUP_QL;
|
||||
else if (!bLock && !bGroup && !bShowQL)
|
||||
lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL);
|
||||
uImageId = IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL;
|
||||
else if (!bLock && bGroup && !bShowQL)
|
||||
lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_NOLOCK_GROUP_NOQL);
|
||||
uImageId = IDB_TASKBARPROP_NOLOCK_GROUP_NOQL;
|
||||
else if (!bLock && !bGroup && bShowQL)
|
||||
lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_NOLOCK_NOGROUP_QL);
|
||||
uImageId = IDB_TASKBARPROP_NOLOCK_NOGROUP_QL;
|
||||
else if (!bLock && bGroup && bShowQL)
|
||||
lpTaskBarImageName = MAKEINTRESOURCEW(IDB_TASKBARPROP_NOLOCK_GROUP_QL);
|
||||
uImageId = IDB_TASKBARPROP_NOLOCK_GROUP_QL;
|
||||
else
|
||||
ASSERT(FALSE);
|
||||
|
||||
|
||||
if (lpTaskBarImageName)
|
||||
{
|
||||
if (pPropInfo->hTaskbarBitmap)
|
||||
{
|
||||
DeleteObject(pPropInfo->hTaskbarBitmap);
|
||||
}
|
||||
SetBitmap(hwndTaskbarBitmap, &m_hbmpTaskbar, uImageId);
|
||||
|
||||
pPropInfo->hTaskbarBitmap = (HBITMAP)LoadImageW(hExplorerInstance,
|
||||
lpTaskBarImageName,
|
||||
IMAGE_BITMAP,
|
||||
0,
|
||||
0,
|
||||
LR_DEFAULTCOLOR);
|
||||
if (pPropInfo->hTaskbarBitmap)
|
||||
{
|
||||
hwndTaskbarBitmap = GetDlgItem(pPropInfo->hTaskbarWnd,
|
||||
IDC_TASKBARPROP_TASKBARBITMAP);
|
||||
if (hwndTaskbarBitmap)
|
||||
{
|
||||
BITMAP bm;
|
||||
GetObject(pPropInfo->hTaskbarBitmap, sizeof(bm), &bm);
|
||||
SetWindowPos(hwndTaskbarBitmap, NULL, 0, 0, bm.bmWidth + 2, bm.bmHeight + 2,
|
||||
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
|
||||
SendMessage(hwndTaskbarBitmap,
|
||||
STM_SETIMAGE,
|
||||
IMAGE_BITMAP,
|
||||
(LPARAM)pPropInfo->hTaskbarBitmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bHideInactive)
|
||||
{
|
||||
EnableWindow(hwndCustomizeNotifyButton, TRUE);
|
||||
if (bShowClock)
|
||||
{
|
||||
EnableWindow(hwndSeconds, TRUE);
|
||||
if (bShowSeconds)
|
||||
lpTrayImageName = MAKEINTRESOURCEW(IDB_SYSTRAYPROP_HIDE_SECONDS);
|
||||
else
|
||||
lpTrayImageName = MAKEINTRESOURCEW(IDB_SYSTRAYPROP_HIDE_CLOCK);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage(hwndSeconds, BM_SETCHECK, BST_UNCHECKED, 0);
|
||||
EnableWindow(hwndSeconds, FALSE);
|
||||
lpTrayImageName = MAKEINTRESOURCEW(IDB_SYSTRAYPROP_HIDE_NOCLOCK);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EnableWindow(hwndCustomizeNotifyButton, FALSE);
|
||||
if (bShowClock)
|
||||
{
|
||||
EnableWindow(hwndSeconds, TRUE);
|
||||
if (bShowSeconds)
|
||||
lpTrayImageName = MAKEINTRESOURCEW(IDB_SYSTRAYPROP_SHOW_SECONDS);
|
||||
else
|
||||
lpTrayImageName = MAKEINTRESOURCEW(IDB_SYSTRAYPROP_SHOW_CLOCK);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage(hwndSeconds, BM_SETCHECK, BST_UNCHECKED, 0);
|
||||
EnableWindow(hwndSeconds, FALSE);
|
||||
lpTrayImageName = MAKEINTRESOURCEW(IDB_SYSTRAYPROP_SHOW_NOCLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
if (lpTrayImageName)
|
||||
{
|
||||
if (pPropInfo->hTrayBitmap)
|
||||
{
|
||||
DeleteObject(pPropInfo->hTrayBitmap);
|
||||
}
|
||||
::EnableWindow(hwndCustomizeNotifyButton, bHideInactive);
|
||||
::EnableWindow(hwndSeconds, bShowClock);
|
||||
if (!bShowSeconds)
|
||||
CheckDlgButton(IDC_TASKBARPROP_SECONDS, BST_UNCHECKED);
|
||||
|
||||
pPropInfo->hTrayBitmap = (HBITMAP)LoadImageW(hExplorerInstance,
|
||||
lpTrayImageName,
|
||||
IMAGE_BITMAP,
|
||||
0,
|
||||
0,
|
||||
LR_DEFAULTCOLOR);
|
||||
if (pPropInfo->hTrayBitmap)
|
||||
{
|
||||
hwndTrayBitmap = GetDlgItem(pPropInfo->hTaskbarWnd,
|
||||
IDC_TASKBARPROP_NOTIFICATIONBITMAP);
|
||||
if (hwndTrayBitmap)
|
||||
{
|
||||
BITMAP bm;
|
||||
GetObject(pPropInfo->hTrayBitmap, sizeof(bm), &bm);
|
||||
SetWindowPos(hwndTrayBitmap, NULL, 0, 0, bm.bmWidth + 2, bm.bmHeight + 2,
|
||||
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
|
||||
SendMessage(hwndTrayBitmap,
|
||||
STM_SETIMAGE,
|
||||
IMAGE_BITMAP,
|
||||
(LPARAM)pPropInfo->hTrayBitmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bHideInactive && bShowClock && bShowSeconds)
|
||||
uImageId = IDB_SYSTRAYPROP_HIDE_SECONDS;
|
||||
else if (bHideInactive && bShowClock && !bShowSeconds)
|
||||
uImageId = IDB_SYSTRAYPROP_HIDE_CLOCK;
|
||||
else if (bHideInactive && !bShowClock)
|
||||
uImageId = IDB_SYSTRAYPROP_HIDE_NOCLOCK;
|
||||
else if (!bHideInactive && bShowClock && bShowSeconds)
|
||||
uImageId = IDB_SYSTRAYPROP_SHOW_SECONDS;
|
||||
else if (!bHideInactive && bShowClock && !bShowSeconds)
|
||||
uImageId = IDB_SYSTRAYPROP_SHOW_CLOCK;
|
||||
else if (!bHideInactive && !bShowClock)
|
||||
uImageId = IDB_SYSTRAYPROP_SHOW_NOCLOCK;
|
||||
else
|
||||
ASSERT(FALSE);
|
||||
|
||||
SetBitmap(hwndTrayBitmap, &m_hbmpTray, uImageId);
|
||||
}
|
||||
|
||||
public:
|
||||
enum { IDD = IDD_TASKBARPROP_TASKBAR };
|
||||
|
||||
BEGIN_MSG_MAP(CTaskBarSettingsPage)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_ID_HANDLER(IDC_TASKBARPROP_ICONCUST, OnCustomizeTrayIcons)
|
||||
COMMAND_RANGE_HANDLER(IDC_TASKBARPROP_FIRST_CMD, IDC_TASKBARPROP_LAST_CMD, OnCtrlCommand)
|
||||
CHAIN_MSG_MAP(CPropertyPageImpl<CTaskBarSettingsPage>)
|
||||
END_MSG_MAP()
|
||||
|
||||
CTaskBarSettingsPage(HWND hwnd):
|
||||
m_hbmpTaskbar(NULL),
|
||||
m_hbmpTray(NULL),
|
||||
m_hwndTaskbar(hwnd)
|
||||
{
|
||||
}
|
||||
|
||||
if(hwndClassicStart && hwndModernStart)
|
||||
~CTaskBarSettingsPage()
|
||||
{
|
||||
if(SendMessage(hwndModernStart, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
{
|
||||
EnableWindow(hwndCustomizeModernStartButton, TRUE);
|
||||
EnableWindow(hwndCustomizeClassicStartButton, FALSE);
|
||||
lpStartImageName = MAKEINTRESOURCEW(IDB_STARTPREVIEW);
|
||||
}
|
||||
else
|
||||
{
|
||||
EnableWindow(hwndCustomizeModernStartButton, FALSE);
|
||||
EnableWindow(hwndCustomizeClassicStartButton, TRUE);
|
||||
lpStartImageName = MAKEINTRESOURCEW(IDB_STARTPREVIEW_CLASSIC);
|
||||
}
|
||||
|
||||
if (lpStartImageName)
|
||||
{
|
||||
if (pPropInfo->hStartBitmap)
|
||||
{
|
||||
DeleteObject(pPropInfo->hStartBitmap);
|
||||
}
|
||||
|
||||
pPropInfo->hStartBitmap = (HBITMAP)LoadImageW(hExplorerInstance,
|
||||
lpStartImageName,
|
||||
IMAGE_BITMAP,
|
||||
0,
|
||||
0,
|
||||
LR_DEFAULTCOLOR);
|
||||
if (pPropInfo->hStartBitmap)
|
||||
{
|
||||
hwndStartBitmap = GetDlgItem(pPropInfo->hStartWnd,
|
||||
IDC_TASKBARPROP_STARTMENU_BITMAP);
|
||||
if (hwndStartBitmap)
|
||||
{
|
||||
BITMAP bm;
|
||||
GetObject(pPropInfo->hStartBitmap, sizeof(bm), &bm);
|
||||
SetWindowPos(hwndStartBitmap, NULL, 0, 0, bm.bmWidth + 2, bm.bmHeight + 2,
|
||||
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
|
||||
SendMessage(hwndStartBitmap,
|
||||
STM_SETIMAGE,
|
||||
IMAGE_BITMAP,
|
||||
(LPARAM)pPropInfo->hStartBitmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_hbmpTaskbar)
|
||||
DeleteObject(m_hbmpTaskbar);
|
||||
if (m_hbmpTray)
|
||||
DeleteObject(m_hbmpTray);
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
static VOID
|
||||
OnCreateTaskbarPage(HWND hwnd,
|
||||
PPROPSHEET_INFO pPropInfo)
|
||||
{
|
||||
SetWindowLongPtr(hwnd,
|
||||
GWLP_USERDATA,
|
||||
(LONG_PTR)pPropInfo);
|
||||
|
||||
pPropInfo->hTaskbarWnd = hwnd;
|
||||
|
||||
CheckDlgButton(hwnd, IDC_TASKBARPROP_LOCK, TaskBarSettings.bLock ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hwnd, IDC_TASKBARPROP_HIDE, TaskBarSettings.bAutoHide ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hwnd, IDC_TASKBARPROP_ONTOP, TaskBarSettings.bAlwaysOnTop ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hwnd, IDC_TASKBARPROP_GROUP, TaskBarSettings.bGroupButtons ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hwnd, IDC_TASKBARPROP_SHOWQL, TaskBarSettings.bShowQuickLaunch ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hwnd, IDC_TASKBARPROP_CLOCK, TaskBarSettings.bShowClock ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hwnd, IDC_TASKBARPROP_SECONDS, TaskBarSettings.bShowSeconds ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(hwnd, IDC_TASKBARPROP_HIDEICONS, TaskBarSettings.bHideInactiveIcons ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
UpdateBitmaps(pPropInfo);
|
||||
}
|
||||
|
||||
static VOID
|
||||
OnCreateStartPage(HWND hwnd,
|
||||
PPROPSHEET_INFO pPropInfo)
|
||||
{
|
||||
pPropInfo->hStartWnd = hwnd;
|
||||
|
||||
CheckDlgButton(hwnd, IDC_TASKBARPROP_STARTMENUCLASSIC, 1); // HACK: This has to be read from registry!
|
||||
|
||||
UpdateBitmaps(pPropInfo);
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK
|
||||
TaskbarPageProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
PPROPSHEET_INFO pPropInfo;
|
||||
|
||||
/* Get the window context */
|
||||
pPropInfo = (PPROPSHEET_INFO)GetWindowLongPtrW(hwndDlg,
|
||||
GWLP_USERDATA);
|
||||
if (pPropInfo == NULL && uMsg != WM_INITDIALOG)
|
||||
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
||||
{
|
||||
goto HandleDefaultMessage;
|
||||
CheckDlgButton(IDC_TASKBARPROP_LOCK, g_TaskbarSettings.bLock ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(IDC_TASKBARPROP_HIDE, g_TaskbarSettings.sr.AutoHide ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(IDC_TASKBARPROP_ONTOP, g_TaskbarSettings.sr.AlwaysOnTop ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(IDC_TASKBARPROP_GROUP, g_TaskbarSettings.bGroupButtons ? BST_CHECKED : BST_UNCHECKED);
|
||||
//CheckDlgButton(IDC_TASKBARPROP_SHOWQL, g_TaskbarSettings.bShowQuickLaunch ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(IDC_TASKBARPROP_CLOCK, (!g_TaskbarSettings.sr.HideClock) ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(IDC_TASKBARPROP_SECONDS, g_TaskbarSettings.bShowSeconds ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(IDC_TASKBARPROP_HIDEICONS, g_TaskbarSettings.bHideInactiveIcons ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
UpdateDialog();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
switch (uMsg)
|
||||
LRESULT OnCustomizeTrayIcons(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
OnCreateTaskbarPage(hwndDlg, (PPROPSHEET_INFO)((LPPROPSHEETPAGE)lParam)->lParam);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_TASKBARPROP_LOCK:
|
||||
case IDC_TASKBARPROP_HIDE:
|
||||
case IDC_TASKBARPROP_GROUP:
|
||||
case IDC_TASKBARPROP_SHOWQL:
|
||||
case IDC_TASKBARPROP_HIDEICONS:
|
||||
case IDC_TASKBARPROP_CLOCK:
|
||||
case IDC_TASKBARPROP_SECONDS:
|
||||
if (HIWORD(wParam) == BN_CLICKED)
|
||||
{
|
||||
UpdateBitmaps(pPropInfo);
|
||||
|
||||
/* Enable the 'Apply' button */
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
}
|
||||
break;
|
||||
case IDC_TASKBARPROP_ICONCUST:
|
||||
ShowCustomizeNotifyIcons(hExplorerInstance, hwndDlg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
LPNMHDR pnmh = (LPNMHDR)lParam;
|
||||
|
||||
switch (pnmh->code)
|
||||
{
|
||||
case PSN_SETACTIVE:
|
||||
break;
|
||||
|
||||
case PSN_APPLY:
|
||||
TaskBarSettings.bLock = IsDlgButtonChecked(hwndDlg, IDC_TASKBARPROP_LOCK);
|
||||
TaskBarSettings.bAutoHide = IsDlgButtonChecked(hwndDlg, IDC_TASKBARPROP_HIDE);
|
||||
TaskBarSettings.bAlwaysOnTop = IsDlgButtonChecked(hwndDlg, IDC_TASKBARPROP_ONTOP);
|
||||
TaskBarSettings.bGroupButtons = IsDlgButtonChecked(hwndDlg, IDC_TASKBARPROP_GROUP);
|
||||
TaskBarSettings.bShowQuickLaunch = IsDlgButtonChecked(hwndDlg, IDC_TASKBARPROP_SHOWQL);
|
||||
TaskBarSettings.bShowClock = IsDlgButtonChecked(hwndDlg, IDC_TASKBARPROP_CLOCK);
|
||||
TaskBarSettings.bShowSeconds = IsDlgButtonChecked(hwndDlg, IDC_TASKBARPROP_SECONDS);
|
||||
TaskBarSettings.bHideInactiveIcons = IsDlgButtonChecked(hwndDlg, IDC_TASKBARPROP_HIDEICONS);
|
||||
SaveTaskBarSettings();
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DESTROY:
|
||||
if (pPropInfo->hTaskbarBitmap)
|
||||
{
|
||||
DeleteObject(pPropInfo->hTaskbarBitmap);
|
||||
}
|
||||
if (pPropInfo->hTrayBitmap)
|
||||
{
|
||||
DeleteObject(pPropInfo->hTrayBitmap);
|
||||
}
|
||||
break;
|
||||
|
||||
HandleDefaultMessage:
|
||||
default:
|
||||
return FALSE;
|
||||
ShowCustomizeNotifyIcons(hExplorerInstance, m_hWnd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static INT_PTR CALLBACK
|
||||
StartMenuPageProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
switch (uMsg)
|
||||
LRESULT OnCtrlCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
OnCreateStartPage(hwndDlg, (PPROPSHEET_INFO)((LPPROPSHEETPAGE)lParam)->lParam);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_TASKBARPROP_STARTMENUCLASSICCUST:
|
||||
ShowCustomizeClassic(hExplorerInstance, hwndDlg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DESTROY:
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
LPNMHDR pnmh = (LPNMHDR)lParam;
|
||||
|
||||
switch (pnmh->code)
|
||||
{
|
||||
case PSN_SETACTIVE:
|
||||
break;
|
||||
|
||||
case PSN_APPLY:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
UpdateDialog();
|
||||
SetModified(TRUE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
int OnApply()
|
||||
{
|
||||
TaskbarSettings newSettings;
|
||||
memcpy(&newSettings, &g_TaskbarSettings, sizeof(TaskbarSettings));
|
||||
|
||||
static VOID
|
||||
InitPropSheetPage(PROPSHEETPAGE *psp,
|
||||
WORD idDlg,
|
||||
DLGPROC DlgProc,
|
||||
LPARAM lParam)
|
||||
newSettings.bLock = IsDlgButtonChecked(IDC_TASKBARPROP_LOCK);
|
||||
newSettings.sr.AutoHide = IsDlgButtonChecked(IDC_TASKBARPROP_HIDE);
|
||||
newSettings.sr.AlwaysOnTop = IsDlgButtonChecked(IDC_TASKBARPROP_ONTOP);
|
||||
newSettings.bGroupButtons = IsDlgButtonChecked(IDC_TASKBARPROP_GROUP);
|
||||
//newSettings.bShowQuickLaunch = IsDlgButtonChecked(IDC_TASKBARPROP_SHOWQL);
|
||||
newSettings.sr.HideClock = !IsDlgButtonChecked(IDC_TASKBARPROP_CLOCK);
|
||||
newSettings.bShowSeconds = IsDlgButtonChecked(IDC_TASKBARPROP_SECONDS);
|
||||
newSettings.bHideInactiveIcons = IsDlgButtonChecked(IDC_TASKBARPROP_HIDEICONS);
|
||||
|
||||
SendMessage(m_hwndTaskbar, TWM_SETTINGSCHANGED, 0, (LPARAM)&newSettings);
|
||||
|
||||
return PSNRET_NOERROR;
|
||||
}
|
||||
};
|
||||
|
||||
class CStartMenuSettingsPage : public CPropertyPageImpl<CStartMenuSettingsPage>
|
||||
{
|
||||
ZeroMemory(psp, sizeof(*psp));
|
||||
psp->dwSize = sizeof(*psp);
|
||||
psp->dwFlags = PSP_DEFAULT;
|
||||
psp->hInstance = hExplorerInstance;
|
||||
psp->pszTemplate = MAKEINTRESOURCEW(idDlg);
|
||||
psp->lParam = lParam;
|
||||
psp->pfnDlgProc = DlgProc;
|
||||
}
|
||||
private:
|
||||
HBITMAP m_hbmpStartBitmap;
|
||||
|
||||
void UpdateDialog()
|
||||
{
|
||||
HWND hwndCustomizeClassic = GetDlgItem(IDC_TASKBARPROP_STARTMENUCLASSICCUST);
|
||||
HWND hwndCustomizeModern = GetDlgItem(IDC_TASKBARPROP_STARTMENUCUST);
|
||||
HWND hwndStartBitmap = GetDlgItem(IDC_TASKBARPROP_STARTMENU_BITMAP);
|
||||
|
||||
BOOL bModern = IsDlgButtonChecked(IDC_TASKBARPROP_STARTMENU);
|
||||
::EnableWindow(hwndCustomizeModern, bModern);
|
||||
::EnableWindow(hwndCustomizeClassic, !bModern);
|
||||
|
||||
UINT uImageId = bModern ? IDB_STARTPREVIEW : IDB_STARTPREVIEW_CLASSIC;
|
||||
SetBitmap(hwndStartBitmap, &m_hbmpStartBitmap, uImageId);
|
||||
}
|
||||
|
||||
public:
|
||||
enum { IDD = IDD_TASKBARPROP_STARTMENU };
|
||||
|
||||
BEGIN_MSG_MAP(CTaskBarSettingsPage)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_ID_HANDLER(IDC_TASKBARPROP_STARTMENUCLASSICCUST, OnStartMenuCustomize)
|
||||
CHAIN_MSG_MAP(CPropertyPageImpl<CStartMenuSettingsPage>)
|
||||
END_MSG_MAP()
|
||||
|
||||
CStartMenuSettingsPage():
|
||||
m_hbmpStartBitmap(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
~CStartMenuSettingsPage()
|
||||
{
|
||||
if (m_hbmpStartBitmap)
|
||||
DeleteObject(m_hbmpStartBitmap);
|
||||
}
|
||||
|
||||
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
||||
{
|
||||
CheckDlgButton(IDC_TASKBARPROP_STARTMENUCLASSIC, BST_CHECKED); // HACK: This has to be read from registry!
|
||||
UpdateDialog();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LRESULT OnStartMenuCustomize(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
|
||||
{
|
||||
ShowCustomizeClassic(hExplorerInstance, m_hWnd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int OnApply()
|
||||
{
|
||||
//TODO
|
||||
return PSNRET_NOERROR;
|
||||
}
|
||||
};
|
||||
|
||||
VOID
|
||||
DisplayTrayProperties(IN HWND hwndOwner)
|
||||
DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar)
|
||||
{
|
||||
PROPSHEET_INFO propInfo = {0};
|
||||
PROPSHEETHEADER psh;
|
||||
PROPSHEETPAGE psp[2];
|
||||
WCHAR szCaption[256];
|
||||
|
||||
if (!LoadStringW(hExplorerInstance,
|
||||
IDS_TASKBAR_STARTMENU_PROP_CAPTION,
|
||||
szCaption,
|
||||
_countof(szCaption)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
HPROPSHEETPAGE hpsp[2];
|
||||
CTaskBarSettingsPage tbSettingsPage(hwndTaskbar);
|
||||
CStartMenuSettingsPage smSettingsPage;
|
||||
CStringW caption;
|
||||
|
||||
caption.LoadStringW(IDS_TASKBAR_STARTMENU_PROP_CAPTION);
|
||||
|
||||
hpsp[0] = tbSettingsPage.Create();
|
||||
hpsp[1] = smSettingsPage.Create();
|
||||
|
||||
ZeroMemory(&psh, sizeof(psh));
|
||||
psh.dwSize = sizeof(psh);
|
||||
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
|
||||
psh.dwFlags = PSH_PROPTITLE;
|
||||
psh.hwndParent = hwndOwner;
|
||||
psh.hInstance = hExplorerInstance;
|
||||
psh.hIcon = NULL;
|
||||
psh.pszCaption = szCaption;
|
||||
psh.nPages = _countof(psp);
|
||||
psh.pszCaption = caption.GetString();
|
||||
psh.nPages = _countof(hpsp);
|
||||
psh.nStartPage = 0;
|
||||
psh.ppsp = psp;
|
||||
|
||||
InitPropSheetPage(&psp[0], IDD_TASKBARPROP_TASKBAR, TaskbarPageProc, (LPARAM)&propInfo);
|
||||
InitPropSheetPage(&psp[1], IDD_TASKBARPROP_STARTMENU, StartMenuPageProc, (LPARAM)&propInfo);
|
||||
psh.phpage = hpsp;
|
||||
|
||||
PropertySheet(&psh);
|
||||
}
|
||||
|
|
|
@ -237,12 +237,6 @@ public:
|
|||
DWORD Flags;
|
||||
struct
|
||||
{
|
||||
DWORD AutoHide : 1;
|
||||
DWORD AlwaysOnTop : 1;
|
||||
DWORD SmSmallIcons : 1;
|
||||
DWORD HideClock : 1;
|
||||
DWORD Locked : 1;
|
||||
|
||||
/* UI Status */
|
||||
DWORD InSizeMove : 1;
|
||||
DWORD IsDragging : 1;
|
||||
|
@ -411,7 +405,7 @@ public:
|
|||
|
||||
m_TrayPropertiesOwner = hwnd;
|
||||
|
||||
DisplayTrayProperties(hwnd);
|
||||
DisplayTrayProperties(hwnd, m_hWnd);
|
||||
|
||||
m_TrayPropertiesOwner = NULL;
|
||||
::DestroyWindow(hwnd);
|
||||
|
@ -494,7 +488,7 @@ public:
|
|||
case ID_LOCKTASKBAR:
|
||||
if (SHRestricted(REST_CLASSICSHELL) == 0)
|
||||
{
|
||||
Lock(!Locked);
|
||||
Lock(!g_TaskbarSettings.bLock);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1192,7 +1186,7 @@ GetPrimaryScreenRect:
|
|||
without user interaction. */
|
||||
rcTray = m_TrayRects[m_Position];
|
||||
|
||||
if (AutoHide)
|
||||
if (g_TaskbarSettings.sr.AutoHide)
|
||||
{
|
||||
rcTray.left += m_AutoHideOffset.cx;
|
||||
rcTray.right += m_AutoHideOffset.cx;
|
||||
|
@ -1273,7 +1267,7 @@ ChangePos:
|
|||
|
||||
/* If AutoHide is false then change the workarea to exclude
|
||||
the area that the taskbar covers. */
|
||||
if (!AutoHide)
|
||||
if (!g_TaskbarSettings.sr.AutoHide)
|
||||
{
|
||||
switch (m_Position)
|
||||
{
|
||||
|
@ -1324,23 +1318,11 @@ ChangePos:
|
|||
ApplyClipping(TRUE);
|
||||
}
|
||||
|
||||
typedef struct _TW_STUCKRECTS2
|
||||
{
|
||||
DWORD cbSize;
|
||||
LONG Unknown;
|
||||
DWORD dwFlags;
|
||||
DWORD Position;
|
||||
SIZE Size;
|
||||
RECT Rect;
|
||||
} TW_STRUCKRECTS2, *PTW_STUCKRECTS2;
|
||||
|
||||
VOID RegLoadSettings()
|
||||
{
|
||||
DWORD Pos;
|
||||
TW_STRUCKRECTS2 sr;
|
||||
RECT rcScreen;
|
||||
SIZE WndSize, EdgeSize, DlgFrameSize;
|
||||
DWORD cbSize = sizeof(sr);
|
||||
SIZE StartBtnSize = m_StartButton.GetSize();
|
||||
|
||||
EdgeSize.cx = GetSystemMetrics(SM_CXEDGE);
|
||||
|
@ -1348,44 +1330,12 @@ ChangePos:
|
|||
DlgFrameSize.cx = GetSystemMetrics(SM_CXDLGFRAME);
|
||||
DlgFrameSize.cy = GetSystemMetrics(SM_CYDLGFRAME);
|
||||
|
||||
if (SHGetValue(hkExplorer,
|
||||
TEXT("StuckRects2"),
|
||||
TEXT("Settings"),
|
||||
NULL,
|
||||
&sr,
|
||||
&cbSize) == ERROR_SUCCESS &&
|
||||
sr.cbSize == sizeof(sr))
|
||||
m_Position = g_TaskbarSettings.sr.Position;
|
||||
rcScreen = g_TaskbarSettings.sr.Rect;
|
||||
GetScreenRectFromRect(&rcScreen, MONITOR_DEFAULTTONEAREST);
|
||||
|
||||
if (!g_TaskbarSettings.sr.Size.cx || !g_TaskbarSettings.sr.Size.cy)
|
||||
{
|
||||
AutoHide = (sr.dwFlags & ABS_AUTOHIDE) != 0;
|
||||
AlwaysOnTop = (sr.dwFlags & ABS_ALWAYSONTOP) != 0;
|
||||
SmSmallIcons = (sr.dwFlags & 0x4) != 0;
|
||||
HideClock = (sr.dwFlags & 0x8) != 0;
|
||||
|
||||
/* FIXME: Are there more flags? */
|
||||
|
||||
#if WIN7_DEBUG_MODE
|
||||
m_Position = ABE_LEFT;
|
||||
#else
|
||||
if (sr.Position > ABE_BOTTOM)
|
||||
m_Position = ABE_BOTTOM;
|
||||
else
|
||||
m_Position = sr.Position;
|
||||
#endif
|
||||
|
||||
/* Try to find out which monitor the tray window was located on last.
|
||||
Here we're only interested in the monitor screen that we think
|
||||
is the last one used. We're going to determine on which monitor
|
||||
we really are after calculating the docked position. */
|
||||
rcScreen = sr.Rect;
|
||||
GetScreenRectFromRect(
|
||||
&rcScreen,
|
||||
MONITOR_DEFAULTTONEAREST);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Position = ABE_BOTTOM;
|
||||
AlwaysOnTop = TRUE;
|
||||
|
||||
/* Use the minimum size of the taskbar, we'll use the start
|
||||
button as a minimum for now. Make sure we calculate the
|
||||
entire window size, not just the client size. However, we
|
||||
|
@ -1393,36 +1343,17 @@ ChangePos:
|
|||
the start button and bands are not stuck to the screen border. */
|
||||
if(!m_Theme)
|
||||
{
|
||||
sr.Size.cx = StartBtnSize.cx + (2 * (EdgeSize.cx + DlgFrameSize.cx));
|
||||
sr.Size.cy = StartBtnSize.cy + (2 * (EdgeSize.cy + DlgFrameSize.cy));
|
||||
g_TaskbarSettings.sr.Size.cx = StartBtnSize.cx + (2 * (EdgeSize.cx + DlgFrameSize.cx));
|
||||
g_TaskbarSettings.sr.Size.cy = StartBtnSize.cy + (2 * (EdgeSize.cy + DlgFrameSize.cy));
|
||||
}
|
||||
else
|
||||
{
|
||||
sr.Size.cx = StartBtnSize.cx - EdgeSize.cx;
|
||||
sr.Size.cy = StartBtnSize.cy - EdgeSize.cy;
|
||||
if(!Locked)
|
||||
sr.Size.cy += GetSystemMetrics(SM_CYSIZEFRAME);
|
||||
g_TaskbarSettings.sr.Size.cx = StartBtnSize.cx - EdgeSize.cx;
|
||||
g_TaskbarSettings.sr.Size.cy = StartBtnSize.cy - EdgeSize.cy;
|
||||
if(!g_TaskbarSettings.bLock)
|
||||
g_TaskbarSettings.sr.Size.cy += GetSystemMetrics(SM_CYSIZEFRAME);
|
||||
}
|
||||
|
||||
/* Use the primary screen by default */
|
||||
rcScreen.left = 0;
|
||||
rcScreen.top = 0;
|
||||
rcScreen.right = GetSystemMetrics(SM_CXSCREEN);
|
||||
rcScreen.bottom = GetSystemMetrics(SM_CYSCREEN);
|
||||
GetScreenRectFromRect(
|
||||
&rcScreen,
|
||||
MONITOR_DEFAULTTOPRIMARY);
|
||||
}
|
||||
|
||||
if (m_hWnd != NULL)
|
||||
SetWindowPos(
|
||||
AlwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||
|
||||
/* Determine a minimum tray window rectangle. The "client" height is
|
||||
zero here since we cannot determine an optimal minimum width when
|
||||
loaded as a vertical tray window. We just need to make sure the values
|
||||
|
@ -1440,10 +1371,10 @@ ChangePos:
|
|||
WndSize.cy = StartBtnSize.cy - EdgeSize.cx;
|
||||
}
|
||||
|
||||
if (WndSize.cx < sr.Size.cx)
|
||||
WndSize.cx = sr.Size.cx;
|
||||
if (WndSize.cy < sr.Size.cy)
|
||||
WndSize.cy = sr.Size.cy;
|
||||
if (WndSize.cx < g_TaskbarSettings.sr.Size.cx)
|
||||
WndSize.cx = g_TaskbarSettings.sr.Size.cx;
|
||||
if (WndSize.cy < g_TaskbarSettings.sr.Size.cy)
|
||||
WndSize.cy = g_TaskbarSettings.sr.Size.cy;
|
||||
|
||||
/* Save the calculated size */
|
||||
m_TraySize = WndSize;
|
||||
|
@ -1940,7 +1871,7 @@ ChangePos:
|
|||
}
|
||||
|
||||
DWORD dwExStyle = WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE;
|
||||
if (AlwaysOnTop)
|
||||
if (g_TaskbarSettings.sr.AlwaysOnTop)
|
||||
dwExStyle |= WS_EX_TOPMOST;
|
||||
|
||||
DWORD dwStyle = WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
|
||||
|
@ -1996,18 +1927,18 @@ ChangePos:
|
|||
|
||||
BOOL STDMETHODCALLTYPE Lock(IN BOOL bLock)
|
||||
{
|
||||
BOOL bPrevLock = Locked;
|
||||
BOOL bPrevLock = g_TaskbarSettings.bLock;
|
||||
|
||||
if (Locked != bLock)
|
||||
if (g_TaskbarSettings.bLock != bLock)
|
||||
{
|
||||
Locked = bLock;
|
||||
g_TaskbarSettings.bLock = bLock;
|
||||
|
||||
if (m_TrayBandSite != NULL)
|
||||
{
|
||||
if (!SUCCEEDED(m_TrayBandSite->Lock(bLock)))
|
||||
{
|
||||
/* Reset?? */
|
||||
Locked = bPrevLock;
|
||||
g_TaskbarSettings.bLock = bPrevLock;
|
||||
return bPrevLock;
|
||||
}
|
||||
}
|
||||
|
@ -2020,7 +1951,7 @@ ChangePos:
|
|||
RECT rcGripper = {0};
|
||||
AdjustSizerRect(&rcGripper, Pos);
|
||||
|
||||
if(Locked)
|
||||
if(g_TaskbarSettings.bLock)
|
||||
{
|
||||
m_TrayRects[Pos].top += rcGripper.top;
|
||||
m_TrayRects[Pos].left += rcGripper.left;
|
||||
|
@ -2130,13 +2061,13 @@ ChangePos:
|
|||
SetWindowTheme(m_Rebar, L"TaskBar", NULL);
|
||||
|
||||
/* Create the tray notification window */
|
||||
m_TrayNotify = CreateTrayNotifyWnd(this, HideClock, &m_TrayNotifyInstance);
|
||||
m_TrayNotify = CreateTrayNotifyWnd(this, &m_TrayNotifyInstance);
|
||||
|
||||
UpdateFonts();
|
||||
|
||||
InitShellServices(&m_ShellServices);
|
||||
|
||||
if (AutoHide)
|
||||
if (g_TaskbarSettings.sr.AutoHide)
|
||||
{
|
||||
m_AutoHideState = AUTOHIDE_HIDING;
|
||||
SetTimer(TIMER_ID_AUTOHIDE, AUTOHIDE_DELAY_HIDE, NULL);
|
||||
|
@ -2248,7 +2179,7 @@ ChangePos:
|
|||
RECT rcClient;
|
||||
POINT pt;
|
||||
|
||||
if (Locked)
|
||||
if (g_TaskbarSettings.bLock)
|
||||
{
|
||||
/* The user may not be able to resize the tray window.
|
||||
Pretend like the window is not sizeable when the user
|
||||
|
@ -2307,7 +2238,7 @@ ChangePos:
|
|||
need to be able to move the window in case the user wants to
|
||||
drag the tray window to another position or in case the user
|
||||
wants to resize the tray window. */
|
||||
if (!Locked && GetCursorPos(&ptCursor))
|
||||
if (!g_TaskbarSettings.bLock && GetCursorPos(&ptCursor))
|
||||
{
|
||||
IsDragging = TRUE;
|
||||
m_DraggingPosition = GetDraggingRectFromPt(ptCursor, pRect, &m_DraggingMonitor);
|
||||
|
@ -2323,7 +2254,7 @@ ChangePos:
|
|||
{
|
||||
PRECT pRect = (PRECT) lParam;
|
||||
|
||||
if (!Locked)
|
||||
if (!g_TaskbarSettings.bLock)
|
||||
{
|
||||
FitToRebar(pRect);
|
||||
}
|
||||
|
@ -2370,7 +2301,7 @@ ChangePos:
|
|||
{
|
||||
InSizeMove = TRUE;
|
||||
IsDragging = FALSE;
|
||||
if (!Locked)
|
||||
if (!g_TaskbarSettings.bLock)
|
||||
{
|
||||
/* Remove the clipping on multi monitor systems while dragging around */
|
||||
ApplyClipping(FALSE);
|
||||
|
@ -2381,7 +2312,7 @@ ChangePos:
|
|||
LRESULT OnExitSizeMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
InSizeMove = FALSE;
|
||||
if (!Locked)
|
||||
if (!g_TaskbarSettings.bLock)
|
||||
{
|
||||
FitToRebar(&m_TrayRects[m_Position]);
|
||||
|
||||
|
@ -2714,7 +2645,7 @@ HandleTrayContextMenu:
|
|||
|
||||
LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if (AutoHide)
|
||||
if (g_TaskbarSettings.sr.AutoHide)
|
||||
{
|
||||
SetTimer(TIMER_ID_MOUSETRACK, MOUSETRACK_INTERVAL, NULL);
|
||||
}
|
||||
|
@ -2741,7 +2672,7 @@ HandleTrayContextMenu:
|
|||
{
|
||||
RECT *rc = NULL;
|
||||
/* Ignore WM_NCCALCSIZE if we are not themed or locked */
|
||||
if(!m_Theme || Locked)
|
||||
if(!m_Theme || g_TaskbarSettings.bLock)
|
||||
{
|
||||
bHandled = FALSE;
|
||||
return 0;
|
||||
|
@ -2817,6 +2748,41 @@ HandleTrayContextMenu:
|
|||
return 0;
|
||||
}
|
||||
|
||||
LRESULT OnTaskbarSettingsChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
TaskbarSettings* newSettings = (TaskbarSettings*)lParam;
|
||||
|
||||
/* Propagate the new settings to the children */
|
||||
::SendMessageW(m_TaskSwitch, uMsg, wParam, lParam);
|
||||
::SendMessageW(m_TrayNotify, uMsg, wParam, lParam);
|
||||
|
||||
/* Toggle autohide */
|
||||
if (newSettings->sr.AutoHide != g_TaskbarSettings.sr.AutoHide)
|
||||
{
|
||||
g_TaskbarSettings.sr.AutoHide = newSettings->sr.AutoHide;
|
||||
memset(&m_AutoHideOffset, 0, sizeof(m_AutoHideOffset));
|
||||
m_AutoHideState = AUTOHIDE_SHOWN;
|
||||
if (!newSettings->sr.AutoHide)
|
||||
SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER);
|
||||
else
|
||||
SetTimer(TIMER_ID_MOUSETRACK, MOUSETRACK_INTERVAL, NULL);
|
||||
}
|
||||
|
||||
/* Toggle lock state */
|
||||
Lock(newSettings->bLock);
|
||||
|
||||
/* Toggle OnTop state */
|
||||
if (newSettings->sr.AlwaysOnTop != g_TaskbarSettings.sr.AlwaysOnTop)
|
||||
{
|
||||
g_TaskbarSettings.sr.AlwaysOnTop = newSettings->sr.AlwaysOnTop;
|
||||
HWND hWndInsertAfter = newSettings->sr.AlwaysOnTop ? HWND_TOPMOST : HWND_BOTTOM;
|
||||
SetWindowPos(hWndInsertAfter, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
|
||||
}
|
||||
|
||||
g_TaskbarSettings.Save();
|
||||
return 0;
|
||||
}
|
||||
|
||||
DECLARE_WND_CLASS_EX(szTrayWndClass, CS_DBLCLKS, COLOR_3DFACE)
|
||||
|
||||
BEGIN_MSG_MAP(CTrayWindow)
|
||||
|
@ -2872,6 +2838,7 @@ HandleTrayContextMenu:
|
|||
MESSAGE_HANDLER(WM_CLOSE, OnDoExitWindows)
|
||||
MESSAGE_HANDLER(WM_HOTKEY, OnHotkey)
|
||||
MESSAGE_HANDLER(WM_NCCALCSIZE, OnNcCalcSize)
|
||||
MESSAGE_HANDLER(TWM_SETTINGSCHANGED, OnTaskbarSettingsChanged)
|
||||
ALT_MSG_MAP(1)
|
||||
END_MSG_MAP()
|
||||
|
||||
|
@ -3032,7 +2999,7 @@ public:
|
|||
|
||||
CheckMenuItem(hPopup,
|
||||
ID_LOCKTASKBAR,
|
||||
MF_BYCOMMAND | (TrayWnd->Locked ? MF_CHECKED : MF_UNCHECKED));
|
||||
MF_BYCOMMAND | (g_TaskbarSettings.bLock ? MF_CHECKED : MF_UNCHECKED));
|
||||
|
||||
UINT idCmdNext;
|
||||
idCmdNext = Shell_MergeMenus(hPopup, menubase, indexMenu, idCmdFirst, idCmdLast, MM_SUBMENUSHAVEIDS | MM_ADDSEPARATOR);
|
||||
|
|
Loading…
Reference in a new issue