diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index b06c0b2f0..741250e5b 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -368,8 +368,6 @@ IDI_FUNCLIST_LEAF BITMAP "icons/funcList_leaf.bmp" IDI_FUNCLIST_SORTBUTTON BITMAP "icons/funclstSort.bmp" IDI_FUNCLIST_RELOADBUTTON BITMAP "icons/funclstReload.bmp" -IDI_FUNCLIST_SORTBUTTON2 BITMAP "icons/funclstSort2.bmp" -IDI_FUNCLIST_RELOADBUTTON2 BITMAP "icons/funclstReload2.bmp" IDI_FUNCLIST_SORTBUTTON_DM BITMAP "icons/darkMode/panels/funclstSort.bmp" IDI_FUNCLIST_RELOADBUTTON_DM BITMAP "icons/darkMode/panels/funclstReload.bmp" diff --git a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp index c4b590b47..445f1a059 100644 --- a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp +++ b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp @@ -108,15 +108,23 @@ INT_PTR CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP NppDarkMode::setDarkTooltips(_hToolbarMenu, NppDarkMode::ToolTipsType::toolbar); NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu); - TBBUTTON tbButtons[3]; // Add the bmap image into toolbar's imagelist - TBADDBITMAP addbmp = { _hInst, 0 }; - addbmp.nID = NppDarkMode::isEnabled() ? IDI_FB_SELECTCURRENTFILE_DM : IDI_FB_SELECTCURRENTFILE; - ::SendMessage(_hToolbarMenu, TB_ADDBITMAP, 1, reinterpret_cast(&addbmp)); - addbmp.nID = NppDarkMode::isEnabled() ? IDI_FB_FOLDALL_DM : IDI_FB_FOLDALL; - ::SendMessage(_hToolbarMenu, TB_ADDBITMAP, 1, reinterpret_cast(&addbmp)); - addbmp.nID = NppDarkMode::isEnabled() ? IDI_FB_EXPANDALL_DM : IDI_FB_EXPANDALL; - ::SendMessage(_hToolbarMenu, TB_ADDBITMAP, 1, reinterpret_cast(&addbmp)); + int iconSizeDyn = nppParam._dpiManager.scaleX(16); + ::SendMessage(_hToolbarMenu, TB_SETBITMAPSIZE, 0, MAKELPARAM(iconSizeDyn, iconSizeDyn)); + + TBADDBITMAP addbmp = { 0, 0 }; + const int nbIcons = 3; + int iconIDs[nbIcons] = { IDI_FB_SELECTCURRENTFILE, IDI_FB_FOLDALL, IDI_FB_EXPANDALL}; + int iconDarkModeIDs[nbIcons] = { IDI_FB_SELECTCURRENTFILE_DM, IDI_FB_FOLDALL_DM, IDI_FB_EXPANDALL_DM}; + for (size_t i = 0; i < nbIcons; ++i) + { + int icoID = NppDarkMode::isEnabled() ? iconDarkModeIDs[i] : iconIDs[i]; + HBITMAP hBmp = static_cast(::LoadImage(_hInst, MAKEINTRESOURCE(icoID), IMAGE_BITMAP, iconSizeDyn, iconSizeDyn, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT)); + addbmp.nID = reinterpret_cast(hBmp); + ::SendMessage(_hToolbarMenu, TB_ADDBITMAP, 1, reinterpret_cast(&addbmp)); + } + + TBBUTTON tbButtons[nbIcons]; tbButtons[0].idCommand = FB_CMD_AIMFILE; tbButtons[0].iBitmap = 0; tbButtons[0].fsState = TBSTATE_ENABLED; @@ -141,7 +149,7 @@ INT_PTR CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP ::SendMessage(_hToolbarMenu, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); ::SendMessage(_hToolbarMenu, TB_SETBUTTONSIZE, 0, MAKELONG(nppParam._dpiManager.scaleX(20), nppParam._dpiManager.scaleY(20))); - ::SendMessage(_hToolbarMenu, TB_SETPADDING, 0, MAKELONG(20, 0)); + ::SendMessage(_hToolbarMenu, TB_SETPADDING, 0, MAKELONG(nppParam._dpiManager.scaleX(10), 0)); ::SendMessage(_hToolbarMenu, TB_ADDBUTTONS, sizeof(tbButtons) / sizeof(TBBUTTON), reinterpret_cast(&tbButtons)); ::SendMessage(_hToolbarMenu, TB_AUTOSIZE, 0, 0); diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp index 9afa3d22d..0f9748acb 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp @@ -832,28 +832,26 @@ INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPA NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu); oldFunclstToolbarProc = reinterpret_cast(::SetWindowLongPtr(_hToolbarMenu, GWLP_WNDPROC, reinterpret_cast(funclstToolbarProc))); - TBBUTTON tbButtons[3]; // Add the bmap image into toolbar's imagelist - int icoID0 = IDI_FUNCLIST_SORTBUTTON; - int icoID1 = IDI_FUNCLIST_RELOADBUTTON; - if (NppDarkMode::isEnabled()) + int iconSizeDyn = nppParams._dpiManager.scaleX(16); + ::SendMessage(_hToolbarMenu, TB_SETBITMAPSIZE, 0, MAKELPARAM(iconSizeDyn, iconSizeDyn)); + + TBADDBITMAP addbmp = { 0, 0 }; + const int nbIcons = 2; + int iconIDs[nbIcons] = { IDI_FUNCLIST_SORTBUTTON, IDI_FUNCLIST_RELOADBUTTON }; + int iconDarkModeIDs[nbIcons] = { IDI_FUNCLIST_SORTBUTTON_DM, IDI_FUNCLIST_RELOADBUTTON_DM }; + for (size_t i = 0; i < nbIcons; ++i) { - icoID0 = IDI_FUNCLIST_SORTBUTTON_DM; - icoID1 = IDI_FUNCLIST_RELOADBUTTON_DM; + int icoID = NppDarkMode::isEnabled() ? iconDarkModeIDs[i] : iconIDs[i]; + HBITMAP hBmp = static_cast(::LoadImage(_hInst, MAKEINTRESOURCE(icoID), IMAGE_BITMAP, iconSizeDyn, iconSizeDyn, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT)); + addbmp.nID = reinterpret_cast(hBmp); + ::SendMessage(_hToolbarMenu, TB_ADDBITMAP, 1, reinterpret_cast(&addbmp)); } - else if (nppParams.getNppGUI()._toolBarStatus != TB_STANDARD) - { - icoID0 = IDI_FUNCLIST_SORTBUTTON2; - icoID1 = IDI_FUNCLIST_RELOADBUTTON2; - } - TBADDBITMAP addbmp = {_hInst, 0}; - addbmp.nID = icoID0; - ::SendMessage(_hToolbarMenu, TB_ADDBITMAP, 1, reinterpret_cast(&addbmp)); - addbmp.nID = icoID1; - ::SendMessage(_hToolbarMenu, TB_ADDBITMAP, 1, reinterpret_cast(&addbmp)); // Place holder of search text field + TBBUTTON tbButtons[1 + nbIcons]; + tbButtons[0].idCommand = 0; tbButtons[0].iBitmap = editWidthSep; tbButtons[0].fsState = TBSTATE_ENABLED; @@ -873,7 +871,7 @@ INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPA tbButtons[2].iString = reinterpret_cast(TEXT("")); ::SendMessage(_hToolbarMenu, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); - ::SendMessage(_hToolbarMenu, TB_SETBUTTONSIZE, 0, MAKELONG(16, 16)); + ::SendMessage(_hToolbarMenu, TB_SETBUTTONSIZE, 0, MAKELONG(nppParams._dpiManager.scaleX(16), nppParams._dpiManager.scaleY(16))); ::SendMessage(_hToolbarMenu, TB_ADDBUTTONS, sizeof(tbButtons) / sizeof(TBBUTTON), reinterpret_cast(&tbButtons)); ::SendMessage(_hToolbarMenu, TB_AUTOSIZE, 0, 0); diff --git a/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp b/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp index 85a92791d..32301c60b 100644 --- a/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp +++ b/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp @@ -340,8 +340,6 @@ void ToolBar::reset(bool create) int icoID = _toolBarIcons.getStdIconAt(static_cast(i)); HBITMAP hBmp = static_cast(::LoadImage(_hInst, MAKEINTRESOURCE(icoID), IMAGE_BITMAP, iconDpiDynamicalSize, iconDpiDynamicalSize, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT)); addbmp.nID = reinterpret_cast(hBmp); - - //addbmp.nID = _toolBarIcons.getStdIconAt(i); ::SendMessage(_hSelf, TB_ADDBITMAP, 1, reinterpret_cast(&addbmp)); } if (_nbDynButtons > 0) @@ -357,7 +355,7 @@ void ToolBar::reset(bool create) if (create) { //if the toolbar has been recreated, readd the buttons _nbCurrentButtons = _nbTotalButtons; - WORD btnSize = (_state == TB_LARGE?32:16); + WORD btnSize = (_state == TB_LARGE ? 32 : 16); ::SendMessage(_hSelf, TB_SETBUTTONSIZE , 0, MAKELONG(btnSize, btnSize)); ::SendMessage(_hSelf, TB_ADDBUTTONS, _nbTotalButtons, reinterpret_cast(_pTBB)); } diff --git a/PowerEditor/src/icons/funclstReload.bmp b/PowerEditor/src/icons/funclstReload.bmp index 37994570d..0e3bb0be8 100644 Binary files a/PowerEditor/src/icons/funclstReload.bmp and b/PowerEditor/src/icons/funclstReload.bmp differ diff --git a/PowerEditor/src/icons/funclstReload2.bmp b/PowerEditor/src/icons/funclstReload2.bmp deleted file mode 100644 index 0e3bb0be8..000000000 Binary files a/PowerEditor/src/icons/funclstReload2.bmp and /dev/null differ diff --git a/PowerEditor/src/icons/funclstSort.bmp b/PowerEditor/src/icons/funclstSort.bmp index c28f09674..c32262bca 100644 Binary files a/PowerEditor/src/icons/funclstSort.bmp and b/PowerEditor/src/icons/funclstSort.bmp differ diff --git a/PowerEditor/src/icons/funclstSort2.bmp b/PowerEditor/src/icons/funclstSort2.bmp deleted file mode 100644 index c32262bca..000000000 Binary files a/PowerEditor/src/icons/funclstSort2.bmp and /dev/null differ diff --git a/PowerEditor/src/resource.h b/PowerEditor/src/resource.h index e6771dbf3..51a1cbf88 100644 --- a/PowerEditor/src/resource.h +++ b/PowerEditor/src/resource.h @@ -280,10 +280,8 @@ #define IDI_FUNCLIST_SORTBUTTON 631 #define IDI_FUNCLIST_RELOADBUTTON 632 -#define IDI_FUNCLIST_SORTBUTTON2 633 -#define IDI_FUNCLIST_RELOADBUTTON2 634 -#define IDI_FUNCLIST_SORTBUTTON_DM 635 -#define IDI_FUNCLIST_RELOADBUTTON_DM 636 +#define IDI_FUNCLIST_SORTBUTTON_DM 633 +#define IDI_FUNCLIST_RELOADBUTTON_DM 634