Apply dark mode on UDL, styler dlg

Fix #10283, close  #10284
This commit is contained in:
ozone10 2021-07-28 19:39:02 +02:00 committed by Don Ho
parent 1ac1b11831
commit 1b6cd7c3ff
2 changed files with 130 additions and 4 deletions

View File

@ -106,6 +106,34 @@ INT_PTR CALLBACK SharedParametersDialog::run_dlgProc(UINT Message, WPARAM wParam
return TRUE;
}
case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
}
break;
}
case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
}
break;
}
case WM_PRINTCLIENT:
{
if (NppDarkMode::isEnabled())
{
return TRUE;
}
break;
}
case WM_COMMAND :
{
if (HIWORD(wParam) == EN_CHANGE)
@ -946,6 +974,8 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
_pUserLang = _pCurrentUserLang;
_ctrlTab.init(_hInst, _hSelf, false);
NppDarkMode::subclassTabControl(_ctrlTab.getHSelf());
int tabDpiDynamicalHeight = nppParam._dpiManager.scaleY(13);
_ctrlTab.setFont(TEXT("Tahoma"), tabDpiDynamicalHeight);
@ -1026,6 +1056,53 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
::SetWindowText(_hSelf, udlVersion.c_str());
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
NppDarkMode::setDarkScrollBar(_hSelf);
return TRUE;
}
case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
}
break;
}
case WM_CTLCOLORLISTBOX:
{
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam));
}
break;
}
case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
}
break;
}
case WM_PRINTCLIENT:
{
if (NppDarkMode::isEnabled())
{
return TRUE;
}
break;
}
case NPPM_INTERNAL_REFRESHDARKMODE:
{
NppDarkMode::autoThemeChildControls(_hSelf);
NppDarkMode::setDarkScrollBar(_hSelf);
return TRUE;
}
@ -1628,6 +1705,9 @@ INT_PTR CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPAR
{
case WM_INITDIALOG :
{
NppDarkMode::setDarkTitleBar(hwnd);
NppDarkMode::autoSubclassAndThemeChildControls(hwnd);
NativeLangSpeaker *pNativeLangSpeaker = nppParam.getNativeLangSpeaker();
pNativeLangSpeaker->changeUserDefineLangPopupDlg(hwnd);
@ -1722,6 +1802,51 @@ INT_PTR CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPAR
return TRUE;
}
case WM_CTLCOLOREDIT:
{
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
}
break;
}
case WM_CTLCOLORLISTBOX:
{
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam));
}
break;
}
case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC:
{
if (NppDarkMode::isEnabled())
{
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
}
break;
}
case WM_PRINTCLIENT:
{
if (NppDarkMode::isEnabled())
{
return TRUE;
}
break;
}
case NPPM_INTERNAL_REFRESHDARKMODE:
{
NppDarkMode::setDarkTitleBar(hwnd);
NppDarkMode::autoThemeChildControls(hwnd);
::SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
return TRUE;
}
case WM_COMMAND :
{
if (dlg == nullptr)
@ -1832,4 +1957,5 @@ INT_PTR CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPAR
default :
return FALSE;
}
return FALSE;
}

View File

@ -220,7 +220,7 @@ BEGIN
END
IDD_GLOBAL_USERDEFINE_DLG DIALOGEX 36, 44, 490, 470
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_VSCROLL | WS_SYSMENU
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_VSCROLL | WS_SYSMENU
EXSTYLE WS_EX_TOOLWINDOW
CAPTION "User Defined Language v2.1"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
@ -261,8 +261,8 @@ BEGIN
CONTROL "Bold",IDC_STYLER_CHECK_BOLD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,31,90,13
CONTROL "Italic",IDC_STYLER_CHECK_ITALIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,45,90,13
CONTROL "Underline",IDC_STYLER_CHECK_UNDERLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,59,90,13
COMBOBOX IDC_STYLER_COMBO_FONT_NAME,65,32,104,80,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_STYLER_COMBO_FONT_SIZE,65,53,104,77,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_STYLER_COMBO_FONT_NAME,65,32,104,80,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_STYLER_COMBO_FONT_SIZE,65,53,104,77,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Foreground color:",IDC_STYLER_FG_STATIC,14,85,75,11
RTEXT "Background color:",IDC_STYLER_BG_STATIC,153,86,75,11
CONTROL "Delimiter 1",IDC_STYLER_CHECK_NESTING_DELIMITER1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,38,132,76,13