IDE, fix for saving localized names in editor options for additional highlight attributes names, issue #14231

git-svn-id: trunk@21032 -
This commit is contained in:
jesus 2009-07-31 20:32:22 +00:00
parent d0ec890db7
commit fb4778a146
2 changed files with 20 additions and 6 deletions

View File

@ -79,6 +79,7 @@ type
fForegroundDefault: TColor; //mh 2000-10-08
FFrameColor: TColor;
FFrameColorDefault: TColor;
FStoredName: string;
fName: string;
fStyle: TFontStyles;
fStyleDefault: TFontStyles; //mh 2000-10-08
@ -122,6 +123,7 @@ type
property IntegerStyleMask: integer read GetStyleMaskFromInt write SetStyleMaskFromInt;
{$ENDIF}
property Name: string read fName;
property StoredName: string read FStoredName write FStoredName;
property OnChange: TNotifyEvent read fOnChange write fOnChange;
published
property Background: TColor read fBackground write SetBackground
@ -248,7 +250,7 @@ type
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
{$IFDEF SYN_LAZARUS}
procedure AddSpecialAttribute(const AttribName: string);
function AddSpecialAttribute(const AttribName: string): TSynHighlighterAttributes;
{$ENDIF}
procedure Assign(Source: TPersistent); override;
procedure BeginUpdate;
@ -494,6 +496,7 @@ begin
Foreground := clNone;
FFrameColor := clNone;
fName := attribName;
FStoredName := attribName;
end;
function TSynHighlighterAttributes.GetBackgroundColorStored: boolean;
@ -1036,9 +1039,10 @@ begin
end;
{$IFDEF SYN_LAZARUS}
procedure TSynCustomHighlighter.AddSpecialAttribute(const AttribName: string);
function TSynCustomHighlighter.AddSpecialAttribute(const AttribName: string):TSynHighlighterAttributes;
begin
AddAttribute(TSynHighlighterAttributes.Create(AttribName));
result := TSynHighlighterAttributes.Create(AttribName);
AddAttribute(result);
end;
{$ENDIF}

View File

@ -699,6 +699,7 @@ type
// Code Folding
FUseCodeFolding: Boolean;
function GetAdditionalAttributeName(aha:TAdditionalHilightAttribute): string;
public
class function GetGroupCaption:string; override;
public
@ -2565,6 +2566,11 @@ begin
end;
end;
function TEditorOptions.GetAdditionalAttributeName(aha:TAdditionalHilightAttribute): string;
begin
result:=GetEnumName(TypeInfo(TAdditionalHilightAttribute), ord(aha));
end;
class function TEditorOptions.GetGroupCaption: string;
begin
Result := dlgGroupEditor;
@ -2891,7 +2897,7 @@ begin
for i := 0 to Syn.AttrCount - 1 do
begin
Attri := Syn.Attribute[i];
AttriName := StrToValidXMLName(Attri.Name);
AttriName := StrToValidXMLName(Attri.StoredName);
if AttriName = '' then
continue;
Path := 'EditorOptions/Color/Lang' + StrToValidXMLName(
@ -2984,7 +2990,7 @@ begin
begin
Attri := Syn.Attribute[i];
OldAttri := OldSyn.Attribute[i];
AttriName := StrToValidXMLName(Attri.Name);
AttriName := StrToValidXMLName(Attri.StoredName);
if AttriName = '' then
continue;
Path := 'EditorOptions/Color/Lang' + StrToValidXMLName(
@ -3468,6 +3474,7 @@ var
HasSpecialAttribute: THasSpecialAttribute;
a: TAdditionalHilightAttribute;
i: Integer;
Attr: TSynHighlighterAttributes;
begin
for a := Low(TAdditionalHilightAttribute)
to High(TAdditionalHilightAttribute) do
@ -3485,7 +3492,10 @@ begin
for a := Low(TAdditionalHilightAttribute)
to High(TAdditionalHilightAttribute) do
if not HasSpecialAttribute[a] then
Syn.AddSpecialAttribute(AdditionalHighlightAttributes[a]);
begin
Attr := Syn.AddSpecialAttribute(AdditionalHighlightAttributes[a]);
Attr.StoredName := GetAdditionalAttributeName(a);
end;
end;
procedure TEditorOptions.GetSynEditPreviewSettings(APreviewEditor: TObject);