editor options, better names

note: breaks reloading of current option file
This commit is contained in:
Basile Burg 2015-12-12 11:03:11 +01:00
parent c6fe1fde18
commit bacac42fb2
4 changed files with 48 additions and 70 deletions

View File

@ -108,7 +108,6 @@ type
fCommtAttrib: TSynHighlighterAttributes; fCommtAttrib: TSynHighlighterAttributes;
fStrngAttrib: TSynHighlighterAttributes; fStrngAttrib: TSynHighlighterAttributes;
fKeywdAttrib: TSynHighlighterAttributes; fKeywdAttrib: TSynHighlighterAttributes;
fCurrIAttrib: TSynHighlighterAttributes;
fDDocsAttrib: TSynHighlighterAttributes; fDDocsAttrib: TSynHighlighterAttributes;
fAsblrAttrib: TSynHighlighterAttributes; fAsblrAttrib: TSynHighlighterAttributes;
fSpeckAttrib: TSynHighlighterAttributes; fSpeckAttrib: TSynHighlighterAttributes;
@ -128,7 +127,6 @@ type
procedure setCommtAttrib(value: TSynHighlighterAttributes); procedure setCommtAttrib(value: TSynHighlighterAttributes);
procedure setStrngAttrib(value: TSynHighlighterAttributes); procedure setStrngAttrib(value: TSynHighlighterAttributes);
procedure setKeywdAttrib(value: TSynHighlighterAttributes); procedure setKeywdAttrib(value: TSynHighlighterAttributes);
procedure setCurrIAttrib(value: TSynHighlighterAttributes);
procedure setDDocsAttrib(value: TSynHighlighterAttributes); procedure setDDocsAttrib(value: TSynHighlighterAttributes);
procedure setAsblrAttrib(value: TSynHighlighterAttributes); procedure setAsblrAttrib(value: TSynHighlighterAttributes);
procedure setSpeckAttrib(value: TSynHighlighterAttributes); procedure setSpeckAttrib(value: TSynHighlighterAttributes);
@ -137,15 +135,14 @@ type
protected protected
function GetRangeClass: TSynCustomHighlighterRangeClass; override; function GetRangeClass: TSynCustomHighlighterRangeClass; override;
published published
property FoldKinds: TFoldKinds read fFoldKinds write setFoldKinds; property foldKinds: TFoldKinds read fFoldKinds write setFoldKinds;
property WhiteAttrib: TSynHighlighterAttributes read fWhiteAttrib write setWhiteAttrib; property whites: TSynHighlighterAttributes read fWhiteAttrib write setWhiteAttrib;
property NumbrAttrib: TSynHighlighterAttributes read fNumbrAttrib write setNumbrAttrib; property numbers: TSynHighlighterAttributes read fNumbrAttrib write setNumbrAttrib;
property SymblAttrib: TSynHighlighterAttributes read fSymblAttrib write setSymblAttrib; property symbols: TSynHighlighterAttributes read fSymblAttrib write setSymblAttrib;
property IdentAttrib: TSynHighlighterAttributes read fIdentAttrib write setIdentAttrib; property identifiers: TSynHighlighterAttributes read fIdentAttrib write setIdentAttrib;
property CommtAttrib: TSynHighlighterAttributes read fCommtAttrib write setCommtAttrib; property comments: TSynHighlighterAttributes read fCommtAttrib write setCommtAttrib;
property StrngAttrib: TSynHighlighterAttributes read fStrngAttrib write setStrngAttrib; property strings: TSynHighlighterAttributes read fStrngAttrib write setStrngAttrib;
property KeywdAttrib: TSynHighlighterAttributes read fKeywdAttrib write setKeywdAttrib; property keywords: TSynHighlighterAttributes read fKeywdAttrib write setKeywdAttrib;
property CurrIAttrib: TSynHighlighterAttributes read fCurrIAttrib write setCurrIAttrib stored false;
property DDocsAttrib: TSynHighlighterAttributes read fDDocsAttrib write setDDocsAttrib; property DDocsAttrib: TSynHighlighterAttributes read fDDocsAttrib write setDDocsAttrib;
property AsblrAttrib: TSynHighlighterAttributes read fAsblrAttrib write setAsblrAttrib; property AsblrAttrib: TSynHighlighterAttributes read fAsblrAttrib write setAsblrAttrib;
property SpeckAttrib: TSynHighlighterAttributes read fSpeckAttrib write setSpeckAttrib; property SpeckAttrib: TSynHighlighterAttributes read fSpeckAttrib write setSpeckAttrib;
@ -302,7 +299,6 @@ begin
fCommtAttrib := TSynHighlighterAttributes.Create('Comment','Comment'); fCommtAttrib := TSynHighlighterAttributes.Create('Comment','Comment');
fStrngAttrib := TSynHighlighterAttributes.Create('String','String'); fStrngAttrib := TSynHighlighterAttributes.Create('String','String');
fKeywdAttrib := TSynHighlighterAttributes.Create('Keyword','Keyword'); fKeywdAttrib := TSynHighlighterAttributes.Create('Keyword','Keyword');
fCurrIAttrib := TSynHighlighterAttributes.Create('CurrentIdentifier','CurrentIdentifier');
fDDocsAttrib := TSynHighlighterAttributes.Create('DDoc','DDoc'); fDDocsAttrib := TSynHighlighterAttributes.Create('DDoc','DDoc');
fAsblrAttrib := TSynHighlighterAttributes.Create('Asm','Asm'); fAsblrAttrib := TSynHighlighterAttributes.Create('Asm','Asm');
fSpeckAttrib := TSynHighlighterAttributes.Create('SpecialKeywords','SpecialKeywords'); fSpeckAttrib := TSynHighlighterAttributes.Create('SpecialKeywords','SpecialKeywords');
@ -316,11 +312,6 @@ begin
fAsblrAttrib.Foreground := clGray; fAsblrAttrib.Foreground := clGray;
fSpeckAttrib.Foreground := clNavy; fSpeckAttrib.Foreground := clNavy;
fCurrIAttrib.Foreground := clBlack;
fCurrIAttrib.FrameEdges := sfeAround;
fCurrIAttrib.FrameColor := $D4D4D4;
fCurrIAttrib.Background := $F0F0F0;
fDDocsAttrib.Foreground := clTeal; fDDocsAttrib.Foreground := clTeal;
fCommtAttrib.Style := [fsItalic]; fCommtAttrib.Style := [fsItalic];
@ -335,7 +326,6 @@ begin
AddAttribute(fCommtAttrib); AddAttribute(fCommtAttrib);
AddAttribute(fStrngAttrib); AddAttribute(fStrngAttrib);
AddAttribute(fKeywdAttrib); AddAttribute(fKeywdAttrib);
AddAttribute(fCurrIAttrib);
AddAttribute(fDDocsAttrib); AddAttribute(fDDocsAttrib);
AddAttribute(fAsblrAttrib); AddAttribute(fAsblrAttrib);
AddAttribute(fSpeckAttrib); AddAttribute(fSpeckAttrib);
@ -369,7 +359,7 @@ begin
if Source is TSynD2Syn then if Source is TSynD2Syn then
begin begin
srcsyn := TSynD2Syn(Source); srcsyn := TSynD2Syn(Source);
FoldKinds := srcsyn.FoldKinds; foldKinds := srcsyn.foldKinds;
end; end;
end; end;
@ -434,11 +424,6 @@ begin
fKeywdAttrib.Assign(value); fKeywdAttrib.Assign(value);
end; end;
procedure TSynD2Syn.setCurrIAttrib(value: TSynHighlighterAttributes);
begin
fCurrIAttrib.Assign(value);
end;
procedure TSynD2Syn.setDDocsAttrib(value: TSynHighlighterAttributes); procedure TSynD2Syn.setDDocsAttrib(value: TSynHighlighterAttributes);
begin begin
fDDocsAttrib.Assign(value); fDDocsAttrib.Assign(value);
@ -524,7 +509,7 @@ begin
end; end;
end; end;
// line comment / region beg-end // line comments / region beg-end
if (fCurrRange.rangeKinds = []) or (fCurrRange.rangeKinds = [rkTokString]) or if (fCurrRange.rangeKinds = []) or (fCurrRange.rangeKinds = [rkTokString]) or
(fCurrRange.rangeKinds = [rkAsm]) (fCurrRange.rangeKinds = [rkAsm])
then if readDelim(reader, fTokStop, '//') then then if readDelim(reader, fTokStop, '//') then
@ -831,7 +816,7 @@ begin
fTokKind := tkIdent; // invalid op not colorized. fTokKind := tkIdent; // invalid op not colorized.
end; end;
// Keyword - Identifier // Keyword - identifiers
if not isWhite(reader^) then if not isWhite(reader^) then
begin begin
fTokKind := tkIdent; fTokKind := tkIdent;

View File

@ -31,10 +31,10 @@ type
// //
fShortCuts: TCollection; fShortCuts: TCollection;
// //
fSelCol: TSynSelectedColor; fSelAttribs: TSynSelectedColor;
fFoldedColor: TSynSelectedColor; fFoldedColor: TSynSelectedColor;
fMouseLinkColor: TSynSelectedColor; fMouseLinkAttribs: TSynSelectedColor;
fBracketMatchColor: TSynSelectedColor; fBracketMatchAttribs: TSynSelectedColor;
fIdentifierMarkup: TSynSelectedColor; fIdentifierMarkup: TSynSelectedColor;
fFont: TFont; fFont: TFont;
// //
@ -52,7 +52,6 @@ type
fMouseOptions: TSynEditorMouseOptions; fMouseOptions: TSynEditorMouseOptions;
fCompletionMenuCaseCare: boolean; fCompletionMenuCaseCare: boolean;
fCompletionMenuWidth: integer; fCompletionMenuWidth: integer;
fCompletionMenuHeight: integer;
fCompletionMenuLines: Byte; fCompletionMenuLines: Byte;
// //
procedure setFont(value: TFont); procedure setFont(value: TFont);
@ -70,16 +69,15 @@ type
published published
property completionMenuCaseCare: boolean read fCompletionMenuCaseCare write fCompletionMenuCaseCare; property completionMenuCaseCare: boolean read fCompletionMenuCaseCare write fCompletionMenuCaseCare;
property completionMenuWidth: integer read fCompletionMenuWidth write fCompletionMenuWidth; property completionMenuWidth: integer read fCompletionMenuWidth write fCompletionMenuWidth;
property completionMenuHeight: integer read fCompletionMenuHeight write fCompletionMenuHeight stored false;
property completionMenuLines: byte read fCompletionMenuLines write setCompletionMenuLines; property completionMenuLines: byte read fCompletionMenuLines write setCompletionMenuLines;
property autoDotDelay: integer read fAutoDotDelay write SetautoDotDelay; property autoDotDelay: integer read fAutoDotDelay write SetautoDotDelay;
property hintDelay: Integer read fDDocDelay write setDDocDelay stored false; deprecated; property hintDelay: Integer read fDDocDelay write setDDocDelay stored false; deprecated;
property ddocDelay: Integer read fDDocDelay write setDDocDelay; property ddocDelay: Integer read fDDocDelay write setDDocDelay;
property bracketMatchColor: TSynSelectedColor read fBracketMatchColor write setBracketMatchColor; property bracketMatch: TSynSelectedColor read fBracketMatchAttribs write setBracketMatchColor;
property mouseLinkColor: TSynSelectedColor read fMouseLinkColor write setMouseLinkColor; property mouseLink: TSynSelectedColor read fMouseLinkAttribs write setMouseLinkColor;
property selectedColor: TSynSelectedColor read fSelCol write setSelCol; property selection: TSynSelectedColor read fSelAttribs write setSelCol;
property foldedColor: TSynSelectedColor read fFoldedColor write setFoldedColor; property folding: TSynSelectedColor read fFoldedColor write setFoldedColor;
property identifierColor: TSynSelectedColor read fIdentifierMarkup write SetIdentifierMarkup; property identifierMatch: TSynSelectedColor read fIdentifierMarkup write SetIdentifierMarkup;
property background: TColor read fBackground write fBackground default clWhite; property background: TColor read fBackground write fBackground default clWhite;
property tabulationWidth: Integer read fTabWidth write fTabWidth default 4; property tabulationWidth: Integer read fTabWidth write fTabWidth default 4;
property blockIdentation: Integer read fBlockIdent write fBlockIdent default 4; property blockIdentation: Integer read fBlockIdent write fBlockIdent default 4;
@ -91,8 +89,8 @@ type
property options1: TSynEditorOptions read fOptions1 write fOptions1; property options1: TSynEditorOptions read fOptions1 write fOptions1;
property options2: TSynEditorOptions2 read fOptions2 write fOptions2; property options2: TSynEditorOptions2 read fOptions2 write fOptions2;
property mouseOptions: TSynEditorMouseOptions read fMouseOptions write fMouseOptions; property mouseOptions: TSynEditorMouseOptions read fMouseOptions write fMouseOptions;
property D2Highlighter: TPersistent read fD2Syn write setD2Syn; property highlighterDlang: TPersistent read fD2Syn write setD2Syn;
property TxtHighlighter: TPersistent read fTxtSyn write setTxtSyn; property highlighterGeneric: TPersistent read fTxtSyn write setTxtSyn;
property shortcuts: TCollection read fShortCuts write setShortcuts; property shortcuts: TCollection read fShortCuts write setShortcuts;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
@ -164,10 +162,10 @@ begin
// //
fDDocDelay:=200; fDDocDelay:=200;
fAutoDotDelay:=200; fAutoDotDelay:=200;
fSelCol := TSynSelectedColor.Create; fSelAttribs := TSynSelectedColor.Create;
fFoldedColor := TSynSelectedColor.Create; fFoldedColor := TSynSelectedColor.Create;
fMouseLinkColor := TSynSelectedColor.Create; fMouseLinkAttribs := TSynSelectedColor.Create;
fBracketMatchColor := TSynSelectedColor.Create; fBracketMatchAttribs := TSynSelectedColor.Create;
fIdentifierMarkup := TSynSelectedColor.Create; fIdentifierMarkup := TSynSelectedColor.Create;
// //
// note: default values come from TSynEditFoldedView ctor. // note: default values come from TSynEditFoldedView ctor.
@ -175,18 +173,17 @@ begin
fFoldedColor.Foreground := clDkGray; fFoldedColor.Foreground := clDkGray;
fFoldedColor.FrameColor := clDkGray; fFoldedColor.FrameColor := clDkGray;
// //
fMouseLinkColor.Style := [fsUnderline, fsBold]; fMouseLinkAttribs.Style := [fsUnderline, fsBold];
fMouseLinkColor.StyleMask := []; fMouseLinkAttribs.StyleMask := [];
fMouseLinkColor.Foreground := clNone; fMouseLinkAttribs.Foreground := clNone;
fMouseLinkColor.Background := clNone; fMouseLinkAttribs.Background := clNone;
// //
fBracketMatchColor.Foreground := clRed; fBracketMatchAttribs.Foreground := clRed;
fBracketMatchColor.Background := clNone; fBracketMatchAttribs.Background := clNone;
// //
fIdentifierMarkup.Foreground:= clNone; fIdentifierMarkup.Foreground:= clNone;
fIdentifierMarkup.Background:= clSilver; fIdentifierMarkup.Background:= clSilver;
// //
fCompletionMenuHeight:= 260;
fCompletionMenuWidth:= 160; fCompletionMenuWidth:= 160;
fCompletionMenuLines:= 15; fCompletionMenuLines:= 15;
// //
@ -224,11 +221,11 @@ end;
destructor TCEEditorOptionsBase.Destroy; destructor TCEEditorOptionsBase.Destroy;
begin begin
fFont.Free; fFont.Free;
fSelCol.Free; fSelAttribs.Free;
fShortCuts.Free; fShortCuts.Free;
fFoldedColor.Free; fFoldedColor.Free;
fMouseLinkColor.Free; fMouseLinkAttribs.Free;
fBracketMatchColor.Free; fBracketMatchAttribs.Free;
fIdentifierMarkup.Free; fIdentifierMarkup.Free;
inherited; inherited;
end; end;
@ -242,16 +239,15 @@ begin
srcopt := TCEEditorOptionsBase(src); srcopt := TCEEditorOptionsBase(src);
// //
fCompletionMenuWidth:=srcopt.fCompletionMenuWidth; fCompletionMenuWidth:=srcopt.fCompletionMenuWidth;
fCompletionMenuHeight:=srcopt.fCompletionMenuHeight;
fCompletionMenuLines:=srcopt.fCompletionMenuLines; fCompletionMenuLines:=srcopt.fCompletionMenuLines;
fCompletionMenuCaseCare:=srcopt.fCompletionMenuCaseCare; fCompletionMenuCaseCare:=srcopt.fCompletionMenuCaseCare;
fAutoDotDelay:=srcopt.fAutoDotDelay; fAutoDotDelay:=srcopt.fAutoDotDelay;
fDDocDelay:=srcopt.fDDocDelay; fDDocDelay:=srcopt.fDDocDelay;
fFont.Assign(srcopt.fFont); fFont.Assign(srcopt.fFont);
fSelCol.Assign(srcopt.fSelCol); fSelAttribs.Assign(srcopt.fSelAttribs);
fFoldedColor.Assign(srcopt.fFoldedColor); fFoldedColor.Assign(srcopt.fFoldedColor);
fMouseLinkColor.Assign(srcopt.fMouseLinkColor); fMouseLinkAttribs.Assign(srcopt.fMouseLinkAttribs);
fBracketMatchColor.Assign(srcopt.fBracketMatchColor); fBracketMatchAttribs.Assign(srcopt.fBracketMatchAttribs);
fD2Syn.Assign(srcopt.fD2Syn); fD2Syn.Assign(srcopt.fD2Syn);
fTxtSyn.Assign(srcopt.fTxtSyn); fTxtSyn.Assign(srcopt.fTxtSyn);
background := srcopt.background; background := srcopt.background;
@ -303,7 +299,7 @@ end;
procedure TCEEditorOptionsBase.setSelCol(value: TSynSelectedColor); procedure TCEEditorOptionsBase.setSelCol(value: TSynSelectedColor);
begin begin
fSelCol.Assign(value); fSelAttribs.Assign(value);
end; end;
procedure TCEEditorOptionsBase.setFoldedColor(value: TSynSelectedColor); procedure TCEEditorOptionsBase.setFoldedColor(value: TSynSelectedColor);
@ -313,12 +309,12 @@ end;
procedure TCEEditorOptionsBase.setMouseLinkColor(value: TSynSelectedColor); procedure TCEEditorOptionsBase.setMouseLinkColor(value: TSynSelectedColor);
begin begin
fMouseLinkColor.Assign(value); fMouseLinkAttribs.Assign(value);
end; end;
procedure TCEEditorOptionsBase.setBracketMatchColor(value: TSynSelectedColor); procedure TCEEditorOptionsBase.setBracketMatchColor(value: TSynSelectedColor);
begin begin
fBracketMatchColor.Assign(value); fBracketMatchAttribs.Assign(value);
end; end;
procedure TCEEditorOptionsBase.SetIdentifierMarkup(value: TSynSelectedColor); procedure TCEEditorOptionsBase.SetIdentifierMarkup(value: TSynSelectedColor);
@ -427,7 +423,6 @@ end;
procedure TCEEditorOptions.docClosing(aDoc: TCESynMemo); procedure TCEEditorOptions.docClosing(aDoc: TCESynMemo);
begin begin
fCompletionMenuHeight:=aDoc.completionMenu.TheForm.Height;
fCompletionMenuWidth := aDoc.completionMenu.TheForm.Width; fCompletionMenuWidth := aDoc.completionMenu.TheForm.Width;
fCompletionMenuLines := aDoc.completionMenu.LinesInWindow; fCompletionMenuLines := aDoc.completionMenu.LinesInWindow;
end; end;
@ -564,15 +559,14 @@ begin
anEditor.Font.Assign(font); anEditor.Font.Assign(font);
anEditor.Font.Size := savedSize; anEditor.Font.Size := savedSize;
anEditor.completionMenu.TheForm.Height := fCompletionMenuHeight;
anEditor.completionMenu.TheForm.Width := fCompletionMenuWidth; anEditor.completionMenu.TheForm.Width := fCompletionMenuWidth;
anEditor.completionMenu.LinesInWindow := fCompletionMenuLines; anEditor.completionMenu.LinesInWindow := fCompletionMenuLines;
anEditor.completionMenu.CaseSensitive := fCompletionMenuCaseCare; anEditor.completionMenu.CaseSensitive := fCompletionMenuCaseCare;
anEditor.SelectedColor.Assign(fSelCol); anEditor.SelectedColor.Assign(fSelAttribs);
anEditor.FoldedCodeColor.Assign(fFoldedColor); anEditor.FoldedCodeColor.Assign(fFoldedColor);
anEditor.MouseLinkColor.Assign(fMouseLinkColor); anEditor.MouseLinkColor.Assign(fMouseLinkAttribs);
anEditor.BracketMatchColor.Assign(fBracketMatchColor); anEditor.BracketMatchColor.Assign(fBracketMatchAttribs);
anEditor.HighlightAllColor.Assign(fIdentifierMarkup); anEditor.HighlightAllColor.Assign(fIdentifierMarkup);
anEditor.TabWidth := tabulationWidth; anEditor.TabWidth := tabulationWidth;
anEditor.BlockIndent := blockIdentation; anEditor.BlockIndent := blockIdentation;

View File

@ -843,7 +843,7 @@ end;
procedure TCESynMemo.highlightCurrentIdentifier; procedure TCESynMemo.highlightCurrentIdentifier;
begin begin
fIdentifier := GetWordAtRowCol(LogicalCaretXY); fIdentifier := GetWordAtRowCol(LogicalCaretXY);
SetHighlightSearch(fIdentifier,[ssoEntireScope]); SetHighlightSearch(fIdentifier,[ssoEntireScope, ssoMatchCase]);
end; end;
procedure TCESynMemo.changeNotify(Sender: TObject); procedure TCESynMemo.changeNotify(Sender: TObject);

View File

@ -20,14 +20,13 @@ type
fToken: TTokenKind; fToken: TTokenKind;
fTokStart, fTokStop: Integer; fTokStart, fTokStop: Integer;
fLineBuf: string; fLineBuf: string;
fCurrIdent: string;
procedure setSymAttribs(aValue: TSynHighlighterAttributes); procedure setSymAttribs(aValue: TSynHighlighterAttributes);
procedure setTxtAttribs(aValue: TSynHighlighterAttributes); procedure setTxtAttribs(aValue: TSynHighlighterAttributes);
procedure setWhiAttribs(aValue: TSynHighlighterAttributes); procedure setWhiAttribs(aValue: TSynHighlighterAttributes);
published published
property symbAttributes: TSynHighlighterAttributes read fSymAttribs write setSymAttribs; property symbols: TSynHighlighterAttributes read fSymAttribs write setSymAttribs;
property textAttributes: TSynHighlighterAttributes read fTxtAttribs write setTxtAttribs; property text: TSynHighlighterAttributes read fTxtAttribs write setTxtAttribs;
property whitAttributes: TSynHighlighterAttributes read fWhiAttribs write setWhiAttribs; property whites: TSynHighlighterAttributes read fWhiAttribs write setWhiAttribs;
public public
constructor Create(aOwner: TComponent); override; constructor Create(aOwner: TComponent); override;
// //