diff --git a/language/ColorDlg.h b/language/ColorDlg.h
new file mode 100644
index 000000000..b65dc1b69
--- /dev/null
+++ b/language/ColorDlg.h
@@ -0,0 +1,63 @@
+/*++
+
+Copyright (c) 1990-1999, Microsoft Corporation All rights reserved.
+
+Module Name:
+
+ colordlg.h
+
+Abstract:
+
+ This module contains the header information for the Win32 color dialog.
+
+Revision History:
+
+--*/
+
+
+#if _MSC_VER > 1000
+#pragma once
+#endif
+
+#ifndef _INC_COLORDLG
+#define _INC_COLORDLG
+
+#define DLG_COLOR 10
+
+#define COLOR_HUESCROLL 700 /* color dialog */
+#define COLOR_SATSCROLL 701
+#define COLOR_LUMSCROLL 702
+#define COLOR_HUE 703
+#define COLOR_SAT 704
+#define COLOR_LUM 705
+#define COLOR_RED 706
+#define COLOR_GREEN 707
+#define COLOR_BLUE 708
+#define COLOR_CURRENT 709
+#define COLOR_RAINBOW 710
+#define COLOR_SAVE 711
+#define COLOR_ADD 712
+#define COLOR_SOLID 713
+#define COLOR_TUNE 714
+#define COLOR_SCHEMES 715
+#define COLOR_ELEMENT 716
+#define COLOR_SAMPLES 717
+#define COLOR_PALETTE 718
+#define COLOR_MIX 719
+#define COLOR_BOX1 720
+#define COLOR_CUSTOM1 721
+
+#define COLOR_HUEACCEL 723
+#define COLOR_SATACCEL 724
+#define COLOR_LUMACCEL 725
+#define COLOR_REDACCEL 726
+#define COLOR_GREENACCEL 727
+#define COLOR_BLUEACCEL 728
+
+#define COLOR_SOLID_LEFT 730
+#define COLOR_SOLID_RIGHT 731
+
+#define NUM_BASIC_COLORS 48
+#define NUM_CUSTOM_COLORS 16
+
+#endif /* !_INC_COLORDLG */
diff --git a/language/common_res.h b/language/common_res.h
index 0e5a6d57e..92c57a251 100644
--- a/language/common_res.h
+++ b/language/common_res.h
@@ -5,6 +5,8 @@
#ifndef _COMMON_RES_H_
#define _COMMON_RES_H_
+#include "ColorDlg.h"
+
// undefined Sub-Language
#define SUBLANG_SPANISH_LATIN_AMERICA 0x16
@@ -316,6 +318,7 @@
#define IDD_MUI_CMDLINEHELP 17037
#define IDD_MUI_SYSFONT_WITHLINK 17038
+#define IDD_MUI_SYSCOLOR_DLG 17039
#define IDC_COMMANDLINE 18000
#define IDC_SEARCHEXE 18001
diff --git a/language/np3_de_de/dialogs_de_de.rc b/language/np3_de_de/dialogs_de_de.rc
index 85c3f4c42..59379e913 100644
--- a/language/np3_de_de/dialogs_de_de.rc
+++ b/language/np3_de_de/dialogs_de_de.rc
@@ -747,6 +747,67 @@ PUSHBUTTON "&Hilfe", pshHelp, 43, 215, 45, 14, WS_GROUP
END
+//
+// ChooseColor Dialog (copied from Color.dlg).
+//
+
+IDD_MUI_SYSCOLOR_DLG DIALOGEX LOADONCALL MOVEABLE DISCARDABLE 2, 0, 298, 184
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Wähle eine Farbe"
+FONT 9, "Segoe UI", 0, 0, 0x0
+BEGIN
+ LTEXT "&Basis Farben:", -1, 4, 4, 140, 9
+ CONTROL "", COLOR_BOX1, "static",
+ SS_SIMPLE | WS_CHILD | WS_TABSTOP | WS_GROUP,
+ 4, 14, 140, 86
+
+ LTEXT "&Eigene Farben:", -1, 4, 106, 140, 9
+ CONTROL "", COLOR_CUSTOM1, "static",
+ SS_SIMPLE | WS_CHILD | WS_TABSTOP | WS_GROUP,
+ 4, 116, 140, 28
+
+ PUSHBUTTON "&Defiere Eigene Farben >>" COLOR_MIX, 4, 150, 138, 14,
+ WS_TABSTOP | WS_GROUP
+
+ DEFPUSHBUTTON "OK", IDOK, 4, 166, 44, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Abbrechen", IDCANCEL, 52, 166, 44, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "&Hilfe", pshHelp, 100, 166, 44, 14, WS_GROUP | WS_TABSTOP
+
+ CONTROL "", COLOR_RAINBOW, "static",
+ SS_SIMPLE | WS_CHILD, 152, 4, 118, 116
+
+ CONTROL "", COLOR_LUMSCROLL, "static",
+ SS_SIMPLE | WS_CHILD, 280, 4, 8, 116
+
+ CONTROL "", COLOR_CURRENT, "static",
+ SS_SIMPLE | WS_CHILD, 152, 124, 40, 26
+
+ PUSHBUTTON "&o", COLOR_SOLID, 300, 200, 4, 14, WS_GROUP
+ RTEXT "Farbe", COLOR_SOLID_LEFT, 152, 151, 20, 9
+ LTEXT "|S&olid", COLOR_SOLID_RIGHT, 172, 151, 20, 9
+
+ RTEXT "To&n:", COLOR_HUEACCEL, 194, 126, 20, 9
+ EDITTEXT, COLOR_HUE, 216, 124, 18, 12, WS_GROUP | WS_TABSTOP
+
+ RTEXT "&Sät:", COLOR_SATACCEL, 194, 140, 20, 9
+ EDITTEXT, COLOR_SAT, 216, 138, 18, 12, WS_GROUP | WS_TABSTOP
+
+ RTEXT "&Leu:", COLOR_LUMACCEL, 194, 154, 20, 9
+ EDITTEXT, COLOR_LUM, 216, 152, 18, 12, WS_GROUP | WS_TABSTOP
+
+ RTEXT "&Rot:", COLOR_REDACCEL, 243, 126, 24, 9
+ EDITTEXT, COLOR_RED, 269, 124, 18, 12, WS_GROUP | WS_TABSTOP
+
+ RTEXT "&Grün:", COLOR_GREENACCEL, 243, 140, 24, 9
+ EDITTEXT, COLOR_GREEN, 269, 138, 18, 12, WS_GROUP | WS_TABSTOP
+
+ RTEXT "Bla&u:", COLOR_BLUEACCEL, 243, 154, 24, 9
+ EDITTEXT, COLOR_BLUE, 269, 152, 18, 12, WS_GROUP | WS_TABSTOP
+
+ PUSHBUTTON "&Füge Eigenen Farben hinzu", COLOR_ADD, 152, 166, 142, 14,
+ WS_GROUP | WS_TABSTOP
+END
+
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/language/np3_en_us/dialogs_en_us.rc b/language/np3_en_us/dialogs_en_us.rc
index 966feee40..904aa3aee 100644
--- a/language/np3_en_us/dialogs_en_us.rc
+++ b/language/np3_en_us/dialogs_en_us.rc
@@ -747,6 +747,68 @@ BEGIN
END
+//
+// ChooseColor Dialog (copied from Color.dlg).
+//
+
+IDD_MUI_SYSCOLOR_DLG DIALOGEX LOADONCALL MOVEABLE DISCARDABLE 2, 0, 298, 184
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Choose Color"
+FONT 9, "Segoe UI", 0, 0, 0x0
+BEGIN
+ LTEXT "&Basic colors:", -1, 4, 4, 140, 9
+ CONTROL "", COLOR_BOX1, "static",
+ SS_SIMPLE | WS_CHILD | WS_TABSTOP | WS_GROUP,
+ 4, 14, 140, 86
+
+ LTEXT "&Custom colors:", -1, 4, 106, 140, 9
+ CONTROL "", COLOR_CUSTOM1, "static",
+ SS_SIMPLE | WS_CHILD | WS_TABSTOP | WS_GROUP,
+ 4, 116, 140, 28
+
+ PUSHBUTTON "&Define Custom Colors >>" COLOR_MIX, 4, 150, 138, 14,
+ WS_TABSTOP | WS_GROUP
+
+ DEFPUSHBUTTON "OK", IDOK, 4, 166, 44, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Cancel", IDCANCEL, 52, 166, 44, 14, WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "&Help", pshHelp, 100, 166, 44, 14, WS_GROUP | WS_TABSTOP
+
+ CONTROL "", COLOR_RAINBOW, "static",
+ SS_SIMPLE | WS_CHILD, 152, 4, 118, 116
+
+ CONTROL "", COLOR_LUMSCROLL, "static",
+ SS_SIMPLE | WS_CHILD, 280, 4, 8, 116
+
+ CONTROL "", COLOR_CURRENT, "static",
+ SS_SIMPLE | WS_CHILD, 152, 124, 40, 26
+
+ PUSHBUTTON "&o", COLOR_SOLID, 300, 200, 4, 14, WS_GROUP
+ RTEXT "Color", COLOR_SOLID_LEFT, 152, 151, 20, 9
+ LTEXT "|S&olid", COLOR_SOLID_RIGHT, 172, 151, 20, 9
+
+ RTEXT "Hu&e:", COLOR_HUEACCEL, 194, 126, 20, 9
+ EDITTEXT, COLOR_HUE, 216, 124, 18, 12, WS_GROUP | WS_TABSTOP
+
+ RTEXT "&Sat:", COLOR_SATACCEL, 194, 140, 20, 9
+ EDITTEXT, COLOR_SAT, 216, 138, 18, 12, WS_GROUP | WS_TABSTOP
+
+ RTEXT "&Lum:", COLOR_LUMACCEL, 194, 154, 20, 9
+ EDITTEXT, COLOR_LUM, 216, 152, 18, 12, WS_GROUP | WS_TABSTOP
+
+ RTEXT "&Red:", COLOR_REDACCEL, 243, 126, 24, 9
+ EDITTEXT, COLOR_RED, 269, 124, 18, 12, WS_GROUP | WS_TABSTOP
+
+ RTEXT "&Green:", COLOR_GREENACCEL, 243, 140, 24, 9
+ EDITTEXT, COLOR_GREEN, 269, 138, 18, 12, WS_GROUP | WS_TABSTOP
+
+ RTEXT "Bl&ue:", COLOR_BLUEACCEL, 243, 154, 24, 9
+ EDITTEXT, COLOR_BLUE, 269, 152, 18, 12, WS_GROUP | WS_TABSTOP
+
+ PUSHBUTTON "&Add to Custom Colors", COLOR_ADD, 152, 166, 142, 14,
+ WS_GROUP | WS_TABSTOP
+END
+
+
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/src/Dialogs.c b/src/Dialogs.c
index 57b7e61c4..6dbbb2cf6 100644
--- a/src/Dialogs.c
+++ b/src/Dialogs.c
@@ -43,7 +43,6 @@
#include "SciCall.h"
-//#include "win/ColorDlg.h" // Color Dialog API infos
#include "Dialogs.h"
//=============================================================================
@@ -5232,30 +5231,32 @@ void ResizeDlg_Destroy(HWND hwnd, int* cxFrame, int* cyFrame)
void ResizeDlg_Size(HWND hwnd, LPARAM lParam, int* cx, int* cy)
{
PRESIZEDLG pm = (PRESIZEDLG)GetProp(hwnd, RESIZEDLG_PROP_KEY);
- const int cxClient = LOWORD(lParam);
- const int cyClient = HIWORD(lParam);
+ if (pm) {
+ const int cxClient = LOWORD(lParam);
+ const int cyClient = HIWORD(lParam);
#if NP3_ENABLE_RESIZEDLG_TEMP_FIX
- const UINT dpi = Scintilla_GetWindowDPI(hwnd);
- const UINT old = pm->dpi;
- if (cx) {
- *cx = cxClient - MulDiv(pm->cxClient, dpi, old);
- }
- if (cy) {
- *cy = cyClient - MulDiv(pm->cyClient, dpi, old);
- }
- // store in original DPI.
- pm->cxClient = MulDiv(cxClient, old, dpi);
- pm->cyClient = MulDiv(cyClient, old, dpi);
+ const UINT dpi = Scintilla_GetWindowDPI(hwnd);
+ const UINT old = pm->dpi;
+ if (cx) {
+ *cx = cxClient - MulDiv(pm->cxClient, dpi, old);
+ }
+ if (cy) {
+ *cy = cyClient - MulDiv(pm->cyClient, dpi, old);
+ }
+ // store in original DPI.
+ pm->cxClient = MulDiv(cxClient, old, dpi);
+ pm->cyClient = MulDiv(cyClient, old, dpi);
#else
- if (cx) {
- *cx = cxClient - pm->cxClient;
- }
- if (cy) {
- *cy = cyClient - pm->cyClient;
- }
- pm->cxClient = cxClient;
- pm->cyClient = cyClient;
+ if (cx) {
+ *cx = cxClient - pm->cxClient;
+ }
+ if (cy) {
+ *cy = cyClient - pm->cyClient;
+ }
+ pm->cxClient = cxClient;
+ pm->cyClient = cyClient;
#endif
+ }
}
void ResizeDlg_GetMinMaxInfo(HWND hwnd, LPARAM lParam)
@@ -6080,7 +6081,7 @@ INT_PTR CALLBACK FontDialogHookProc(
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
int const ctl[] = { grp1, grp2, chx1, chx2, cmb1, cmb2, cmb3, cmb4, cmb5, stc1, stc2, stc3, stc4, stc5, stc6, stc7 };
for (int i = 0; i < COUNTOF(ctl); ++i) {
- SetWindowTheme(GetDlgItem(hdlg, ctl[i]), L"", L""); // remove theme for BS_AUTORADIOBUTTON
+ SetWindowTheme(GetDlgItem(hdlg, ctl[i]), L"", L""); // remove theme
}
}
#endif
@@ -6145,8 +6146,7 @@ INT_PTR CALLBACK FontDialogHookProc(
UpdateWindowLayoutForDPI(hdlg, (RECT *)lParam, 0);
int const ctl[] = { cmb1, cmb2, cmb3, cmb4, cmb5 };
for (int i = 0; i < COUNTOF(ctl); ++i) {
- //HFONT const hFont = (HFONT)SendMessage(GetDlgItem(hdlg, ctl[i]), WM_GETFONT, 0, 0);
- HFONT const hFont = 0;
+ HFONT const hFont = (HFONT)SendMessage(GetDlgItem(hdlg, ctl[i]), WM_GETFONT, 0, 0);
SendMessage(GetDlgItem(hdlg, ctl[i]), WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
}
return TRUE;
@@ -6188,10 +6188,12 @@ INT_PTR CALLBACK ColorDialogHookProc(
if (UseDarkMode()) {
SetExplorerTheme(GetDlgItem(hdlg, IDOK));
SetExplorerTheme(GetDlgItem(hdlg, IDCANCEL));
+ SetExplorerTheme(GetDlgItem(hdlg, COLOR_ADD));
+ SetExplorerTheme(GetDlgItem(hdlg, COLOR_MIX));
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
- int const ctl[] = { IDC_STATIC };
+ int const ctl[] = { COLOR_RAINBOW, COLOR_LUMSCROLL, COLOR_CURRENT, IDC_STATIC };
for (int i = 0; i < COUNTOF(ctl); ++i) {
- SetWindowTheme(GetDlgItem(hdlg, ctl[i]), L"", L""); // remove theme for BS_AUTORADIOBUTTON
+ SetWindowTheme(GetDlgItem(hdlg, ctl[i]), L"", L""); // remove theme
}
}
#endif
@@ -6228,7 +6230,7 @@ INT_PTR CALLBACK ColorDialogHookProc(
bool const darkModeEnabled = CheckDarkModeEnabled();
AllowDarkModeForWindowEx(hdlg, darkModeEnabled);
RefreshTitleBarThemeColor(hdlg);
- int const buttons[] = { /*COLOR_MIX,*/ IDOK, IDCANCEL };
+ int const buttons[] = { IDOK, IDCANCEL };
for (int id = 0; id < COUNTOF(buttons); ++id) {
HWND const hBtn = GetDlgItem(hdlg, buttons[id]);
AllowDarkModeForWindowEx(hBtn, darkModeEnabled);
@@ -6244,12 +6246,11 @@ INT_PTR CALLBACK ColorDialogHookProc(
dpi = LOWORD(wParam);
//dpi.y = HIWORD(wParam);
UpdateWindowLayoutForDPI(hdlg, (RECT *)lParam, 0);
- //int const ctl[] = { cmb1, cmb2, cmb3, cmb4, cmb5 };
- //for (int i = 0; i < COUNTOF(ctl); ++i) {
- // //HFONT const hFont = (HFONT)SendMessage(GetDlgItem(hdlg, ctl[i]), WM_GETFONT, 0, 0);
- // HFONT const hFont = 0;
- // SendMessage(GetDlgItem(hdlg, ctl[i]), WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
- //}
+ int const ctl[] = { COLOR_ADD, COLOR_MIX, IDOK, IDCANCEL };
+ for (int i = 0; i < COUNTOF(ctl); ++i) {
+ HFONT const hFont = (HFONT)SendMessage(GetDlgItem(hdlg, ctl[i]), WM_GETFONT, 0, 0);
+ SendMessage(GetDlgItem(hdlg, ctl[i]), WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
+ }
return TRUE;
default:
diff --git a/src/Notepad3.c b/src/Notepad3.c
index b9e857426..8bb5e3c0f 100644
--- a/src/Notepad3.c
+++ b/src/Notepad3.c
@@ -7096,6 +7096,7 @@ void HandleColorDefClicked(HWND hwnd, const DocPos position)
CHOOSECOLOR cc = { sizeof(CHOOSECOLOR) };
cc.hwndOwner = hwnd;
+ cc.hInstance = (HWND)Globals.hLngResContainer; // Globals.hInstance;
cc.rgbResult = rgbCur;
cc.lpCustColors = &g_colorCustom[0];
cc.Flags = CC_FULLOPEN | CC_RGBINIT | CC_ANYCOLOR;
@@ -7110,6 +7111,10 @@ void HandleColorDefClicked(HWND hwnd, const DocPos position)
pt.y = wi.y + SciCall_PointYFromPosition(SciCall_GetCurrentPos()) + offset;
cc.lCustData = (LPARAM)&pt;
+ // Color.dlg resource template
+ cc.Flags |= CC_ENABLETEMPLATE | CC_ENABLETEMPLATEHANDLE;
+ cc.lpTemplateName = MAKEINTRESOURCEW(IDD_MUI_SYSCOLOR_DLG);
+
if (!ChooseColor(&cc)) {
return;
}
diff --git a/src/Notepad3.vcxproj b/src/Notepad3.vcxproj
index cc456bf75..6edd426d7 100644
--- a/src/Notepad3.vcxproj
+++ b/src/Notepad3.vcxproj
@@ -752,6 +752,7 @@
+
@@ -823,7 +824,6 @@
-
diff --git a/src/Notepad3.vcxproj.filters b/src/Notepad3.vcxproj.filters
index 8d9c28684..4c58e3279 100644
--- a/src/Notepad3.vcxproj.filters
+++ b/src/Notepad3.vcxproj.filters
@@ -590,7 +590,7 @@
Header Files
-
+
Header Files
diff --git a/src/Styles.c b/src/Styles.c
index 6a224036d..fb685b0dd 100644
--- a/src/Styles.c
+++ b/src/Styles.c
@@ -3525,6 +3525,7 @@ bool Style_SelectColor(HWND hwnd,bool bForeGround,LPWSTR lpszStyle,int cchStyle,
CHOOSECOLOR cc = { sizeof(CHOOSECOLOR) };
cc.hwndOwner = hwnd;
+ cc.hInstance = (HWND)Globals.hLngResContainer; // Globals.hInstance;
cc.rgbResult = dRGBResult;
cc.lpCustColors = &g_colorCustom[0];
cc.Flags = CC_FULLOPEN | CC_RGBINIT | CC_SOLIDCOLOR;
@@ -3534,6 +3535,10 @@ bool Style_SelectColor(HWND hwnd,bool bForeGround,LPWSTR lpszStyle,int cchStyle,
cc.lpfnHook = (LPCCHOOKPROC)ColorDialogHookProc;
cc.lCustData = (LPARAM)NULL;
+ // Color.dlg resource template
+ cc.Flags |= CC_ENABLETEMPLATE | CC_ENABLETEMPLATEHANDLE;
+ cc.lpTemplateName = MAKEINTRESOURCEW(IDD_MUI_SYSCOLOR_DLG);
+
if (!ChooseColor(&cc)) {
return false;
}