diff --git a/PowerEditor/src/NppDarkMode.cpp b/PowerEditor/src/NppDarkMode.cpp index 31a3c0730..86a66d3fd 100644 --- a/PowerEditor/src/NppDarkMode.cpp +++ b/PowerEditor/src/NppDarkMode.cpp @@ -4020,6 +4020,19 @@ namespace NppDarkMode return reinterpret_cast(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(NppDarkMode::getDlgBackgroundBrush()); + } + LRESULT onCtlColorListbox(WPARAM wParam, LPARAM lParam) { auto hdc = reinterpret_cast(wParam); diff --git a/PowerEditor/src/NppDarkMode.h b/PowerEditor/src/NppDarkMode.h index 53369c2b7..676d772b4 100644 --- a/PowerEditor/src/NppDarkMode.h +++ b/PowerEditor/src/NppDarkMode.h @@ -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); } diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index ff638d9fe..b027f9fdb 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -59,11 +59,11 @@ BEGIN CONTROL "Filled Fluent UI: small",IDC_RADIO_SMALLICON2,"Button",BS_AUTORADIOBUTTON,28,93,135,10 CONTROL "Filled Fluent UI: large",IDC_RADIO_BIGICON2,"Button",BS_AUTORADIOBUTTON,28,106,135,10 CONTROL "Standard icons: small",IDC_RADIO_STANDARD,"Button",BS_AUTORADIOBUTTON,28,119,135,10 - + GROUPBOX "Colorization",IDC_TOOLBAR_GB_COLORIZATION,171,19,250,173,BS_CENTER CONTROL "Complete",IDC_RADIO_COMPLETE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,197,32,93,10 CONTROL "Partial",IDC_RADIO_PARTIAL,"Button",BS_AUTORADIOBUTTON,197,45,79,10 - + GROUPBOX "Color choice",IDC_TOOLBAR_GB_COLORCHOICE,184,67,224,115,BS_CENTER CONTROL "Red",IDC_RADIO_RED,"Button",BS_AUTORADIOBUTTON | WS_GROUP,195,80,77,10 CONTROL "Green",IDC_RADIO_GREEN,"Button",BS_AUTORADIOBUTTON,195,94,77,10 @@ -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 diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index a2a118369..05a2bddf1 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -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(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(wParam)); + auto hdc = reinterpret_cast(wParam); + const int dlgCtrlID = ::GetDlgCtrlID(reinterpret_cast(lParam)); + if (dlgCtrlID == IDD_ACCENT_TIP_STATIC) + { + return NppDarkMode::onCtlColorDlgLinkText(hdc, !isCheckedOrNot(IDC_RADIO_STANDARD)); + } + return NppDarkMode::onCtlColorDlg(hdc); } case WM_PRINTCLIENT: diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.h b/PowerEditor/src/WinControls/Preference/preferenceDlg.h index 9684c45ba..9b7ad17ab 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.h +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.h @@ -52,6 +52,7 @@ private : class ToolbarSubDlg : public StaticDialog { +friend class PreferenceDlg; public: ToolbarSubDlg() = default;