Fix root menu item mouse hover color issue while being back in light mode
https://github.com/notepad-plus-plus/notepad-plus-plus/pull/10039#discussion_r656151554
This commit is contained in:
parent
c8be679cde
commit
296e1c695e
|
@ -981,11 +981,6 @@ namespace NppDarkMode
|
||||||
SetWindowSubclass(hwnd, TabSubclass, g_tabSubclassID, 0);
|
SetWindowSubclass(hwnd, TabSubclass, g_tabSubclassID, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void disableVisualStyle(HWND hwnd)
|
|
||||||
{
|
|
||||||
SetWindowTheme(hwnd, L"", L"");
|
|
||||||
}
|
|
||||||
|
|
||||||
void autoSubclassAndThemeChildControls(HWND hwndParent, bool subclass, bool theme)
|
void autoSubclassAndThemeChildControls(HWND hwndParent, bool subclass, bool theme)
|
||||||
{
|
{
|
||||||
struct Params
|
struct Params
|
||||||
|
@ -1116,9 +1111,16 @@ namespace NppDarkMode
|
||||||
::SendMessage(hwnd, TB_SETCOLORSCHEME, 0, reinterpret_cast<LPARAM>(&scheme));
|
::SendMessage(hwnd, TB_SETCOLORSCHEME, 0, reinterpret_cast<LPARAM>(&scheme));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setExplorerTheme(HWND hwnd)
|
void setExplorerTheme(HWND hwnd, bool doEnable)
|
||||||
|
{
|
||||||
|
if (doEnable)
|
||||||
{
|
{
|
||||||
NppDarkMode::allowDarkModeForWindow(hwnd, NppDarkMode::isEnabled() && NppDarkMode::isExperimentalEnabled());
|
NppDarkMode::allowDarkModeForWindow(hwnd, NppDarkMode::isEnabled() && NppDarkMode::isExperimentalEnabled());
|
||||||
SetWindowTheme(hwnd, L"Explorer", nullptr);
|
SetWindowTheme(hwnd, L"Explorer", nullptr);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetWindowTheme(hwnd, L"", L"");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,6 @@ namespace NppDarkMode
|
||||||
void subclassGroupboxControl(HWND hwnd);
|
void subclassGroupboxControl(HWND hwnd);
|
||||||
void subclassToolbarControl(HWND hwnd);
|
void subclassToolbarControl(HWND hwnd);
|
||||||
void subclassTabControl(HWND hwnd);
|
void subclassTabControl(HWND hwnd);
|
||||||
void disableVisualStyle(HWND hwnd);
|
|
||||||
|
|
||||||
void autoSubclassAndThemeChildControls(HWND hwndParent, bool subclass = true, bool theme = true);
|
void autoSubclassAndThemeChildControls(HWND hwndParent, bool subclass = true, bool theme = true);
|
||||||
void autoThemeChildControls(HWND hwndParent);
|
void autoThemeChildControls(HWND hwndParent);
|
||||||
|
@ -87,5 +86,5 @@ namespace NppDarkMode
|
||||||
void setDarkTooltips(HWND hwnd, ToolTipsType type);
|
void setDarkTooltips(HWND hwnd, ToolTipsType type);
|
||||||
void setDarkLineAbovePanelToolbar(HWND hwnd);
|
void setDarkLineAbovePanelToolbar(HWND hwnd);
|
||||||
|
|
||||||
void setExplorerTheme(HWND hwnd);
|
void setExplorerTheme(HWND hwnd, bool doEnable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ void ListView::init(HINSTANCE hInst, HWND parent)
|
||||||
throw std::runtime_error("ListView::init : CreateWindowEx() function return null");
|
throw std::runtime_error("ListView::init : CreateWindowEx() function return null");
|
||||||
}
|
}
|
||||||
|
|
||||||
NppDarkMode::setExplorerTheme(_hSelf);
|
NppDarkMode::setExplorerTheme(_hSelf, true);
|
||||||
|
|
||||||
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
|
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
|
||||||
_defaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(staticProc)));
|
_defaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(staticProc)));
|
||||||
|
|
|
@ -55,7 +55,7 @@ INT_PTR CALLBACK AnsiCharPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||||
|
|
||||||
case NPPM_INTERNAL_REFRESHDARKMODE:
|
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||||
{
|
{
|
||||||
NppDarkMode::setExplorerTheme(_listView.getHSelf());
|
NppDarkMode::setExplorerTheme(_listView.getHSelf(), true);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ INT_PTR CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
||||||
case NPPM_INTERNAL_REFRESHDARKMODE:
|
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||||
{
|
{
|
||||||
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
||||||
NppDarkMode::setExplorerTheme(_treeView.getHSelf());
|
NppDarkMode::setExplorerTheme(_treeView.getHSelf(), true);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -838,7 +838,7 @@ INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPA
|
||||||
case NPPM_INTERNAL_REFRESHDARKMODE:
|
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||||
{
|
{
|
||||||
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
||||||
NppDarkMode::setExplorerTheme(_treeView.getHSelf());
|
NppDarkMode::setExplorerTheme(_treeView.getHSelf(), true);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ INT_PTR CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
|
||||||
case NPPM_INTERNAL_REFRESHDARKMODE:
|
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||||
{
|
{
|
||||||
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
||||||
NppDarkMode::setExplorerTheme(_treeView.getHSelf());
|
NppDarkMode::setExplorerTheme(_treeView.getHSelf(), true);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -813,15 +813,16 @@ void ProjectPanel::notified(LPNMHDR notification)
|
||||||
}
|
}
|
||||||
else if (notification->code == NM_CUSTOMDRAW && (notification->hwndFrom == _hToolbarMenu))
|
else if (notification->code == NM_CUSTOMDRAW && (notification->hwndFrom == _hToolbarMenu))
|
||||||
{
|
{
|
||||||
|
static bool becomeDarkMode = false;
|
||||||
|
static bool becomeLightMode = false;
|
||||||
if (NppDarkMode::isEnabled())
|
if (NppDarkMode::isEnabled())
|
||||||
{
|
{
|
||||||
static bool isVSDisabled = false;
|
if (!becomeDarkMode)
|
||||||
if (!isVSDisabled)
|
|
||||||
{
|
{
|
||||||
NppDarkMode::disableVisualStyle(_hToolbarMenu);
|
NppDarkMode::setExplorerTheme(_hToolbarMenu, false);
|
||||||
isVSDisabled = true;
|
becomeDarkMode = true;
|
||||||
}
|
}
|
||||||
|
becomeLightMode = false;
|
||||||
auto nmtbcd = reinterpret_cast<LPNMTBCUSTOMDRAW>(notification);
|
auto nmtbcd = reinterpret_cast<LPNMTBCUSTOMDRAW>(notification);
|
||||||
FillRect(nmtbcd->nmcd.hdc, &nmtbcd->nmcd.rc, NppDarkMode::getBackgroundBrush());
|
FillRect(nmtbcd->nmcd.hdc, &nmtbcd->nmcd.rc, NppDarkMode::getBackgroundBrush());
|
||||||
nmtbcd->clrText = NppDarkMode::getTextColor();
|
nmtbcd->clrText = NppDarkMode::getTextColor();
|
||||||
|
@ -834,6 +835,12 @@ void ProjectPanel::notified(LPNMHDR notification)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (!becomeLightMode)
|
||||||
|
{
|
||||||
|
NppDarkMode::setExplorerTheme(_hToolbarMenu, true);
|
||||||
|
becomeLightMode = true;
|
||||||
|
}
|
||||||
|
becomeDarkMode = false;
|
||||||
SetWindowLongPtr(_hSelf, DWLP_MSGRESULT, CDRF_DODEFAULT);
|
SetWindowLongPtr(_hSelf, DWLP_MSGRESULT, CDRF_DODEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ void TreeView::init(HINSTANCE hInst, HWND parent, int treeViewID)
|
||||||
_hInst,
|
_hInst,
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
||||||
NppDarkMode::setExplorerTheme(_hSelf);
|
NppDarkMode::setExplorerTheme(_hSelf, true);
|
||||||
NppDarkMode::setDarkTooltips(_hSelf, NppDarkMode::ToolTipsType::treeview);
|
NppDarkMode::setDarkTooltips(_hSelf, NppDarkMode::ToolTipsType::treeview);
|
||||||
|
|
||||||
int itemHeight = NppParameters::getInstance()._dpiManager.scaleY(CY_ITEMHEIGHT);
|
int itemHeight = NppParameters::getInstance()._dpiManager.scaleY(CY_ITEMHEIGHT);
|
||||||
|
|
|
@ -73,7 +73,7 @@ INT_PTR CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
|
||||||
|
|
||||||
case NPPM_INTERNAL_REFRESHDARKMODE:
|
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||||
{
|
{
|
||||||
NppDarkMode::setExplorerTheme(_fileListView.getHSelf());
|
NppDarkMode::setExplorerTheme(_fileListView.getHSelf(), true);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ void VerticalFileSwitcherListView::init(HINSTANCE hInst, HWND parent, HIMAGELIST
|
||||||
throw std::runtime_error("VerticalFileSwitcherListView::init : CreateWindowEx() function return null");
|
throw std::runtime_error("VerticalFileSwitcherListView::init : CreateWindowEx() function return null");
|
||||||
}
|
}
|
||||||
|
|
||||||
NppDarkMode::setExplorerTheme(_hSelf);
|
NppDarkMode::setExplorerTheme(_hSelf, true);
|
||||||
NppDarkMode::setDarkTooltips(_hSelf, NppDarkMode::ToolTipsType::listview);
|
NppDarkMode::setDarkTooltips(_hSelf, NppDarkMode::ToolTipsType::listview);
|
||||||
|
|
||||||
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
|
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
|
||||||
|
|
Loading…
Reference in New Issue