mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-26 23:34:44 +02:00
Improve slider control's look in dark mode when it's disabled
Fix #16379, close #16380
This commit is contained in:
parent
f59777b0b3
commit
8537f022b1
@ -3047,6 +3047,85 @@ namespace NppDarkMode
|
||||
return ::DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
static LRESULT darkTrackBarNotifyCustomDraw(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool isPlugin)
|
||||
{
|
||||
auto lpnmcd = reinterpret_cast<LPNMCUSTOMDRAW>(lParam);
|
||||
|
||||
switch (lpnmcd->dwDrawStage)
|
||||
{
|
||||
case CDDS_PREPAINT:
|
||||
{
|
||||
LRESULT lr = NppDarkMode::isEnabled() ? CDRF_NOTIFYITEMDRAW : CDRF_DODEFAULT;
|
||||
|
||||
if (isPlugin)
|
||||
{
|
||||
lr |= ::DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
return lr;
|
||||
}
|
||||
|
||||
case CDDS_ITEMPREPAINT:
|
||||
{
|
||||
switch (lpnmcd->dwItemSpec)
|
||||
{
|
||||
case TBCD_THUMB:
|
||||
{
|
||||
if (::IsWindowEnabled(lpnmcd->hdr.hwndFrom) == FALSE)
|
||||
{
|
||||
::FillRect(lpnmcd->hdc, &lpnmcd->rc, NppDarkMode::getDisabledEdgeBrush());
|
||||
LRESULT lr = CDRF_SKIPDEFAULT;
|
||||
if (isPlugin)
|
||||
{
|
||||
lr |= ::DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
return lr;
|
||||
}
|
||||
else if ((lpnmcd->uItemState & CDIS_SELECTED) == CDIS_SELECTED)
|
||||
{
|
||||
::FillRect(lpnmcd->hdc, &lpnmcd->rc, NppDarkMode::getSofterBackgroundBrush());
|
||||
LRESULT lr = CDRF_SKIPDEFAULT;
|
||||
if (isPlugin)
|
||||
{
|
||||
lr |= ::DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
return lr;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case TBCD_CHANNEL:
|
||||
{
|
||||
if (::IsWindowEnabled(lpnmcd->hdr.hwndFrom) == FALSE)
|
||||
{
|
||||
::FillRect(lpnmcd->hdc, &lpnmcd->rc, NppDarkMode::getDarkerBackgroundBrush());
|
||||
NppDarkMode::paintRoundFrameRect(lpnmcd->hdc, lpnmcd->rc, NppDarkMode::getDisabledEdgePen(), 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
::FillRect(lpnmcd->hdc, &lpnmcd->rc, NppDarkMode::getSofterBackgroundBrush());
|
||||
}
|
||||
|
||||
LRESULT lr = CDRF_SKIPDEFAULT;
|
||||
if (isPlugin)
|
||||
{
|
||||
lr |= ::DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
return lr;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ::DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
constexpr UINT_PTR g_pluginDockWindowSubclassID = 42;
|
||||
|
||||
static LRESULT CALLBACK PluginDockWindowSubclass(
|
||||
@ -3147,31 +3226,36 @@ namespace NppDarkMode
|
||||
{
|
||||
case NM_CUSTOMDRAW:
|
||||
{
|
||||
constexpr size_t classNameLen = 16;
|
||||
wchar_t className[classNameLen]{};
|
||||
GetClassName(nmhdr->hwndFrom, className, classNameLen);
|
||||
|
||||
if (wcscmp(className, TOOLBARCLASSNAME) == 0)
|
||||
std::wstring className = getWndClassName(nmhdr->hwndFrom);
|
||||
if (className == TOOLBARCLASSNAME)
|
||||
{
|
||||
return NppDarkMode::darkToolBarNotifyCustomDraw(hWnd, uMsg, wParam, lParam, true);
|
||||
}
|
||||
|
||||
if (wcscmp(className, WC_LISTVIEW) == 0)
|
||||
if (className == WC_LISTVIEW)
|
||||
{
|
||||
return NppDarkMode::darkListViewNotifyCustomDraw(hWnd, uMsg, wParam, lParam, true);
|
||||
}
|
||||
|
||||
if (wcscmp(className, WC_TREEVIEW) == 0)
|
||||
if (className == WC_TREEVIEW)
|
||||
{
|
||||
return NppDarkMode::darkTreeViewNotifyCustomDraw(hWnd, uMsg, wParam, lParam, true);
|
||||
}
|
||||
|
||||
if (className == TRACKBAR_CLASS)
|
||||
{
|
||||
return NppDarkMode::darkTrackBarNotifyCustomDraw(hWnd, uMsg, wParam, lParam, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
return ::DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
void autoSubclassAndThemePluginDockWindow(HWND hwnd)
|
||||
@ -3295,36 +3379,40 @@ namespace NppDarkMode
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
auto nmhdr = reinterpret_cast<LPNMHDR>(lParam);
|
||||
|
||||
constexpr size_t classNameLen = 16;
|
||||
wchar_t className[classNameLen]{};
|
||||
GetClassName(nmhdr->hwndFrom, className, classNameLen);
|
||||
|
||||
switch (nmhdr->code)
|
||||
{
|
||||
case NM_CUSTOMDRAW:
|
||||
{
|
||||
if (wcscmp(className, TOOLBARCLASSNAME) == 0)
|
||||
std::wstring className = getWndClassName(nmhdr->hwndFrom);
|
||||
if (className == TOOLBARCLASSNAME)
|
||||
{
|
||||
return NppDarkMode::darkToolBarNotifyCustomDraw(hWnd, uMsg, wParam, lParam, false);
|
||||
}
|
||||
|
||||
if (wcscmp(className, WC_LISTVIEW) == 0)
|
||||
if (className == WC_LISTVIEW)
|
||||
{
|
||||
return NppDarkMode::darkListViewNotifyCustomDraw(hWnd, uMsg, wParam, lParam, false);
|
||||
}
|
||||
|
||||
if (wcscmp(className, WC_TREEVIEW) == 0)
|
||||
if (className == WC_TREEVIEW)
|
||||
{
|
||||
return NppDarkMode::darkTreeViewNotifyCustomDraw(hWnd, uMsg, wParam, lParam, false);
|
||||
}
|
||||
|
||||
if (className == TRACKBAR_CLASS)
|
||||
{
|
||||
return NppDarkMode::darkTrackBarNotifyCustomDraw(hWnd, uMsg, wParam, lParam, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
return ::DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
void autoSubclassAndThemeWindowNotify(HWND hwnd)
|
||||
|
@ -1527,6 +1527,7 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
|
||||
case WM_INITDIALOG :
|
||||
{
|
||||
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
|
||||
NppDarkMode::autoSubclassAndThemeWindowNotify(_hSelf);
|
||||
|
||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||
HWND hReplaceCombo = ::GetDlgItem(_hSelf, IDREPLACEWITH);
|
||||
|
@ -1094,6 +1094,7 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
|
||||
|
||||
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
|
||||
NppDarkMode::setDarkScrollBar(_hSelf);
|
||||
NppDarkMode::autoSubclassAndThemeWindowNotify(_hSelf);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -170,6 +170,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||
_globalOverrideTip = CreateToolTip(IDC_GLOBAL_WHATISGLOBALOVERRIDE_LINK, _hSelf, _hInst, const_cast<PTSTR>(globalOverrideTipStr.c_str()), false);
|
||||
|
||||
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
|
||||
NppDarkMode::autoSubclassAndThemeWindowNotify(_hSelf);
|
||||
|
||||
goToCenter(SWP_SHOWWINDOW | SWP_NOSIZE);
|
||||
|
||||
@ -178,13 +179,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
||||
|
||||
case WM_CTLCOLOREDIT:
|
||||
{
|
||||
auto hdcStatic = reinterpret_cast<HDC>(wParam);
|
||||
auto dlgCtrlID = ::GetDlgCtrlID(reinterpret_cast<HWND>(lParam));
|
||||
if (dlgCtrlID == IDC_USER_EXT_EDIT || dlgCtrlID == IDC_USER_KEYWORDS_EDIT)
|
||||
{
|
||||
return NppDarkMode::onCtlColorSofter(hdcStatic);
|
||||
}
|
||||
return NppDarkMode::onCtlColor(hdcStatic);
|
||||
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
|
||||
}
|
||||
|
||||
case WM_CTLCOLORLISTBOX:
|
||||
|
@ -1160,6 +1160,8 @@ intptr_t CALLBACK EditingSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
|
||||
initScintParam();
|
||||
|
||||
NppDarkMode::autoSubclassAndThemeWindowNotify(_hSelf);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -2291,6 +2293,8 @@ intptr_t CALLBACK MarginsBorderEdgeSubDlg::run_dlgProc(UINT message, WPARAM wPar
|
||||
}
|
||||
initScintParam();
|
||||
|
||||
NppDarkMode::autoSubclassAndThemeWindowNotify(_hSelf);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -5039,6 +5043,8 @@ intptr_t CALLBACK AutoCompletionSubDlg::run_dlgProc(UINT message, WPARAM wParam,
|
||||
}
|
||||
}
|
||||
|
||||
NppDarkMode::autoSubclassAndThemeWindowNotify(_hSelf);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user