From: <aka...@us...> - 2024-06-09 16:13:43
|
Revision: 4267 http://sourceforge.net/p/gexperts/code/4267 Author: akalwahome Date: 2024-06-09 16:13:41 +0000 (Sun, 09 Jun 2024) Log Message: ----------- SynEdit dark mode. Modified Paths: -------------- branches/dark-mode/ExternalSource/UniSynEdit/SynHighlighterPas.pas branches/dark-mode/Source/Framework/GX_SynMemoUtils.pas Modified: branches/dark-mode/ExternalSource/UniSynEdit/SynHighlighterPas.pas =================================================================== --- branches/dark-mode/ExternalSource/UniSynEdit/SynHighlighterPas.pas 2024-06-09 16:12:45 UTC (rev 4266) +++ branches/dark-mode/ExternalSource/UniSynEdit/SynHighlighterPas.pas 2024-06-09 16:13:41 UTC (rev 4267) @@ -1463,6 +1463,7 @@ var tmpAsmAttri, tmpCommentAttri, tmpIdentAttri, tmpKeyAttri, tmpNumberAttri, + tmpFloatAttri, tmpSpaceAttri, tmpStringAttri, tmpSymbolAttri: TSynHighlighterAttributes; iVersions: TStringList; iVersionTag: string; @@ -1489,6 +1490,7 @@ tmpIdentAttri := TSynHighlighterAttributes.Create('', ''); tmpKeyAttri := TSynHighlighterAttributes.Create('', ''); tmpNumberAttri := TSynHighlighterAttributes.Create('', ''); + tmpFloatAttri := TSynHighlighterAttributes.Create('', ''); tmpSpaceAttri := TSynHighlighterAttributes.Create('', ''); tmpStringAttri := TSynHighlighterAttributes.Create('', ''); tmpSymbolAttri := TSynHighlighterAttributes.Create('', ''); @@ -1508,7 +1510,6 @@ FCharAttri.AssignColorAndStyle(tmpStringAttri); { Delphi lacks Char attribute } FCommentAttri.AssignColorAndStyle(tmpCommentAttri); FDirecAttri.AssignColorAndStyle(tmpCommentAttri); { Delphi lacks Directive attribute } - FFloatAttri.AssignColorAndStyle(tmpNumberAttri); { Delphi lacks Float attribute } FHexAttri.AssignColorAndStyle(tmpNumberAttri); { Delphi lacks Hex attribute } FIdentifierAttri.AssignColorAndStyle(tmpIdentAttri); FKeyAttri.AssignColorAndStyle(tmpKeyAttri); @@ -1516,12 +1517,19 @@ FSpaceAttri.AssignColorAndStyle(tmpSpaceAttri); FStringAttri.AssignColorAndStyle(tmpStringAttri); FSymbolAttri.AssignColorAndStyle(tmpSymbolAttri); + + FFloatAttri.Assign(FNumberAttri); // use Number as fallback for Float end; + + if Result and ReadDelphiSetting(iVersionTag, tmpFloatAttri, 'Float') then + FFloatAttri.AssignColorAndStyle(tmpFloatAttri); + tmpAsmAttri.Free; tmpCommentAttri.Free; tmpIdentAttri.Free; tmpKeyAttri.Free; tmpNumberAttri.Free; + tmpFloatAttri.Free; tmpSpaceAttri.Free; tmpStringAttri.Free; tmpSymbolAttri.Free; Modified: branches/dark-mode/Source/Framework/GX_SynMemoUtils.pas =================================================================== --- branches/dark-mode/Source/Framework/GX_SynMemoUtils.pas 2024-06-09 16:12:45 UTC (rev 4266) +++ branches/dark-mode/Source/Framework/GX_SynMemoUtils.pas 2024-06-09 16:13:41 UTC (rev 4267) @@ -15,9 +15,10 @@ implementation uses - SysUtils, Classes, Graphics, ToolsAPI, + Windows, SysUtils, Classes, Graphics, ToolsAPI, SynEditHighlighter, SynHighlighterPas, SynHighlighterCpp, SynHighlighterHtml, - SynHighlighterSql, SynHighlighterCS, SynHighlighterXML, SynHighlighterGeneral, GX_OtaUtils; + SynHighlighterSql, SynHighlighterCS, SynHighlighterXML, SynHighlighterGeneral, + GX_OtaUtils; procedure GxGetIDEHighLigherSettings(Highlighter: TSynCustomHighlighter; const Prefer: string); var @@ -71,7 +72,34 @@ SynEdit.Highlighter := TSynGeneralSyn.Create(SynEdit); end; if Highlighter in [gxpPAS, gxpCPP, gxpSQL, gxpCS] then + begin GxGetIDEHighLigherSettings(SynEdit.Highlighter, GetIDEVersionID); +{$IFDEF GX_SUPPORTS_THEMING} + var Key: string; + if GxOtaThemingEnabled + and IdeStyleIsDark // ColorToGrayscale(GxOtaGetThemedColor(clWindow)) < 127) + then begin + // Dark Mode + Key := GxOtaGetIdeBaseRegistryKey + '\Editor\Highlight'; + for i := 0 to SynEdit.Highlighter.AttrCount-1 do + begin + SynEdit.Highlighter.Attribute[i].LoadFromBorlandRegistry( + HKEY_CURRENT_USER, + Key, + SynEdit.Highlighter.Attribute[i].FriendlyName, + False + ); + end; + SynEdit.Highlighter.WhitespaceAttribute.LoadFromBorlandRegistry( + HKEY_CURRENT_USER, + Key, + 'Whitespace', + False + ); + SynEdit.Color := SynEdit.Highlighter.WhitespaceAttribute.Background; + end; +{$ENDIF} + end; end; function GetGXHighlighterForCurrentSourceEditor: TGXSyntaxHighlighter; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |