mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 19:39:17 +02:00
SynEdit: Change to use FTheLinesView instead of FFoldedView
git-svn-id: trunk@63200 -
This commit is contained in:
parent
f5447ddcde
commit
34099573b4
@ -923,7 +923,7 @@ type
|
|||||||
function GetSelStart: integer;
|
function GetSelStart: integer;
|
||||||
procedure SetSelEnd(const Value: integer);
|
procedure SetSelEnd(const Value: integer);
|
||||||
procedure SetSelStart(const Value: integer);
|
procedure SetSelStart(const Value: integer);
|
||||||
property TextView : TSynEditFoldedView read FFoldedLinesView;
|
property TextView : TSynEditStringsLinked read FTheLinesView;
|
||||||
property TopView: Integer read GetTopView write SetTopView; // TopLine converted into Visible(View) lines
|
property TopView: Integer read GetTopView write SetTopView; // TopLine converted into Visible(View) lines
|
||||||
function PasteFromClipboardEx(ClipHelper: TSynClipboardStream; AForceColumnMode: Boolean = False): Boolean;
|
function PasteFromClipboardEx(ClipHelper: TSynClipboardStream; AForceColumnMode: Boolean = False): Boolean;
|
||||||
function FindNextUnfoldedLine(iLine: integer; Down: boolean): Integer;
|
function FindNextUnfoldedLine(iLine: integer; Down: boolean): Integer;
|
||||||
@ -1908,7 +1908,7 @@ begin
|
|||||||
if not Assigned(FTextArea) then
|
if not Assigned(FTextArea) then
|
||||||
Result := -1
|
Result := -1
|
||||||
else
|
else
|
||||||
Result := FFoldedLinesView.ViewToTextIndex(ToIdx(FTextArea.TopLine)) + 1;
|
Result := FTheLinesView.ViewToTextIndex(ToIdx(FTextArea.TopLine)) + 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomSynEdit.SetBlockTabIndent(AValue: integer);
|
procedure TCustomSynEdit.SetBlockTabIndent(AValue: integer);
|
||||||
@ -1975,7 +1975,7 @@ function TCustomSynEdit.ScreenRowToRow(ScreenRow: integer; LimitToLines: Boolean
|
|||||||
// ScreenRow is 0-base
|
// ScreenRow is 0-base
|
||||||
// result is 1-based
|
// result is 1-based
|
||||||
begin
|
begin
|
||||||
Result := FFoldedLinesView.ScreenLineToTextIndex(ScreenRow)+1;
|
Result := ToPos(FTheLinesView.ViewToTextIndex(ToIdx(TopView + ScreenRow)));
|
||||||
if LimitToLines and (Result >= Lines.Count) then
|
if LimitToLines and (Result >= Lines.Count) then
|
||||||
Result := Lines.Count;
|
Result := Lines.Count;
|
||||||
// DebugLn(['=== SrceenRow TO Row In:',ScreenRow,' out:',Result, ' topline=',TopLine, ' view topline=',FFoldedLinesView.TopLine]);
|
// DebugLn(['=== SrceenRow TO Row In:',ScreenRow,' out:',Result, ' topline=',TopLine, ' view topline=',FFoldedLinesView.TopLine]);
|
||||||
@ -1987,7 +1987,7 @@ function TCustomSynEdit.RowToScreenRow(PhysicalRow: integer): integer;
|
|||||||
// 0 to LinesInWindow for visible lines (incl last partial visble line)
|
// 0 to LinesInWindow for visible lines (incl last partial visble line)
|
||||||
// and returns LinesInWindow+1 for lines below visible screen
|
// and returns LinesInWindow+1 for lines below visible screen
|
||||||
begin
|
begin
|
||||||
Result := FFoldedLinesView.TextIndexToScreenLine(PhysicalRow-1);
|
Result := ToPos(FTheLinesView.TextToViewIndex(ToIdx(PhysicalRow))) - TopView;
|
||||||
if Result < -1 then Result := -1;
|
if Result < -1 then Result := -1;
|
||||||
if Result > LinesInWindow+1 then Result := LinesInWindow+1;
|
if Result > LinesInWindow+1 then Result := LinesInWindow+1;
|
||||||
// DebugLn(['=== Row TO ScreenRow In:',PhysicalRow,' out:',Result]);
|
// DebugLn(['=== Row TO ScreenRow In:',PhysicalRow,' out:',Result]);
|
||||||
@ -3869,7 +3869,7 @@ begin
|
|||||||
else
|
else
|
||||||
TopView := TopView + fScrollDeltaY;
|
TopView := TopView + fScrollDeltaY;
|
||||||
if fScrollDeltaY > 0
|
if fScrollDeltaY > 0
|
||||||
then Y := FFoldedLinesView.TextIndex[LinesInWindow-1]+1 // scrolling down
|
then Y := ToPos(FTheLinesView.ViewToTextIndex(TopView + LinesInWindow))
|
||||||
else Y := TopLine; // scrolling up
|
else Y := TopLine; // scrolling up
|
||||||
if Y < 1 // past end of file
|
if Y < 1 // past end of file
|
||||||
then y := FCaret.LinePos;
|
then y := FCaret.LinePos;
|
||||||
@ -4723,7 +4723,7 @@ end;
|
|||||||
|
|
||||||
function TCustomSynEdit.CurrentMaxTopView: Integer;
|
function TCustomSynEdit.CurrentMaxTopView: Integer;
|
||||||
begin
|
begin
|
||||||
Result := FFoldedLinesView.ViewedCount;
|
Result := FTheLinesView.ViewedCount;
|
||||||
if not(eoScrollPastEof in Options) then
|
if not(eoScrollPastEof in Options) then
|
||||||
Result := Result + 1 - Max(0, LinesInWindow);
|
Result := Result + 1 - Max(0, LinesInWindow);
|
||||||
Result := Max(Result, 1);
|
Result := Max(Result, 1);
|
||||||
@ -4741,7 +4741,7 @@ begin
|
|||||||
|
|
||||||
if not HandleAllocated then
|
if not HandleAllocated then
|
||||||
Include(fStateFlags, sfExplicitTopLine);
|
Include(fStateFlags, sfExplicitTopLine);
|
||||||
NewTopView := ToPos(FFoldedLinesView.TextToViewIndex(ToIdx(Value)));
|
NewTopView := ToPos(FTheLinesView.TextToViewIndex(ToIdx(Value)));
|
||||||
if NewTopView <> TopView then begin
|
if NewTopView <> TopView then begin
|
||||||
TopView := NewTopView;
|
TopView := NewTopView;
|
||||||
end;
|
end;
|
||||||
@ -4917,7 +4917,7 @@ begin
|
|||||||
//' nPage=',ScrollInfo.nPage,' nPos=',ScrollInfo.nPos,' ClientW=',ClientWidth);
|
//' nPage=',ScrollInfo.nPage,' nPos=',ScrollInfo.nPos,' ClientW=',ClientWidth);
|
||||||
|
|
||||||
// Vertical
|
// Vertical
|
||||||
ScrollInfo.nMax := FFoldedLinesView.ViewedCount+1;
|
ScrollInfo.nMax := FTheLinesView.ViewedCount+1;
|
||||||
if (eoScrollPastEof in Options) then
|
if (eoScrollPastEof in Options) then
|
||||||
Inc(ScrollInfo.nMax, LinesInWindow - 1);
|
Inc(ScrollInfo.nMax, LinesInWindow - 1);
|
||||||
if ((fScrollBars in [ssBoth, ssVertical]) or
|
if ((fScrollBars in [ssBoth, ssVertical]) or
|
||||||
@ -5143,7 +5143,7 @@ begin
|
|||||||
case Msg.ScrollCode of
|
case Msg.ScrollCode of
|
||||||
// Scrolls to start / end of the text
|
// Scrolls to start / end of the text
|
||||||
SB_TOP: TopView := 1;
|
SB_TOP: TopView := 1;
|
||||||
SB_BOTTOM: TopView := FFoldedLinesView.ViewedCount;
|
SB_BOTTOM: TopView := FTheLinesView.ViewedCount;
|
||||||
// Scrolls one line up / down
|
// Scrolls one line up / down
|
||||||
SB_LINEDOWN: TopView := TopView + 1;
|
SB_LINEDOWN: TopView := TopView + 1;
|
||||||
SB_LINEUP: TopView := TopView - 1;
|
SB_LINEUP: TopView := TopView - 1;
|
||||||
@ -6778,22 +6778,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
ecEditorTop, ecSelEditorTop:
|
ecEditorTop, ecSelEditorTop:
|
||||||
begin
|
begin
|
||||||
FCaret.LineCharPos := Point(1, ToPos(FFoldedLinesView.ViewToTextIndex(0)));
|
FCaret.LineCharPos := Point(1, ToPos(FTheLinesView.ViewToTextIndex(0)));
|
||||||
end;
|
end;
|
||||||
ecEditorBottom, ecSelEditorBottom:
|
ecEditorBottom, ecSelEditorBottom:
|
||||||
begin
|
begin
|
||||||
CaretNew := Point(1, ToPos(FFoldedLinesView.ViewToTextIndex(ToIdx(FFoldedLinesView.ViewedCount))));
|
CaretNew := Point(1, ToPos(FTheLinesView.ViewToTextIndex(ToIdx(FTheLinesView.ViewedCount))));
|
||||||
if (CaretNew.Y > 0) then
|
if (CaretNew.Y > 0) then
|
||||||
CaretNew.X := Length(FTheLinesView[CaretNew.Y - 1]) + 1;
|
CaretNew.X := Length(FTheLinesView[CaretNew.Y - 1]) + 1;
|
||||||
FCaret.LineCharPos := CaretNew;
|
FCaret.LineCharPos := CaretNew;
|
||||||
end;
|
end;
|
||||||
ecColSelEditorTop:
|
ecColSelEditorTop:
|
||||||
begin
|
begin
|
||||||
FCaret.LinePos := ToPos(FFoldedLinesView.ViewToTextIndex(0));
|
FCaret.LinePos := ToPos(FTheLinesView.ViewToTextIndex(0));
|
||||||
end;
|
end;
|
||||||
ecColSelEditorBottom:
|
ecColSelEditorBottom:
|
||||||
begin
|
begin
|
||||||
FCaret.LinePos := ToPos(FFoldedLinesView.ViewToTextIndex(ToIdx(FFoldedLinesView.ViewedCount)));
|
FCaret.LinePos := ToPos(FTheLinesView.ViewToTextIndex(ToIdx(FTheLinesView.ViewedCount)));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// goto special line / column position
|
// goto special line / column position
|
||||||
@ -8344,7 +8344,7 @@ begin
|
|||||||
if not(eoScrollPastEol in fOptions) then begin
|
if not(eoScrollPastEol in fOptions) then begin
|
||||||
// move to begin of next line
|
// move to begin of next line
|
||||||
NewCaret.Y:= FFoldedLinesView.TextPosAddLines(FCaret.LinePos, +1);
|
NewCaret.Y:= FFoldedLinesView.TextPosAddLines(FCaret.LinePos, +1);
|
||||||
if NewCaret.Y <= ToPos(FFoldedLinesView.ViewToTextIndex(ToIdx(FFoldedLinesView.ViewedCount))) then begin
|
if NewCaret.Y <= ToPos(FTheLinesView.ViewToTextIndex(ToIdx(FTheLinesView.ViewedCount))) then begin
|
||||||
NewCaret.X := 1;
|
NewCaret.X := 1;
|
||||||
FCaret.LineBytePos := NewCaret;
|
FCaret.LineBytePos := NewCaret;
|
||||||
end;
|
end;
|
||||||
|
@ -301,7 +301,8 @@ end;
|
|||||||
procedure TTestFoldedView.ReCreateEdit;
|
procedure TTestFoldedView.ReCreateEdit;
|
||||||
begin
|
begin
|
||||||
inherited ReCreateEdit;
|
inherited ReCreateEdit;
|
||||||
FoldedView := SynEdit.TextView;
|
//FoldedView := SynEdit.TextView;
|
||||||
|
FoldedView := TSynEditFoldedView(SynEdit.TextViewsManager.SynTextViewByClass[TSynEditFoldedView]);
|
||||||
if DoAllowScrollPastEof then SynEdit.Options := SynEdit.Options + [eoScrollPastEof];
|
if DoAllowScrollPastEof then SynEdit.Options := SynEdit.Options + [eoScrollPastEof];
|
||||||
EnableFolds([cfbtBeginEnd.. cfbtNone], [cfbtSlashComment]);
|
EnableFolds([cfbtBeginEnd.. cfbtNone], [cfbtSlashComment]);
|
||||||
end;
|
end;
|
||||||
|
@ -243,6 +243,7 @@ type
|
|||||||
FCaretStamp: Int64;
|
FCaretStamp: Int64;
|
||||||
FMarkupIdentComplWindow: TSynMarkupIdentComplWindow;
|
FMarkupIdentComplWindow: TSynMarkupIdentComplWindow;
|
||||||
FShowTopInfo: boolean;
|
FShowTopInfo: boolean;
|
||||||
|
FFoldView: TSynEditFoldedView;
|
||||||
FTopInfoNestList: TLazSynEditNestedFoldsList;
|
FTopInfoNestList: TLazSynEditNestedFoldsList;
|
||||||
FSyncroEdit: TSynPluginSyncroEdit;
|
FSyncroEdit: TSynPluginSyncroEdit;
|
||||||
FTemplateEdit: TSynPluginTemplateEdit;
|
FTemplateEdit: TSynPluginTemplateEdit;
|
||||||
@ -1453,10 +1454,10 @@ var
|
|||||||
end;
|
end;
|
||||||
NodeFoldType: TPascalCodeFoldBlockType;
|
NodeFoldType: TPascalCodeFoldBlockType;
|
||||||
begin
|
begin
|
||||||
if (not FShowTopInfo) or (not HandleAllocated) or (TextView.HighLighter = nil) then exit;
|
if (not FShowTopInfo) or (not HandleAllocated) or (FFoldView.HighLighter = nil) then exit;
|
||||||
if FSrcSynCaretChangedLock or not(TextView.HighLighter is TSynPasSyn) then exit;
|
if FSrcSynCaretChangedLock or not(FFoldView.HighLighter is TSynPasSyn) then exit;
|
||||||
|
|
||||||
if TextView.HighLighter.NeedScan then begin
|
if FFoldView.HighLighter.NeedScan then begin
|
||||||
FSrcSynCaretChangedNeeded := True;
|
FSrcSynCaretChangedNeeded := True;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -1748,6 +1749,7 @@ var
|
|||||||
MarkupFoldColors: TSynEditMarkupFoldColors;
|
MarkupFoldColors: TSynEditMarkupFoldColors;
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
|
FFoldView := TSynEditFoldedView(TextViewsManager.SynTextViewByClass[TSynEditFoldedView]);
|
||||||
FCaretColor := clNone;
|
FCaretColor := clNone;
|
||||||
FUserWordsList := TFPList.Create;
|
FUserWordsList := TFPList.Create;
|
||||||
FTemplateEdit:=TSynPluginTemplateEdit.Create(Self);
|
FTemplateEdit:=TSynPluginTemplateEdit.Create(Self);
|
||||||
|
Loading…
Reference in New Issue
Block a user