IDE/SynEdit: Enable SnInfoView

git-svn-id: trunk@35589 -
This commit is contained in:
martin 2012-02-25 02:50:53 +00:00
parent 0eb5dd0740
commit 31401c1a23
15 changed files with 172 additions and 63 deletions

View File

@ -122,6 +122,7 @@ type
procedure SetRightEdgeColumn(AValue: integer); virtual;
procedure SetRightEdgeVisible(AValue: boolean); virtual;
procedure SetVisibleSpecialChars(AValue: TSynVisibleSpecialChars); virtual;
procedure SetHighlighter(AValue: TSynCustomHighlighter); virtual;
protected
procedure DoPaint(ACanvas: TCanvas; AClip: TRect); override;
procedure DoDisplayViewChanged; override;
@ -148,6 +149,7 @@ type
property RightEdgeColumn: integer write SetRightEdgeColumn;
property RightEdgeVisible: boolean write SetRightEdgeVisible;
property RightEdgeColor: TColor write SetRightEdgeColor;
property Highlighter: TSynCustomHighlighter write SetHighlighter;
end;
@ -250,6 +252,11 @@ begin
FTextArea.VisibleSpecialChars := AValue;
end;
procedure TLazSynSurfaceManager.SetHighlighter(AValue: TSynCustomHighlighter);
begin
FTextArea.Highlighter := AValue;
end;
procedure TLazSynSurfaceManager.DoPaint(ACanvas: TCanvas; AClip: TRect);
begin
FLeftGutterArea.Paint(ACanvas, AClip);
@ -792,15 +799,14 @@ var
procedure PaintHighlightToken(bFillToEOL: boolean);
var
Spaces: String = ' ';
nX1, eolx: integer;
NextPos : Integer;
NextPos, CurPos: Integer;
MarkupInfo: TSynSelectedColor;
FillFCol, FillBCol, FillFrame: TColor;
FrameStyle: TSynLineStyle;
FillStyle: TFontStyles;
tok: TRect;
Attr: TSynHighlighterAttributes;
s: TLazSynBorderSide;
HasFrame: Boolean;
begin
{debugln('PaintHighlightToken A TokenAccu: Len=',dbgs(TokenAccu.Len),
' PhysicalStartPos=',dbgs(TokenAccu.PhysicalStartPos),
@ -834,38 +840,30 @@ var
if bFillToEOL and (rcToken.Left < rcLine.Right) then begin
eolx := rcToken.Left; // remeber end of actual line, so we can decide to draw the right edge
NextPos := Min(LastCol, TokenAccu.PhysicalEndPos+1);
MarkupInfo := TSynSelectedColor.Create;
if Assigned(fHighlighter) then
Attr := fHighlighter.GetEndOfLineAttribute
else
Attr := nil;
repeat
MarkupInfo := fMarkupManager.GetMarkupAttributeAtRowCol(CurTextIndex+1, NextPos);
CurPos := NextPos;
NextPos := fMarkupManager.GetNextMarkupColAfterRowCol(CurTextIndex+1, NextPos);
if Assigned(Attr) then
begin
FillFCol := Attr.Foreground;
FillBCol := Attr.Background;
FillFrame := Attr.FrameColor;
FillStyle := Attr.Style;
FrameStyle := Attr.FrameStyle;
if FillFCol = clNone then FillFCol := ForegroundColor;
if FillBCol = clNone then FillBCol := colEditorBG;
end else
begin
FillFCol := ForegroundColor;
FillBCol := colEditorBG;
FillFrame := clNone;
FillStyle := []; // Font.Style; // currently always cleared
FrameStyle := slsSolid;
end;
MarkupInfo.Assign(Attr)
else
MarkupInfo.Clear;
MarkupInfo.MergeFinalStyle := True;
MarkupInfo.StyleMask := [];
if MarkupInfo.Background = clNone then
MarkupInfo.Background := colEditorBG;
if MarkupInfo.Foreground = clNone then
MarkupInfo.Foreground := ForegroundColor;
MarkupInfo.StartX := CurPos;
MarkupInfo.EndX := NextPos;
if Assigned(MarkupInfo) then
MarkupInfo.ModifyColors(FillFCol, FillBCol, FillFrame, FillStyle, FrameStyle);
fTextDrawer.BackColor := FillBCol;
//fTextDrawer.ForeColor := FillFCol; // for underline
//fTextDrawer.Style := FillStyle;
fMarkupManager.MergeMarkupAttributeAtRowCol(CurTextIndex+1,
CurPos, NextPos, MarkupInfo);
if NextPos < 1
then nX1 := rcLine.Right
@ -875,17 +873,45 @@ var
then nX1 := rcLine.Right;
end;
HasFrame := False;
with fTextDrawer do
begin
SetBackColor(MarkupInfo.Background);
SetForeColor(MarkupInfo.Foreground);
SetStyle(MarkupInfo.Style);
for s := low(TLazSynBorderSide) to high(TLazSynBorderSide) do begin
HasFrame := HasFrame or (MarkupInfo.FrameSideColors[s] <> clNone);
FrameColor[s] := MarkupInfo.FrameSideColors[s];
FrameStyle[s] := MarkupInfo.FrameSideStyles[s];
end;
end;
// Paint the chars
rcToken.Right := ScreenColumnToXValue(TokenAccu.PhysicalEndPos+1);
if nX1 > AClip.Right then begin
fTextDrawer.FrameColor[bsRight] := clNone; // right side of char is not painted
end;
if nX1 > nRightEdge then begin
if rcToken.Left < nRightEdge then begin
tok := rcToken;
tok.Right := nRightEdge;
InternalFillRect(dc, tok);
if (fsUnderline in MarkupInfo.Style) or (HasFrame) then
fTextDrawer.ExtTextOut(tok.Right, tok.Top, ETOOptions, tok,
@Spaces, 1, rcLine.Bottom)
else
InternalFillRect(dc, tok);
rcToken.Left := nRightEdge;
end;
rcToken.Bottom := rcLine.Bottom;
end;
rcToken.Right := nX1;
InternalFillRect(dc, rcToken); {TODO: if style underline, then print spaces}
if (fsUnderline in MarkupInfo.Style) or (HasFrame) then
fTextDrawer.ExtTextOut(rcToken.Right, rcToken.Top, ETOOptions, rcToken,
@Spaces, 1, rcLine.Bottom)
else
InternalFillRect(dc, rcToken);
rcToken.Left := nX1;
until nX1 >= rcLine.Right;
@ -895,6 +921,7 @@ var
LCLIntf.MoveToEx(dc, nRightEdge, rcLine.Top, nil);
LCLIntf.LineTo(dc, nRightEdge, rcLine.Bottom + 1);
end;
FreeAndNil(MarkupInfo);
end;
end;

View File

@ -5619,7 +5619,7 @@ begin
fMarkupHighCaret.Highlighter := nil;
fMarkupWordGroup.Highlighter := nil;
FFoldedLinesView.Highlighter := nil;
FTextArea.Highlighter := nil;
FPaintArea.Highlighter := nil;
if not (csDestroying in ComponentState) then begin
RecalcCharExtent;
Invalidate;
@ -5660,7 +5660,7 @@ begin
fMarkupHighCaret.Highlighter := Value;
fMarkupWordGroup.Highlighter := Value;
FFoldedLinesView.Highlighter := Value;
FTextArea.Highlighter := Value;
FPaintArea.Highlighter := Value;
FWordBreaker.Reset;
if fHighlighter<>nil then begin
fTSearch.IdentChars := fHighlighter.IdentChars;

View File

@ -242,7 +242,7 @@ procedure TSynEditMarkup.SetCaret(const AValue : TSynEditCaret);
var
r: Boolean;
begin
// inly register caret change callback, if handler is overriden
// only register caret change callback, if handler is overriden
r := TMethod(@Self.DoCaretChanged).Code <> Pointer(@TSynEditMarkup.DoCaretChanged);
if r and (FCaret <> nil) then
FCaret.RemoveChangeHandler(@DoCaretChanged);

View File

@ -166,8 +166,7 @@ begin
if (FHighlightedLine = ARow) and HasLineHighlight then
begin
FSpecialLine := True;
MarkupInfo.Foreground := FMarkupLineHighlightInfo.Foreground;
MarkupInfo.Background := FMarkupLineHighlightInfo.Background;
MarkupInfo.Assign(FMarkupLineHighlightInfo);
end;
end;
end;
@ -175,8 +174,8 @@ end;
function TSynEditMarkupSpecialLine.GetMarkupAttributeAtRowCol(const ARow, ACol : Integer): TSynSelectedColor;
begin
Result := nil;
MarkupInfo.StartX := -1;
MarkupInfo.EndX := -1;
MarkupInfo.StartX := 1;
MarkupInfo.EndX := MaxInt;
if FSpecialLine then
Result := MarkupInfo;
end;

View File

@ -34,6 +34,7 @@
<ahaGutterSeparator Background="clWhite" Foreground="clGray"/>
<ahaGutter Background="clBtnFace"/>
<ahaRightMargin Foreground="clSilver"/>
<ahaTopInfoHint Background="clActiveCaption" Foreground="clBlack" FrameColor="clMaroon" FrameStyle="slsDashed" FrameEdges="sfeBottom"/>
</SchemeDefault>
</Globals>
<LangObjectPascal Version="6">

View File

@ -35,6 +35,7 @@
<ahaGutterSeparator Background="clWhite" Foreground="clGray"/>
<ahaGutter Background="clBtnFace"/>
<ahaRightMargin Foreground="clSilver"/>
<ahaTopInfoHint Background="clActiveCaption" Foreground="clBlack" FrameColor="clMaroon" FrameStyle="slsDashed" FrameEdges="sfeBottom"/>
</SchemeDelphi>
</Globals>
<LangObjectPascal Version="6">

View File

@ -34,6 +34,7 @@
<ahaGutterSeparator Background="clWhite" Foreground="clGray"/>
<ahaGutter Background="clBtnFace"/>
<ahaRightMargin Foreground="clSilver"/>
<ahaTopInfoHint Background="clPurple" Foreground="clYellow" FrameColor="clOlive" FrameStyle="slsDashed"/>
</SchemeOcean>
</Globals>
<LangObjectPascal Version="6">

View File

@ -33,6 +33,7 @@
<ahaGutterSeparator Background="clWhite" Foreground="clGray"/>
<ahaGutter Background="clBtnFace"/>
<ahaRightMargin Foreground="clSilver"/>
<ahaTopInfoHint Background="clPurple" Foreground="clYellow" FrameColor="clOlive" FrameStyle="slsDashed"/>
</SchemePascal_Classic>
</Globals>
<LangObjectPascal Version="6">

View File

@ -34,6 +34,7 @@
<ahaGutterSeparator Background="clWhite" Foreground="clGray"/>
<ahaGutter Background="clBtnFace"/>
<ahaRightMargin Foreground="clSilver"/>
<ahaTopInfoHint Background="clPurple" Foreground="clYellow" FrameColor="clOlive" FrameStyle="slsDashed"/>
</SchemeTwilight>
</Globals>
<LangObjectPascal Version="6">

View File

@ -91,7 +91,8 @@ type
ahaWordGroup, ahaTemplateEditCur, ahaTemplateEditSync,
ahaTemplateEditOther, ahaSyncroEditCur, ahaSyncroEditSync,
ahaSyncroEditOther, ahaSyncroEditArea, ahaGutterSeparator,
ahaGutter, ahaRightMargin, ahaSpecialVisibleChars);
ahaGutter, ahaRightMargin, ahaSpecialVisibleChars,
ahaTopInfoHint);
TAhaGroupName = (agnDefault, agnLanguage, agnText, agnLine, agnGutter, agnTemplateMode, agnSyncronMode);
@ -119,7 +120,8 @@ const
'', // scaGutterSeparator => uses RTTI only
'', // ahaGutter
'', // ahaRightMargin
'' // ahaSpecialVisibleChars
'', // ahaSpecialVisibleChars
'' // ahaTopInfoHint
);
ahaGroupMap: array[TAdditionalHilightAttribute] of TAhaGroupName = (
@ -152,7 +154,8 @@ const
{ ahaGutterSeparator } agnGutter,
{ ahaGutter } agnGutter,
{ ahaRightMargin} agnGutter,
{ ahaSpecialVisibleChars } agnText
{ ahaSpecialVisibleChars } agnText,
{ ahaTopInfoHint } agnLine
);
ahaSupportedFeatures: array[TAdditionalHilightAttribute] of TSynHighlighterAttrFeatures =
(
@ -185,7 +188,8 @@ const
{ ahaGutterSeparator } [hafBackColor, hafForeColor],
{ ahaGutter } [hafBackColor],
{ ahaRightMargin} [hafForeColor],
{ ahaSpecialVisibleChars }[hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask]
{ ahaSpecialVisibleChars }[hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaTopInfoHint } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask]
);
@ -1155,6 +1159,7 @@ type
FPasExtendedKeywordsMode: Boolean;
FHideSingleTabInWindow: Boolean;
FPasStringKeywordMode: TSynPasStringMode;
FTopInfoView: boolean;
xmlconfig: TRttiXMLConfig;
// general options
@ -1405,6 +1410,8 @@ type
// Display
property ShowOverviewGutter: boolean
read FShowOverviewGutter write FShowOverviewGutter default True;
property TopInfoView: boolean
read FTopInfoView write FTopInfoView default False;
// Code Folding
property ReverseFoldPopUpOrder: Boolean
read FReverseFoldPopUpOrder write FReverseFoldPopUpOrder default True;
@ -1823,6 +1830,7 @@ begin
AdditionalHighlightAttributes[ahaGutter] := dlgGutter;
AdditionalHighlightAttributes[ahaRightMargin] := dlgRightMargin;
AdditionalHighlightAttributes[ahaSpecialVisibleChars] := dlgAddHiSpecialVisibleChars;
AdditionalHighlightAttributes[ahaTopInfoHint] := dlgTopInfoHint;
AdditionalHighlightGroupNames[agnDefault] := dlgAddHiAttrGroupDefault;
AdditionalHighlightGroupNames[agnText] := dlgAddHiAttrGroupText;
@ -3678,6 +3686,7 @@ begin
fEditorFontSize := SynDefaultFontSize;
fDisableAntialiasing := DefaultEditorDisableAntiAliasing;
FShowOverviewGutter := True;
FTopInfoView := False;
// Key Mappings
fKeyMappingScheme := KeyMapSchemeNames[kmsLazarus];
@ -4648,6 +4657,8 @@ begin
ASynEdit.Gutter.LineNumberPart(0).ShowOnlyLineNumbersMultiplesOf :=
fShowOnlyLineNumbersMultiplesOf;
ASynEdit.RightGutter.Visible := ShowOverviewGutter;
if ASynEdit is TIDESynEditor then
TIDESynEditor(ASynEdit).ShowTopInfo := TopInfoView;
ASynEdit.Gutter.CodeFoldPart.Visible := FUseCodeFolding;
if not FUseCodeFolding then
@ -5310,6 +5321,8 @@ begin
SetMarkupColor(ahaMouseLink, aSynEdit.MouseLinkColor);
SetMarkupColor(ahaFoldedCode, aSynEdit.FoldedCodeColor);
SetMarkupColor(ahaLineHighlight, aSynEdit.LineHighlightColor);
if ASynEdit is TIDESynEditor then
SetMarkupColor(ahaTopInfoHint, TIDESynEditor(aSynEdit).TopInfoMarkup);
SetMarkupColorByClass(ahaHighlightWord, TSynEditMarkupHighlightAllCaret);
SetMarkupColorByClass(ahaWordGroup, TSynEditMarkupWordGroup);
SetMarkupColorByClass(ahaSpecialVisibleChars, TSynEditMarkupSpecialChar);

Binary file not shown.

View File

@ -12,13 +12,13 @@ object EditorDisplayOptionsFrame: TEditorDisplayOptionsFrame
object MarginAndGutterGroupBox: TGroupBox
AnchorSideRight.Side = asrBottom
Left = 0
Height = 124
Height = 149
Top = 0
Width = 501
Align = alTop
AutoSize = True
Caption = 'MarginAndGutterGroupBox'
ClientHeight = 106
ClientHeight = 131
ClientWidth = 497
TabOrder = 0
object RightMarginLabel: TLabel
@ -178,12 +178,24 @@ object EditorDisplayOptionsFrame: TEditorDisplayOptionsFrame
OnChange = GeneralCheckBoxOnChange
TabOrder = 6
end
object chkTopInfoView: TCheckBox
AnchorSideLeft.Control = MarginAndGutterGroupBox
AnchorSideTop.Control = chkShowOverview
AnchorSideTop.Side = asrBottom
Left = 6
Height = 19
Top = 106
Width = 106
BorderSpacing.Around = 6
Caption = 'chkTopInfoView'
TabOrder = 7
end
end
object EditorFontGroupBox: TGroupBox
AnchorSideRight.Side = asrBottom
Left = 0
Height = 111
Top = 130
Top = 155
Width = 501
Align = alTop
AutoSize = True
@ -336,8 +348,8 @@ object EditorDisplayOptionsFrame: TEditorDisplayOptionsFrame
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 208
Top = 247
Height = 183
Top = 272
Width = 501
Align = alClient
BorderSpacing.Top = 6

View File

@ -34,6 +34,7 @@ type
{ TEditorDisplayOptionsFrame }
TEditorDisplayOptionsFrame = class(TAbstractIDEOptionsEditor)
chkTopInfoView: TCheckBox;
chkShowOverview: TCheckBox;
DisableAntialiasingCheckBox: TCheckBox;
DisplayPreview: TSynEdit;
@ -349,6 +350,7 @@ begin
DisableAntialiasingCheckBox.Caption := dlgDisableAntialiasing;
RightMarginColorLink.Caption := dlgColorLink;
chkShowOverview.Caption := lisShowOverviewGutter;
chkTopInfoView.Caption := lisTopInfoView;
with GeneralPage do
AddPreviewEdit(DisplayPreview);
@ -394,6 +396,7 @@ begin
SetComboBoxText(ExtraLineSpacingComboBox, IntToStr(ExtraLineSpacing),cstCaseInsensitive);
DisableAntialiasingCheckBox.Checked := DisableAntialiasing;
chkShowOverview.Checked := ShowOverviewGutter;
chkTopInfoView.Checked := TopInfoView;
end;
ShowOnlyLineNumbersMultiplesOfLabel.Enabled := ShowLineNumbersCheckBox.Checked;
@ -417,6 +420,7 @@ begin
ExtraLineSpacing := StrToIntDef(ExtraLineSpacingComboBox.Text, ExtraLineSpacing);
DisableAntialiasing := DisableAntialiasingCheckBox.Checked;
ShowOverviewGutter := chkShowOverview.Checked;
TopInfoView := chkTopInfoView.Checked;
end;
end;

View File

@ -1715,6 +1715,7 @@ resourcestring
dlgAddHiAttrSyncroEditArea = 'Selected Area';
dlgAddHiAttrGutterSeparator = 'Gutter Separator';
dlgAddHiSpecialVisibleChars = 'Visualized Special Chars';
dlgTopInfoHint = 'Current Class/Proc Hint';
dlgAddHiAttrGroupDefault = 'Global';
dlgAddHiAttrGroupText = 'Text';
@ -4830,6 +4831,7 @@ resourcestring
lisFileExtensionOfPrograms = 'File extension of programs';
lisEveryNThLineNumber = 'Every n-th line number';
lisShowOverviewGutter = 'Show overview Gutter';
lisTopInfoView = 'Show Class/Proc Hint';
lisLink = 'Link:';
lisShort = 'Short:';
lisInsertUrlTag = 'Insert url tag';

View File

@ -40,7 +40,7 @@ uses
Classes, SysUtils, Controls, LCLProc, LCLType, Graphics, Menus, math, LazarusIDEStrConsts,
SynEdit, SynEditMiscClasses, SynGutter, SynGutterBase, SynEditMarks,
SynEditTypes, SynGutterLineNumber, SynGutterCodeFolding, SynGutterMarks, SynGutterChanges,
SynGutterLineOverview, SynEditMarkup, SynEditMarkupGutterMark,
SynGutterLineOverview, SynEditMarkup, SynEditMarkupGutterMark, SynEditMarkupSpecialLine,
SynEditTextBuffer, SynEditFoldedView, SynTextDrawer, SynEditTextBase, LazSynEditText,
SynPluginTemplateEdit, SynPluginSyncroEdit, LazSynTextArea,
SynEditHighlighter, SynEditHighlighterFoldBase, SynHighlighterPas;
@ -101,6 +101,7 @@ type
procedure SetRightEdgeColumn(AValue: integer); override;
procedure SetRightEdgeVisible(AValue: boolean); override;
procedure SetVisibleSpecialChars(AValue: TSynVisibleSpecialChars); override;
procedure SetHighlighter(AValue: TSynCustomHighlighter); override;
protected
procedure DoPaint(ACanvas: TCanvas; AClip: TRect); override;
procedure BoundsChanged; override;
@ -121,21 +122,24 @@ type
TIDESynEditor = class(TSynEdit)
private
FShowTopInfo: boolean;
FSyncroEdit: TSynPluginSyncroEdit;
FTemplateEdit: TSynPluginTemplateEdit;
FMarkupForGutterMark: TSynEditMarkupGutterMark;
{$IFDEF WithSynInfoView}
FTopInfoDisplay: TSourceLazSynTopInfoView;
FSrcSynCaretChangedLock: boolean;
{$ENDIF}
FExtraMarkupLine: TSynEditMarkupSpecialLine;
FExtraMarkupMgr: TSynEditMarkupManager;
FTopInfoMarkup: TSynSelectedColor;
function GetIDEGutterMarks: TIDESynGutterMarks;
{$IFDEF WithSynInfoView}
procedure GetTopInfoMarkupForLine(Sender: TObject; Line: integer; var Special: boolean;
aMarkup: TSynSelectedColor);
procedure SetShowTopInfo(AValue: boolean);
procedure SetTopInfoMarkup(AValue: TSynSelectedColor);
procedure SrcSynCaretChanged(Sender: TObject);
{$ENDIF}
protected
{$IFDEF WithSynInfoView}
procedure DoOnStatusChange(Changes: TSynStatusChanges); override;
{$ENDIF}
function CreateGutter(AOwner : TSynEditBase; ASide: TSynGutterSide;
ATextDrawer: TheTextDrawer): TSynGutter; override;
public
@ -147,6 +151,9 @@ type
property TextBuffer;
property TemplateEdit: TSynPluginTemplateEdit read FTemplateEdit;
property SyncroEdit: TSynPluginSyncroEdit read FSyncroEdit;
//////
property TopInfoMarkup: TSynSelectedColor read FTopInfoMarkup write SetTopInfoMarkup;
property ShowTopInfo: boolean read FShowTopInfo write SetShowTopInfo;
end;
TIDESynHighlighterPasRangeList = class(TSynHighlighterPasRangeList)
@ -467,7 +474,7 @@ end;
procedure TSourceLazSynSurfaceManager.SetBackgroundColor(AValue: TColor);
begin
FOriginalManager.BackgroundColor := AValue;
//FExtraManager.BackgroundColor := AValue;
FExtraManager.BackgroundColor := AValue;
end;
procedure TSourceLazSynSurfaceManager.SetExtraCharSpacing(AValue: integer);
@ -486,7 +493,7 @@ end;
procedure TSourceLazSynSurfaceManager.SetForegroundColor(AValue: TColor);
begin
FOriginalManager.ForegroundColor := AValue;
//FExtraManager.ForegroundColor := AValue;
FExtraManager.ForegroundColor := AValue;
end;
procedure TSourceLazSynSurfaceManager.SetPadding(Side: TLazSynBorderSide; AValue: integer);
@ -519,6 +526,12 @@ begin
FExtraManager.VisibleSpecialChars := AValue;
end;
procedure TSourceLazSynSurfaceManager.SetHighlighter(AValue: TSynCustomHighlighter);
begin
FOriginalManager.Highlighter := AValue;
FExtraManager.Highlighter := AValue;
end;
procedure TSourceLazSynSurfaceManager.DoPaint(ACanvas: TCanvas; AClip: TRect);
begin
FOriginalManager.Paint(ACanvas, AClip);
@ -599,7 +612,6 @@ end;
{ TIDESynEditor }
{$IFDEF WithSynInfoView}
procedure TIDESynEditor.SrcSynCaretChanged(Sender: TObject);
var
InfCnt, i, t, ListCnt: Integer;
@ -608,8 +620,8 @@ var
List: TLazSynEditNestedFoldsList;
Inf: TSynFoldNodeInfo;
begin
if (not FShowTopInfo) or (not HandleAllocated) then exit;
if FSrcSynCaretChangedLock or not(TextView.HighLighter is TSynPasSyn) then exit;
if not HandleAllocated then exit;
FSrcSynCaretChangedLock := True;
try
@ -698,7 +710,29 @@ begin
if Changes * [scTopLine, scLinesInWindow] <> []then
SrcSynCaretChanged(nil);
end;
{$ENDIF}
procedure TIDESynEditor.GetTopInfoMarkupForLine(Sender: TObject; Line: integer;
var Special: boolean; aMarkup: TSynSelectedColor);
begin
Special := True;
aMarkup.Assign(FTopInfoMarkup);
end;
procedure TIDESynEditor.SetShowTopInfo(AValue: boolean);
begin
if FShowTopInfo = AValue then Exit;
FShowTopInfo := AValue;
if FShowTopInfo then
SrcSynCaretChanged(nil)
else
TSourceLazSynSurfaceManager(FPaintArea).TopLineCount := 0;
end;
procedure TIDESynEditor.SetTopInfoMarkup(AValue: TSynSelectedColor);
begin
if FTopInfoMarkup = AValue then Exit;
FTopInfoMarkup.Assign(AValue);
end;
function TIDESynEditor.GetIDEGutterMarks: TIDESynGutterMarks;
begin
@ -719,16 +753,28 @@ begin
FMarkupForGutterMark := TSynEditMarkupGutterMark.Create(Self, FWordBreaker);
TSynEditMarkupManager(MarkupMgr).AddMarkUp(FMarkupForGutterMark);
{$IFDEF WithSynInfoView}
FPaintArea := TSourceLazSynSurfaceManager.Create(Self, FPaintArea);
GetCaretObj.AddChangeHandler({$IFDEF FPC}@{$ENDIF}SrcSynCaretChanged);
FTopInfoDisplay := TSourceLazSynTopInfoView.Create;
FTopInfoDisplay.NextView := ViewedTextBuffer.DisplayView;
TSourceLazSynSurfaceManager(FPaintArea).TopLineCount := 0;
TSourceLazSynSurfaceManager(FPaintArea).ExtraManager.TextArea.BackgroundColor := clSilver;
// TSourceLazSynSurfaceManager(FPaintArea).ExtraManager.TextArea.BackgroundColor := clSilver;
TSourceLazSynSurfaceManager(FPaintArea).ExtraManager.DisplayView := FTopInfoDisplay;
{$ENDIF}
FTopInfoMarkup := TSynSelectedColor.Create;
FTopInfoMarkup.Clear;
FExtraMarkupLine := TSynEditMarkupSpecialLine.Create(Self);
FExtraMarkupLine.OnSpecialLineMarkup := @GetTopInfoMarkupForLine;
FExtraMarkupMgr := TSynEditMarkupManager.Create(Self);
FExtraMarkupMgr.AddMarkUp(TSynEditMarkup(MarkupMgr));
FExtraMarkupMgr.AddMarkUp(FExtraMarkupLine);
FExtraMarkupMgr.Lines := ViewedTextBuffer;
FExtraMarkupMgr.Caret := GetCaretObj;
FExtraMarkupMgr.InvalidateLinesMethod := @InvalidateLines;
TSourceLazSynSurfaceManager(FPaintArea).ExtraManager.TextArea.MarkupManager :=
FExtraMarkupMgr;
{$IFDEF WithSynDebugGutter}
TIDESynGutter(RightGutter).DebugGutter.TheLinesView := ViewedTextBuffer;
{$ENDIF}
@ -736,10 +782,11 @@ end;
destructor TIDESynEditor.Destroy;
begin
inherited Destroy;
{$IFDEF WithSynInfoView}
FExtraMarkupMgr.RemoveMarkUp(TSynEditMarkup(MarkupMgr));
FreeAndNil(FTopInfoDisplay);
{$ENDIF}
FreeAndNil(FExtraMarkupMgr);
FreeAndNil(FTopInfoMarkup);
inherited Destroy;
end;
function TIDESynEditor.TextIndexToViewPos(aTextIndex: Integer): Integer;