diff --git a/components/synedit/synedithighlighter.pp b/components/synedit/synedithighlighter.pp index 3d42d4036a..7cb267d96b 100644 --- a/components/synedit/synedithighlighter.pp +++ b/components/synedit/synedithighlighter.pp @@ -169,6 +169,7 @@ type procedure AssignFrom(Src: TLazSynCustomTextAttributes); override; procedure DoChange; override; + property ConstName: string read FConstName write FConstName; // internal accessor public constructor Create; constructor Create(aCaption: string; aStoredName: String = ''); diff --git a/ide/editoroptions.pp b/ide/editoroptions.pp index 23b2261389..71063dea5f 100644 --- a/ide/editoroptions.pp +++ b/ide/editoroptions.pp @@ -296,6 +296,7 @@ type function IsEnabled: boolean; override; procedure ApplyTo(aDest: TSynHighlighterAttributes; aDefault: TColorSchemeAttribute = nil); procedure Assign(Src: TPersistent); override; + procedure AssignColors(Src: TPersistent); function Equals(Other: TColorSchemeAttribute): Boolean; reintroduce; function GetStoredValuesForAttrib: TColorSchemeAttribute; // The IDE default colors from the resources function GetSchemeGlobal: TColorSchemeAttribute; @@ -3219,7 +3220,7 @@ begin Add('Comment=Comment'); Add('Preprocessor=Comment'); Add('Identifier=Identifier'); - Add('Reserved_word=Reserved_word'); + Add('Reserved word=Reserved word'); Add('Number=Number'); Add('Space=Space'); Add('String=String'); @@ -3246,7 +3247,7 @@ begin MappedAttributes := TStringList.Create; with MappedAttributes do begin - Add('Element=Reserved_word'); + Add('Element=Reserved word'); Add('Comment=Comment'); Add('Text=Identifier'); Add('Space=Space'); @@ -3273,10 +3274,10 @@ begin MappedAttributes := TStringList.Create; with MappedAttributes do begin - Add('Element=Reserved_word'); + Add('Element=Reserved word'); Add('Comment=Comment'); Add('Identifier=Identifier'); - Add('Key=Reserved_word'); + Add('Key=Reserved word'); Add('Number=Number'); Add('Space=Space'); Add('String=String'); @@ -3305,7 +3306,7 @@ begin begin Add('Comment=Comment'); Add('Identifier=Identifier'); - Add('KeyAttri=Reserved_word'); + Add('KeyAttri=Reserved word'); Add('NumberAttri=Number'); Add('SpaceAttri=Space'); Add('StringAttri=String'); @@ -3341,7 +3342,7 @@ begin Add('Comment=Comment'); Add('Documentation=Comment'); Add('Identifier=Identifier'); - Add('Reserved_word=Reserved_word'); + Add('Reserved word=Reserved word'); Add('Number=Number'); Add('Space=Space'); Add('String=String'); @@ -3375,7 +3376,7 @@ begin begin Add('Comment=Comment'); Add('Variable=Identifier'); - Add('Key=Reserved_word'); + Add('Key=Reserved word'); Add('Number=Number'); Add('Space=Space'); Add('String=String'); @@ -3409,7 +3410,7 @@ begin Add('Comment=Comment'); Add('Identifier=Identifier'); Add('Documentation=Comment'); - Add('Reserved_word=Reserved_word'); + Add('Reserved word=Reserved word'); Add('Number=Number'); Add('Space=Space'); Add('String=String'); @@ -3434,7 +3435,7 @@ begin MappedAttributes := TStringList.Create; with MappedAttributes do begin - Add('Element=Reserved_word'); + Add('Element=Reserved word'); Add('Comment=Comment'); Add('Variable=Identifier'); Add('Space=Space'); @@ -3466,7 +3467,7 @@ begin with MappedAttributes do begin Add('Comment=Comment'); - Add('Element=Reserved_word'); + Add('Element=Reserved word'); Add('Variable=Identifier'); Add('Space=Space'); Add('Symbol=Symbol'); @@ -3498,7 +3499,7 @@ begin with MappedAttributes do begin Add('Comment=Comment'); - Add('Selector=Reserved_word'); + Add('Selector=Reserved word'); Add('Identifier=Identifier'); Add('Space=Space'); Add('Symbol=Symbol'); @@ -3541,7 +3542,7 @@ begin Add('Comment=Comment'); Add('Documentation=Comment'); Add('Identifier=Identifier'); - Add('Reserved_word=Reserved_word'); + Add('Reserved word=Reserved word'); Add('Number=Number'); Add('Space=Space'); Add('String=String'); @@ -3681,7 +3682,7 @@ begin Add('Comment=Comment'); Add('Documentation=Comment'); Add('Identifier=Identifier'); - Add('Reserved_word=Reserved_word'); + Add('Reserved word=Reserved word'); Add('Number=Number'); Add('Space=Space'); Add('String=String'); @@ -6668,6 +6669,28 @@ begin end; end; +procedure TColorSchemeAttribute.AssignColors(Src: TPersistent); +var + SrcAttr: TColorSchemeAttribute; + sn, n: String; +begin + BeginUpdate; + sn := StoredName; + n := ConstName; + inherited Assign(Src); + StoredName := sn; + ConstName := n; + + if Src is TColorSchemeAttribute then begin + SrcAttr := TColorSchemeAttribute(Src); + FUseSchemeGlobals := SrcAttr.FUseSchemeGlobals; + FMarkupFoldLineColor := SrcAttr.FMarkupFoldLineColor; + FMarkupFoldLineStyle := SrcAttr.FMarkupFoldLineStyle; + FMarkupFoldLineAlpha := SrcAttr.FMarkupFoldLineAlpha; + end; + EndUpdate; +end; + function TColorSchemeAttribute.Equals(Other: TColorSchemeAttribute): Boolean; begin Result := (FGroup = Other.FGroup) and @@ -6875,7 +6898,7 @@ begin if (n <> '') then begin pasattr := aPascalScheme.Attribute[n]; if pasattr <> nil then - csa.Assign(pasattr); + csa.AssignColors(pasattr); end; end; exit; diff --git a/ide/frames/editor_color_options.pas b/ide/frames/editor_color_options.pas index 2c2380acf0..32025e7771 100644 --- a/ide/frames/editor_color_options.pas +++ b/ide/frames/editor_color_options.pas @@ -1229,10 +1229,10 @@ begin DefAttri := DefaultColorScheme.Attribute[FCurHighlightElement.StoredName]; if FCurHighlightElement.IsUsingSchemeGlobals then begin // reset the globol settings for the element - FCurHighlightElement.GetSchemeGlobal.Assign(DefAttri); + FCurHighlightElement.GetSchemeGlobal.AssignColors(DefAttri); end else begin - FCurHighlightElement.Assign(DefAttri); + FCurHighlightElement.AssignColors(DefAttri); FCurHighlightElement.UseSchemeGlobals := False; // keep editing locals, for single elem reset, this should not change. end; end else begin