mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 07:00:32 +02:00
EditorOptions: Merged SingleColor Attributes and AhaAttributes
git-svn-id: trunk@21167 -
This commit is contained in:
parent
76e14f2fb4
commit
99239efec9
@ -102,9 +102,7 @@ type
|
||||
ahaCodeFoldingTree, ahaHighlightWord, ahaFoldedCode, ahaWordGroup,
|
||||
ahaTemplateEditCur, ahaTemplateEditSync, ahaTemplateEditOther,
|
||||
ahaSyncroEditCur, ahaSyncroEditSync, ahaSyncroEditOther, ahaSyncroEditArea,
|
||||
ahaGutterSeparator);
|
||||
|
||||
TSingleColorAttribute = (scaGutter, scaRightMargin);
|
||||
ahaGutterSeparator, ahaGutter, ahaRightMargin);
|
||||
|
||||
TAhaGroupName = (agnText, agnLine, agnGutter, agnSpecialMode);
|
||||
|
||||
@ -143,7 +141,9 @@ const
|
||||
'SyncronEdit Syncron Cells',
|
||||
'SyncronEdit Other Cells',
|
||||
'SyncronEdit Range',
|
||||
'' // scaGutterSeparator => uses RTTI only
|
||||
'', // scaGutterSeparator => uses RTTI only
|
||||
'', // ahaGutter
|
||||
'' // ahaRightMargin
|
||||
);
|
||||
|
||||
ahaSupportedFeatures: array[TAdditionalHilightAttribute] of TAhaSupportedFeatures =
|
||||
@ -174,7 +174,9 @@ const
|
||||
{ ahaSyncroEditSync } (FG: True; BG: True; FF: True; Style: True; Group: agnSpecialMode),
|
||||
{ ahaSyncroEditOther } (FG: True; BG: True; FF: True; Style: True; Group: agnSpecialMode),
|
||||
{ ahaSyncroEditArea } (FG: True; BG: True; FF: True; Style: True; Group: agnSpecialMode),
|
||||
{ ahaGutterSeparator } (FG: True; BG: True; FF: False; Style: False; Group: agnGutter)
|
||||
{ ahaGutterSeparator } (FG: True; BG: True; FF: False; Style: False; Group: agnGutter),
|
||||
{ ahaGutter } (FG: False; BG: True; FF: False; Style: False; Group: agnGutter),
|
||||
{ ahaRightMargin} (FG: True; BG: False; FF: False; Style: False; Group: agnGutter)
|
||||
);
|
||||
|
||||
|
||||
@ -182,13 +184,6 @@ var
|
||||
AdditionalHighlightAttributes: array[TAdditionalHilightAttribute] of String;
|
||||
AdditionalHighlightGroupNames: array[TAhaGroupName] of String;
|
||||
|
||||
const
|
||||
SingleColorAttributes: array[TSingleColorAttribute] of String =
|
||||
(
|
||||
dlgGutter,
|
||||
dlgRightMargin
|
||||
);
|
||||
|
||||
type
|
||||
TSchemeAttribute = record
|
||||
BG, FG, FC: TColor;
|
||||
@ -201,7 +196,6 @@ type
|
||||
Default: TSchemeAttribute;
|
||||
Attributes: array[TPascalHilightAttribute] of TSchemeAttribute;
|
||||
Additional: array[TAdditionalHilightAttribute] of TSchemeAttribute;
|
||||
Single: array[TSingleColorAttribute] of TColor;
|
||||
end;
|
||||
|
||||
TColorSchemeMapping = class(TObject)
|
||||
@ -266,12 +260,10 @@ const
|
||||
{ ahaSyncroEditSync } (BG: clNone; FG: clNone; FC: clRed; Styles: []; StylesMask: []),
|
||||
{ ahaSyncroEditOther } (BG: clNone; FG: clNone; FC: $94b094; Styles: []; StylesMask: []),
|
||||
{ ahaSyncroEditArea } (BG: clMoneyGreen; FG: clNone; FC: clNone; Styles: []; StylesMask: []),
|
||||
{ ahaGutterSeparator } (BG: clWhite; FG: clDkGray; FC: clNone; Styles: []; StylesMask: [])
|
||||
{ ahaGutterSeparator } (BG: clWhite; FG: clDkGray; FC: clNone; Styles: []; StylesMask: []),
|
||||
{ ahaGutter } (BG: clBtnFace; FG: clNone; FC: clNone; Styles: []; StylesMask: []),
|
||||
{ ahaRightMargin } (BG: clNone; FG: clSilver; FC: clNone; Styles: []; StylesMask: [])
|
||||
);
|
||||
Single: (
|
||||
{ scaGutter } clBtnFace,
|
||||
{ scaRightMargin } clSilver
|
||||
)
|
||||
);
|
||||
|
||||
TWILIGHT_COLOR_SCHEME: TPascalColorScheme = (
|
||||
@ -313,12 +305,10 @@ const
|
||||
{ ahaSyncroEditSync } (BG: clNone; FG: clNone; FC: clRed; Styles: []; StylesMask: []),
|
||||
{ ahaSyncroEditOther } (BG: clNone; FG: clNone; FC: $94b094; Styles: []; StylesMask: []),
|
||||
{ ahaSyncroEditArea } (BG: clMoneyGreen; FG: clNone; FC: clNone; Styles: []; StylesMask: []),
|
||||
{ ahaGutterSeparator } (BG: clWhite; FG: clDkGray; FC: clNone; Styles: []; StylesMask: [])
|
||||
{ ahaGutterSeparator } (BG: clWhite; FG: clDkGray; FC: clNone; Styles: []; StylesMask: []),
|
||||
{ ahaGutter } (BG: clBtnFace; FG: clNone; FC: clNone; Styles: []; StylesMask: []),
|
||||
{ ahaRightMargin } (BG: clNone; FG: clSilver; FC: clNone; Styles: []; StylesMask: [])
|
||||
);
|
||||
Single: (
|
||||
{ scaGutter } clBtnFace,
|
||||
{ scaRightMargin } clSilver
|
||||
)
|
||||
);
|
||||
|
||||
CLASSIC_COLOR_SCHEME: TPascalColorScheme = (
|
||||
@ -360,12 +350,10 @@ const
|
||||
{ ahaSyncroEditSync } (BG: clNone; FG: clNone; FC: clRed; Styles: []; StylesMask: []),
|
||||
{ ahaSyncroEditOther } (BG: clNone; FG: clNone; FC: $94b094; Styles: []; StylesMask: []),
|
||||
{ ahaSyncroEditArea } (BG: clMoneyGreen; FG: clNone; FC: clNone; Styles: []; StylesMask: []),
|
||||
{ ahaGutterSeparator } (BG: clWhite; FG: clDkGray; FC: clNone; Styles: []; StylesMask: [])
|
||||
{ ahaGutterSeparator } (BG: clWhite; FG: clDkGray; FC: clNone; Styles: []; StylesMask: []),
|
||||
{ ahaGutter } (BG: clBtnFace; FG: clNone; FC: clNone; Styles: []; StylesMask: []),
|
||||
{ ahaRightMargin } (BG: clNone; FG: clSilver; FC: clNone; Styles: []; StylesMask: [])
|
||||
);
|
||||
Single: (
|
||||
{ scaGutter } clBtnFace,
|
||||
{ scaRightMargin } clSilver
|
||||
)
|
||||
);
|
||||
|
||||
OCEAN_COLOR_SCHEME: TPascalColorScheme = (
|
||||
@ -407,12 +395,10 @@ const
|
||||
{ ahaSyncroEditSync } (BG: clNone; FG: clNone; FC: clRed; Styles: []; StylesMask: []),
|
||||
{ ahaSyncroEditOther } (BG: clNone; FG: clNone; FC: $94b094; Styles: []; StylesMask: []),
|
||||
{ ahaSyncroEditArea } (BG: clMoneyGreen; FG: clNone; FC: clNone; Styles: []; StylesMask: []),
|
||||
{ ahaGutterSeparator } (BG: clWhite; FG: clDkGray; FC: clNone; Styles: []; StylesMask: [])
|
||||
{ ahaGutterSeparator } (BG: clWhite; FG: clDkGray; FC: clNone; Styles: []; StylesMask: []),
|
||||
{ ahaGutter } (BG: clBtnFace; FG: clNone; FC: clNone; Styles: []; StylesMask: []),
|
||||
{ ahaRightMargin } (BG: clNone; FG: clSilver; FC: clNone; Styles: []; StylesMask: [])
|
||||
);
|
||||
Single: (
|
||||
{ scaGutter } clBtnFace,
|
||||
{ scaRightMargin } clSilver
|
||||
)
|
||||
);
|
||||
|
||||
DELPHI_COLOR_SCHEME: TPascalColorScheme = (
|
||||
@ -454,12 +440,10 @@ const
|
||||
{ ahaSyncroEditSync } (BG: clNone; FG: clNone; FC: clRed; Styles: []; StylesMask: []),
|
||||
{ ahaSyncroEditOther } (BG: clNone; FG: clNone; FC: clBlue; Styles: []; StylesMask: []),
|
||||
{ ahaSyncroEditArea } (BG: $FAFFE6; FG: clNone; FC: clNone; Styles: []; StylesMask: []),
|
||||
{ ahaGutterSeparator } (BG: clWhite; FG: clDkGray; FC: clNone; Styles: []; StylesMask: [])
|
||||
{ ahaGutterSeparator } (BG: clWhite; FG: clDkGray; FC: clNone; Styles: []; StylesMask: []),
|
||||
{ ahaGutter } (BG: clBtnFace; FG: clNone; FC: clNone; Styles: []; StylesMask: []),
|
||||
{ ahaRightMargin } (BG: clNone; FG: clSilver; FC: clNone; Styles: []; StylesMask: [])
|
||||
);
|
||||
Single: (
|
||||
{ scaGutter } clBtnFace,
|
||||
{ scaRightMargin } clSilver
|
||||
)
|
||||
);
|
||||
|
||||
type
|
||||
@ -730,11 +714,9 @@ type
|
||||
fVisibleGutter: Boolean;
|
||||
fShowLineNumbers: Boolean;
|
||||
fShowOnlyLineNumbersMultiplesOf: integer;
|
||||
fGutterColor: TColor;
|
||||
fGutterWidth: Integer;
|
||||
FGutterSeparatorIndex: Integer;
|
||||
fRightMargin: Integer;
|
||||
fRightMarginColor: TColor;
|
||||
fEditorFont: String;
|
||||
fEditorFontHeight: Integer;
|
||||
fExtraCharSpacing: Integer;
|
||||
@ -829,6 +811,8 @@ type
|
||||
function GetLineColors(Syn: TSrcIDEHighlighter;
|
||||
AddHilightAttr: TAdditionalHilightAttribute; {TODO: MFR maybe remove?}
|
||||
out FG, BG: TColor; out Styles, StylesMask: TFontStyles): Boolean;
|
||||
function GetSynAttributeByAha(Syn : TSrcIDEHighlighter;
|
||||
Aha: TAdditionalHilightAttribute): TSynHighlighterAttributes;
|
||||
procedure SetMarkupColor(Syn: TSrcIDEHighlighter;
|
||||
AddHilightAttr: TAdditionalHilightAttribute;
|
||||
aMarkup: TSynSelectedColor);
|
||||
@ -870,16 +854,12 @@ type
|
||||
write fShowLineNumbers default False;
|
||||
property ShowOnlyLineNumbersMultiplesOf: integer read fShowOnlyLineNumbersMultiplesOf
|
||||
write fShowOnlyLineNumbersMultiplesOf;
|
||||
property GutterColor: TColor
|
||||
read fGutterColor write fGutterColor default clBtnFace;
|
||||
property GutterWidth: Integer
|
||||
read fGutterWidth write fGutterWidth default 30;
|
||||
property GutterSeparatorIndex: Integer read FGutterSeparatorIndex
|
||||
write FGutterSeparatorIndex default 3;
|
||||
property RightMargin: Integer
|
||||
read fRightMargin write fRightMargin default 80;
|
||||
property RightMarginColor: Integer
|
||||
read fRightMarginColor write fRightMarginColor default clBtnFace;
|
||||
property EditorFont: String read fEditorFont write fEditorFont;
|
||||
property EditorFontHeight: Integer
|
||||
read fEditorFontHeight write FEditorFontHeight;
|
||||
@ -2147,6 +2127,8 @@ begin
|
||||
AdditionalHighlightAttributes[ahaSyncroEditOther] := dlgAddHiAttrSyncroEditOther;
|
||||
AdditionalHighlightAttributes[ahaSyncroEditArea] := dlgAddHiAttrSyncroEditArea;
|
||||
AdditionalHighlightAttributes[ahaGutterSeparator] := dlgAddHiAttrGutterSeparator;
|
||||
AdditionalHighlightAttributes[ahaGutter] := dlgGutter;
|
||||
AdditionalHighlightAttributes[ahaRightMargin] := dlgRightMargin;
|
||||
|
||||
AdditionalHighlightGroupNames[agnText] := dlgAddHiAttrGroupText;
|
||||
AdditionalHighlightGroupNames[agnLine] := dlgAddHiAttrGroupLine;
|
||||
@ -2324,17 +2306,12 @@ begin
|
||||
fShowOnlyLineNumbersMultiplesOf :=
|
||||
XMLConfig.GetValue('EditorOptions/Display/ShowOnlyLineNumbersMultiplesOf', 5);
|
||||
end;
|
||||
fGutterColor :=
|
||||
XMLConfig.GetValue('EditorOptions/Display/GutterColor', clBtnFace);
|
||||
fGutterWidth :=
|
||||
XMLConfig.GetValue('EditorOptions/Display/GutterWidth', 30);
|
||||
FGutterSeparatorIndex :=
|
||||
XMLConfig.GetValue('EditorOptions/Display/GutterSeparatorIndex', 3);
|
||||
fRightMargin :=
|
||||
XMLConfig.GetValue('EditorOptions/Display/RightMargin', 80);
|
||||
fRightMarginColor :=
|
||||
XMLConfig.GetValue('EditorOptions/Display/RightMarginColor'
|
||||
, clBtnFace);
|
||||
fEditorFont :=
|
||||
XMLConfig.GetValue('EditorOptions/Display/EditorFont', SynDefaultFontName);
|
||||
fEditorFontHeight :=
|
||||
@ -2572,16 +2549,12 @@ begin
|
||||
fShowLineNumbers, True);
|
||||
XMLConfig.SetDeleteValue('EditorOptions/Display/ShowOnlyLineNumbersMultiplesOf',
|
||||
fShowOnlyLineNumbersMultiplesOf, 5);
|
||||
XMLConfig.SetDeleteValue('EditorOptions/Display/GutterColor',
|
||||
fGutterColor, clBtnFace);
|
||||
XMLConfig.SetDeleteValue('EditorOptions/Display/GutterWidth',
|
||||
fGutterWidth, 30);
|
||||
XMLConfig.SetDeleteValue('EditorOptions/Display/GutterSeparatorIndex',
|
||||
fGutterSeparatorIndex, 3);
|
||||
XMLConfig.SetDeleteValue('EditorOptions/Display/RightMargin',
|
||||
fRightMargin, 80);
|
||||
XMLConfig.SetDeleteValue('EditorOptions/Display/RightMarginColor',
|
||||
fRightMarginColor, clBtnFace);
|
||||
XMLConfig.SetDeleteValue('EditorOptions/Display/EditorFont',
|
||||
fEditorFont, SynDefaultFontName);
|
||||
XMLConfig.SetDeleteValue('EditorOptions/Display/EditorFontHeight'
|
||||
@ -3043,6 +3016,11 @@ begin
|
||||
Include(fs, fsUnderline);
|
||||
Attri.StyleMask := fs;
|
||||
end;
|
||||
// Read old single colrs
|
||||
if Attri.StoredName = GetAdditionalAttributeName(ahaRightMargin) then
|
||||
Attri.Foreground := XMLConfig.GetValue('EditorOptions/Display/RightMarginColor', clBtnFace);
|
||||
if Attri.StoredName = GetAdditionalAttributeName(ahaGutter) then
|
||||
Attri.Background := XMLConfig.GetValue('EditorOptions/Display/GutterColor', clBtnFace);
|
||||
// Read the Version >= 5 if exist, or keep values
|
||||
if Attri.StoredName = '' then
|
||||
continue;
|
||||
@ -3116,7 +3094,14 @@ begin
|
||||
AttriName := OldAdditionalAttributeName(Attri.StoredName);
|
||||
if AttriName <> '' then
|
||||
XMLConfig.DeletePath(Path + StrToValidXMLName(AttriName));
|
||||
// Write Version >= 5
|
||||
// Delete old single colors
|
||||
if (Syn is TPreviewPasSyn) or (Syn is TSynPasSyn) then begin
|
||||
if Attri.StoredName = GetAdditionalAttributeName(ahaRightMargin) then
|
||||
XMLConfig.DeleteValue('EditorOptions/Display/RightMarginColor');
|
||||
if Attri.StoredName = GetAdditionalAttributeName(ahaGutter) then
|
||||
XMLConfig.DeleteValue('EditorOptions/Display/GutterColor');
|
||||
end;
|
||||
// Write Version >= 5
|
||||
if Attri.StoredName = '' then
|
||||
continue;
|
||||
XMLConfig.WriteObject(Path + StrToValidXMLName(Attri.StoredName) + '/',
|
||||
@ -3340,6 +3325,9 @@ begin
|
||||
end;
|
||||
|
||||
procedure TEditorOptions.SetMarkupColors(Syn: TSrcIDEHighlighter; aSynEd: TSynEdit);
|
||||
(* ASynEd.Highlighter has a copy of all the ahaAttributes
|
||||
SetMarkupColors copies them from the highlighter to the synedit
|
||||
*)
|
||||
procedure SetMarkupColorByClass(AddHilightAttr: TAdditionalHilightAttribute;
|
||||
aClass: TSynEditMarkupClass);
|
||||
begin
|
||||
@ -3357,7 +3345,15 @@ procedure TEditorOptions.SetMarkupColors(Syn: TSrcIDEHighlighter; aSynEd: TSynEd
|
||||
|
||||
var
|
||||
i: integer;
|
||||
Attri: TSynHighlighterAttributes;
|
||||
begin
|
||||
Attri := GetSynAttributeByAha(aSynEd.Highlighter, ahaGutter);
|
||||
if Attri <> nil then
|
||||
aSynEd.Gutter.Color := Attri.Background;
|
||||
Attri := GetSynAttributeByAha(aSynEd.Highlighter, ahaRightMargin);
|
||||
if Attri <> nil then
|
||||
aSynEd.RightEdgeColor := Attri.Foreground;
|
||||
|
||||
SetMarkupColor(aSynEd.Highlighter, ahaTextBlock, aSynEd.SelectedColor);
|
||||
SetMarkupColor(aSynEd.Highlighter, ahaIncrementalSearch, aSynEd.IncrementColor);
|
||||
SetMarkupColor(aSynEd.Highlighter, ahaHighlightAll, aSynEd.HighlightAllColor);
|
||||
@ -3398,28 +3394,38 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TEditorOptions.GetSynAttributeByAha(Syn : TSrcIDEHighlighter;
|
||||
Aha: TAdditionalHilightAttribute): TSynHighlighterAttributes;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if Syn <> nil
|
||||
then begin
|
||||
for i := 0 to Syn.AttrCount - 1 do
|
||||
begin
|
||||
Result := Syn.Attribute[i];
|
||||
if Result.StoredName = '' then Continue;
|
||||
if SysUtils.CompareText(Result.StoredName, GetAdditionalAttributeName(Aha))= 0
|
||||
then exit;
|
||||
end;
|
||||
end;
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
procedure TEditorOptions.SetMarkupColor(Syn : TSrcIDEHighlighter;
|
||||
AddHilightAttr : TAdditionalHilightAttribute; aMarkup : TSynSelectedColor);
|
||||
var
|
||||
i: Integer;
|
||||
Attrib: TSynHighlighterAttributes;
|
||||
begin
|
||||
if Syn <> nil
|
||||
then begin
|
||||
for i := 0 to Syn.AttrCount - 1 do
|
||||
begin
|
||||
Attrib := Syn.Attribute[i];
|
||||
if Attrib.Name = '' then Continue;
|
||||
if SysUtils.CompareText(Attrib.Name,AdditionalHighlightAttributes[AddHilightAttr])<>0
|
||||
then Continue;
|
||||
|
||||
aMarkup.Foreground := Attrib.Foreground;
|
||||
aMarkup.Background := Attrib.Background;
|
||||
aMarkup.FrameColor := Attrib.FrameColor;
|
||||
aMarkup.Style := Attrib.Style;
|
||||
aMarkup.StyleMask := Attrib.StyleMask;
|
||||
Exit;
|
||||
end;
|
||||
Attrib := GetSynAttributeByAha(Syn, AddHilightAttr);
|
||||
if Attrib <> nil then begin
|
||||
aMarkup.Foreground := Attrib.Foreground;
|
||||
aMarkup.Background := Attrib.Background;
|
||||
aMarkup.FrameColor := Attrib.FrameColor;
|
||||
aMarkup.Style := Attrib.Style;
|
||||
aMarkup.StyleMask := Attrib.StyleMask;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// set default
|
||||
@ -3467,9 +3473,7 @@ begin
|
||||
if not FUseCodeFolding then
|
||||
ASynEdit.UnfoldAll;
|
||||
|
||||
ASynEdit.Gutter.Color := fGutterColor;
|
||||
ASynEdit.Gutter.Width := fGutterWidth;
|
||||
|
||||
ASynEdit.Gutter.SeparatorPart.Visible := FGutterSeparatorIndex <> -1;
|
||||
if FGutterSeparatorIndex <> -1 then
|
||||
ASynEdit.Gutter.SeparatorPart(0).Index := FGutterSeparatorIndex;
|
||||
@ -3478,7 +3482,6 @@ begin
|
||||
ASynEdit.RightEdge := fRightMargin
|
||||
else
|
||||
ASynEdit.RightEdge := 0;
|
||||
ASynEdit.RightEdgeColor := fRightMarginColor;
|
||||
|
||||
ApplyFontSettingsTo(ASynEdit);
|
||||
//debugln(['TEditorOptions.GetSynEditSettings ',ASynEdit.font.height]);
|
||||
@ -3527,6 +3530,7 @@ procedure TEditorOptions.SetSynEditSettings(ASynEdit: TSynEdit);
|
||||
// copy settings from a synedit to the options
|
||||
var
|
||||
MarkCaret: TSynEditMarkupHighlightAllCaret;
|
||||
Attri: TSynHighlighterAttributes;
|
||||
begin
|
||||
// general options
|
||||
fSynEditOptions := ASynEdit.Options;
|
||||
@ -3543,7 +3547,9 @@ begin
|
||||
fShowOnlyLineNumbersMultiplesOf := ASynEdit.Gutter.LineNumberPart(0).ShowOnlyLineNumbersMultiplesOf;
|
||||
FUseCodeFolding := ASynEdit.Gutter.CodeFoldPart.Visible;
|
||||
|
||||
fGutterColor := ASynEdit.Gutter.Color;
|
||||
Attri := GetSynAttributeByAha(ASynEdit.Highlighter, ahaGutter);
|
||||
if Attri <> nil then
|
||||
Attri.Background := ASynEdit.Gutter.Color;
|
||||
fGutterWidth := ASynEdit.Gutter.Width;
|
||||
if ASynEdit.Gutter.SeparatorPart.Visible then
|
||||
FGutterSeparatorIndex := ASynEdit.Gutter.SeparatorPart(0).Index
|
||||
@ -3552,7 +3558,11 @@ begin
|
||||
fVisibleRightMargin := ASynEdit.RightEdge>0;
|
||||
if fVisibleRightMargin then
|
||||
fRightMargin:= ASynEdit.RightEdge;
|
||||
fRightMarginColor := ASynEdit.RightEdgeColor;
|
||||
|
||||
Attri := GetSynAttributeByAha(ASynEdit.Highlighter, ahaRightMargin);
|
||||
if Attri <> nil then
|
||||
Attri.Foreground := ASynEdit.RightEdgeColor;
|
||||
|
||||
fEditorFont := ASynEdit.Font.Name;
|
||||
fEditorFontHeight := ASynEdit.Font.Height;
|
||||
fExtraCharSpacing := ASynEdit.ExtraCharSpacing;
|
||||
@ -3590,11 +3600,11 @@ begin
|
||||
for i := 0 to Syn.AttrCount - 1 do
|
||||
with Syn.Attribute[i] do
|
||||
begin
|
||||
if Name = '' then
|
||||
if StoredName = '' then
|
||||
continue;
|
||||
for a := Low(TAdditionalHilightAttribute)
|
||||
to High(TAdditionalHilightAttribute) do
|
||||
if AdditionalHighlightAttributes[a] = Name then
|
||||
if GetAdditionalAttributeName(a) = StoredName then
|
||||
HasSpecialAttribute[a] := True;
|
||||
end;
|
||||
for a := Low(TAdditionalHilightAttribute)
|
||||
|
@ -91,9 +91,7 @@ type
|
||||
// current index in EditorOpts.EditOptHighlighterList
|
||||
CurHighlightElement: TSynHighlightElement;
|
||||
CurHighlightElementIsExtra: Boolean;
|
||||
CurHighlightElementIsSingle: Boolean;
|
||||
CurExtraElement: TAdditionalHilightAttribute;
|
||||
CurSingleElement: TSingleColorAttribute;
|
||||
|
||||
UpdatingColor: Boolean;
|
||||
FFileExtensions: TStringList; // list of LanguageName=FileExtensions
|
||||
@ -118,11 +116,6 @@ type
|
||||
procedure InvalidatePreviews;
|
||||
procedure SetPreviewSynInAllPreviews;
|
||||
|
||||
function GetSingleColor(AElement: TSingleColorAttribute): TColor;
|
||||
procedure SetSingleColor(AEditor: TPreviewEditor;
|
||||
AElement: TSingleColorAttribute; AColor: TColor); overload;
|
||||
procedure SetSingleColor(AElement: TSingleColorAttribute; AColor: TColor); overload;
|
||||
|
||||
procedure OnStatusChange(Sender: TObject; Changes: TSynStatusChanges);
|
||||
procedure OnSpecialLineMarkup(Sender: TObject; Line: Integer;
|
||||
var Special: boolean; aMarkup: TSynSelectedColor);
|
||||
@ -234,13 +227,10 @@ procedure TEditorColorOptionsFrame.ForegroundColorBoxChange(Sender: TObject);
|
||||
begin
|
||||
if Sender = ForegroundColorBox then
|
||||
begin
|
||||
if ((CurHighlightElement = nil) and not CurHighlightElementIsSingle) or UpdatingColor then
|
||||
if (CurHighlightElement = nil) or UpdatingColor then
|
||||
Exit;
|
||||
UpdatingColor := True;
|
||||
if CurHighlightElementIsSingle then
|
||||
SetSingleColor(CurSingleElement, DefaultToNone(ForeGroundColorBox.Selected))
|
||||
else
|
||||
CurHighlightElement.Foreground := DefaultToNone(ForeGroundColorBox.Selected);
|
||||
CurHighlightElement.Foreground := DefaultToNone(ForeGroundColorBox.Selected);
|
||||
ForeGroundUseDefaultCheckBox.Checked := ForeGroundColorBox.Selected = clDefault;
|
||||
InvalidatePreviews;
|
||||
UpdatingColor := False;
|
||||
@ -375,43 +365,10 @@ begin
|
||||
CurHighlightElement.Style := CurHighlightElement.Style - [fsUnderline];
|
||||
InvalidatePreviews;
|
||||
end;
|
||||
end
|
||||
else
|
||||
if CurHighlightElementIsSingle then
|
||||
begin
|
||||
if Sender = ForeGroundUseDefaultCheckBox then
|
||||
if UpdatingColor = False then
|
||||
begin
|
||||
UpdatingColor := True;
|
||||
if ForeGroundUseDefaultCheckBox.Checked then
|
||||
begin
|
||||
ForegroundColorBox.Tag := ForegroundColorBox.Selected;
|
||||
ForegroundColorBox.Selected := clDefault;
|
||||
end
|
||||
else
|
||||
ForegroundColorBox.Selected := ForegroundColorBox.Tag;
|
||||
if DefaultToNone(ForegroundColorBox.Selected) <> GetSingleColor(CurSingleElement) then
|
||||
begin
|
||||
SetSingleColor(CurSingleElement, DefaultToNone(ForegroundColorBox.Selected));
|
||||
InvalidatePreviews;
|
||||
end;
|
||||
UpdatingColor := False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEditorColorOptionsFrame.ComboBoxOnExit(Sender: TObject);
|
||||
|
||||
procedure SetSingleColors(AColorScheme: String);
|
||||
var
|
||||
Scheme: TPascalColorScheme;
|
||||
s: TSingleColorAttribute;
|
||||
begin
|
||||
Scheme := EditorOpts.GetColorScheme(AColorScheme);
|
||||
for s := Low(TSingleColorAttribute) to High(TSingleColorAttribute) do
|
||||
SetSingleColor(s, Scheme.Single[s]);
|
||||
end;
|
||||
|
||||
var
|
||||
Box: TComboBox absolute Sender;
|
||||
NewVal, a: integer;
|
||||
@ -428,7 +385,6 @@ begin
|
||||
// change the colorscheme
|
||||
SetCurColorScheme(PreviewSyn.LanguageName, Box.Text);
|
||||
SetComboBoxText(Box, Box.Text);
|
||||
SetSingleColors(Box.Text);
|
||||
PreviewSyn := GetHighlighter(TCustomSynClass(PreviewSyn.ClassType),
|
||||
Box.Text, True);
|
||||
SetPreviewSynInAllPreviews;
|
||||
@ -581,7 +537,7 @@ end;
|
||||
|
||||
procedure TEditorColorOptionsFrame.ShowCurAttribute;
|
||||
begin
|
||||
if ((CurHighlightElement = nil) and not CurHighlightElementIsSingle) or UpdatingColor then
|
||||
if (CurHighlightElement = nil) or UpdatingColor then
|
||||
Exit;
|
||||
UpdatingColor := True;
|
||||
|
||||
@ -592,23 +548,17 @@ begin
|
||||
TextUnderlineRadioPanel.Visible := CurHighlightElementIsExtra and
|
||||
ahaSupportedFeatures[CurExtraElement].Style;
|
||||
|
||||
TextBoldCheckBox.Visible := not(CurHighlightElementIsSingle or
|
||||
(CurHighlightElementIsExtra and
|
||||
TextBoldCheckBox.Visible := not((CurHighlightElementIsExtra and
|
||||
not ahaSupportedFeatures[CurExtraElement].Style));
|
||||
TextItalicCheckBox.Visible := not(CurHighlightElementIsSingle or
|
||||
(CurHighlightElementIsExtra and
|
||||
TextItalicCheckBox.Visible := not((CurHighlightElementIsExtra and
|
||||
not ahaSupportedFeatures[CurExtraElement].Style));
|
||||
TextUnderlineCheckBox.Visible := not(CurHighlightElementIsSingle or
|
||||
(CurHighlightElementIsExtra and
|
||||
TextUnderlineCheckBox.Visible := not((CurHighlightElementIsExtra and
|
||||
not ahaSupportedFeatures[CurExtraElement].Style));
|
||||
|
||||
ForeGroundLabel.Caption := dlgForecolor;
|
||||
BackGroundLabel.Caption := dlgBackColor;
|
||||
FrameColorLabel.Caption := dlgFrameColor;
|
||||
|
||||
if CurHighlightElementIsSingle then
|
||||
ForeGroundLabel.Caption := dlgColor
|
||||
else
|
||||
if CurHighlightElementIsExtra and (CurExtraElement = ahaModifiedLine) then
|
||||
begin
|
||||
ForeGroundLabel.Caption := dlgSavedLineColor;
|
||||
@ -657,7 +607,6 @@ begin
|
||||
TextUnderlineRadioOff.Checked := True;
|
||||
end
|
||||
else
|
||||
if not CurHighlightElementIsSingle then
|
||||
begin
|
||||
TextBoldCheckBox.Checked := fsBold in CurHighlightElement.Style;
|
||||
TextItalicCheckBox.Checked := fsItalic in CurHighlightElement.Style;
|
||||
@ -672,46 +621,34 @@ begin
|
||||
FrameColorBox.Enabled := ahaSupportedFeatures[CurExtraElement].FF;
|
||||
FrameColorUseDefaultCheckBox.Enabled := ahaSupportedFeatures[CurExtraElement].FF;
|
||||
end else begin
|
||||
BackGroundColorBox.Enabled := not CurHighlightElementIsSingle;
|
||||
BackGroundUseDefaultCheckBox.Enabled := not CurHighlightElementIsSingle;
|
||||
BackGroundColorBox.Enabled := True;
|
||||
BackGroundUseDefaultCheckBox.Enabled := True;
|
||||
ForegroundColorBox.Enabled := True;
|
||||
ForeGroundUseDefaultCheckBox.Enabled := True;
|
||||
FrameColorBox.Enabled := not CurHighlightElementIsSingle;
|
||||
FrameColorUseDefaultCheckBox.Enabled := not CurHighlightElementIsSingle;
|
||||
FrameColorBox.Enabled := True;
|
||||
FrameColorUseDefaultCheckBox.Enabled := True;
|
||||
end;
|
||||
|
||||
if not CurHighlightElementIsSingle then
|
||||
begin
|
||||
ForegroundColorBox.Selected := NoneToDefault(CurHighlightElement.Foreground);
|
||||
if ForegroundColorBox.Selected = clDefault then
|
||||
ForegroundColorBox.Tag := ForegroundColorBox.DefaultColorColor
|
||||
else
|
||||
ForegroundColorBox.Tag := ForegroundColorBox.Selected;
|
||||
ForeGroundUseDefaultCheckBox.Checked := ForegroundColorBox.Selected = clDefault;
|
||||
|
||||
BackGroundColorBox.Selected := NoneToDefault(CurHighlightElement.Background);
|
||||
if BackGroundColorBox.Selected = clDefault then
|
||||
BackGroundColorBox.Tag := BackGroundColorBox.DefaultColorColor
|
||||
else
|
||||
BackGroundColorBox.Tag := BackGroundColorBox.Selected;
|
||||
BackGroundUseDefaultCheckBox.Checked := BackGroundColorBox.Selected = clDefault;
|
||||
|
||||
FrameColorBox.Selected := NoneToDefault(CurHighlightElement.FrameColor);
|
||||
if FrameColorBox.Selected = clDefault then
|
||||
FrameColorBox.Tag := FrameColorBox.DefaultColorColor
|
||||
else
|
||||
FrameColorBox.Tag := FrameColorBox.Selected;
|
||||
FrameColorUseDefaultCheckBox.Checked := FrameColorBox.Selected = clDefault;
|
||||
end
|
||||
ForegroundColorBox.Selected := NoneToDefault(CurHighlightElement.Foreground);
|
||||
if ForegroundColorBox.Selected = clDefault then
|
||||
ForegroundColorBox.Tag := ForegroundColorBox.DefaultColorColor
|
||||
else
|
||||
begin
|
||||
ForegroundColorBox.Selected := NoneToDefault(GetSingleColor(CurSingleElement));
|
||||
if ForegroundColorBox.Selected = clDefault then
|
||||
ForegroundColorBox.Tag := ForegroundColorBox.DefaultColorColor
|
||||
else
|
||||
ForegroundColorBox.Tag := ForegroundColorBox.Selected;
|
||||
ForeGroundUseDefaultCheckBox.Checked := ForegroundColorBox.Selected = clDefault;
|
||||
end;
|
||||
ForegroundColorBox.Tag := ForegroundColorBox.Selected;
|
||||
ForeGroundUseDefaultCheckBox.Checked := ForegroundColorBox.Selected = clDefault;
|
||||
|
||||
BackGroundColorBox.Selected := NoneToDefault(CurHighlightElement.Background);
|
||||
if BackGroundColorBox.Selected = clDefault then
|
||||
BackGroundColorBox.Tag := BackGroundColorBox.DefaultColorColor
|
||||
else
|
||||
BackGroundColorBox.Tag := BackGroundColorBox.Selected;
|
||||
BackGroundUseDefaultCheckBox.Checked := BackGroundColorBox.Selected = clDefault;
|
||||
|
||||
FrameColorBox.Selected := NoneToDefault(CurHighlightElement.FrameColor);
|
||||
if FrameColorBox.Selected = clDefault then
|
||||
FrameColorBox.Tag := FrameColorBox.DefaultColorColor
|
||||
else
|
||||
FrameColorBox.Tag := FrameColorBox.Selected;
|
||||
FrameColorUseDefaultCheckBox.Checked := FrameColorBox.Selected = clDefault;
|
||||
|
||||
UpdatingColor := False;
|
||||
end;
|
||||
@ -734,7 +671,6 @@ end;
|
||||
procedure TEditorColorOptionsFrame.FindCurHighlightElement;
|
||||
var
|
||||
i: Integer;
|
||||
s: TSingleColorAttribute;
|
||||
Old: TSynHighlightElement;
|
||||
NewName: String;
|
||||
begin
|
||||
@ -750,7 +686,6 @@ begin
|
||||
|
||||
Old := CurHighlightElement;
|
||||
CurHighlightElement := nil;
|
||||
CurSingleElement := Low(TSingleColorAttribute);
|
||||
CurExtraElement := Low(TAdditionalHilightAttribute);
|
||||
i := PreviewSyn.AttrCount - 1;
|
||||
while (i >= 0) do
|
||||
@ -766,22 +701,9 @@ begin
|
||||
if (Old <> CurHighlightElement) or (CurHighlightElement = nil) then
|
||||
begin
|
||||
CurHighlightElementIsExtra := False;
|
||||
CurHighlightElementIsSingle := False;
|
||||
|
||||
if CurHighlightElement <> nil then
|
||||
begin
|
||||
CurHighlightElementIsExtra := IsAhaElement(NewName, CurExtraElement);
|
||||
end
|
||||
else
|
||||
begin
|
||||
for s := Low(TSingleColorAttribute) to High(TSingleColorAttribute) do
|
||||
if NewName = SingleColorAttributes[s] then
|
||||
begin
|
||||
CurHighlightElementIsSingle := True;
|
||||
CurSingleElement := s;
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
ShowCurAttribute;
|
||||
end;
|
||||
end;
|
||||
@ -789,7 +711,6 @@ end;
|
||||
procedure TEditorColorOptionsFrame.FillColorElementListBox;
|
||||
var
|
||||
i: Integer;
|
||||
s: TSingleColorAttribute;
|
||||
ParentName: String;
|
||||
h: TAdditionalHilightAttribute;
|
||||
ParentNode: TTreeNode;
|
||||
@ -797,26 +718,18 @@ begin
|
||||
ColorElementTree.BeginUpdate;
|
||||
ColorElementTree.Items.Clear;
|
||||
|
||||
for i := 0 to PreviewSyn.AttrCount - 1 do
|
||||
if PreviewSyn.Attribute[i].Name <> '' then begin
|
||||
ParentName := PreviewSyn.LanguageName;
|
||||
if IsAhaElement(PreviewSyn.Attribute[i].Name, h) then
|
||||
ParentName := AdditionalHighlightGroupNames[ahaSupportedFeatures[h].Group];
|
||||
ParentNode := ColorElementTree.Items.FindTopLvlNode(ParentName);
|
||||
if ParentNode = nil then begin
|
||||
ParentNode := ColorElementTree.Items.Add(nil, ParentName);
|
||||
end;
|
||||
ColorElementTree.Items.AddChild(ParentNode, PreviewSyn.Attribute[i].Name);
|
||||
end;
|
||||
|
||||
// add single color attributes there
|
||||
for s := Low(TSingleColorAttribute) to High(TSingleColorAttribute) do begin
|
||||
ParentName := AdditionalHighlightGroupNames[agnGutter];
|
||||
for i := 0 to PreviewSyn.AttrCount - 1 do
|
||||
if PreviewSyn.Attribute[i].Name <> '' then begin
|
||||
ParentName := PreviewSyn.LanguageName;
|
||||
if IsAhaElement(PreviewSyn.Attribute[i].Name, h) then
|
||||
ParentName := AdditionalHighlightGroupNames[ahaSupportedFeatures[h].Group];
|
||||
ParentNode := ColorElementTree.Items.FindTopLvlNode(ParentName);
|
||||
if ParentNode = nil then
|
||||
if ParentNode = nil then begin
|
||||
ParentNode := ColorElementTree.Items.Add(nil, ParentName);
|
||||
ColorElementTree.Items.AddChild(ParentNode, SingleColorAttributes[s]);
|
||||
end;
|
||||
ColorElementTree.Items.AddChild(ParentNode, PreviewSyn.Attribute[i].Name);
|
||||
end;
|
||||
|
||||
for i := 0 to ColorElementTree.Items.Count - 1 do
|
||||
ColorElementTree.Items[i].AlphaSort;
|
||||
ColorElementTree.EndUpdate;
|
||||
@ -825,10 +738,8 @@ begin
|
||||
ColorElementTree.Items.GetFirstNode.Selected := True;
|
||||
|
||||
CurHighlightElement := nil;
|
||||
CurSingleElement := Low(TSingleColorAttribute);
|
||||
CurExtraElement := Low(TAdditionalHilightAttribute);
|
||||
CurHighlightElementIsExtra := False;
|
||||
CurHighlightElementIsSingle := False;
|
||||
FindCurHighlightElement;
|
||||
end;
|
||||
|
||||
@ -840,7 +751,6 @@ var
|
||||
i, j: Integer;
|
||||
CurSynClass: TCustomSynClass;
|
||||
Scheme: TPascalColorScheme;
|
||||
s: TSingleColorAttribute;
|
||||
begin
|
||||
PascalSyn := TPreviewPasSyn(GetHighlighter(TPreviewPasSyn,
|
||||
ColorSchemeComboBox.Text, True));
|
||||
@ -866,11 +776,6 @@ begin
|
||||
CopyHiLightAttributeValues(DefaultSyn.Attribute[i],
|
||||
PreviewSyn.Attribute[j]);
|
||||
end;
|
||||
if OnlySelected then
|
||||
SetSingleColor(CurSingleElement, Scheme.Single[CurSingleElement])
|
||||
else
|
||||
for s := Low(TSingleColorAttribute) to High(TSingleColorAttribute) do
|
||||
SetSingleColor(s, Scheme.Single[s])
|
||||
finally
|
||||
DefaultSyn.Free;
|
||||
end;
|
||||
@ -932,15 +837,6 @@ begin
|
||||
end;
|
||||
|
||||
procedure TEditorColorOptionsFrame.InvalidatePreviews;
|
||||
|
||||
procedure SetSingleColors(AEditor: TPreviewEditor);
|
||||
var
|
||||
s: TSingleColorAttribute;
|
||||
begin
|
||||
for s := Low(TSingleColorAttribute) to High(TSingleColorAttribute) do
|
||||
SetSingleColor(AEditor, s, GetSingleColor(s));
|
||||
end;
|
||||
|
||||
var
|
||||
a: Integer;
|
||||
begin
|
||||
@ -949,7 +845,6 @@ begin
|
||||
if PreviewEdits[a] <> nil then
|
||||
begin
|
||||
EditorOpts.SetMarkupColors(PreviewEdits[a].Highlighter, PreviewEdits[a]);
|
||||
SetSingleColors(PreviewEdits[a]);
|
||||
PreviewEdits[a].Invalidate;
|
||||
end;
|
||||
end;
|
||||
@ -967,29 +862,6 @@ begin
|
||||
PreviewEdits[a].Highlighter := nil;
|
||||
end;
|
||||
|
||||
function TEditorColorOptionsFrame.GetSingleColor(AElement: TSingleColorAttribute): TColor;
|
||||
begin
|
||||
case AElement of
|
||||
scaGutter: Result := ColorPreview.Gutter.Color;
|
||||
scaRightMargin: Result := ColorPreview.RightEdgeColor;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEditorColorOptionsFrame.SetSingleColor(
|
||||
AEditor: TPreviewEditor; AElement: TSingleColorAttribute; AColor: TColor);
|
||||
begin
|
||||
case AElement of
|
||||
scaGutter: AEditor.Gutter.Color := AColor;
|
||||
scaRightMargin: AEditor.RightEdgeColor := AColor;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEditorColorOptionsFrame.SetSingleColor(
|
||||
AElement: TSingleColorAttribute; AColor: TColor);
|
||||
begin
|
||||
SetSingleColor(ColorPreview, AElement, AColor);
|
||||
end;
|
||||
|
||||
function TEditorColorOptionsFrame.GeneralPage: TEditorGeneralOptionsFrame; inline;
|
||||
begin
|
||||
Result := TEditorGeneralOptionsFrame(FDialog.FindEditor(TEditorGeneralOptionsFrame));
|
||||
@ -1013,10 +885,8 @@ begin
|
||||
FDialog := ADialog;
|
||||
UpdatingColor := False;
|
||||
CurHighlightElement := nil;
|
||||
CurSingleElement := Low(TSingleColorAttribute);
|
||||
CurExtraElement := Low(TAdditionalHilightAttribute);
|
||||
CurHighlightElementIsExtra := False;
|
||||
CurHighlightElementIsSingle := False;
|
||||
|
||||
UseSyntaxHighlightCheckBox.Caption := dlgUseSyntaxHighlight;
|
||||
LanguageLabel.Caption := dlgLang;
|
||||
@ -1131,19 +1001,9 @@ begin
|
||||
end;
|
||||
|
||||
procedure TEditorColorOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||
|
||||
procedure WriteSingleColor(s: TSingleColorAttribute; AColor: TColor);
|
||||
begin
|
||||
case s of
|
||||
scaGutter: TEditorOptions(AOptions).GutterColor := AColor;
|
||||
scaRightMargin: TEditorOptions(AOptions).RightMarginColor := AColor;
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
i, j: Integer;
|
||||
Syn: TSrcIDEHighlighter;
|
||||
s: TSingleColorAttribute;
|
||||
begin
|
||||
with AOptions as TEditorOptions do
|
||||
begin
|
||||
@ -1183,9 +1043,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
// write single colors
|
||||
for s := Low(TSingleColorAttribute) to High(TSingleColorAttribute) do
|
||||
WriteSingleColor(s, GetSingleColor(s));
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user