SynEdit: remove more FFoldedLinesView references.

git-svn-id: trunk@63432 -
This commit is contained in:
martin 2020-06-23 19:43:11 +00:00
parent e51e371c7c
commit 8af680d14f
2 changed files with 16 additions and 15 deletions

View File

@ -943,9 +943,6 @@ type
procedure FontChanged(Sender: TObject); override;
function GetReadOnly: boolean; virtual;
procedure HighlighterAttrChanged(Sender: TObject);
// note: FirstLine and LastLine don't need to be in correct order
procedure InvalidateGutterLines(FirstLine, LastLine: integer);
procedure InvalidateLines(FirstLine, LastLine: integer);
Procedure LineCountChanged(Sender: TSynEditStrings; AIndex, ACount : Integer);
Procedure LineTextChanged(Sender: TSynEditStrings; AIndex, ACount : Integer);
procedure SizeOrFontChanged(bFont: boolean);
@ -1105,6 +1102,8 @@ type
function IsLinkable(Y, X1, X2: Integer): Boolean;
procedure InvalidateGutter;
procedure InvalidateLine(Line: integer);
procedure InvalidateGutterLines(FirstLine, LastLine: integer); // Currently invalidates full line => that may change
procedure InvalidateLines(FirstLine, LastLine: integer);
// Byte to Char
function LogicalToPhysicalPos(const p: TPoint): TPoint;
@ -2344,10 +2343,9 @@ begin
{$ENDIF} // WithSynExperimentalCharWidth
FFoldedLinesView := TSynEditFoldedView.Create(fCaret);
FFoldedLinesView := TSynEditFoldedView.Create(Self, fCaret);
FTextViewsManager.AddTextView(FFoldedLinesView);
FFoldedLinesView.AddChangeHandler(senrLineMappingChanged, @FoldChanged);
FFoldedLinesView.OnLineInvalidate := @InvalidateGutterLines;
// External Accessor
FStrings := TSynEditLines.Create(TSynEditStringList(FLines), @MarkTextAsSaved);
@ -5566,8 +5564,9 @@ var
begin
{$IFDEF SynFoldDebug}debugln(['FOLD-- FoldChanged; Index=', aIndex, ' TopView=', TopView, ' ScreenRowToRow(LinesInWindow + 1)=', ScreenRowToRow(LinesInWindow + 1)]);{$ENDIF}
TopView := TopView;
i := FFoldedLinesView.CollapsedLineForFoldAtLine(CaretY);
if i > 0 then begin
if (not FTheLinesView.IsTextIdxVisible(ToIdx(CaretY))) and (FTheLinesView.ViewedCount > 0) then begin
i := Max(0, FTheLinesView.TextToViewIndex(ToIdx(CaretY)));
i := ToPos(FTheLinesView.ViewToTextIndex(i)); // unfolded line, above the fold
SetCaretXY(Point(1, i));
UpdateCaret;
end

View File

@ -47,7 +47,7 @@ interface
uses
Classes, SysUtils,
// LCL
LCLProc, Graphics,
LCLProc, Graphics, LCLType,
// LazUtils
LazLoggerBase, LazMethodList,
// SynEdit
@ -378,6 +378,7 @@ type
TSynEditFoldedView = class(TSynEditStringsLinked)
private
FOwner: TSynEditBase;
fCaret: TSynEditCaret;
FBlockSelection: TSynEditSelection;
FFoldProvider: TSynEditFoldProvider;
@ -385,7 +386,6 @@ type
FMarkupInfoFoldedCode: TSynSelectedColor;
FMarkupInfoFoldedCodeLine: TSynSelectedColor;
FMarkupInfoHiddenCodeLine: TSynSelectedColor;
FOnLineInvalidate: TInvalidateLineProc;
fTopLine : Integer;
fLinesInWindow : Integer; // there may be an additional part visible line
fTextIndexList : Array of integer; (* Map each Screen line into a line in textbuffer *)
@ -439,7 +439,7 @@ type
// SkipFixFolding : Boolean = False);
property FoldTree: TSynTextFoldAVLTree read fFoldTree;
public
constructor Create(ACaret: TSynEditCaret);
constructor Create(AOwner: TSynEditBase; ACaret: TSynEditCaret);
destructor Destroy; override;
// Converting between Folded and Unfolded Lines/Indexes
@ -545,8 +545,6 @@ type
function IsFoldedAtTextIndex(AStartIndex, ColIndex: Integer): Boolean; (* Checks xth Fold at nth TextIndex (all lines in buffer) / 1-based *)
property FoldedAtTextIndex [index : integer] : Boolean read IsFolded;
property OnLineInvalidate: TInvalidateLineProc(* reports 1-based line *) {TODO: synedit expects 0 based }
read FOnLineInvalidate write FOnLineInvalidate;
property HighLighter: TSynCustomHighlighter read GetHighLighter
write SetHighLighter;
property FoldProvider: TSynEditFoldProvider read FFoldProvider;
@ -556,6 +554,8 @@ function dbgs(AClassification: TFoldNodeClassification): String; overload;
implementation
uses SynEdit;
//var
// SYN_FOLD_DEBUG: PLazLoggerLogGroup;
@ -3097,8 +3097,10 @@ end;
{ TSynEditFoldedView }
constructor TSynEditFoldedView.Create(ACaret: TSynEditCaret);
constructor TSynEditFoldedView.Create(AOwner: TSynEditBase;
ACaret: TSynEditCaret);
begin
FOwner := AOwner;
inherited Create;
fTopLine := 0;
fLinesInWindow := -1;
@ -3469,8 +3471,8 @@ begin
fFoldTypeList[i].Capability := NewCapability;
fFoldTypeList[i].Classifications := NewClassifications;
end;
if (not FInTopLineChanged) and assigned(FOnLineInvalidate) and (FirstChanged > 0) then
FOnLineInvalidate(FirstChanged, LastChanged + 1);
if (not FInTopLineChanged) and (FirstChanged > 0) then
TSynEdit(FOwner).InvalidateGutterLines(FirstChanged, LastChanged + 1);
end;
(* Lines *)