mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00

This squashed commit ports back almost all improvements we did to explorer during 0.4.8-dev. Main motivation is: -fixing tons of bugs painting the systray icons, e.g. (but not exclusively) CORE-11378 -and to fix a regression about clock margins CORE-14272 -and the clocks vertical text placement -Win+E behavior CORE-14199 Here is a list of the commits I ported back: [PSDK] shellapi.h 0.4.8-dev-1053-g8b78b0ff98
0.4.8-dev-982-ga64c33e787
0.4.8-dev-970-g9d2139b7d8
[SHELL32]/[REACTOS]/[EXPLORER] 0.4.8-dev-984-g131678a025
0.4.8-dev-971-g5ecabcce59
[EXPLORER] 0.4.8-dev-1065-gf1535c2d6e
tiny part of CORE-14306 0.4.8-dev-1064-gabdde0b764
0.4.8-dev-1054-g3003471e64
0.4.8-dev-974-g04498f3eb5
0.4.8-dev-944-gf5d679aeb9
fixes CORE-14272 Clock Margins 0.4.8-dev-936-g556c485c8b
0.4.8-dev-935-gd11e7af5f2
0.4.8-dev-934-gc109dc9f24
0.4.8-dev-928-g22d1e1017f
0.4.8-dev-925-gc54c5ebb5f
0.4.8-dev-924-g488477d10d
0.4.8-dev-923-g85d7dd4f83
0.4.8-dev-922-g5a1984c998
0.4.8-dev-921-g6c073e9539
0.4.8-dev-920-g455bce68b5
0.4.8-dev-908-g7f35908ad2
0.4.8-dev-860-g3d75cc0814
0.4.8-dev-853-g5ec441a867
0.4.8-dev-852-gbc43733e48
0.4.8-dev-851-gbbca71c4a5
[EXPLORER]&[ROSCTRLS] 0.4.8-dev-789-gcb8cc0d098
0.4.8-dev-788-gbe2bf9b8c5
0.4.8-dev-787-g851e0ca5a8
0.4.8-dev-786-g2abd068398
0.4.8-dev-785-g8c91a00fcf
0.4.8-dev-784-g6c9629bb72
0.4.8-dev-783-gd66c6890f7
0.4.8-dev-691-g2c8ed37605
0.4.8-dev-690-g74e58d938e
0.4.8-dev-669-g4b6d929be1
fixes CORE-14199 0.4.8-dev-46-g2ed535da8a
0.4.8-dev-21-g82b12ef4cf
0.4.8-dev-20-g4238f22396
For now I intentionally did leave out 0.4.8-dev-684-g71e66c69c1
to not make explorer import oleaut32 SysAllocString()/SysFreeString(). I also did not update the translations rc files.
274 lines
9.8 KiB
C++
274 lines
9.8 KiB
C++
/*
|
|
* ReactOS Explorer
|
|
*
|
|
* Copyright 2006 - 2007 Thomas Weidenmueller <w3seek@reactos.org>
|
|
* 2015 Robert Naumann <gonzomdx@gmail.com>
|
|
*
|
|
* 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
|
|
*/
|
|
|
|
#include "precomp.h"
|
|
|
|
static void SetBitmap(HWND hwnd, HBITMAP* hbmp, UINT uImageId)
|
|
{
|
|
if (*hbmp)
|
|
DeleteObject(*hbmp);
|
|
|
|
*hbmp = (HBITMAP)LoadImageW(hExplorerInstance,
|
|
MAKEINTRESOURCEW(uImageId),
|
|
IMAGE_BITMAP,
|
|
0,
|
|
0,
|
|
LR_DEFAULTCOLOR);
|
|
|
|
if (*hbmp && hwnd)
|
|
{
|
|
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)
|
|
uImageId = IDB_TASKBARPROP_AUTOHIDE;
|
|
else if (bLock && bGroup && bShowQL)
|
|
uImageId = IDB_TASKBARPROP_LOCK_GROUP_QL;
|
|
else if (bLock && !bGroup && !bShowQL)
|
|
uImageId = IDB_TASKBARPROP_LOCK_NOGROUP_NOQL;
|
|
else if (bLock && bGroup && !bShowQL)
|
|
uImageId = IDB_TASKBARPROP_LOCK_GROUP_NOQL;
|
|
else if (bLock && !bGroup && bShowQL)
|
|
uImageId = IDB_TASKBARPROP_LOCK_NOGROUP_QL;
|
|
else if (!bLock && !bGroup && !bShowQL)
|
|
uImageId = IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL;
|
|
else if (!bLock && bGroup && !bShowQL)
|
|
uImageId = IDB_TASKBARPROP_NOLOCK_GROUP_NOQL;
|
|
else if (!bLock && !bGroup && bShowQL)
|
|
uImageId = IDB_TASKBARPROP_NOLOCK_NOGROUP_QL;
|
|
else if (!bLock && bGroup && bShowQL)
|
|
uImageId = IDB_TASKBARPROP_NOLOCK_GROUP_QL;
|
|
else
|
|
ASSERT(FALSE);
|
|
|
|
SetBitmap(hwndTaskbarBitmap, &m_hbmpTaskbar, uImageId);
|
|
|
|
::EnableWindow(hwndCustomizeNotifyButton, bHideInactive);
|
|
::EnableWindow(hwndSeconds, bShowClock);
|
|
if (!bShowSeconds)
|
|
CheckDlgButton(IDC_TASKBARPROP_SECONDS, BST_UNCHECKED);
|
|
|
|
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)
|
|
{
|
|
}
|
|
|
|
~CTaskBarSettingsPage()
|
|
{
|
|
if (m_hbmpTaskbar)
|
|
DeleteObject(m_hbmpTaskbar);
|
|
if (m_hbmpTray)
|
|
DeleteObject(m_hbmpTray);
|
|
}
|
|
|
|
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
|
{
|
|
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;
|
|
}
|
|
|
|
LRESULT OnCustomizeTrayIcons(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
|
|
{
|
|
ShowCustomizeNotifyIcons(hExplorerInstance, m_hWnd);
|
|
return 0;
|
|
}
|
|
|
|
LRESULT OnCtrlCommand(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
|
|
{
|
|
UpdateDialog();
|
|
SetModified(TRUE);
|
|
return 0;
|
|
}
|
|
|
|
int OnApply()
|
|
{
|
|
TaskbarSettings newSettings;
|
|
memcpy(&newSettings, &g_TaskbarSettings, sizeof(TaskbarSettings));
|
|
|
|
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>
|
|
{
|
|
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, IN HWND hwndTaskbar)
|
|
{
|
|
PROPSHEETHEADER psh;
|
|
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_PROPTITLE;
|
|
psh.hwndParent = hwndOwner;
|
|
psh.hInstance = hExplorerInstance;
|
|
psh.hIcon = NULL;
|
|
psh.pszCaption = caption.GetString();
|
|
psh.nPages = _countof(hpsp);
|
|
psh.nStartPage = 0;
|
|
psh.phpage = hpsp;
|
|
|
|
PropertySheet(&psh);
|
|
}
|