Fix Doc Switcher panel not follow theme in dark mode
Plus add highlightHotTrackColor in dark mode & clean up.pull/10088/head
parent
36ea7e8b3e
commit
60105d68f7
|
@ -27,6 +27,7 @@ namespace NppDarkMode
|
|||
COLORREF darkerText = 0;
|
||||
COLORREF disabledText = 0;
|
||||
COLORREF edge = 0;
|
||||
COLORREF highlightHotTrack = 0;
|
||||
};
|
||||
|
||||
struct Brushes
|
||||
|
@ -64,7 +65,8 @@ namespace NppDarkMode
|
|||
HEXRGB(0xE0E0E0), // textColor
|
||||
HEXRGB(0xC0C0C0), // darkerTextColor
|
||||
HEXRGB(0x808080), // disabledTextColor
|
||||
HEXRGB(0x808080) // edgeColor
|
||||
HEXRGB(0x808080), // edgeColor
|
||||
HEXRGB(0x414141) // highlightHotTrack
|
||||
};
|
||||
|
||||
struct Theme
|
||||
|
@ -190,21 +192,22 @@ namespace NppDarkMode
|
|||
return invert_c;
|
||||
}
|
||||
|
||||
COLORREF getBackgroundColor() { return getTheme().colors.background; }
|
||||
COLORREF getSofterBackgroundColor() { return getTheme().colors.softerBackground; }
|
||||
COLORREF getHotBackgroundColor() { return getTheme().colors.hotBackground; }
|
||||
COLORREF getDarkerBackgroundColor() { return getTheme().colors.pureBackground; }
|
||||
COLORREF getErrorBackgroundColor() { return getTheme().colors.errorBackground; }
|
||||
COLORREF getTextColor() { return getTheme().colors.text; }
|
||||
COLORREF getDarkerTextColor() { return getTheme().colors.darkerText; }
|
||||
COLORREF getDisabledTextColor() { return getTheme().colors.disabledText; }
|
||||
COLORREF getEdgeColor() { return getTheme().colors.edge; }
|
||||
COLORREF getBackgroundColor() { return getTheme().colors.background; }
|
||||
COLORREF getSofterBackgroundColor() { return getTheme().colors.softerBackground; }
|
||||
COLORREF getHotBackgroundColor() { return getTheme().colors.hotBackground; }
|
||||
COLORREF getDarkerBackgroundColor() { return getTheme().colors.pureBackground; }
|
||||
COLORREF getErrorBackgroundColor() { return getTheme().colors.errorBackground; }
|
||||
COLORREF getTextColor() { return getTheme().colors.text; }
|
||||
COLORREF getDarkerTextColor() { return getTheme().colors.darkerText; }
|
||||
COLORREF getDisabledTextColor() { return getTheme().colors.disabledText; }
|
||||
COLORREF getEdgeColor() { return getTheme().colors.edge; }
|
||||
COLORREF getHighlightHotTrackColor() { return getTheme().colors.highlightHotTrack; }
|
||||
|
||||
HBRUSH getBackgroundBrush() { return getTheme().brushes.background; }
|
||||
HBRUSH getSofterBackgroundBrush() { return getTheme().brushes.softerBackground; }
|
||||
HBRUSH getHotBackgroundBrush() { return getTheme().brushes.hotBackground; }
|
||||
HBRUSH getDarkerBackgroundBrush() { return getTheme().brushes.pureBackground; }
|
||||
HBRUSH getErrorBackgroundBrush() { return getTheme().brushes.errorBackground; }
|
||||
HBRUSH getBackgroundBrush() { return getTheme().brushes.background; }
|
||||
HBRUSH getSofterBackgroundBrush() { return getTheme().brushes.softerBackground; }
|
||||
HBRUSH getHotBackgroundBrush() { return getTheme().brushes.hotBackground; }
|
||||
HBRUSH getDarkerBackgroundBrush() { return getTheme().brushes.pureBackground; }
|
||||
HBRUSH getErrorBackgroundBrush() { return getTheme().brushes.errorBackground; }
|
||||
|
||||
// handle events
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ namespace NppDarkMode
|
|||
COLORREF getDarkerTextColor();
|
||||
COLORREF getDisabledTextColor();
|
||||
COLORREF getEdgeColor();
|
||||
COLORREF getHighlightHotTrackColor();
|
||||
|
||||
HBRUSH getBackgroundBrush();
|
||||
HBRUSH getDarkerBackgroundBrush();
|
||||
|
|
|
@ -133,11 +133,9 @@ INT_PTR CALLBACK AnsiCharPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
}
|
||||
becomeLightMode = false;
|
||||
|
||||
auto nmtbcd = reinterpret_cast<LPNMTBCUSTOMDRAW>((LPNMHDR)lParam);
|
||||
auto nmtbcd = reinterpret_cast<LPNMTBCUSTOMDRAW>(lParam);
|
||||
SetBkMode(nmtbcd->nmcd.hdc, TRANSPARENT);
|
||||
FillRect(nmtbcd->nmcd.hdc, &nmtbcd->nmcd.rc, NppDarkMode::getBackgroundBrush());
|
||||
nmtbcd->clrText = RGB(255, 255, 255);
|
||||
SetTextColor(nmtbcd->nmcd.hdc, RGB(255, 255, 255));
|
||||
SetWindowLongPtr(_hSelf, DWLP_MSGRESULT, CDRF_NOTIFYSUBITEMDRAW);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -611,12 +611,7 @@ void FunctionListPanel::notified(LPNMHDR notification)
|
|||
auto nmtbcd = reinterpret_cast<LPNMTBCUSTOMDRAW>(notification);
|
||||
FillRect(nmtbcd->nmcd.hdc, &nmtbcd->nmcd.rc, NppDarkMode::getBackgroundBrush());
|
||||
nmtbcd->clrText = NppDarkMode::getTextColor();
|
||||
|
||||
// highlight color when hover
|
||||
// same color when hovering above menu
|
||||
// RGB(65, 65, 65) should be added to NppDarkMode.cpp
|
||||
// needed because, visual style is disabled
|
||||
nmtbcd->clrHighlightHotTrack = RGB(65, 65, 65);
|
||||
nmtbcd->clrHighlightHotTrack = NppDarkMode::getHighlightHotTrackColor();
|
||||
SetWindowLongPtr(_hSelf, DWLP_MSGRESULT, CDRF_NOTIFYSUBITEMDRAW | TBCDRF_HILITEHOTTRACK);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -828,11 +828,7 @@ void ProjectPanel::notified(LPNMHDR notification)
|
|||
auto nmtbcd = reinterpret_cast<LPNMTBCUSTOMDRAW>(notification);
|
||||
FillRect(nmtbcd->nmcd.hdc, &nmtbcd->nmcd.rc, NppDarkMode::getBackgroundBrush());
|
||||
nmtbcd->clrText = NppDarkMode::getTextColor();
|
||||
// highlight color when hover
|
||||
// same color when hovering above menu
|
||||
// RGB(65, 65, 65) should be added to NppDarkMode.cpp
|
||||
// needed because, visual style is disabled
|
||||
nmtbcd->clrHighlightHotTrack = RGB(65, 65, 65);
|
||||
nmtbcd->clrHighlightHotTrack = NppDarkMode::getHighlightHotTrackColor();
|
||||
SetWindowLongPtr(_hSelf, DWLP_MSGRESULT, CDRF_NOTIFYSUBITEMDRAW | TBCDRF_HILITEHOTTRACK);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -80,14 +80,15 @@ INT_PTR CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
|
|||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
switch (((LPNMHDR)lParam)->code)
|
||||
LPNMHDR notif = reinterpret_cast<LPNMHDR>(lParam);
|
||||
switch (notif->code)
|
||||
{
|
||||
case NM_CUSTOMDRAW:
|
||||
{
|
||||
static bool becomeDarkMode = false;
|
||||
static bool becomeLightMode = false;
|
||||
HWND hHeader = ListView_GetHeader(_fileListView.getHSelf());
|
||||
if (NppDarkMode::isEnabled())
|
||||
if (NppDarkMode::isEnabled() && (notif->hwndFrom == hHeader))
|
||||
{
|
||||
if (!becomeDarkMode)
|
||||
{
|
||||
|
@ -96,11 +97,9 @@ INT_PTR CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
|
|||
}
|
||||
becomeLightMode = false;
|
||||
|
||||
auto nmtbcd = reinterpret_cast<LPNMTBCUSTOMDRAW>((LPNMHDR)lParam);
|
||||
auto nmtbcd = reinterpret_cast<LPNMTBCUSTOMDRAW>(notif);
|
||||
SetBkMode(nmtbcd->nmcd.hdc, TRANSPARENT);
|
||||
FillRect(nmtbcd->nmcd.hdc, &nmtbcd->nmcd.rc, NppDarkMode::getBackgroundBrush());
|
||||
nmtbcd->clrText = RGB(255, 255, 255);
|
||||
SetTextColor(nmtbcd->nmcd.hdc, RGB(255, 255, 255));
|
||||
SetWindowLongPtr(_hSelf, DWLP_MSGRESULT, CDRF_NOTIFYSUBITEMDRAW);
|
||||
}
|
||||
else
|
||||
|
@ -115,6 +114,7 @@ INT_PTR CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NM_DBLCLK:
|
||||
{
|
||||
LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) lParam;
|
||||
|
|
Loading…
Reference in New Issue