Make dark colors consistent

1. Make dark colors consistent for panel toolbars.
2. Make dark colors consistent style configurator edit controls.
3. Make dark colors consistent for docking elements.

* BackgroundColor(), BackgroundBrush() – should be used for items which have some interactions, or need to be different from Darker variant.
* DarkerBackgroundColor(), DarkerBackgroundBrush() – should be used for static/top backgrounds.
* SofterBackgroundColor(), SofterBackgroundBrush() – should be used for items , which have interactions, or have focus.

Fix #10242, close #10243
This commit is contained in:
ozone10 2021-07-25 10:52:38 +02:00 committed by Don Ho
parent b0d4e776c6
commit 7c4a428e47
7 changed files with 25 additions and 11 deletions

View File

@ -181,7 +181,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
{ {
RECT rc = { 0 }; RECT rc = { 0 };
GetClientRect(hwnd, &rc); GetClientRect(hwnd, &rc);
FillRect((HDC)wParam, &rc, NppDarkMode::getBackgroundBrush()); ::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush());
return 0; return 0;
} }
else else

View File

@ -191,7 +191,6 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
case WM_CTLCOLORLISTBOX: case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORDLG: case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC:
{ {
if (NppDarkMode::isEnabled()) if (NppDarkMode::isEnabled())
{ {
@ -200,6 +199,23 @@ INT_PTR CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM l
break; break;
} }
case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{
HWND hwnd = reinterpret_cast<HWND>(lParam);
if (hwnd == ::GetDlgItem(_hSelf, IDC_DEF_EXT_EDIT) || hwnd == ::GetDlgItem(_hSelf, IDC_DEF_KEYWORDS_EDIT))
{
return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam));
}
else
{
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
}
}
break;
}
case WM_PRINTCLIENT: case WM_PRINTCLIENT:
{ {
if (NppDarkMode::isEnabled()) if (NppDarkMode::isEnabled())

View File

@ -104,8 +104,8 @@ protected :
RECT rc = { 0 }; RECT rc = { 0 };
getClientRect(rc); getClientRect(rc);
FillRect((HDC)wParam, &rc, NppDarkMode::getBackgroundBrush()); ::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush());
return 1; return TRUE;
} }
case WM_NOTIFY: case WM_NOTIFY:
{ {

View File

@ -152,10 +152,8 @@ LRESULT DockingSplitter::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
RECT rc = { 0 }; RECT rc = { 0 };
getClientRect(rc); getClientRect(rc);
::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getBackgroundBrush());
FillRect((HDC)wParam, &rc, NppDarkMode::getSofterBackgroundBrush()); return TRUE;
return 1;
} }
default : default :
break; break;

View File

@ -721,7 +721,7 @@ void FileBrowser::notified(LPNMHDR notification)
if (NppDarkMode::isEnabled()) if (NppDarkMode::isEnabled())
{ {
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::getDarkerBackgroundBrush());
} }
} }
} }

View File

@ -618,7 +618,7 @@ void FunctionListPanel::notified(LPNMHDR notification)
if (NppDarkMode::isEnabled()) if (NppDarkMode::isEnabled())
{ {
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::getDarkerBackgroundBrush());
} }
} }
} }

View File

@ -818,7 +818,7 @@ void ProjectPanel::notified(LPNMHDR notification)
if (NppDarkMode::isEnabled()) if (NppDarkMode::isEnabled())
{ {
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::getDarkerBackgroundBrush());
nmtbcd->clrText = NppDarkMode::getTextColor(); nmtbcd->clrText = NppDarkMode::getTextColor();
nmtbcd->clrHighlightHotTrack = NppDarkMode::getHotBackgroundColor(); nmtbcd->clrHighlightHotTrack = NppDarkMode::getHotBackgroundColor();
SetWindowLongPtr(_hSelf, DWLP_MSGRESULT, CDRF_NOTIFYITEMDRAW | TBCDRF_HILITEHOTTRACK); SetWindowLongPtr(_hSelf, DWLP_MSGRESULT, CDRF_NOTIFYITEMDRAW | TBCDRF_HILITEHOTTRACK);