[EXPLORER] Add Show Desktop button to taskbar customization preview (#7727)

Use a 4D lookup table for the notification area settings preview, instead of many if cases.

CORE-19738
This commit is contained in:
Miguel Almeida 2025-03-02 19:56:30 +00:00 committed by GitHub
parent afb96acfdd
commit 6988b4e2c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 51 additions and 26 deletions

View file

@ -49,15 +49,21 @@ IDB_TASKBARPROP_LOCK_GROUP_NOQL BITMAP "res/bmp/150.bmp"
IDB_TASKBARPROP_NOLOCK_GROUP_NOQL BITMAP "res/bmp/151.bmp"
IDB_TASKBARPROP_LOCK_NOGROUP_NOQL BITMAP "res/bmp/152.bmp"
IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL BITMAP "res/bmp/153.bmp"
IDB_SYSTRAYPROP_SHOW_SECONDS BITMAP "res/bmp/154.bmp"
IDB_SYSTRAYPROP_HIDE_SECONDS BITMAP "res/bmp/155.bmp"
IDB_SYSTRAYPROP_SHOW_SECONDS_NODESK BITMAP "res/bmp/154.bmp"
IDB_SYSTRAYPROP_HIDE_SECONDS_NODESK BITMAP "res/bmp/155.bmp"
IDB_STARTMENU BITMAP "res/bmp/158.bmp"
IDB_STARTPREVIEW BITMAP "res/bmp/170.bmp"
IDB_STARTPREVIEW_CLASSIC BITMAP "res/bmp/171.bmp"
IDB_SYSTRAYPROP_HIDE_CLOCK BITMAP "res/bmp/180.bmp"
IDB_SYSTRAYPROP_HIDE_NOCLOCK BITMAP "res/bmp/181.bmp"
IDB_SYSTRAYPROP_SHOW_CLOCK BITMAP "res/bmp/182.bmp"
IDB_SYSTRAYPROP_SHOW_NOCLOCK BITMAP "res/bmp/183.bmp"
IDB_SYSTRAYPROP_HIDE_CLOCK_NODESK BITMAP "res/bmp/180.bmp"
IDB_SYSTRAYPROP_HIDE_NOCLOCK_NODESK BITMAP "res/bmp/181.bmp"
IDB_SYSTRAYPROP_SHOW_CLOCK_NODESK BITMAP "res/bmp/182.bmp"
IDB_SYSTRAYPROP_SHOW_NOCLOCK_NODESK BITMAP "res/bmp/183.bmp"
IDB_SYSTRAYPROP_SHOW_SECONDS_DESK BITMAP "res/bmp/184.bmp"
IDB_SYSTRAYPROP_HIDE_SECONDS_DESK BITMAP "res/bmp/185.bmp"
IDB_SYSTRAYPROP_HIDE_CLOCK_DESK BITMAP "res/bmp/186.bmp"
IDB_SYSTRAYPROP_HIDE_NOCLOCK_DESK BITMAP "res/bmp/187.bmp"
IDB_SYSTRAYPROP_SHOW_CLOCK_DESK BITMAP "res/bmp/188.bmp"
IDB_SYSTRAYPROP_SHOW_NOCLOCK_DESK BITMAP "res/bmp/189.bmp"
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "explorer.exe.manifest"

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -39,15 +39,21 @@
#define IDB_TASKBARPROP_NOLOCK_GROUP_NOQL 151
#define IDB_TASKBARPROP_LOCK_NOGROUP_NOQL 152
#define IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL 153
#define IDB_SYSTRAYPROP_SHOW_SECONDS 154
#define IDB_SYSTRAYPROP_HIDE_SECONDS 155
#define IDB_SYSTRAYPROP_SHOW_SECONDS_NODESK 154
#define IDB_SYSTRAYPROP_HIDE_SECONDS_NODESK 155
#define IDB_STARTMENU 158
#define IDB_STARTPREVIEW 170
#define IDB_STARTPREVIEW_CLASSIC 171
#define IDB_SYSTRAYPROP_HIDE_CLOCK 180
#define IDB_SYSTRAYPROP_HIDE_NOCLOCK 181
#define IDB_SYSTRAYPROP_SHOW_CLOCK 182
#define IDB_SYSTRAYPROP_SHOW_NOCLOCK 183
#define IDB_SYSTRAYPROP_HIDE_CLOCK_NODESK 180
#define IDB_SYSTRAYPROP_HIDE_NOCLOCK_NODESK 181
#define IDB_SYSTRAYPROP_SHOW_CLOCK_NODESK 182
#define IDB_SYSTRAYPROP_SHOW_NOCLOCK_NODESK 183
#define IDB_SYSTRAYPROP_SHOW_SECONDS_DESK 184
#define IDB_SYSTRAYPROP_HIDE_SECONDS_DESK 185
#define IDB_SYSTRAYPROP_HIDE_CLOCK_DESK 186
#define IDB_SYSTRAYPROP_HIDE_NOCLOCK_DESK 187
#define IDB_SYSTRAYPROP_SHOW_CLOCK_DESK 188
#define IDB_SYSTRAYPROP_SHOW_NOCLOCK_DESK 189
/*******************************************************************************\
|* Menu Resources *|

View file

@ -230,13 +230,14 @@ class CNotifySettingsPage : public CPropertyPageImpl<CNotifySettingsPage>
private:
HBITMAP m_hbmpTray;
HWND m_hwndTaskbar;
static const WORD wImageIdLookupTable[2][2][2][2];
void _UpdateDialog()
{
BOOL bShowClock = IsDlgButtonChecked(IDC_TASKBARPROP_CLOCK);
BOOL bShowSeconds = IsDlgButtonChecked(IDC_TASKBARPROP_SECONDS);
BOOL bHideInactive = IsDlgButtonChecked(IDC_TASKBARPROP_HIDEICONS);
UINT uImageId;
BOOL bShowDesktopButton = IsDlgButtonChecked(IDC_TASKBARPROP_DESKTOP);
HWND hwndCustomizeNotifyButton = GetDlgItem(IDC_TASKBARPROP_ICONCUST);
HWND hwndSeconds = GetDlgItem(IDC_TASKBARPROP_SECONDS);
@ -246,19 +247,7 @@ private:
::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;
UINT uImageId = wImageIdLookupTable[bShowClock][bShowSeconds][bHideInactive][bShowDesktopButton];
SetBitmap(hwndTrayBitmap, &m_hbmpTray, uImageId);
}
@ -324,6 +313,30 @@ public:
}
};
const WORD CNotifySettingsPage::wImageIdLookupTable[2][2][2][2] =
{
{
{
{IDB_SYSTRAYPROP_SHOW_NOCLOCK_NODESK, IDB_SYSTRAYPROP_SHOW_NOCLOCK_DESK},
{IDB_SYSTRAYPROP_HIDE_NOCLOCK_NODESK, IDB_SYSTRAYPROP_HIDE_NOCLOCK_DESK}
},
{
{IDB_SYSTRAYPROP_SHOW_NOCLOCK_NODESK, IDB_SYSTRAYPROP_SHOW_NOCLOCK_DESK},
{IDB_SYSTRAYPROP_HIDE_NOCLOCK_NODESK, IDB_SYSTRAYPROP_HIDE_NOCLOCK_DESK}
}
},
{
{
{IDB_SYSTRAYPROP_SHOW_CLOCK_NODESK, IDB_SYSTRAYPROP_SHOW_CLOCK_DESK},
{IDB_SYSTRAYPROP_HIDE_CLOCK_NODESK, IDB_SYSTRAYPROP_HIDE_CLOCK_DESK}
},
{
{IDB_SYSTRAYPROP_SHOW_SECONDS_NODESK, IDB_SYSTRAYPROP_SHOW_SECONDS_DESK},
{IDB_SYSTRAYPROP_HIDE_SECONDS_NODESK, IDB_SYSTRAYPROP_HIDE_SECONDS_DESK}
}
}
};
static int CALLBACK
PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
{