mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-27 15:54:17 +02:00
Fix accent tooltip behaviour and enhance '(?)' static control appearence
ref: https://github.com/notepad-plus-plus/notepad-plus-plus/pull/16434#issuecomment-2817077992 Close #16448
This commit is contained in:
parent
9f2326d30c
commit
faec21b57e
@ -4020,6 +4020,19 @@ namespace NppDarkMode
|
||||
return reinterpret_cast<LRESULT>(NppDarkMode::getDlgBackgroundBrush());
|
||||
}
|
||||
|
||||
LRESULT onCtlColorDlgLinkText(HDC hdc, bool isTextEnabled)
|
||||
{
|
||||
if (!NppDarkMode::isEnabled())
|
||||
{
|
||||
::SetTextColor(hdc, ::GetSysColor(isTextEnabled ? COLOR_HOTLIGHT : COLOR_GRAYTEXT));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
::SetTextColor(hdc, isTextEnabled ? NppDarkMode::getLinkTextColor() : NppDarkMode::getDisabledTextColor());
|
||||
::SetBkColor(hdc, NppDarkMode::getDlgBackgroundColor());
|
||||
return reinterpret_cast<LRESULT>(NppDarkMode::getDlgBackgroundBrush());
|
||||
}
|
||||
|
||||
LRESULT onCtlColorListbox(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
auto hdc = reinterpret_cast<HDC>(wParam);
|
||||
|
@ -239,5 +239,6 @@ namespace NppDarkMode
|
||||
LRESULT onCtlColorDlg(HDC hdc);
|
||||
LRESULT onCtlColorError(HDC hdc);
|
||||
LRESULT onCtlColorDlgStaticText(HDC hdc, bool isTextEnabled);
|
||||
LRESULT onCtlColorDlgLinkText(HDC hdc, bool isTextEnabled = true);
|
||||
LRESULT onCtlColorListbox(WPARAM wParam, LPARAM lParam);
|
||||
}
|
||||
|
@ -74,9 +74,9 @@ BEGIN
|
||||
CONTROL "Yellow",IDC_RADIO_YELLOW,"Button",BS_AUTORADIOBUTTON,195,164,77,10
|
||||
CONTROL "Default",IDC_RADIO_DEFAULTCOLOR,"Button",BS_AUTORADIOBUTTON,278,80,112,10
|
||||
CONTROL "System Accent",IDC_RADIO_ACCENTCOLOR,"Button",BS_AUTORADIOBUTTON,278,94,112,10
|
||||
LTEXT "(?)",IDD_ACCENT_TIP_STATIC,393,94,10,10, SS_NOTIFY
|
||||
CONTROL "Custom",IDC_RADIO_CUSTOMCOLOR,"Button",BS_AUTORADIOBUTTON,278,108,112,10
|
||||
LTEXT "",IDC_STATIC,310,127,1,8 // For placing the color picker on the left
|
||||
LTEXT "(?)",IDD_ACCENT_TIP_STATIC,393,94,10,8,SS_NOTIFY
|
||||
LTEXT "",IDC_STATIC,310,127,1,8 // For placing the color picker on the left
|
||||
END
|
||||
|
||||
IDD_PREFERENCE_SUB_TABBAR DIALOGEX 115, 10, 460, 205
|
||||
|
@ -250,6 +250,9 @@ intptr_t CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
{
|
||||
NppDarkMode::autoThemeChildControls(_hSelf);
|
||||
|
||||
if (_toolbarSubDlg._accentTip != nullptr)
|
||||
NppDarkMode::setDarkTooltips(_toolbarSubDlg._accentTip, NppDarkMode::ToolTipsType::tooltip);
|
||||
|
||||
if (_editing2SubDlg._tip != nullptr)
|
||||
NppDarkMode::setDarkTooltips(_editing2SubDlg._tip, NppDarkMode::ToolTipsType::tooltip);
|
||||
|
||||
@ -882,13 +885,20 @@ intptr_t CALLBACK ToolbarSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_YELLOW), enableColor);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_DEFAULTCOLOR), enableColor);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_ACCENTCOLOR), enableColor);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_ACCENT_TIP_STATIC), enableColor);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_CUSTOMCOLOR), enableColor);
|
||||
|
||||
auto nStyle = ::GetWindowLongPtr(::GetDlgItem(_hSelf, IDD_ACCENT_TIP_STATIC), GWL_STYLE);
|
||||
const bool isNotify = (nStyle & SS_NOTIFY) == SS_NOTIFY;
|
||||
if (enableColor != isNotify)
|
||||
{
|
||||
nStyle ^= SS_NOTIFY;
|
||||
::SetWindowLongPtr(::GetDlgItem(_hSelf, IDD_ACCENT_TIP_STATIC), GWL_STYLE, nStyle);
|
||||
redrawDlgItem(IDD_ACCENT_TIP_STATIC);
|
||||
}
|
||||
|
||||
bool useDark = static_cast<bool>(wParam) ? !NppDarkMode::isEnabled() : NppDarkMode::isEnabled();
|
||||
enableIconColorPicker(enableColor && enableCustom, useDark);
|
||||
|
||||
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_TOOLBAR_GB_COLORCHOICE), enableColor);
|
||||
@ -907,7 +917,13 @@ intptr_t CALLBACK ToolbarSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
|
||||
case WM_CTLCOLORSTATIC:
|
||||
{
|
||||
return NppDarkMode::onCtlColorDlg(reinterpret_cast<HDC>(wParam));
|
||||
auto hdc = reinterpret_cast<HDC>(wParam);
|
||||
const int dlgCtrlID = ::GetDlgCtrlID(reinterpret_cast<HWND>(lParam));
|
||||
if (dlgCtrlID == IDD_ACCENT_TIP_STATIC)
|
||||
{
|
||||
return NppDarkMode::onCtlColorDlgLinkText(hdc, !isCheckedOrNot(IDC_RADIO_STANDARD));
|
||||
}
|
||||
return NppDarkMode::onCtlColorDlg(hdc);
|
||||
}
|
||||
|
||||
case WM_PRINTCLIENT:
|
||||
|
@ -52,6 +52,7 @@ private :
|
||||
|
||||
class ToolbarSubDlg : public StaticDialog
|
||||
{
|
||||
friend class PreferenceDlg;
|
||||
public:
|
||||
ToolbarSubDlg() = default;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user