Add border to dark mode tabs
Minor tweaks to autocomplete, to make top white rectangle dark on resize. Fix #11622, close #11623
This commit is contained in:
parent
664d46084b
commit
ef9e836903
|
@ -1240,30 +1240,28 @@ namespace NppDarkMode
|
||||||
{
|
{
|
||||||
RECT rcItem = {};
|
RECT rcItem = {};
|
||||||
TabCtrl_GetItemRect(hWnd, i, &rcItem);
|
TabCtrl_GetItemRect(hWnd, i, &rcItem);
|
||||||
|
RECT rcFrame = rcItem;
|
||||||
|
|
||||||
RECT rcIntersect = {};
|
RECT rcIntersect = {};
|
||||||
if (IntersectRect(&rcIntersect, &ps.rcPaint, &rcItem))
|
if (IntersectRect(&rcIntersect, &ps.rcPaint, &rcItem))
|
||||||
{
|
{
|
||||||
bool bHot = PtInRect(&rcItem, ptCursor);
|
bool bHot = PtInRect(&rcItem, ptCursor);
|
||||||
|
bool isSelectedTab = (i == nSelTab);
|
||||||
POINT edges[] = {
|
|
||||||
{rcItem.right - 1, rcItem.top},
|
|
||||||
{rcItem.right - 1, rcItem.bottom}
|
|
||||||
};
|
|
||||||
Polyline(hdc, edges, _countof(edges));
|
|
||||||
rcItem.right -= 1;
|
|
||||||
|
|
||||||
HRGN hClip = CreateRectRgnIndirect(&rcItem);
|
HRGN hClip = CreateRectRgnIndirect(&rcItem);
|
||||||
|
|
||||||
SelectClipRgn(hdc, hClip);
|
SelectClipRgn(hdc, hClip);
|
||||||
|
|
||||||
SetTextColor(hdc, (bHot || (i == nSelTab) ) ? NppDarkMode::getTextColor() : NppDarkMode::getDarkerTextColor());
|
SetTextColor(hdc, (bHot || isSelectedTab ) ? NppDarkMode::getTextColor() : NppDarkMode::getDarkerTextColor());
|
||||||
|
|
||||||
|
::InflateRect(&rcItem, -1, -1);
|
||||||
|
rcItem.right += 1;
|
||||||
|
|
||||||
// for consistency getBackgroundBrush()
|
// for consistency getBackgroundBrush()
|
||||||
// would be better, than getSofterBackgroundBrush(),
|
// would be better, than getSofterBackgroundBrush(),
|
||||||
// however default getBackgroundBrush() has same color
|
// however default getBackgroundBrush() has same color
|
||||||
// as getDarkerBackgroundBrush()
|
// as getDarkerBackgroundBrush()
|
||||||
::FillRect(hdc, &rcItem, (i == nSelTab) ? NppDarkMode::getDarkerBackgroundBrush() : NppDarkMode::getSofterBackgroundBrush());
|
::FillRect(hdc, &rcItem, isSelectedTab ? NppDarkMode::getDarkerBackgroundBrush() : bHot ? NppDarkMode::getHotBackgroundBrush() : NppDarkMode::getSofterBackgroundBrush());
|
||||||
|
|
||||||
SetBkMode(hdc, TRANSPARENT);
|
SetBkMode(hdc, TRANSPARENT);
|
||||||
|
|
||||||
|
@ -1275,14 +1273,23 @@ namespace NppDarkMode
|
||||||
|
|
||||||
::SendMessage(hWnd, TCM_GETITEM, i, reinterpret_cast<LPARAM>(&tci));
|
::SendMessage(hWnd, TCM_GETITEM, i, reinterpret_cast<LPARAM>(&tci));
|
||||||
|
|
||||||
RECT rcText = rcItem;
|
auto dpiManager = NppParameters::getInstance()._dpiManager;
|
||||||
rcText.left += NppParameters::getInstance()._dpiManager.scaleX(6);
|
|
||||||
rcText.right -= NppParameters::getInstance()._dpiManager.scaleX(3);
|
|
||||||
|
|
||||||
if (i == nSelTab)
|
RECT rcText = rcItem;
|
||||||
|
rcText.left += dpiManager.scaleX(5);
|
||||||
|
rcText.right -= dpiManager.scaleX(3);
|
||||||
|
|
||||||
|
if (isSelectedTab)
|
||||||
{
|
{
|
||||||
rcText.bottom -= NppParameters::getInstance()._dpiManager.scaleX(4);
|
rcText.bottom -= dpiManager.scaleY(4);
|
||||||
|
::InflateRect(&rcFrame, 0, 1);
|
||||||
}
|
}
|
||||||
|
if (i != nTabs - 1)
|
||||||
|
{
|
||||||
|
rcFrame.right += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
::FrameRect(hdc, &rcFrame, NppDarkMode::getEdgeBrush());
|
||||||
|
|
||||||
DrawText(hdc, label, -1, &rcText, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
|
DrawText(hdc, label, -1, &rcText, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
|
||||||
|
|
||||||
|
@ -1306,10 +1313,13 @@ namespace NppDarkMode
|
||||||
EndPaint(hWnd, &ps);
|
EndPaint(hWnd, &ps);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_NCDESTROY:
|
case WM_NCDESTROY:
|
||||||
|
{
|
||||||
RemoveWindowSubclass(hWnd, TabSubclass, g_tabSubclassID);
|
RemoveWindowSubclass(hWnd, TabSubclass, g_tabSubclassID);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1417,7 +1427,8 @@ namespace NppDarkMode
|
||||||
};
|
};
|
||||||
::Polyline(hdc, edge, _countof(edge));
|
::Polyline(hdc, edge, _countof(edge));
|
||||||
|
|
||||||
::FrameRect(hdc, &rc, isHot || hasFocus ? NppDarkMode::getHotEdgeBrush() : NppDarkMode::getEdgeBrush());
|
::SelectObject(hdc, ::GetStockObject(NULL_BRUSH));
|
||||||
|
::RoundRect(hdc, rc.left, rc.top, rc.right, rc.bottom, 0, 0);
|
||||||
|
|
||||||
::SelectObject(hdc, holdPen);
|
::SelectObject(hdc, holdPen);
|
||||||
::SelectObject(hdc, holdBrush);
|
::SelectObject(hdc, holdBrush);
|
||||||
|
@ -1931,11 +1942,12 @@ namespace NppDarkMode
|
||||||
constexpr size_t classNameLen = 16;
|
constexpr size_t classNameLen = 16;
|
||||||
TCHAR className[classNameLen]{};
|
TCHAR className[classNameLen]{};
|
||||||
GetClassName(hwnd, className, classNameLen);
|
GetClassName(hwnd, className, classNameLen);
|
||||||
if ((wcscmp(className, L"ListBoxX") == 0) ||
|
if ((wcscmp(className, L"ListBoxX") == 0))
|
||||||
(wcscmp(className, WC_LISTBOX) == 0))
|
|
||||||
{
|
{
|
||||||
NppDarkMode::setDarkScrollBar(hwnd);
|
NppDarkMode::setDarkTitleBar(hwnd);
|
||||||
::EnumChildWindows(hwnd, (WNDENUMPROC)enumAutocompleteProc, 0);
|
NppDarkMode::autoThemeChildControls(hwnd);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in New Issue