Replace tab bar close button BMP files with ICO
ref #15298 Close #15317
@ -326,14 +326,14 @@ IDR_FUNC_LIST BITMAP "icons/standard/toolbar/funcList.bmp"
|
|||||||
IDR_FILEBROWSER BITMAP "icons/standard/toolbar/fileBrowser.bmp"
|
IDR_FILEBROWSER BITMAP "icons/standard/toolbar/fileBrowser.bmp"
|
||||||
IDR_FILEMONITORING BITMAP "icons/standard/toolbar/monitoring.bmp"
|
IDR_FILEMONITORING BITMAP "icons/standard/toolbar/monitoring.bmp"
|
||||||
|
|
||||||
IDR_CLOSETAB BITMAP "icons/standard/tabbar/closeTabButton.bmp"
|
IDR_CLOSETAB ICON "icons/standard/tabbar/closeTabButton.ico"
|
||||||
IDR_CLOSETAB_INACT BITMAP "icons/standard/tabbar/closeTabButton_inact.bmp"
|
IDR_CLOSETAB_INACT ICON "icons/standard/tabbar/closeTabButton_inact.ico"
|
||||||
IDR_CLOSETAB_HOVER BITMAP "icons/standard/tabbar/closeTabButton_hover.bmp"
|
IDR_CLOSETAB_HOVER ICON "icons/standard/tabbar/closeTabButton_hover.ico"
|
||||||
IDR_CLOSETAB_PUSH BITMAP "icons/standard/tabbar/closeTabButton_push.bmp"
|
IDR_CLOSETAB_PUSH ICON "icons/standard/tabbar/closeTabButton_push.ico"
|
||||||
IDR_CLOSETAB_DM BITMAP "icons/dark/tabbar/closeTabButton.bmp"
|
IDR_CLOSETAB_DM ICON "icons/dark/tabbar/closeTabButton.ico"
|
||||||
IDR_CLOSETAB_INACT_DM BITMAP "icons/dark/tabbar/closeTabButton_inact.bmp"
|
IDR_CLOSETAB_INACT_DM ICON "icons/dark/tabbar/closeTabButton_inact.ico"
|
||||||
IDR_CLOSETAB_HOVER_DM BITMAP "icons/dark/tabbar/closeTabButton_hover.bmp"
|
IDR_CLOSETAB_HOVER_DM ICON "icons/dark/tabbar/closeTabButton_hover.ico"
|
||||||
IDR_CLOSETAB_PUSH_DM BITMAP "icons/dark/tabbar/closeTabButton_push.bmp"
|
IDR_CLOSETAB_PUSH_DM ICON "icons/dark/tabbar/closeTabButton_push.ico"
|
||||||
|
|
||||||
IDR_DOCMAP_ICO ICON "icons/standard/panels/tabbar/docMap.ico"
|
IDR_DOCMAP_ICO ICON "icons/standard/panels/tabbar/docMap.ico"
|
||||||
IDR_DOCMAP_ICO2 ICON "icons/light/panels/tabbar/docMap.ico"
|
IDR_DOCMAP_ICO2 ICON "icons/light/panels/tabbar/docMap.ico"
|
||||||
|
@ -3678,6 +3678,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
_subDocTab.setFont();
|
_subDocTab.setFont();
|
||||||
_mainDocTab.resizeIconsDpi();
|
_mainDocTab.resizeIconsDpi();
|
||||||
_subDocTab.resizeIconsDpi();
|
_subDocTab.resizeIconsDpi();
|
||||||
|
_subDocTab.setCloseBtnImageList();
|
||||||
|
_subDocTab.setCloseBtnImageList();
|
||||||
::SendMessage(_pPublicInterface->getHSelf(), WM_COMMAND, IDM_VIEW_REDUCETABBAR, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_COMMAND, IDM_VIEW_REDUCETABBAR, 0);
|
||||||
|
|
||||||
changeDocumentListIconSet(false);
|
changeDocumentListIconSet(false);
|
||||||
|
@ -270,6 +270,12 @@ void TabBarPlus::destroy()
|
|||||||
TabBar::destroy();
|
TabBar::destroy();
|
||||||
::DestroyWindow(_tooltips);
|
::DestroyWindow(_tooltips);
|
||||||
_tooltips = NULL;
|
_tooltips = NULL;
|
||||||
|
|
||||||
|
if (_hCloseBtnImgLst != nullptr)
|
||||||
|
{
|
||||||
|
::ImageList_Destroy(_hCloseBtnImgLst);
|
||||||
|
_hCloseBtnImgLst = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -339,6 +345,8 @@ void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isMult
|
|||||||
_tabBarDefaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(TabBarPlus_Proc)));
|
_tabBarDefaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(TabBarPlus_Proc)));
|
||||||
|
|
||||||
setFont();
|
setFont();
|
||||||
|
|
||||||
|
setCloseBtnImageList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabBar::setFont()
|
void TabBar::setFont()
|
||||||
@ -452,6 +460,34 @@ void TabBarPlus::currentTabToEnd()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabBarPlus::setCloseBtnImageList()
|
||||||
|
{
|
||||||
|
if (_hCloseBtnImgLst != nullptr)
|
||||||
|
{
|
||||||
|
::ImageList_Destroy(_hCloseBtnImgLst);
|
||||||
|
_hCloseBtnImgLst = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int btnSize = _dpiManager.scale(g_TabCloseBtnSize);
|
||||||
|
|
||||||
|
const auto idsCloseIcons = {
|
||||||
|
IDR_CLOSETAB, IDR_CLOSETAB_INACT, IDR_CLOSETAB_HOVER, IDR_CLOSETAB_PUSH,
|
||||||
|
IDR_CLOSETAB_DM, IDR_CLOSETAB_INACT_DM, IDR_CLOSETAB_HOVER_DM, IDR_CLOSETAB_PUSH_DM };
|
||||||
|
|
||||||
|
_hCloseBtnImgLst = ::ImageList_Create(btnSize, btnSize, ILC_COLOR32 | ILC_MASK, static_cast<int>(idsCloseIcons.size()), 0);
|
||||||
|
|
||||||
|
for (const auto& id : idsCloseIcons)
|
||||||
|
{
|
||||||
|
HICON hIcon = nullptr;
|
||||||
|
DPIManagerV2::loadIcon(_hInst, MAKEINTRESOURCE(id), btnSize, btnSize, &hIcon);
|
||||||
|
::ImageList_AddIcon(_hCloseBtnImgLst, hIcon);
|
||||||
|
::DestroyIcon(hIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
_closeButtonZone._width = btnSize;
|
||||||
|
_closeButtonZone._height = btnSize;
|
||||||
|
}
|
||||||
|
|
||||||
void TabBarPlus::doVertical()
|
void TabBarPlus::doVertical()
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < _nbCtrl ; ++i)
|
for (int i = 0 ; i < _nbCtrl ; ++i)
|
||||||
@ -1264,36 +1300,31 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct, bool isDarkMode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// draw close button
|
// draw close button
|
||||||
if (_drawTabCloseButton)
|
if (_drawTabCloseButton && _hCloseBtnImgLst != nullptr)
|
||||||
{
|
{
|
||||||
// 3 status for each inactive tab and selected tab close item :
|
// 3 status for each inactive tab and selected tab close item :
|
||||||
// normal / hover / pushed
|
// normal / hover / pushed
|
||||||
int idCloseImg;
|
int idxCloseImg = isDarkMode ? 4 : 0; // selected
|
||||||
|
|
||||||
if (_isCloseHover && (_currentHoverTabItem == nTab) && (_whichCloseClickDown == -1)) // hover
|
if (_isCloseHover && (_currentHoverTabItem == nTab))
|
||||||
idCloseImg = isDarkMode ? IDR_CLOSETAB_HOVER_DM : IDR_CLOSETAB_HOVER;
|
{
|
||||||
else if (_isCloseHover && (_currentHoverTabItem == nTab) && (_whichCloseClickDown == _currentHoverTabItem)) // pushed
|
if (_whichCloseClickDown == -1) // hover
|
||||||
idCloseImg = isDarkMode ? IDR_CLOSETAB_PUSH_DM : IDR_CLOSETAB_PUSH;
|
{
|
||||||
else
|
idxCloseImg += 2;
|
||||||
idCloseImg = isSelected ? (isDarkMode ? IDR_CLOSETAB_DM : IDR_CLOSETAB) : (isDarkMode ? IDR_CLOSETAB_INACT_DM : IDR_CLOSETAB_INACT);
|
}
|
||||||
|
else if (_whichCloseClickDown == _currentHoverTabItem) // pushed
|
||||||
HDC hdcMemory = ::CreateCompatibleDC(hDC);
|
{
|
||||||
HBITMAP hBmp = ::LoadBitmap(_hInst, MAKEINTRESOURCE(idCloseImg));
|
idxCloseImg += 3;
|
||||||
BITMAP bmp{};
|
}
|
||||||
::GetObject(hBmp, sizeof(bmp), &bmp);
|
}
|
||||||
|
else if (!isSelected) // inactive
|
||||||
_closeButtonZone._width = _dpiManager.scale(bmp.bmWidth);
|
{
|
||||||
_closeButtonZone._height = _dpiManager.scale(bmp.bmHeight);
|
idxCloseImg += 1;
|
||||||
|
}
|
||||||
|
|
||||||
RECT buttonRect = _closeButtonZone.getButtonRectFrom(rect, _isVertical);
|
RECT buttonRect = _closeButtonZone.getButtonRectFrom(rect, _isVertical);
|
||||||
|
|
||||||
// StretchBlt will crop image in RTL if there is no stretching, thus move image by -1
|
::ImageList_Draw(_hCloseBtnImgLst, idxCloseImg, hDC, buttonRect.left, buttonRect.top, ILD_TRANSPARENT);
|
||||||
const bool isRTL = (::GetWindowLongPtr(::GetParent(_hSelf), GWL_EXSTYLE) & WS_EX_LAYOUTRTL) == WS_EX_LAYOUTRTL;
|
|
||||||
const int offset = isRTL && (_closeButtonZone._width == bmp.bmWidth) ? -1 : 0;
|
|
||||||
::SelectObject(hdcMemory, hBmp);
|
|
||||||
::StretchBlt(hDC, buttonRect.left + offset, buttonRect.top, _closeButtonZone._width, _closeButtonZone._height, hdcMemory, offset, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
|
|
||||||
::DeleteDC(hdcMemory);
|
|
||||||
::DeleteObject(hBmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw image
|
// draw image
|
||||||
|
@ -229,6 +229,8 @@ public :
|
|||||||
void currentTabToStart();
|
void currentTabToStart();
|
||||||
void currentTabToEnd();
|
void currentTabToEnd();
|
||||||
|
|
||||||
|
void setCloseBtnImageList();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// it's the boss to decide if we do the drag N drop
|
// it's the boss to decide if we do the drag N drop
|
||||||
static bool _doDragNDrop;
|
static bool _doDragNDrop;
|
||||||
@ -248,6 +250,7 @@ protected:
|
|||||||
int _currentHoverTabItem = -1; // -1 : no mouse on any tab
|
int _currentHoverTabItem = -1; // -1 : no mouse on any tab
|
||||||
|
|
||||||
CloseButtonZone _closeButtonZone;
|
CloseButtonZone _closeButtonZone;
|
||||||
|
HIMAGELIST _hCloseBtnImgLst = nullptr;
|
||||||
bool _isCloseHover = false;
|
bool _isCloseHover = false;
|
||||||
int _whichCloseClickDown = -1;
|
int _whichCloseClickDown = -1;
|
||||||
bool _lmbdHit = false; // Left Mouse Button Down Hit
|
bool _lmbdHit = false; // Left Mouse Button Down Hit
|
||||||
|
Before Width: | Height: | Size: 254 B |
BIN
PowerEditor/src/icons/dark/tabbar/closeTabButton.ico
Normal file
After Width: | Height: | Size: 423 B |
Before Width: | Height: | Size: 246 B |
BIN
PowerEditor/src/icons/dark/tabbar/closeTabButton_hover.ico
Normal file
After Width: | Height: | Size: 420 B |
Before Width: | Height: | Size: 254 B |
BIN
PowerEditor/src/icons/dark/tabbar/closeTabButton_inact.ico
Normal file
After Width: | Height: | Size: 398 B |
Before Width: | Height: | Size: 246 B |
BIN
PowerEditor/src/icons/dark/tabbar/closeTabButton_push.ico
Normal file
After Width: | Height: | Size: 427 B |
Before Width: | Height: | Size: 450 B |
BIN
PowerEditor/src/icons/standard/tabbar/closeTabButton.ico
Normal file
After Width: | Height: | Size: 467 B |
Before Width: | Height: | Size: 450 B |
BIN
PowerEditor/src/icons/standard/tabbar/closeTabButton_hover.ico
Normal file
After Width: | Height: | Size: 467 B |
Before Width: | Height: | Size: 450 B |
BIN
PowerEditor/src/icons/standard/tabbar/closeTabButton_inact.ico
Normal file
After Width: | Height: | Size: 435 B |
Before Width: | Height: | Size: 450 B |
BIN
PowerEditor/src/icons/standard/tabbar/closeTabButton_push.ico
Normal file
After Width: | Height: | Size: 456 B |