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

View File

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

View File

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

View File

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