mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-20 21:13:25 +08:00
Merge pull request #4966 from RaiKoHoff/Dev_Master
Dark-Mode Contrast control for Schemes configuration
This commit is contained in:
commit
1da0b0cffd
@ -65,7 +65,6 @@ SettingsVersion=5
|
||||
;DarkModeBkgColor=0x1F1F1F
|
||||
;DarkModeBtnFaceColor=0x333333
|
||||
;DarkModeTxtColor=0xEFEFEF
|
||||
;DarkModeHiglightContrast=75
|
||||
;HyperlinkShellExURLWithApp=""
|
||||
;HyperlinkShellExURLCmdLnArgs="${URL}" ;(use ${URL} as place holder for clicked Hyperlink URL string)
|
||||
;HyperlinkFileProtocolVerb="" ;(ShellExecuteEx()::lpVerb (""=default, "edit", "explore", "find", "open", "print", "properties", "runas")
|
||||
|
||||
@ -467,6 +467,7 @@
|
||||
#define IDC_AS_BACKUP_SIDEBYSIDE 18133
|
||||
#define IDC_AS_BACKUP_OPENFOLDER 18134
|
||||
#define IDC_FILE_CHECK_INTERVAL 18135
|
||||
#define IDC_DARK_MODE_CONTRAST 18136
|
||||
|
||||
#define IDC_RADIO_BTN_A 18200
|
||||
#define IDC_RADIO_BTN_B 18201
|
||||
|
||||
@ -302,12 +302,12 @@ BEGIN
|
||||
PUSHBUTTON "Abbrechen",IDCANCEL,141,173,50,14
|
||||
END
|
||||
|
||||
IDD_MUI_STYLECONFIG DIALOGEX 0, 0, 467, 254
|
||||
IDD_MUI_STYLECONFIG DIALOGEX 0, 0, 467, 264
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION " ☰ Schema"
|
||||
FONT 9, "Segoe UI", 400, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "",IDC_STYLELIST,"SysTreeView32",TVS_SHOWSELALWAYS | TVS_SINGLEEXPAND | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,7,164,240
|
||||
CONTROL "",IDC_STYLELIST,"SysTreeView32",TVS_SHOWSELALWAYS | TVS_SINGLEEXPAND | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,7,164,250
|
||||
LTEXT "",IDC_STYLELABEL_ROOT,181,141,279,8
|
||||
EDITTEXT IDC_STYLEEDIT_ROOT,181,152,279,12,ES_AUTOHSCROLL
|
||||
LTEXT "",IDC_STYLELABEL,181,171,279,8
|
||||
@ -319,10 +319,13 @@ BEGIN
|
||||
PUSHBUTTON "&Standard",IDC_STYLEDEFAULT,377,201,42,14
|
||||
PUSHBUTTON "",IDC_PREVSTYLE,426,201,15,14,BS_BITMAP
|
||||
PUSHBUTTON "",IDC_NEXTSTYLE,445,201,15,14,BS_BITMAP
|
||||
PUSHBUTTON "&Importieren...",IDC_IMPORT,181,232,60,14
|
||||
PUSHBUTTON "E&xportieren...",IDC_EXPORT,246,232,60,14
|
||||
DEFPUSHBUTTON "OK",IDOK,355,232,50,14
|
||||
PUSHBUTTON "Abbrechen",IDCANCEL,410,232,50,14
|
||||
LTEXT "Dark-Mode Kontrast(%):",IDC_STYLELABEL,181,222,80,8
|
||||
EDITTEXT IDC_DARK_MODE_CONTRAST,262,220,24,12,ES_AUTOHSCROLL
|
||||
LTEXT "[0-6000] Standard: 75%",IDC_STATIC3,300,222,80,8
|
||||
PUSHBUTTON "&Importieren...",IDC_IMPORT,181,240,60,14
|
||||
PUSHBUTTON "E&xportieren...",IDC_EXPORT,246,240,60,14
|
||||
DEFPUSHBUTTON "OK",IDOK,355,240,50,14
|
||||
PUSHBUTTON "Abbrechen",IDCANCEL,410,240,50,14
|
||||
GROUPBOX "Information",IDC_INFO_GROUPBOX,181,7,280,127
|
||||
CTEXT "-",IDC_TITLE,240,20,180,24,SS_CENTERIMAGE
|
||||
EDITTEXT IDC_STYLEEDIT_HELP,197,54,252,74,ES_MULTILINE | ES_READONLY | NOT WS_BORDER
|
||||
@ -992,7 +995,7 @@ BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 460
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 246
|
||||
BOTTOMMARGIN, 257
|
||||
END
|
||||
|
||||
IDD_MUI_TABSETTINGS, DIALOG
|
||||
|
||||
@ -302,12 +302,12 @@ BEGIN
|
||||
PUSHBUTTON "Cancel",IDCANCEL,108,173,50,14
|
||||
END
|
||||
|
||||
IDD_MUI_STYLECONFIG DIALOGEX 0, 0, 467, 254
|
||||
IDD_MUI_STYLECONFIG DIALOGEX 0, 0, 467, 264
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION " ☰ Scheme"
|
||||
FONT 9, "Segoe UI", 400, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "",IDC_STYLELIST,"SysTreeView32",TVS_SHOWSELALWAYS | TVS_SINGLEEXPAND | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,7,164,239
|
||||
CONTROL "",IDC_STYLELIST,"SysTreeView32",TVS_SHOWSELALWAYS | TVS_SINGLEEXPAND | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,7,164,250
|
||||
LTEXT "",IDC_STYLELABEL_ROOT,181,141,279,8
|
||||
EDITTEXT IDC_STYLEEDIT_ROOT,181,152,279,12,ES_AUTOHSCROLL
|
||||
LTEXT "",IDC_STYLELABEL,181,171,279,8
|
||||
@ -319,10 +319,13 @@ BEGIN
|
||||
PUSHBUTTON "&Reset",IDC_STYLEDEFAULT,377,201,42,14
|
||||
PUSHBUTTON "",IDC_PREVSTYLE,426,201,15,14,BS_BITMAP
|
||||
PUSHBUTTON "",IDC_NEXTSTYLE,445,201,15,14,BS_BITMAP
|
||||
PUSHBUTTON "&Import...",IDC_IMPORT,181,232,50,14
|
||||
PUSHBUTTON "E&xport...",IDC_EXPORT,237,232,50,14
|
||||
DEFPUSHBUTTON "OK",IDOK,355,232,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,410,232,50,14
|
||||
LTEXT "Dark-Mode Contrast(%):", IDC_STATIC2,181,222,80,8
|
||||
EDITTEXT IDC_DARK_MODE_CONTRAST,262,220,24,12,ES_AUTOHSCROLL
|
||||
LTEXT "[0-6000] Default: 75%",IDC_STATIC3,300,222,80,8
|
||||
PUSHBUTTON "&Import...",IDC_IMPORT,181,240,50,14
|
||||
PUSHBUTTON "E&xport...",IDC_EXPORT,237,240,50,14
|
||||
DEFPUSHBUTTON "OK",IDOK,355,240,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,410,240,50,14
|
||||
GROUPBOX "Info",IDC_INFO_GROUPBOX,181,7,280,127
|
||||
CTEXT "-",IDC_TITLE,240,20,180,24,SS_CENTERIMAGE
|
||||
EDITTEXT IDC_STYLEEDIT_HELP,197,54,252,74,ES_MULTILINE | ES_READONLY | NOT WS_BORDER
|
||||
@ -992,7 +995,7 @@ BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 460
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 246
|
||||
BOTTOMMARGIN, 257
|
||||
END
|
||||
|
||||
IDD_MUI_TABSETTINGS, DIALOG
|
||||
|
||||
@ -226,6 +226,7 @@
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
<Lib />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
@ -301,6 +302,7 @@
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
<Lib />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
|
||||
@ -491,8 +491,8 @@ Variable=fore:#B4E1F5
|
||||
Cmdlet=fore:#F8B076; back:#544604
|
||||
Alias=bold; fore:#B4E1F5
|
||||
[Python Script]
|
||||
Comment=fore:#F76D70
|
||||
Keyword=bold; fore:#AECDF6
|
||||
Comment=fore:#82AA94
|
||||
Keyword=bold; fore:#4D89C6
|
||||
Keyword 2nd=fore:#AECDF6
|
||||
Attribute=fore:#C2C2C2
|
||||
String Single Quoted=fore:#46F545
|
||||
|
||||
@ -1344,8 +1344,6 @@ void LoadSettings()
|
||||
|
||||
Settings2.OpacityLevel = clampi(IniSectionGetInt(IniSecSettings2, L"OpacityLevel", 75), 10, 100);
|
||||
|
||||
Settings2.DarkModeHiglightContrast = (float)clampi(IniSectionGetInt(IniSecSettings2, L"DarkModeHiglightContrast", 75), 0, 1000) / 100.0f;
|
||||
|
||||
Settings2.FindReplaceOpacityLevel = clampi(IniSectionGetInt(IniSecSettings2, L"FindReplaceOpacityLevel", 50), 10, 100);
|
||||
|
||||
IniSectionGetStringNoQuotes(IniSecSettings2, L"filebrowser.exe", L"", pPathBuffer, PATHLONG_MAX_CCH);
|
||||
@ -1499,13 +1497,6 @@ void LoadSettings()
|
||||
|
||||
#endif
|
||||
|
||||
// --- remove deprecated ---
|
||||
constexpr const WCHAR* const mocc = L"MarkOccurrencesMaxCount";
|
||||
if (IniSectionGetLong(IniSecSettings2, mocc, -111) != -111) {
|
||||
IniSectionDelete(IniSecSettings2, mocc, true);
|
||||
bDirtyFlag = true;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Settings: IniSecSettings
|
||||
// --------------------------------------------------------------------------
|
||||
@ -1526,6 +1517,26 @@ void LoadSettings()
|
||||
Defaults.VARNAME = (cpi_enc_t)DEFAULT; \
|
||||
Settings.VARNAME = (cpi_enc_t)clampi(IniSectionGetInt(IniSecSettings, _W(_STRG(VARNAME)), (int)Defaults.VARNAME), (int)MIN, (int)MAX)
|
||||
|
||||
// --- remove deprecated --------------------------------------------------
|
||||
|
||||
GET_INT_VALUE_FROM_INISECTION(DarkModeHiglightContrast, 75, 0, 6000);
|
||||
constexpr const WCHAR* const dmhlctrst = L"DarkModeHiglightContrast";
|
||||
int const deprecatedDmHlC = IniSectionGetInt(IniSecSettings2, dmhlctrst, 0);
|
||||
if (deprecatedDmHlC != 0) {
|
||||
Settings.DarkModeHiglightContrast = clampi(deprecatedDmHlC, 0, 6000);
|
||||
IniSectionDelete(IniSecSettings2, dmhlctrst, true);
|
||||
bDirtyFlag = true;
|
||||
}
|
||||
|
||||
constexpr const WCHAR* const mocc = L"MarkOccurrencesMaxCount";
|
||||
if (IniSectionGetLong(IniSecSettings2, mocc, -111) != -111) {
|
||||
IniSectionDelete(IniSecSettings2, mocc, true);
|
||||
bDirtyFlag = true;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
|
||||
GET_BOOL_VALUE_FROM_INISECTION(SaveRecentFiles, true);
|
||||
GET_BOOL_VALUE_FROM_INISECTION(PreserveCaretPos, false);
|
||||
GET_BOOL_VALUE_FROM_INISECTION(SaveFindReplace, false);
|
||||
@ -2153,6 +2164,7 @@ static bool _SaveSettings(bool bForceSaveSettings)
|
||||
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, PreferredLocale4DateFmt);
|
||||
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, SearchByClipboardIfEmpty);
|
||||
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, ReplaceByClipboardTag);
|
||||
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Int, DarkModeHiglightContrast);
|
||||
|
||||
#ifdef D_NP3_WIN10_DARK_MODE
|
||||
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Int, WinThemeDarkMode);
|
||||
|
||||
@ -344,7 +344,7 @@ static inline int SetModeTextColor(const HDC hdc, const bool bDarkMode)
|
||||
{
|
||||
#ifdef D_NP3_WIN10_DARK_MODE
|
||||
//return SetTextColor(hdc, bDarkMode ? Settings2.DarkModeTxtColor : GetSysColor(COLOR_WINDOWTEXT));
|
||||
return SetTextColor(hdc, bDarkMode ? ContrastColor(Settings2.DarkModeTxtColor, Settings2.DarkModeHiglightContrast) : GetSysColor(COLOR_WINDOWTEXT));
|
||||
return SetTextColor(hdc, bDarkMode ? ContrastColor(Settings2.DarkModeTxtColor, ((float)Settings.DarkModeHiglightContrast / 100.0f)) : GetSysColor(COLOR_WINDOWTEXT));
|
||||
#else
|
||||
UNREFERENCED_PARAMETER(bDarkMode);
|
||||
return SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT));
|
||||
@ -355,7 +355,7 @@ static inline COLORREF GetModeTextColor(const bool bDarkMode)
|
||||
{
|
||||
#ifdef D_NP3_WIN10_DARK_MODE
|
||||
//return bDarkMode ? Settings2.DarkModeTxtColor : (COLORREF)GetSysColor(COLOR_WINDOWTEXT);
|
||||
return bDarkMode ? ContrastColor(Settings2.DarkModeTxtColor, Settings2.DarkModeHiglightContrast) : (COLORREF)GetSysColor(COLOR_WINDOWTEXT);
|
||||
return bDarkMode ? ContrastColor(Settings2.DarkModeTxtColor, ((float)Settings.DarkModeHiglightContrast / 100.0f)) : (COLORREF)GetSysColor(COLOR_WINDOWTEXT);
|
||||
#else
|
||||
UNREFERENCED_PARAMETER(bDarkMode);
|
||||
return (COLORREF)GetSysColor(COLOR_WINDOWTEXT);
|
||||
|
||||
@ -34,7 +34,6 @@
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<EnableASAN>false</EnableASAN>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
@ -45,7 +44,6 @@
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<EnableASAN>false</EnableASAN>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
@ -56,7 +54,6 @@
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<EnableASAN>false</EnableASAN>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
@ -145,12 +142,13 @@
|
||||
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<AdditionalLibraryDirectories>$(OutputPath)obj;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(OutputPath)obj;$(ClangAnalysisToolsPath)\..\lib\clang\16\lib\windows\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
<SupportUnloadOfDelayLoadedDLL>true</SupportUnloadOfDelayLoadedDLL>
|
||||
<DelayLoadDLLs>uxtheme.dll</DelayLoadDLLs>
|
||||
<CETCompat>true</CETCompat>
|
||||
<AllowIsolation>true</AllowIsolation>
|
||||
<IgnoreSpecificDefaultLibraries>clang_rt.asan-i386.lib</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
@ -218,12 +216,13 @@
|
||||
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
<AdditionalLibraryDirectories>$(OutputPath)obj;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(OutputPath)obj;$(ClangAnalysisToolsPath)\..\lib\clang\16\lib\windows\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
<SupportUnloadOfDelayLoadedDLL>true</SupportUnloadOfDelayLoadedDLL>
|
||||
<DelayLoadDLLs>uxtheme.dll</DelayLoadDLLs>
|
||||
<CETCompat>true</CETCompat>
|
||||
<AllowIsolation>true</AllowIsolation>
|
||||
<IgnoreSpecificDefaultLibraries>clang_rt.asan-i386.lib</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
@ -298,7 +297,7 @@
|
||||
<SetChecksum>true</SetChecksum>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<AdditionalLibraryDirectories>$(OutputPath)obj;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(OutputPath)obj;$(ClangAnalysisToolsPath)\..\lib\clang\16\lib\windows\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
<Profile>true</Profile>
|
||||
<SupportUnloadOfDelayLoadedDLL>true</SupportUnloadOfDelayLoadedDLL>
|
||||
@ -308,6 +307,8 @@
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<CETCompat>true</CETCompat>
|
||||
<AllowIsolation>true</AllowIsolation>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
@ -381,7 +382,7 @@
|
||||
<SetChecksum>true</SetChecksum>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
<AdditionalLibraryDirectories>$(OutputPath)obj;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(OutputPath)obj;$(ClangAnalysisToolsPath)\..\lib\clang\16\lib\windows\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
<Profile>true</Profile>
|
||||
<SupportUnloadOfDelayLoadedDLL>true</SupportUnloadOfDelayLoadedDLL>
|
||||
@ -391,6 +392,8 @@
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
<CETCompat>true</CETCompat>
|
||||
<AllowIsolation>true</AllowIsolation>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
|
||||
34
src/Styles.c
34
src/Styles.c
@ -37,6 +37,7 @@
|
||||
#include "Notepad3.h"
|
||||
#include "Config/Config.h"
|
||||
#include "DarkMode/DarkMode.h"
|
||||
#include "tinyexpr/tinyexpr.h"
|
||||
|
||||
#include "SciCall.h"
|
||||
|
||||
@ -3392,7 +3393,7 @@ bool Style_StrGetColor(LPCWSTR lpszStyle, COLOR_LAYER layer, COLORALPHAREF* rgba
|
||||
*rgbaOrig = color;
|
||||
}
|
||||
if (bFGLayer && UseDarkMode()) {
|
||||
color = AxRGB(GetAValue(color), ContrastColor(ARGB_TO_COLREF(color), Settings2.DarkModeHiglightContrast));
|
||||
color = AxRGB(GetAValue(color), ContrastColor(ARGB_TO_COLREF(color), ((float)Settings.DarkModeHiglightContrast / 100.0f)));
|
||||
}
|
||||
if (rgba) {
|
||||
*rgba = color;
|
||||
@ -4312,12 +4313,12 @@ void Style_AddLexerToListView(HWND hwnd,PEDITLEXER plex)
|
||||
// Style_CustomizeSchemesDlgProc()
|
||||
//
|
||||
|
||||
static bool _ApplyDialogItemText(HWND hwnd,
|
||||
PEDITLEXER pDlgLexer, PEDITSTYLE pDlgStyle, int iDlgStyleIdx, bool bIsStyleSelected)
|
||||
static bool _ApplyDialogItemText(HWND hwnd, PEDITLEXER pDlgLexer, PEDITSTYLE pDlgStyle, int iDlgStyleIdx, bool bIsStyleSelected)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(iDlgStyleIdx);
|
||||
|
||||
bool bChgNfy = false;
|
||||
bool bForce = false;
|
||||
|
||||
WCHAR szBuf[max(BUFSIZE_STYLE_VALUE, STYLE_EXTENTIONS_BUFFER)] = { L'\0' };
|
||||
GetDlgItemText(hwnd, IDC_STYLEEDIT, szBuf, COUNTOF(szBuf));
|
||||
@ -4338,7 +4339,22 @@ static bool _ApplyDialogItemText(HWND hwnd,
|
||||
bChgNfy = true;
|
||||
}
|
||||
}
|
||||
if (bChgNfy && (IsLexerStandard(pDlgLexer) || (pDlgLexer == s_pLexCurrent))) {
|
||||
|
||||
char chDMHlContrast[96];
|
||||
GetDlgItemTextA(hwnd, IDC_DARK_MODE_CONTRAST, chDMHlContrast, COUNTOF(chDMHlContrast));
|
||||
te_int_t iExprError = 0;
|
||||
int iDmHlCntrst = clampi((int)round(te_interp(chDMHlContrast, &iExprError)), 0, 6000);
|
||||
if (iExprError > 1) {
|
||||
chDMHlContrast[iExprError - 1] = '\0';
|
||||
iDmHlCntrst = clampi((int)round(te_interp(chDMHlContrast, &iExprError)), 0, 6000);
|
||||
}
|
||||
if ((iExprError == 0) && (iDmHlCntrst != Settings.DarkModeHiglightContrast)) {
|
||||
Settings.DarkModeHiglightContrast = iDmHlCntrst;
|
||||
bForce = true;
|
||||
}
|
||||
SetDlgItemInt(hwnd, IDC_DARK_MODE_CONTRAST, Settings.DarkModeHiglightContrast, false);
|
||||
|
||||
if (bForce || (bChgNfy && (IsLexerStandard(pDlgLexer) || (pDlgLexer == s_pLexCurrent)))) {
|
||||
Style_ResetCurrentLexer(Globals.hwndEdit);
|
||||
}
|
||||
return bChgNfy;
|
||||
@ -4390,6 +4406,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
|
||||
static HBRUSH hbrBack = { 0 };
|
||||
static bool bIsStyleSelected = false;
|
||||
static bool bWarnedNoIniFile = false;
|
||||
static int iDMHighliteContrast = 75;
|
||||
|
||||
static WCHAR tchTmpBuffer[max(BUFSIZE_STYLE_VALUE, STYLE_EXTENTIONS_BUFFER)] = {L'\0'};
|
||||
static UT_array *pStylesBackup = NULL;
|
||||
@ -4420,6 +4437,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
|
||||
SetExplorerTheme(GetDlgItem(hwnd, IDC_STYLEDEFAULT));
|
||||
SetExplorerTheme(GetDlgItem(hwnd, IDC_PREVSTYLE));
|
||||
SetExplorerTheme(GetDlgItem(hwnd, IDC_NEXTSTYLE));
|
||||
SetExplorerTheme(GetDlgItem(hwnd, IDC_DARK_MODE_CONTRAST));
|
||||
SetExplorerTheme(GetDlgItem(hwnd, IDC_IMPORT));
|
||||
SetExplorerTheme(GetDlgItem(hwnd, IDC_EXPORT));
|
||||
//SetExplorerTheme(GetDlgItem(hwnd, IDC_RESIZEGRIP));
|
||||
@ -4528,6 +4546,11 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
|
||||
SendDlgItemMessageW(hwnd, IDC_TITLE, WM_SETFONT, (WPARAM)hFontTitle, true);
|
||||
SendDlgItemMessageW(hwnd, IDC_TITLE, WM_SETTEXT, 0, (LPARAM)s_TitleTxt);
|
||||
}
|
||||
|
||||
iDMHighliteContrast = Settings.DarkModeHiglightContrast;
|
||||
SetDlgItemInt(hwnd, IDC_DARK_MODE_CONTRAST, iDMHighliteContrast, false);
|
||||
SendDlgItemMessage(hwnd, IDC_DARK_MODE_CONTRAST, EM_LIMITTEXT, 80, 0);
|
||||
EnableItem(hwnd, IDC_DARK_MODE_CONTRAST, UseDarkMode());
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
@ -5028,6 +5051,9 @@ CASE_WM_CTLCOLOR_SET:
|
||||
if (fDragging) {
|
||||
SendMessage(hwnd, WM_CANCELMODE, 0, 0);
|
||||
} else {
|
||||
Settings.DarkModeHiglightContrast = iDMHighliteContrast;
|
||||
SetDlgItemInt(hwnd, IDC_DARK_MODE_CONTRAST, iDMHighliteContrast, false);
|
||||
|
||||
_ApplyDialogItemText(hwnd, pCurrentLexer, pCurrentStyle, iCurStyleIdx, bIsStyleSelected);
|
||||
|
||||
// Restore Styles from Backup
|
||||
|
||||
@ -675,6 +675,7 @@ typedef struct SETTINGS_T {
|
||||
int AutoSaveInterval;
|
||||
bool SearchByClipboardIfEmpty;
|
||||
bool ReplaceByClipboardTag;
|
||||
int DarkModeHiglightContrast;
|
||||
|
||||
AutoSaveBackupOptions AutoSaveOptions;
|
||||
|
||||
@ -767,10 +768,10 @@ typedef struct SETTINGS2_T {
|
||||
int ZoomTooltipTimeout;
|
||||
int WrapAroundTooltipTimeout;
|
||||
int LargeIconScalePrecent;
|
||||
int DarkModeHiglightContrast;
|
||||
|
||||
float AnalyzeReliableConfidenceLevel;
|
||||
float LocaleAnsiCodePageAnalysisBonus;
|
||||
float DarkModeHiglightContrast;
|
||||
|
||||
#ifdef D_NP3_WIN10_DARK_MODE
|
||||
COLORREF DarkModeBkgColor;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user