From 3a5c9cc198e0a46d8ac2f8b309d15ec42b465cba Mon Sep 17 00:00:00 2001 From: funap <31555185+funap@users.noreply.github.com> Date: Sat, 4 Mar 2023 13:50:19 +0900 Subject: [PATCH] Fixed a bug that caused toolbar icons to be small in the hidpi environment. --- src/Explorer/Explorer.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Explorer/Explorer.cpp b/src/Explorer/Explorer.cpp index 906a877..520455b 100644 --- a/src/Explorer/Explorer.cpp +++ b/src/Explorer/Explorer.cpp @@ -255,13 +255,17 @@ extern "C" __declspec(dllexport) void beNotified(SCNotification *notifyCode) case NPPN_FILEOPENED: UpdateDocs(); break; - case NPPN_TBMODIFICATION: - g_explorerIcons.hToolbarBmp = (HBITMAP) ::LoadImage(g_hInst, MAKEINTRESOURCE(IDB_TB_EXPLORER), IMAGE_BITMAP, 0, 0, (LR_DEFAULTSIZE | LR_LOADMAP3DCOLORS)); - g_explorerIcons.hToolbarIcon = (HICON) ::LoadImage(g_hInst, MAKEINTRESOURCE(IDI_TB_FLUENT_EXPLORER), IMAGE_ICON, 0, 0, (LR_DEFAULTSIZE | LR_LOADMAP3DCOLORS)); - g_explorerIcons.hToolbarIconDarkMode = (HICON) ::LoadImage(g_hInst, MAKEINTRESOURCE(IDI_TB_FLUENT_EXPLORER_DARKMODE), IMAGE_ICON, 0, 0, (LR_DEFAULTSIZE | LR_LOADMAP3DCOLORS)); - g_favesIcons.hToolbarBmp = (HBITMAP) ::LoadImage(g_hInst, MAKEINTRESOURCE(IDB_TB_FAVES), IMAGE_BITMAP, 0, 0, (LR_DEFAULTSIZE | LR_LOADMAP3DCOLORS)); - g_favesIcons.hToolbarIcon = (HICON) ::LoadImage(g_hInst, MAKEINTRESOURCE(IDI_TB_FLUENT_FAVES), IMAGE_ICON, 0, 0, (LR_DEFAULTSIZE | LR_LOADMAP3DCOLORS)); - g_favesIcons.hToolbarIconDarkMode = (HICON) ::LoadImage(g_hInst, MAKEINTRESOURCE(IDI_TB_FLUENT_FAVES_DARKMODE), IMAGE_ICON, 0, 0, (LR_DEFAULTSIZE | LR_LOADMAP3DCOLORS)); + case NPPN_TBMODIFICATION: { + SIZE smallIconSize = { + .cx = GetSystemMetrics(SM_CXSMICON), + .cy = GetSystemMetrics(SM_CYSMICON), + }; + g_explorerIcons.hToolbarBmp = (HBITMAP) ::LoadImage(g_hInst, MAKEINTRESOURCE(IDB_TB_EXPLORER), IMAGE_BITMAP, smallIconSize.cx, smallIconSize.cy, LR_LOADMAP3DCOLORS); + g_explorerIcons.hToolbarIcon = (HICON) ::LoadImage(g_hInst, MAKEINTRESOURCE(IDI_TB_FLUENT_EXPLORER), IMAGE_ICON, smallIconSize.cx, smallIconSize.cy, LR_LOADMAP3DCOLORS); + g_explorerIcons.hToolbarIconDarkMode = (HICON) ::LoadImage(g_hInst, MAKEINTRESOURCE(IDI_TB_FLUENT_EXPLORER_DARKMODE), IMAGE_ICON, smallIconSize.cx, smallIconSize.cy, LR_LOADMAP3DCOLORS); + g_favesIcons.hToolbarBmp = (HBITMAP) ::LoadImage(g_hInst, MAKEINTRESOURCE(IDB_TB_FAVES), IMAGE_BITMAP, smallIconSize.cx, smallIconSize.cy, LR_LOADMAP3DCOLORS); + g_favesIcons.hToolbarIcon = (HICON) ::LoadImage(g_hInst, MAKEINTRESOURCE(IDI_TB_FLUENT_FAVES), IMAGE_ICON, smallIconSize.cx, smallIconSize.cy, LR_LOADMAP3DCOLORS); + g_favesIcons.hToolbarIconDarkMode = (HICON) ::LoadImage(g_hInst, MAKEINTRESOURCE(IDI_TB_FLUENT_FAVES_DARKMODE), IMAGE_ICON, smallIconSize.cx, smallIconSize.cy, LR_LOADMAP3DCOLORS); /* change menu language */ if (NppInterface::isSupportFluentUI()) { @@ -273,6 +277,7 @@ extern "C" __declspec(dllexport) void beNotified(SCNotification *notifyCode) ::SendMessage(g_nppData._nppHandle, NPPM_ADDTOOLBARICON_DEPRECATED, (WPARAM)funcItem[DOCKABLE_FAVORTIES_INDEX]._cmdID, (LPARAM)&g_favesIcons); } break; + } case NPPN_READY: UpdateThemeColor(); explorerDlg.initFinish();