mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-27 07:44:24 +02:00
parent
6a4ef408f2
commit
f27e561379
@ -595,6 +595,41 @@ void FunctionListPanel::notified(LPNMHDR notification)
|
|||||||
{
|
{
|
||||||
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_FUNC_LIST, 0);
|
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_FUNC_LIST, 0);
|
||||||
}
|
}
|
||||||
|
else if (notification->code == NM_CUSTOMDRAW && (notification->hwndFrom == _hToolbarMenu))
|
||||||
|
{
|
||||||
|
static bool becomeDarkMode = false;
|
||||||
|
static bool becomeLightMode = false;
|
||||||
|
if (NppDarkMode::isEnabled())
|
||||||
|
{
|
||||||
|
if (!becomeDarkMode)
|
||||||
|
{
|
||||||
|
NppDarkMode::setExplorerTheme(_hToolbarMenu, false);
|
||||||
|
becomeDarkMode = true;
|
||||||
|
}
|
||||||
|
becomeLightMode = false;
|
||||||
|
|
||||||
|
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);
|
||||||
|
SetWindowLongPtr(_hSelf, DWLP_MSGRESULT, CDRF_NOTIFYSUBITEMDRAW | TBCDRF_HILITEHOTTRACK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!becomeLightMode)
|
||||||
|
{
|
||||||
|
NppDarkMode::setExplorerTheme(_hToolbarMenu, true);
|
||||||
|
becomeLightMode = true;
|
||||||
|
}
|
||||||
|
becomeDarkMode = false;
|
||||||
|
SetWindowLongPtr(_hSelf, DWLP_MSGRESULT, CDRF_DODEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL FunctionListPanel::setTreeViewImageList(int root_id, int node_id, int leaf_id)
|
BOOL FunctionListPanel::setTreeViewImageList(int root_id, int node_id, int leaf_id)
|
||||||
@ -737,24 +772,45 @@ INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPA
|
|||||||
// Make edit field red if not found
|
// Make edit field red if not found
|
||||||
case WM_CTLCOLOREDIT :
|
case WM_CTLCOLOREDIT :
|
||||||
{
|
{
|
||||||
// if the text not found modify the background color of the editor
|
|
||||||
static HBRUSH hBrushBackground = CreateSolidBrush(BCKGRD_COLOR);
|
|
||||||
TCHAR text2search[MAX_PATH] ;
|
TCHAR text2search[MAX_PATH] ;
|
||||||
::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text2search));
|
::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text2search));
|
||||||
|
bool textFound = false;
|
||||||
if (text2search[0] == '\0')
|
if (text2search[0] == '\0')
|
||||||
{
|
{
|
||||||
return FALSE; // no text, use the default color
|
textFound = true; // no text, use the default color
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!textFound)
|
||||||
|
{
|
||||||
HTREEITEM searchViewRoot = _treeViewSearchResult.getRoot();
|
HTREEITEM searchViewRoot = _treeViewSearchResult.getRoot();
|
||||||
if (searchViewRoot)
|
if (searchViewRoot)
|
||||||
{
|
{
|
||||||
if (_treeViewSearchResult.getChildFrom(searchViewRoot))
|
if (_treeViewSearchResult.getChildFrom(searchViewRoot))
|
||||||
return FALSE; // children on root found, use the default color
|
{
|
||||||
|
textFound = true; // children on root found, use the default color
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE; // no root (no parser), use the default color
|
{
|
||||||
|
textFound = true; // no root (no parser), use the default color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (textFound)
|
||||||
|
{
|
||||||
|
if (NppDarkMode::isEnabled())
|
||||||
|
{
|
||||||
|
SetTextColor((HDC)wParam, NppDarkMode::getTextColor());
|
||||||
|
SetBkColor((HDC)wParam, NppDarkMode::getBackgroundColor());
|
||||||
|
return (LRESULT)NppDarkMode::getBackgroundBrush();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
// text not found
|
// text not found
|
||||||
|
// if the text not found modify the background color of the editor
|
||||||
|
static HBRUSH hBrushBackground = CreateSolidBrush(BCKGRD_COLOR);
|
||||||
SetTextColor((HDC)wParam, TXT_COLOR);
|
SetTextColor((HDC)wParam, TXT_COLOR);
|
||||||
SetBkColor((HDC)wParam, BCKGRD_COLOR);
|
SetBkColor((HDC)wParam, BCKGRD_COLOR);
|
||||||
return (LRESULT)hBrushBackground;
|
return (LRESULT)hBrushBackground;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user