mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 20:59:08 +02:00
SynEdit: Extend TSynEditStrings (TextView), add TextToViewIndex / ViewToTextIndex / ViewedCount / ViewedLines
git-svn-id: trunk@63194 -
This commit is contained in:
parent
71fbdbd144
commit
8518346192
@ -262,6 +262,9 @@ type
|
|||||||
function GetTextChangeStamp: int64; virtual; abstract;
|
function GetTextChangeStamp: int64; virtual; abstract;
|
||||||
function GetViewChangeStamp: int64; virtual;
|
function GetViewChangeStamp: int64; virtual;
|
||||||
|
|
||||||
|
function GetViewedCount: Integer; virtual;
|
||||||
|
function GetViewedLines(Index: integer): string; virtual;
|
||||||
|
|
||||||
function GetIsInEditAction: Boolean; virtual; abstract;
|
function GetIsInEditAction: Boolean; virtual; abstract;
|
||||||
procedure IncIsInEditAction; virtual; abstract;
|
procedure IncIsInEditAction; virtual; abstract;
|
||||||
procedure DecIsInEditAction; virtual; abstract;
|
procedure DecIsInEditAction; virtual; abstract;
|
||||||
@ -349,6 +352,9 @@ type
|
|||||||
function PhysicalToLogicalCol(const Line: string;
|
function PhysicalToLogicalCol(const Line: string;
|
||||||
Index, PhysicalPos: integer): integer; virtual; //deprecated;
|
Index, PhysicalPos: integer): integer; virtual; //deprecated;
|
||||||
property LogPhysConvertor :TSynLogicalPhysicalConvertor read FLogPhysConvertor;
|
property LogPhysConvertor :TSynLogicalPhysicalConvertor read FLogPhysConvertor;
|
||||||
|
|
||||||
|
function TextToViewIndex(aTextIndex : TLineIdx) : TLineIdx; virtual;
|
||||||
|
function ViewToTextIndex(aViewIndex : TLineIdx) : TLineIdx; virtual;
|
||||||
public
|
public
|
||||||
// Currently Lines are physical
|
// Currently Lines are physical
|
||||||
procedure EditInsert(LogX, LogY: Integer; AText: String); virtual; abstract;
|
procedure EditInsert(LogX, LogY: Integer; AText: String); virtual; abstract;
|
||||||
@ -376,8 +382,10 @@ type
|
|||||||
public
|
public
|
||||||
property TextChangeStamp: int64 read GetTextChangeStamp;
|
property TextChangeStamp: int64 read GetTextChangeStamp;
|
||||||
property ViewChangeStamp: int64 read GetViewChangeStamp; // tabs-size, trailing-spaces, ...
|
property ViewChangeStamp: int64 read GetViewChangeStamp; // tabs-size, trailing-spaces, ...
|
||||||
property ExpandedStrings[Index: integer]: string read GetExpandedString;
|
property ExpandedStrings[Index: integer]: string read GetExpandedString; deprecated;
|
||||||
property LengthOfLongestLine: integer read GetLengthOfLongestLine;
|
property LengthOfLongestLine: integer read GetLengthOfLongestLine;
|
||||||
|
property ViewedLines[Index: integer]: string read GetViewedLines;
|
||||||
|
property ViewedCount: Integer read GetViewedCount;
|
||||||
property IsUtf8: Boolean read GetIsUtf8 write SetIsUtf8;
|
property IsUtf8: Boolean read GetIsUtf8 write SetIsUtf8;
|
||||||
public
|
public
|
||||||
property DisplayView: TLazSynDisplayView read GetDisplayView;
|
property DisplayView: TLazSynDisplayView read GetDisplayView;
|
||||||
@ -399,6 +407,9 @@ type
|
|||||||
function GetRange(Index: Pointer): TSynManagedStorageMem; override;
|
function GetRange(Index: Pointer): TSynManagedStorageMem; override;
|
||||||
procedure PutRange(Index: Pointer; const ARange: TSynManagedStorageMem); override;
|
procedure PutRange(Index: Pointer; const ARange: TSynManagedStorageMem); override;
|
||||||
|
|
||||||
|
function GetViewedCount: Integer; override;
|
||||||
|
function GetViewedLines(Index: integer): string; override;
|
||||||
|
|
||||||
function GetExpandedString(Index: integer): string; override;
|
function GetExpandedString(Index: integer): string; override;
|
||||||
function GetLengthOfLongestLine: integer; override;
|
function GetLengthOfLongestLine: integer; override;
|
||||||
|
|
||||||
@ -463,6 +474,10 @@ type
|
|||||||
AFlags: LPosFlags = []): Boolean; override;
|
AFlags: LPosFlags = []): Boolean; override;
|
||||||
function LogicPosAdjustToChar(const ALine: String; ALogicalPos: integer;
|
function LogicPosAdjustToChar(const ALine: String; ALogicalPos: integer;
|
||||||
AFlags: LPosFlags = []): Integer; override;
|
AFlags: LPosFlags = []): Integer; override;
|
||||||
|
|
||||||
|
function TextToViewIndex(aTextIndex : TLineIdx) : TLineIdx; override;
|
||||||
|
function ViewToTextIndex(aViewIndex : TLineIdx) : TLineIdx; override;
|
||||||
|
|
||||||
// LogX, LogY are 1-based
|
// LogX, LogY are 1-based
|
||||||
procedure EditInsert(LogX, LogY: Integer; AText: String); override;
|
procedure EditInsert(LogX, LogY: Integer; AText: String); override;
|
||||||
function EditDelete(LogX, LogY, ByteLen: Integer): String; override;
|
function EditDelete(LogX, LogY, ByteLen: Integer): String; override;
|
||||||
@ -1082,6 +1097,16 @@ begin
|
|||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSynEditStrings.GetViewedCount: Integer;
|
||||||
|
begin
|
||||||
|
Result := Count;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSynEditStrings.GetViewedLines(Index: integer): string;
|
||||||
|
begin
|
||||||
|
Result := Strings[Index];
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSynEditStrings.SetTextStr(const Value : string);
|
procedure TSynEditStrings.SetTextStr(const Value : string);
|
||||||
var
|
var
|
||||||
StartPos: PChar;
|
StartPos: PChar;
|
||||||
@ -1180,6 +1205,16 @@ begin
|
|||||||
Result := FLogPhysConvertorTmp.PhysicalToLogical(-9 , PhysicalPos);
|
Result := FLogPhysConvertorTmp.PhysicalToLogical(-9 , PhysicalPos);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSynEditStrings.TextToViewIndex(aTextIndex: TLineIdx): TLineIdx;
|
||||||
|
begin
|
||||||
|
Result := aTextIndex;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSynEditStrings.ViewToTextIndex(aViewIndex: TLineIdx): TLineIdx;
|
||||||
|
begin
|
||||||
|
Result := aViewIndex;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TSynEditStringsLinked }
|
{ TSynEditStringsLinked }
|
||||||
|
|
||||||
constructor TSynEditStringsLinked.Create(ASynStringSource: TSynEditStrings);
|
constructor TSynEditStringsLinked.Create(ASynStringSource: TSynEditStrings);
|
||||||
@ -1295,6 +1330,16 @@ begin
|
|||||||
fSynStrings.Ranges[Index] := ARange;
|
fSynStrings.Ranges[Index] := ARange;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSynEditStringsLinked.GetViewedCount: Integer;
|
||||||
|
begin
|
||||||
|
Result := fSynStrings.ViewedCount;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSynEditStringsLinked.GetViewedLines(Index: integer): string;
|
||||||
|
begin
|
||||||
|
Result := fSynStrings.ViewedLines[Index];
|
||||||
|
end;
|
||||||
|
|
||||||
function TSynEditStringsLinked.GetExpandedString(Index: integer): string;
|
function TSynEditStringsLinked.GetExpandedString(Index: integer): string;
|
||||||
begin
|
begin
|
||||||
Result:= fSynStrings.GetExpandedString(Index);
|
Result:= fSynStrings.GetExpandedString(Index);
|
||||||
@ -1480,6 +1525,16 @@ begin
|
|||||||
Result := fSynStrings.LogicPosAdjustToChar(ALine, ALogicalPos, AFlags);
|
Result := fSynStrings.LogicPosAdjustToChar(ALine, ALogicalPos, AFlags);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSynEditStringsLinked.TextToViewIndex(aTextIndex: TLineIdx): TLineIdx;
|
||||||
|
begin
|
||||||
|
Result := fSynStrings.TextToViewIndex(aTextIndex);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSynEditStringsLinked.ViewToTextIndex(aViewIndex: TLineIdx): TLineIdx;
|
||||||
|
begin
|
||||||
|
Result := fSynStrings.ViewToTextIndex(aViewIndex);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSynEditStringsLinked.IgnoreSendNotification(AReason: TSynEditNotifyReason;
|
procedure TSynEditStringsLinked.IgnoreSendNotification(AReason: TSynEditNotifyReason;
|
||||||
IncIgnore: Boolean);
|
IncIgnore: Boolean);
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user