+ add: DarkMode: Toolbar, static checkbox/listbox control

This commit is contained in:
RaiKoHoff 2020-09-07 17:09:52 +02:00
parent 71a69c40ff
commit 3abf75e4f5
9 changed files with 292 additions and 222 deletions

View File

@ -147,8 +147,8 @@ extern "C" LRESULT OwnerDrawTextItem(HWND hwnd, WPARAM wParam, LPARAM lParam)
#ifdef D_NP3_WIN10_DARK_MODE
COLORREF g_rgbDarkBkgColor = 0;
COLORREF g_rgbDarkTextColor = 0;
COLORREF g_rgbDarkBkgColor = RGB(0x38, 0x38, 0x38);
COLORREF g_rgbDarkTextColor = RGB(0xEF, 0xEF, 0xEF);
#pragma comment(lib, "Comctl32.lib")
#pragma comment(lib, "Uxtheme.lib")
@ -360,7 +360,7 @@ constexpr COLORREF GetDarkBkgColor() {
// return color;
// }
//}
return 0x282828;
return RGB(0x38,0x38,0x38);
}
constexpr COLORREF GetDarkTextColor() {
@ -373,7 +373,7 @@ constexpr COLORREF GetDarkTextColor() {
// return color;
// }
//}
return 0xEFEFEF;
return RGB(0xEF, 0xEF, 0xEF);
}
@ -386,7 +386,7 @@ constexpr bool CheckBuildNumber(DWORD buildNumber) {
extern "C" void InitDarkMode()
{
{
g_rgbDarkBkgColor = GetDarkBkgColor();
g_rgbDarkTextColor = GetDarkTextColor();
g_hbrWndDarkBkgBrush = CreateSolidBrush(g_rgbDarkBkgColor);

View File

@ -2,8 +2,9 @@
#ifdef D_NP3_WIN10_DARK_MODE
struct SubclassInfo
{
extern HBRUSH g_hbrWndDarkBkgBrush;
struct SubclassInfo {
COLORREF headerTextColor;
};
@ -40,7 +41,7 @@ extern "C" void InitListView(HWND hListView)
{
if (IsDarkModeSupported())
{
HWND hHeader = ListView_GetHeader(hWnd);
HWND const hHeader = ListView_GetHeader(hWnd);
AllowDarkModeForWindow(hWnd, CheckDarkModeEnabled());
AllowDarkModeForWindow(hHeader, CheckDarkModeEnabled());
@ -129,7 +130,7 @@ extern "C" void InitTreeView(HWND hTreeView)
{
AllowDarkModeForWindow(hWnd, CheckDarkModeEnabled());
HTHEME hTheme = OpenThemeData(nullptr, L"ItemsView");
HTHEME const hTheme = OpenThemeData(nullptr, L"ItemsView");
if (hTheme)
{
COLORREF color;
@ -172,8 +173,8 @@ extern "C" void InitListView(HWND hListView) {
(void)(hListView);
}
extern "C" void InitTreeView(HWND hTreeView) {
(void)(hTreeView);
extern "C" void InitTreeView(HWND hToolbar) {
(void)(hToolbar);
}
#endif

View File

@ -241,21 +241,22 @@ static INT_PTR CALLBACK _InfoBoxLngDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
case WM_INITDIALOG:
{
SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)lParam);
SetDialogIconNP3(hwnd);
LPINFOBOXLNG const lpMsgBox = (LPINFOBOXLNG)lParam;
SetDialogIconNP3(hwnd);
InitWindowCommon(hwnd, true);
if (UseDarkMode())
{
#ifdef D_NP3_WIN10_DARK_MODE
if (UseDarkMode()) {
for (int btn = IDOK; btn <= IDCONTINUE; ++btn) {
HWND const hBtn = GetDlgItem(hwnd, btn);
if (hBtn) {
SetExplorerTheme(hBtn);
}
}
SetWindowTheme(GetDlgItem(hwnd, IDC_INFOBOXCHECK), L"", L"");
}
#endif
dpi = Scintilla_GetWindowDPI(hwnd);
@ -330,11 +331,12 @@ static INT_PTR CALLBACK _InfoBoxLngDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -584,11 +586,12 @@ static INT_PTR CALLBACK CmdLineHelpProc(HWND hwnd, UINT umsg, WPARAM wParam, LPA
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -645,15 +648,19 @@ INT_PTR DisplayCmdLineHelp(HWND hwnd)
//
int CALLBACK BFFCallBack(HWND hwnd, UINT umsg, LPARAM lParam, LPARAM lpData)
{
if (umsg == BFFM_INITIALIZED) {
SetDialogIconNP3(hwnd);
//?InitWindowCommon(hwnd, true);
SendMessage(hwnd, BFFM_SETSELECTION, true, lpData);
}
UNUSED(lParam);
return(0);
switch (umsg) {
case BFFM_INITIALIZED:
SetDialogIconNP3(hwnd);
//~InitWindowCommon(hwnd, true);
SendMessage(hwnd, BFFM_SETSELECTION, true, lpData);
break;
case BFFM_VALIDATEFAILED:
break;
default:
break;
}
return 0;
}
@ -679,7 +686,7 @@ bool GetDirectory(HWND hwndParent, int uiTitle, LPWSTR pszFolder, LPCWSTR pszBas
bi.pidlRoot = NULL;
bi.pszDisplayName = pszFolder;
bi.lpszTitle = szTitle;
bi.ulFlags = BIF_RETURNONLYFSDIRS | (bNewDialogStyle ? BIF_NEWDIALOGSTYLE : 0);
bi.ulFlags = BIF_RETURNONLYFSDIRS | (bNewDialogStyle ? (BIF_NEWDIALOGSTYLE | BIF_USENEWUI) : 0);
bi.lpfn = &BFFCallBack;
bi.lParam = (LPARAM)szBase;
bi.iImage = 0;
@ -960,24 +967,24 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
//case WM_ERASEBKGND:
// if (UseDarkMode()) {
// HDC const hdc = (HDC)wParam;
// SelectObject((HDC)wParam, g_hbrWndDarkBgrBrush);
// SelectObject((HDC)wParam, g_hbrWndDarkBkgBrush);
// RECT rc;
// GetClientRect(hwnd, &rc);
// SetMapMode(hdc, MM_ANISOTROPIC);
// SetWindowExtEx(hdc, 100, 100, NULL);
// SetViewportExtEx(hdc, rc.right, rc.bottom, NULL);
// FillRect(hdc, &rc, g_hbrWndDarkBgrBrush);
// FillRect(hdc, &rc, g_hbrWndDarkBkgBrush);
// }
// return TRUE;
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
}
break;
break;
case WM_SETTINGCHANGE:
@ -1214,11 +1221,12 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM l
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -1473,11 +1481,12 @@ static INT_PTR CALLBACK OpenWithDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -1663,7 +1672,7 @@ static INT_PTR CALLBACK FavoritesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
LVCOLUMN lvc = { LVCF_FMT | LVCF_TEXT, LVCFMT_LEFT, 0, L"", -1, 0, 0, 0 };
hwndLV = GetDlgItem(hwnd, IDC_FAVORITESDIR);
InitWindowCommon(hwndLV, false);
InitWindowCommon(hwndLV, true);
InitListView(hwndLV); // DarkMode
ListView_SetExtendedListViewStyle(hwndLV,/*LVS_EX_FULLROWSELECT|*/LVS_EX_DOUBLEBUFFER|LVS_EX_LABELTIP);
@ -1721,11 +1730,12 @@ static INT_PTR CALLBACK FavoritesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -1928,11 +1938,12 @@ static INT_PTR CALLBACK AddToFavDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPA
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -2134,6 +2145,10 @@ static INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPAR
SetExplorerTheme(GetDlgItem(hwnd, IDCANCEL));
SetExplorerTheme(GetDlgItem(hwnd, IDC_REMOVE));
SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
int const ctl[] = { IDC_SAVEMRU, IDC_PRESERVECARET, IDC_REMEMBERSEARCHPATTERN, IDC_STATIC };
for (int i = 0; i < COUNTOF(ctl); ++i) {
SetWindowTheme(GetDlgItem(hwnd, ctl[i]), L"", L""); // remove theme for BS_AUTORADIOBUTTON
}
}
#endif
// sync with other instances
@ -2247,11 +2262,12 @@ static INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPAR
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -2599,6 +2615,10 @@ static INT_PTR CALLBACK ChangeNotifyDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
SetExplorerTheme(GetDlgItem(hwnd, IDOK));
SetExplorerTheme(GetDlgItem(hwnd, IDCANCEL));
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
int const ctl[] = { 100, 101, 102, 103, -1 };
for (int i = 0; i < COUNTOF(ctl); ++i) {
SetWindowTheme(GetDlgItem(hwnd, ctl[i]), L"", L""); // remove theme for BS_AUTORADIOBUTTON
}
}
#endif
@ -2618,11 +2638,12 @@ static INT_PTR CALLBACK ChangeNotifyDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -2636,7 +2657,7 @@ static INT_PTR CALLBACK ChangeNotifyDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
AllowDarkModeForWindow(hwnd, darkModeEnabled);
RefreshTitleBarThemeColor(hwnd);
int const buttons[] = { IDOK, IDCANCEL };
int const buttons[] = { IDOK, IDCANCEL, 100, 101, 102, 103 };
for (int id = 0; id < COUNTOF(buttons); ++id) {
HWND const hBtn = GetDlgItem(hwnd, buttons[id]);
AllowDarkModeForWindow(hBtn, darkModeEnabled);
@ -2750,11 +2771,12 @@ static INT_PTR CALLBACK ColumnWrapDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, L
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -2861,6 +2883,10 @@ static INT_PTR CALLBACK WordWrapSettingsDlgProc(HWND hwnd, UINT umsg, WPARAM wPa
SetExplorerTheme(GetDlgItem(hwnd, IDOK));
SetExplorerTheme(GetDlgItem(hwnd, IDCANCEL));
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
int const ctl[] = { 100, 101, 102, 103, -1 };
for (int i = 0; i < COUNTOF(ctl); ++i) {
SetWindowTheme(GetDlgItem(hwnd, ctl[i]), L"", L""); // remove theme for BS_AUTORADIOBUTTON
}
}
#endif
@ -2898,11 +2924,12 @@ static INT_PTR CALLBACK WordWrapSettingsDlgProc(HWND hwnd, UINT umsg, WPARAM wPa
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -3007,6 +3034,10 @@ static INT_PTR CALLBACK LongLineSettingsDlgProc(HWND hwnd, UINT umsg, WPARAM wPa
SetExplorerTheme(GetDlgItem(hwnd, IDOK));
SetExplorerTheme(GetDlgItem(hwnd, IDCANCEL));
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
int const ctl[] = { IDC_SHOWEDGELINE, IDC_BACKGRDCOLOR, IDC_STATIC };
for (int i = 0; i < COUNTOF(ctl); ++i) {
SetWindowTheme(GetDlgItem(hwnd, ctl[i]), L"", L""); // remove theme for BS_AUTORADIOBUTTON
}
}
#endif
@ -3045,11 +3076,12 @@ static INT_PTR CALLBACK LongLineSettingsDlgProc(HWND hwnd, UINT umsg, WPARAM wPa
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -3180,6 +3212,11 @@ static INT_PTR CALLBACK TabSettingsDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPA
SetExplorerTheme(GetDlgItem(hwnd, IDOK));
SetExplorerTheme(GetDlgItem(hwnd, IDCANCEL));
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
int const ctl[] = { IDC_TAB_AS_SPC, IDC_TAB_INDENTS, IDC_BACKTAB_INDENTS,
IDC_WARN_INCONSISTENT_INDENTS, IDC_AUTO_DETECT_INDENTS, IDC_STATIC };
for (int i = 0; i < COUNTOF(ctl); ++i) {
SetWindowTheme(GetDlgItem(hwnd, ctl[i]), L"", L""); // remove theme for BS_AUTORADIOBUTTON
}
}
#endif
@ -3209,6 +3246,7 @@ static INT_PTR CALLBACK TabSettingsDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPA
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC: {
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
@ -3344,6 +3382,11 @@ static INT_PTR CALLBACK SelectDefEncodingDlgProc(HWND hwnd, UINT umsg, WPARAM wP
SetExplorerTheme(GetDlgItem(hwnd, IDCANCEL));
SetExplorerTheme(GetDlgItem(hwnd, IDC_ENCODINGLIST));
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
int const ctl[] = { IDC_USEASREADINGFALLBACK, IDC_ASCIIASUTF8, IDC_RELIABLE_DETECTION_RES, IDC_NFOASOEM,
IDC_ENCODINGFROMFILEVARS, IDC_NOUNICODEDETECTION, IDC_NOANSICPDETECTION, IDC_STATIC };
for (int i = 0; i < COUNTOF(ctl); ++i) {
SetWindowTheme(GetDlgItem(hwnd, ctl[i]), L"", L""); // remove theme for BS_AUTORADIOBUTTON
}
}
#endif
@ -3388,11 +3431,11 @@ static INT_PTR CALLBACK SelectDefEncodingDlgProc(HWND hwnd, UINT umsg, WPARAM wP
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -3611,11 +3654,12 @@ static INT_PTR CALLBACK SelectEncodingDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -3787,6 +3831,10 @@ static INT_PTR CALLBACK SelectDefLineEndingDlgProc(HWND hwnd,UINT umsg,WPARAM wP
SetExplorerTheme(GetDlgItem(hwnd, IDOK));
SetExplorerTheme(GetDlgItem(hwnd, IDCANCEL));
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
int const ctl[] = { IDC_EOLMODELIST, IDC_WARN_INCONSISTENT_EOLS, IDC_CONSISTENT_EOLS, IDC_AUTOSTRIPBLANKS, IDC_STATIC };
for (int i = 0; i < COUNTOF(ctl); ++i) {
SetWindowTheme(GetDlgItem(hwnd, ctl[i]), L"", L""); // remove theme for BS_AUTORADIOBUTTON
}
}
#endif
@ -3820,11 +3868,12 @@ static INT_PTR CALLBACK SelectDefLineEndingDlgProc(HWND hwnd,UINT umsg,WPARAM wP
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -3912,6 +3961,7 @@ static INT_PTR CALLBACK WarnLineEndingDlgProc(HWND hwnd, UINT umsg, WPARAM wPara
SetExplorerTheme(GetDlgItem(hwnd, IDOK));
SetExplorerTheme(GetDlgItem(hwnd, IDCANCEL));
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
SetWindowTheme(GetDlgItem(hwnd, IDC_WARN_INCONSISTENT_EOLS), L"", L""); // remove theme for BS_AUTORADIOBUTTON
}
#endif
@ -3949,11 +3999,12 @@ static INT_PTR CALLBACK WarnLineEndingDlgProc(HWND hwnd, UINT umsg, WPARAM wPara
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -4034,6 +4085,10 @@ static INT_PTR CALLBACK WarnIndentationDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
SetExplorerTheme(GetDlgItem(hwnd, IDOK));
SetExplorerTheme(GetDlgItem(hwnd, IDCANCEL));
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
int const ctl[] = { IDC_INDENT_BY_SPCS, IDC_INDENT_BY_TABS, IDC_WARN_INCONSISTENT_INDENTS, IDC_STATIC };
for (int i = 0; i < COUNTOF(ctl); ++i) {
SetWindowTheme(GetDlgItem(hwnd, ctl[i]), L"", L""); // remove theme for BS_AUTORADIOBUTTON
}
}
#endif
@ -4093,11 +4148,12 @@ static INT_PTR CALLBACK WarnIndentationDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {

View File

@ -82,7 +82,7 @@ void SetDlgPos(HWND hDlg, int xDlg, int yDlg);
//void SnapToDefaultButton(HWND);
inline void InitWindowCommon(HWND hwnd, bool bSetExplorerTheme) {
if (bSetExplorerTheme) { SetExplorerTheme(hwnd); }
if (bSetExplorerTheme) { SetExplorerTheme(hwnd); } else { SetWindowTheme(hwnd, L"", L""); }
SetWindowLayoutRTL(hwnd, Settings.DialogsLayoutRTL);
}

View File

@ -5627,14 +5627,17 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
#ifdef D_NP3_WIN10_DARK_MODE
if (UseDarkMode()) {
SetExplorerTheme(GetDlgItem(hwnd, IDOK));
SetExplorerTheme(GetDlgItem(hwnd, IDCANCEL));
SetExplorerTheme(GetDlgItem(hwnd, IDC_FINDPREV));
SetExplorerTheme(GetDlgItem(hwnd, IDC_REPLACE));
SetExplorerTheme(GetDlgItem(hwnd, IDC_REPLACEALL));
SetExplorerTheme(GetDlgItem(hwnd, IDC_REPLACEINSEL));
SetExplorerTheme(GetDlgItem(hwnd, IDC_SWAPSTRG));
SetExplorerTheme(GetDlgItem(hwnd, IDC_TOGGLE_VISIBILITY));
int const ctlx[] = { IDOK, IDCANCEL, IDC_FINDPREV, IDC_REPLACE, IDC_REPLACEALL,
IDC_REPLACEINSEL, IDC_SWAPSTRG, IDC_TOGGLE_VISIBILITY };
for (int i = 0; i < COUNTOF(ctlx); ++i) {
SetExplorerTheme(GetDlgItem(hwnd, ctlx[i]));
}
int const ctl[] = { IDC_FINDCASE, IDC_FINDWORD, IDC_FINDSTART, IDC_FINDTRANSFORMBS, IDC_FINDAUTOESCCTRLCHR,
IDC_FINDREGEXP, IDC_DOT_MATCH_ALL, IDC_FIND_OVERLAPPING, IDC_NOWRAP, IDC_FINDCLOSE,
IDC_ALL_OCCURRENCES, IDC_WILDCARDSEARCH, IDC_TRANSPARENT, IDC_STATIC };
for (int i = 0; i < COUNTOF(ctl); ++i) {
SetWindowTheme(GetDlgItem(hwnd, ctl[i]), L"", L""); // remove theme for BS_AUTORADIOBUTTON
}
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
}
#endif
@ -5908,41 +5911,83 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
#ifdef D_NP3_WIN10_DARK_MODE
case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC: {
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
case WM_CTLCOLORDLG:
//~case WM_CTLCOLOREDIT:
//~case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
SendMessage(hwnd, WM_THEMECHANGED, 0, 0);
}
break;
case WM_THEMECHANGED:
if (IsDarkModeSupported()) {
bool const darkModeEnabled = CheckDarkModeEnabled();
AllowDarkModeForWindow(hwnd, darkModeEnabled);
RefreshTitleBarThemeColor(hwnd);
int const buttons[] = { IDOK, IDCANCEL, IDC_FINDPREV, IDC_REPLACE, IDC_SWAPSTRG,
IDC_REPLACEALL, IDC_REPLACEINSEL, IDC_TOGGLE_VISIBILITY };
for (int i = 0; i < COUNTOF(buttons); ++i) {
HWND const hBtn = GetDlgItem(hwnd, buttons[i]);
AllowDarkModeForWindow(hBtn, darkModeEnabled);
SendMessage(hBtn, WM_THEMECHANGED, 0, 0);
}
} break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
SendMessage(hwnd, WM_THEMECHANGED, 0, 0);
}
break;
case WM_THEMECHANGED:
if (IsDarkModeSupported()) {
bool const darkModeEnabled = CheckDarkModeEnabled();
AllowDarkModeForWindow(hwnd, darkModeEnabled);
RefreshTitleBarThemeColor(hwnd);
int const buttons[] = { IDOK, IDCANCEL, IDC_FINDPREV, IDC_REPLACE, IDC_SWAPSTRG,
IDC_REPLACEALL, IDC_REPLACEINSEL, IDC_TOGGLE_VISIBILITY };
for (int id = 0; id < COUNTOF(buttons); ++id) {
HWND const hBtn = GetDlgItem(hwnd, buttons[id]);
AllowDarkModeForWindow(hBtn, darkModeEnabled);
SendMessage(hBtn, WM_THEMECHANGED, 0, 0);
}
UpdateWindow(hwnd);
}
break;
UpdateWindow(hwnd);
}
break;
#endif
case WM_CTLCOLOREDIT:
case WM_CTLCOLORLISTBOX:
{
if (sg_pefrData->bMarkOccurences) {
HWND hCheck = (HWND)lParam;
HDC hDC = (HDC)wParam;
case WM_ACTIVATE:
HWND hComboBox = GetDlgItem(hwnd, IDC_FINDTEXT);
COMBOBOXINFO ci = { sizeof(COMBOBOXINFO) };
GetComboBoxInfo(hComboBox, &ci);
//if (hCheck == ci.hwndItem || hCheck == ci.hwndList)
if (hCheck == ci.hwndItem) {
SetBkMode(hDC, TRANSPARENT);
INT_PTR hBrush;
switch (s_anyMatch) {
case MATCH:
//SetTextColor(hDC, green);
SetBkColor(hDC, rgbGreenColorRef);
hBrush = (INT_PTR)hBrushGreen;
break;
case NO_MATCH:
//SetTextColor(hDC, blue);
SetBkColor(hDC, rgbBlueColorRef);
hBrush = (INT_PTR)hBrushBlue;
break;
case INVALID:
default:
//SetTextColor(hDC, red);
SetBkColor(hDC, rgbRedColorRef);
hBrush = (INT_PTR)hBrushRed;
break;
}
return hBrush;
}
}
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
}
return FALSE;
case WM_ACTIVATE:
{
if (!sg_pefrData) { return false; }
@ -6528,49 +6573,6 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
}
break;
case WM_CTLCOLOREDIT:
case WM_CTLCOLORLISTBOX:
{
if (sg_pefrData->bMarkOccurences)
{
HWND hCheck = (HWND)lParam;
HDC hDC = (HDC)wParam;
HWND hComboBox = GetDlgItem(hwnd, IDC_FINDTEXT);
COMBOBOXINFO ci = { sizeof(COMBOBOXINFO) };
GetComboBoxInfo(hComboBox, &ci);
//if (hCheck == ci.hwndItem || hCheck == ci.hwndList)
if (hCheck == ci.hwndItem) {
SetBkMode(hDC, TRANSPARENT);
INT_PTR hBrush;
switch (s_anyMatch) {
case MATCH:
//SetTextColor(hDC, green);
SetBkColor(hDC, rgbGreenColorRef);
hBrush = (INT_PTR)hBrushGreen;
break;
case NO_MATCH:
//SetTextColor(hDC, blue);
SetBkColor(hDC, rgbBlueColorRef);
hBrush = (INT_PTR)hBrushBlue;
break;
case INVALID:
default:
//SetTextColor(hDC, red);
SetBkColor(hDC, rgbRedColorRef);
hBrush = (INT_PTR)hBrushRed;
break;
}
return hBrush;
}
}
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
}
return DefWindowProc(hwnd, umsg, wParam, lParam);
default:
break;
@ -8006,11 +8008,12 @@ static INT_PTR CALLBACK EditLinenumDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPA
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -8230,6 +8233,7 @@ static INT_PTR CALLBACK EditModifyLinesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
{
DWORD const dwId = GetWindowLong((HWND)lParam, GWL_ID);
@ -8417,6 +8421,10 @@ static INT_PTR CALLBACK EditAlignDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
SetExplorerTheme(GetDlgItem(hwnd, IDOK));
SetExplorerTheme(GetDlgItem(hwnd, IDCANCEL));
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
int const ctl[] = { 100, 101, 102, 103, 104, -1 };
for (int i = 0; i < COUNTOF(ctl); ++i) {
SetWindowTheme(GetDlgItem(hwnd, ctl[i]), L"", L""); // remove theme for BS_AUTORADIOBUTTON
}
}
#endif
CheckRadioButton(hwnd,100,104,*piAlignMode+100);
@ -8432,12 +8440,12 @@ static INT_PTR CALLBACK EditAlignDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -8560,12 +8568,12 @@ static INT_PTR CALLBACK EditEncloseSelectionDlgProc(HWND hwnd,UINT umsg,WPARAM w
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -8693,12 +8701,12 @@ static INT_PTR CALLBACK EditInsertTagDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,L
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -8855,13 +8863,11 @@ static INT_PTR CALLBACK EditSortDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM
if (UseDarkMode()) {
SetExplorerTheme(GetDlgItem(hwnd, IDOK));
SetExplorerTheme(GetDlgItem(hwnd, IDCANCEL));
//~SetExplorerTheme(GetDlgItem(hwnd, 100));
//~SetExplorerTheme(GetDlgItem(hwnd, 101));
//~SetExplorerTheme(GetDlgItem(hwnd, 102));
//~SetExplorerTheme(GetDlgItem(hwnd, 103));
//~SetExplorerTheme(GetDlgItem(hwnd, 104));
//~SetExplorerTheme(GetDlgItem(hwnd, 105));
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
int const ctl[] = { 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, -1 };
for (int i = 0; i < COUNTOF(ctl); ++i) {
SetWindowTheme(GetDlgItem(hwnd, ctl[i]), L"", L""); // remove theme for BS_AUTORADIOBUTTON
}
}
#endif
@ -8870,15 +8876,10 @@ static INT_PTR CALLBACK EditSortDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM
}
else if (*piSortFlags & SORT_SHUFFLE) {
CheckRadioButton(hwnd,100,102,102);
DialogEnableControl(hwnd,103,false);
DialogEnableControl(hwnd,104,false);
DialogEnableControl(hwnd,105,false);
DialogEnableControl(hwnd,106,false);
DialogEnableControl(hwnd,107,false);
DialogEnableControl(hwnd,108,false);
DialogEnableControl(hwnd,109,false);
DialogEnableControl(hwnd,110,false);
DialogEnableControl(hwnd,111,false);
int const ctl[] = { 103, 104, 105, 106, 107, 108, 109, 110, 111, 112 };
for (int i = 0; i < COUNTOF(ctl); ++i) {
DialogEnableControl(hwnd, ctl[i], false);
}
}
else {
CheckRadioButton(hwnd, 100, 102, 100);
@ -8947,11 +8948,13 @@ static INT_PTR CALLBACK EditSortDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
//~case WM_CTLCOLORBTN: - BS_AUTORADIOBUTTON
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -8965,7 +8968,7 @@ static INT_PTR CALLBACK EditSortDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM
AllowDarkModeForWindow(hwnd, darkModeEnabled);
RefreshTitleBarThemeColor(hwnd);
int const buttons[] = { IDOK, IDCANCEL/*, 100, 101, 102, 103, 104, 105*/ };
int const buttons[] = { IDOK, IDCANCEL, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112 };
for (int id = 0; id < COUNTOF(buttons); ++id) {
HWND const hBtn = GetDlgItem(hwnd, buttons[id]);
AllowDarkModeForWindow(hBtn, darkModeEnabled);

View File

@ -157,6 +157,19 @@ inline bool IsAsyncKeyDown(int key) { return (((GetAsyncKeyState(key) >> 8) & 0x
// ----------------------------------------------------------------------------
#define RGB_SUB(X, Y) (((X) > (Y)) ? ((X) - (Y)) : ((Y) - (X)))
inline COLORREF CalcContrastColor(COLORREF rgb, int alpha) {
bool const mask = RGB_SUB(MulDiv(rgb >> 0, alpha, SC_ALPHA_OPAQUE) & SC_ALPHA_OPAQUE, 0x80) <= 0x20 &&
RGB_SUB(MulDiv(rgb >> 8, alpha, SC_ALPHA_OPAQUE) & SC_ALPHA_OPAQUE, 0x80) <= 0x20 &&
RGB_SUB(MulDiv(rgb >> 16, alpha, SC_ALPHA_OPAQUE) & SC_ALPHA_OPAQUE, 0x80) <= 0x20;
return mask ? ((0x7F7F7F + rgb)) & 0xFFFFFF : (rgb ^ 0xFFFFFF);
}
// ----------------------------------------------------------------------------
#define SendWMCommandEx(hwnd, id, extra) SendMessage((hwnd), WM_COMMAND, MAKEWPARAM((id), (extra)), 0)
#define SendWMCommand(hwnd, id) SendWMCommandEx((hwnd), (id), 1)
#define PostWMCommand(hwnd, id) PostMessage((hwnd), WM_COMMAND, MAKEWPARAM((id), 1), 0)

View File

@ -118,7 +118,6 @@ static WCHAR s_wchWndClass[64] = { L'\0' };
static HWND s_hwndEditFrame = NULL;
static HWND s_hwndNextCBChain = NULL;
static HWND s_hwndReBar = NULL;
static WCHAR s_wchTmpFilePath[MAX_PATH] = { L'\0' };
@ -1887,7 +1886,7 @@ static void _SetWrapVisualFlags(HWND hwndEditCtrl)
//
static void _InitializeSciEditCtrl(HWND hwndEditCtrl)
{
InitWindowCommon(hwndEditCtrl, false);
InitWindowCommon(hwndEditCtrl, true);
SendMessage(hwndEditCtrl, SCI_SETTECHNOLOGY, (WPARAM)Settings.RenderingTechnology, 0);
Settings.RenderingTechnology = SciCall_GetTechnology();
@ -2190,7 +2189,7 @@ LRESULT MsgCreate(HWND hwnd, WPARAM wParam,LPARAM lParam)
DragAcceptFiles(hwnd,true);
if (Globals.hwndEdit == NULL || s_hwndEditFrame == NULL ||
Globals.hwndStatus == NULL || Globals.hwndToolbar == NULL || s_hwndReBar == NULL) {
Globals.hwndStatus == NULL || Globals.hwndToolbar == NULL || Globals.hwndRebar == NULL) {
return -1LL;
}
Style_SetDefaultLexer(Globals.hwndEdit);
@ -2381,7 +2380,7 @@ static HIMAGELIST CreateScaledImageListFromBitmap(HWND hWnd, HBITMAP hBmp)
//
void CreateBars(HWND hwnd, HINSTANCE hInstance)
{
DWORD dwToolbarStyle = NP3_WS_TOOLBAR | TBSTYLE_TRANSPARENT;
DWORD dwToolbarStyle = NP3_WS_TOOLBAR /*| TBSTYLE_CUSTOMERASE */ | TBSTYLE_TRANSPARENT;
DWORD dwToolbarExStyle = TBSTYLE_EX_DOUBLEBUFFER /* | TBSTYLE_EX_HIDECLIPPEDBUTTONS */;
if (Settings.ToolBarTheme < 0) { // undefined: determine High DPI screen
@ -2418,19 +2417,12 @@ void CreateBars(HWND hwnd, HINSTANCE hInstance)
// hInstance, // handle to application instance
// NULL); // no window creation data
//~InitWindowCommon(Globals.hwndToolbar, true); ~ SetWindowLayoutRTL() no correct behavior
//~SetWindowTheme(Globals.hwndToolbar, L"", L""); // you cannot change a toolbar's color when a visual style is active
SetExplorerTheme(Globals.hwndToolbar);
InitWindowCommon(Globals.hwndToolbar, true);
#ifdef D_NP3_WIN10_DARK_MODE
if (IsDarkModeSupported()) {
AllowDarkModeForWindow(Globals.hwndToolbar, CheckDarkModeEnabled());
}
//~ no effect:
//~HDC const hdcTB = GetWindowDC(Globals.hwndToolbar);
//~SelectObject(hdcTB, g_hbrWndDarkBgrBrush);
//~SetBkColor(hdcTB, Globals.rgbDarkBkgColor);
//~ReleaseDC(Globals.hwndToolbar, hdcTB);
#endif
SendMessage(Globals.hwndToolbar,TB_BUTTONSTRUCTSIZE,(WPARAM)sizeof(TBBUTTON),0);
@ -2587,40 +2579,48 @@ void CreateBars(HWND hwnd, HINSTANCE hInstance)
// ------------------------------
DWORD const dwReBarStyle = Settings.ShowToolbar ? (NP3_WS_REBAR | WS_VISIBLE) : (NP3_WS_REBAR);
if (s_hwndReBar) { DestroyWindow(s_hwndReBar); }
if (Globals.hwndRebar) {
DestroyWindow(Globals.hwndRebar);
}
Globals.hwndRebar = CreateWindowEx(WS_EX_TOOLWINDOW, REBARCLASSNAME, NULL, dwReBarStyle,
0,0,0,0,hwnd,(HMENU)IDC_REBAR,hInstance,NULL);
s_hwndReBar = CreateWindowEx(WS_EX_TOOLWINDOW,REBARCLASSNAME,NULL,dwReBarStyle,
0,0,0,0,hwnd,(HMENU)IDC_REBAR,hInstance,NULL);
InitWindowCommon(Globals.hwndRebar, false); // false(!) ~ you cannot change a toolbar's color when a visual style is active
SetExplorerTheme(s_hwndReBar);
#ifdef D_NP3_WIN10_DARK_MODE
if (IsDarkModeSupported()) {
AllowDarkModeForWindow(Globals.hwndRebar, CheckDarkModeEnabled());
}
#endif
REBARINFO rbi;
rbi.cbSize = sizeof(REBARINFO);
rbi.fMask = 0;
rbi.himl = (HIMAGELIST)NULL;
SendMessage(s_hwndReBar,RB_SETBARINFO,0,(LPARAM)&rbi);
SendMessage(Globals.hwndRebar, RB_SETBARINFO, 0, (LPARAM)&rbi);
RECT rc;
SendMessage(Globals.hwndToolbar, TB_GETITEMRECT, 0, (LPARAM)&rc);
//SendMessage(Globals.hwndToolbar,TB_SETINDENT,2,0);
REBARBANDINFO rbBand; ZeroMemory(&rbBand, sizeof(REBARBANDINFO));
rbBand.cbSize = sizeof(REBARBANDINFO);
rbBand.fMask = /*RBBIM_COLORS | RBBIM_TEXT | RBBIM_BACKGROUND | */
rbBand.fMask = RBBIM_COLORS /*| RBBIM_TEXT | RBBIM_BACKGROUND */ |
RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE /*| RBBIM_SIZE*/;
//rbBand.fStyle = /*RBBS_CHILDEDGE |*//* RBBS_BREAK |*/ RBBS_FIXEDSIZE /*| RBBS_GRIPPERALWAYS*/;
rbBand.fStyle = s_bIsAppThemed ? (RBBS_FIXEDSIZE | RBBS_CHILDEDGE) : RBBS_FIXEDSIZE;
rbBand.hbmBack = NULL;
rbBand.lpText = L"Toolbar";
rbBand.lpText = L"Toolbar";
rbBand.clrFore = UseDarkMode() ? g_rgbDarkTextColor : (COLORREF)GetSysColor(COLOR_WINDOWTEXT);
rbBand.clrBack = UseDarkMode() ? g_rgbDarkBkgColor : (COLORREF)GetSysColor(COLOR_WINDOW);
rbBand.hwndChild = Globals.hwndToolbar;
rbBand.cxMinChild = (rc.right - rc.left) * COUNTOF(s_tbbMainWnd);
rbBand.cyMinChild = (rc.bottom - rc.top) + 2 * rc.top;
rbBand.cx = 0;
SendMessage(s_hwndReBar,RB_INSERTBAND,(WPARAM)-1,(LPARAM)&rbBand);
SendMessage(Globals.hwndRebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
SetWindowPos(s_hwndReBar,NULL,0,0,0,0,SWP_NOZORDER);
GetWindowRect(s_hwndReBar,&rc);
SetWindowPos(Globals.hwndRebar, NULL, 0, 0, 0, 0, SWP_NOZORDER);
GetWindowRect(Globals.hwndRebar, &rc);
s_cyReBar = rc.bottom - rc.top;
s_cyReBarFrame = s_bIsAppThemed ? 0 : 2;
@ -2849,13 +2849,13 @@ LRESULT MsgSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
cy -= (rc.bottom - rc.top);*/
//SendMessage(Globals.hwndToolbar,TB_GETITEMRECT,0,(LPARAM)&rc);
SetWindowPos(s_hwndReBar,NULL,0,0,LOWORD(lParam),s_cyReBar,SWP_NOZORDER);
SetWindowPos(Globals.hwndRebar, NULL, 0, 0, LOWORD(lParam), s_cyReBar, SWP_NOZORDER);
// the ReBar automatically sets the correct height
// calling SetWindowPos() with the height of one toolbar button
// causes the control not to temporarily use the whole client area
// and prevents flickering
//GetWindowRect(s_hwndReBar,&rc);
//GetWindowRect(Globals.hwndRebar,&rc);
y = s_cyReBar + s_cyReBarFrame; // define
cy -= s_cyReBar + s_cyReBarFrame; // border
}
@ -5683,7 +5683,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
case IDM_VIEW_TOOLBAR:
Settings.ShowToolbar = !Settings.ShowToolbar;
ShowWindow(s_hwndReBar, (Settings.ShowToolbar ? SW_SHOW : SW_HIDE));
ShowWindow(Globals.hwndRebar, (Settings.ShowToolbar ? SW_SHOW : SW_HIDE));
SendWMSize(hwnd, NULL);
break;
@ -5826,7 +5826,8 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
case IDM_SET_RTL_LAYOUT_DLG:
Settings.DialogsLayoutRTL = !Settings.DialogsLayoutRTL;
SetWindowLayoutRTL(Globals.hwndMain, Settings.DialogsLayoutRTL);
//~SetWindowLayoutRTL(Globals.hwndToolbar, Settings.DialogsLayoutRTL); ~ not working correct
SetWindowLayoutRTL(Globals.hwndToolbar, Settings.DialogsLayoutRTL);
SetWindowLayoutRTL(Globals.hwndRebar, Settings.DialogsLayoutRTL);
SetWindowLayoutRTL(Globals.hwndStatus, Settings.DialogsLayoutRTL);
break;
@ -6806,21 +6807,6 @@ void HandlePosChange()
//
static DocPos prevCursorPosition = -1;
#define RGB_TOLERANCE 0x20
#define RGB_SUB(X, Y) (((X) > (Y)) ? ((X) - (Y)) : ((Y) - (X)))
inline COLORREF _CalcContrastColor(COLORREF rgb, int alpha)
{
bool const mask = RGB_SUB(MulDiv(rgb >> 0, alpha, SC_ALPHA_OPAQUE) & SC_ALPHA_OPAQUE, 0x80) <= RGB_TOLERANCE &&
RGB_SUB(MulDiv(rgb >> 8, alpha, SC_ALPHA_OPAQUE) & SC_ALPHA_OPAQUE, 0x80) <= RGB_TOLERANCE &&
RGB_SUB(MulDiv(rgb >> 16, alpha, SC_ALPHA_OPAQUE) & SC_ALPHA_OPAQUE, 0x80) <= RGB_TOLERANCE;
return mask ? ((0x7F7F7F + rgb)) & 0xFFFFFF : (rgb ^ 0xFFFFFF);
}
// ----------------------------------------------------------------------------
#define ARGB_TO_COLREF(X) (RGB(((X) >> 16) & SC_ALPHA_OPAQUE, ((X) >> 8) & SC_ALPHA_OPAQUE, (X) & SC_ALPHA_OPAQUE))
#define RGBA_TO_COLREF(X) (RGB(((X) >> 24) & SC_ALPHA_OPAQUE, ((X) >> 16) & SC_ALPHA_OPAQUE, ((X) >> 8) & SC_ALPHA_OPAQUE))
#define BGRA_TO_COLREF(X) (RGB(((X) >> 8) & SC_ALPHA_OPAQUE, ((X) >> 16) & SC_ALPHA_OPAQUE, ((X) >> 24) & SC_ALPHA_OPAQUE))
@ -6963,7 +6949,7 @@ void HandleDWellStartEnd(const DocPos position, const UINT uid)
rgb = RGB((iValue >> 16) & 0xFF, (iValue >> 8) & 0xFF, iValue & 0xFF);
alpha = SC_ALPHA_OPAQUE;
}
COLORREF const fgr = _CalcContrastColor(rgb, alpha);
COLORREF const fgr = CalcContrastColor(rgb, alpha);
SciCall_SetIndicatorCurrent(INDIC_NP3_COLOR_DEF_T);
SciCall_IndicatorFillRange(firstPos, length);

View File

@ -1839,6 +1839,7 @@ void Style_SetMargin(HWND hwnd, int iStyle, LPCWSTR lpszStyle)
// occurrence bookmarker
bool const visible = Settings.MarkOccurrencesBookmark;
SciCall_MarkerDefine(MARKER_NP3_OCCURRENCE, visible ? SC_MARK_ARROWS : SC_MARK_BACKGROUND);
SciCall_MarkerSetFore(MARKER_NP3_OCCURRENCE, CalcContrastColor(clrBack, 100));
SciCall_MarkerSetAlpha(MARKER_NP3_OCCURRENCE, SC_ALPHA_TRANSPARENT);
// --- WordBookMarks ---
@ -4047,6 +4048,9 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
SetExplorerTheme(GetDlgItem(hwnd, IDC_IMPORT));
SetExplorerTheme(GetDlgItem(hwnd, IDC_EXPORT));
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
// remove themes to colorize static controls correctly
SetWindowTheme(GetDlgItem(hwnd, IDC_STATIC), L"", L"");
SetWindowTheme(GetDlgItem(hwnd, IDC_INFO_GROUPBOX), L"", L"");
}
#endif
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
@ -4225,11 +4229,12 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {
@ -4832,6 +4837,10 @@ INT_PTR CALLBACK Style_SelectLexerDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPAR
SetExplorerTheme(GetDlgItem(hwnd, IDOK));
SetExplorerTheme(GetDlgItem(hwnd, IDCANCEL));
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
int const ctl[] = { IDC_DEFAULTSCHEME, IDC_AUTOSELECT, IDC_STATIC };
for (int i = 0; i < COUNTOF(ctl); ++i) {
SetWindowTheme(GetDlgItem(hwnd, ctl[i]), L"", L""); // remove theme for BS_AUTORADIOBUTTON
}
}
#endif
@ -4928,11 +4937,12 @@ INT_PTR CALLBACK Style_SelectLexerDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPAR
case WM_CTLCOLORDLG:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC: {
case WM_CTLCOLORLISTBOX:
case WM_CTLCOLORSTATIC:
if (UseDarkMode()) {
return SetDarkModeCtlColors((HDC)wParam);
}
} break;
break;
case WM_SETTINGCHANGE:
if (IsDarkModeSupported() && IsColorSchemeChangeMessage(lParam)) {

View File

@ -334,6 +334,7 @@ typedef struct _globals_t
HWND hwndEdit;
HANDLE hndlScintilla;
HANDLE hwndToolbar;
HANDLE hwndRebar;
HWND hwndStatus;
DWORD dwLastError;
HMENU hMainMenu;