mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-26 05:21:33 +01:00
SynEdit: Refactor, clean out some older methods
git-svn-id: trunk@25784 -
This commit is contained in:
parent
fb64f40660
commit
9dc8e28df8
@ -70,7 +70,7 @@ type
|
|||||||
private
|
private
|
||||||
FMem: PByte;
|
FMem: PByte;
|
||||||
FCount, FCapacity: Integer;
|
FCount, FCapacity: Integer;
|
||||||
function GetItemPointer(Index: Integer): Pointer;
|
function GetItemPointer(Index: Integer): Pointer; inline;
|
||||||
protected
|
protected
|
||||||
procedure SetCapacity(const AValue: Integer); virtual;
|
procedure SetCapacity(const AValue: Integer); virtual;
|
||||||
procedure SetCount(const AValue: Integer); virtual;
|
procedure SetCount(const AValue: Integer); virtual;
|
||||||
@ -143,8 +143,6 @@ type
|
|||||||
FIsUtf8: Boolean;
|
FIsUtf8: Boolean;
|
||||||
function GetIsUtf8 : Boolean; virtual;
|
function GetIsUtf8 : Boolean; virtual;
|
||||||
procedure SetIsUtf8(const AValue : Boolean); virtual;
|
procedure SetIsUtf8(const AValue : Boolean); virtual;
|
||||||
function GetAttribute(const Owner: TClass; const Index: Integer): Pointer; virtual; abstract;
|
|
||||||
procedure SetAttribute(const Owner: TClass; const Index: Integer; const AValue: Pointer); virtual; abstract;
|
|
||||||
|
|
||||||
function GetExpandedString(Index: integer): string; virtual; abstract;
|
function GetExpandedString(Index: integer): string; virtual; abstract;
|
||||||
function GetLengthOfLongestLine: integer; virtual; abstract;
|
function GetLengthOfLongestLine: integer; virtual; abstract;
|
||||||
@ -171,10 +169,6 @@ type
|
|||||||
procedure InsertLines(Index, NumLines: integer); virtual; abstract;
|
procedure InsertLines(Index, NumLines: integer); virtual; abstract;
|
||||||
procedure InsertStrings(Index: integer; NewStrings: TStrings); virtual; abstract;
|
procedure InsertStrings(Index: integer; NewStrings: TStrings); virtual; abstract;
|
||||||
|
|
||||||
procedure RegisterAttribute(const Index: TClass; const Size: Word); virtual; abstract;
|
|
||||||
property Attribute[Owner: TClass; Index: Integer]: Pointer
|
|
||||||
read GetAttribute write SetAttribute;
|
|
||||||
|
|
||||||
procedure AddGenericHandler(AReason: TSynEditNotifyReason;
|
procedure AddGenericHandler(AReason: TSynEditNotifyReason;
|
||||||
AHandler: TMethod); virtual; abstract;
|
AHandler: TMethod); virtual; abstract;
|
||||||
procedure AddChangeHandler(AReason: TSynEditNotifyReason;
|
procedure AddChangeHandler(AReason: TSynEditNotifyReason;
|
||||||
@ -242,9 +236,6 @@ 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 GetAttribute(const Owner: TClass; const Index: Integer): Pointer; override;
|
|
||||||
procedure SetAttribute(const Owner: TClass; const Index: Integer; const AValue: Pointer); override;
|
|
||||||
|
|
||||||
function GetExpandedString(Index: integer): string; override;
|
function GetExpandedString(Index: integer): string; override;
|
||||||
function GetLengthOfLongestLine: integer; override;
|
function GetLengthOfLongestLine: integer; override;
|
||||||
|
|
||||||
@ -281,8 +272,6 @@ type
|
|||||||
procedure InsertLines(Index, NumLines: integer); override;
|
procedure InsertLines(Index, NumLines: integer); override;
|
||||||
procedure InsertStrings(Index: integer; NewStrings: TStrings); override;
|
procedure InsertStrings(Index: integer; NewStrings: TStrings); override;
|
||||||
|
|
||||||
// Size: 0 = Bit (TODO); 1..8 Size In Byte "SizeOf()"
|
|
||||||
procedure RegisterAttribute(const Index: TClass; const Size: Word); override;
|
|
||||||
procedure AddGenericHandler(AReason: TSynEditNotifyReason;
|
procedure AddGenericHandler(AReason: TSynEditNotifyReason;
|
||||||
AHandler: TMethod); override;
|
AHandler: TMethod); override;
|
||||||
procedure RemoveGenericHandler(AReason: TSynEditNotifyReason;
|
procedure RemoveGenericHandler(AReason: TSynEditNotifyReason;
|
||||||
@ -712,17 +701,6 @@ begin
|
|||||||
fSynStrings.Ranges[Index] := ARange;
|
fSynStrings.Ranges[Index] := ARange;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynEditStringsLinked.GetAttribute(const Owner: TClass; const Index: Integer): Pointer;
|
|
||||||
begin
|
|
||||||
Result := fSynStrings.Attribute[Owner, Index];
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSynEditStringsLinked.SetAttribute(const Owner: TClass;
|
|
||||||
const Index: Integer; const AValue: Pointer);
|
|
||||||
begin
|
|
||||||
fSynStrings.Attribute[Owner, Index] := AValue;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSynEditStringsLinked.GetExpandedString(Index: integer): string;
|
function TSynEditStringsLinked.GetExpandedString(Index: integer): string;
|
||||||
begin
|
begin
|
||||||
Result:= fSynStrings.GetExpandedString(Index);
|
Result:= fSynStrings.GetExpandedString(Index);
|
||||||
@ -748,11 +726,6 @@ begin
|
|||||||
Result := fSynStrings.GetCurUndoList;
|
Result := fSynStrings.GetCurUndoList;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditStringsLinked.RegisterAttribute(const Index: TClass; const Size: Word);
|
|
||||||
begin
|
|
||||||
fSynStrings.RegisterAttribute(Index, Size);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSynEditStringsLinked.AddGenericHandler(AReason: TSynEditNotifyReason; AHandler: TMethod);
|
procedure TSynEditStringsLinked.AddGenericHandler(AReason: TSynEditNotifyReason; AHandler: TMethod);
|
||||||
begin
|
begin
|
||||||
fSynStrings.AddGenericHandler(AReason, AHandler);
|
fSynStrings.AddGenericHandler(AReason, AHandler);
|
||||||
|
|||||||
@ -56,15 +56,10 @@ type
|
|||||||
sfSaved // a line is modified and saved after
|
sfSaved // a line is modified and saved after
|
||||||
);
|
);
|
||||||
TSynEditStringFlags = set of TSynEditStringFlag;
|
TSynEditStringFlags = set of TSynEditStringFlag;
|
||||||
|
PSynEditStringFlags = ^TSynEditStringFlags;
|
||||||
|
|
||||||
TStringListIndexEvent = procedure(Index: Integer) of object;
|
TStringListIndexEvent = procedure(Index: Integer) of object;
|
||||||
|
|
||||||
TSynEditStringAttribute = record
|
|
||||||
Index: TClass;
|
|
||||||
Size: Word;
|
|
||||||
Pos: Integer;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TLineRangeNotificationList }
|
{ TLineRangeNotificationList }
|
||||||
|
|
||||||
TLineRangeNotificationList = Class(TSynMethodList)
|
TLineRangeNotificationList = Class(TSynMethodList)
|
||||||
@ -84,16 +79,13 @@ type
|
|||||||
|
|
||||||
TSynEditStringMemory = class(TSynEditStorageMem)
|
TSynEditStringMemory = class(TSynEditStorageMem)
|
||||||
private
|
private
|
||||||
FAttributeSize: Integer;
|
|
||||||
FRangeList: TSynManagedStorageMemList;
|
FRangeList: TSynManagedStorageMemList;
|
||||||
FRangeListLock: Integer;
|
FRangeListLock: Integer;
|
||||||
function GetAttribute(Index: Integer; Pos: Integer; Size: Word): Pointer;
|
function GetFlags(Index: Integer): TSynEditStringFlags;
|
||||||
function GetAttributeSize: Integer;
|
|
||||||
function GetObject(Index: Integer): TObject;
|
function GetObject(Index: Integer): TObject;
|
||||||
function GetRange(Index: Pointer): TSynManagedStorageMem;
|
function GetRange(Index: Pointer): TSynManagedStorageMem;
|
||||||
function GetString(Index: Integer): String;
|
function GetString(Index: Integer): String;
|
||||||
procedure SetAttribute(Index: Integer; Pos: Integer; Size: Word; const AValue: Pointer);
|
procedure SetFlags(Index: Integer; const AValue: TSynEditStringFlags);
|
||||||
procedure SetAttributeSize(const AValue: Integer);
|
|
||||||
procedure SetObject(Index: Integer; const AValue: TObject);
|
procedure SetObject(Index: Integer; const AValue: TObject);
|
||||||
procedure SetRange(Index: Pointer; const AValue: TSynManagedStorageMem);
|
procedure SetRange(Index: Pointer; const AValue: TSynManagedStorageMem);
|
||||||
procedure SetString(Index: Integer; const AValue: String);
|
procedure SetString(Index: Integer; const AValue: String);
|
||||||
@ -110,11 +102,8 @@ type
|
|||||||
procedure DeleteRows(AIndex, ACount: Integer); override;
|
procedure DeleteRows(AIndex, ACount: Integer); override;
|
||||||
property Strings[Index: Integer]: String read GetString write SetString; default;
|
property Strings[Index: Integer]: String read GetString write SetString; default;
|
||||||
property Objects[Index: Integer]: TObject read GetObject write SetObject;
|
property Objects[Index: Integer]: TObject read GetObject write SetObject;
|
||||||
property Attribute[Index: Integer; Pos: Integer; Size: Word]: Pointer
|
|
||||||
read GetAttribute write SetAttribute;
|
|
||||||
property AttributeSize: Integer read GetAttributeSize write SetAttributeSize;
|
|
||||||
|
|
||||||
property RangeList[Index: Pointer]: TSynManagedStorageMem read GetRange write SetRange;
|
property RangeList[Index: Pointer]: TSynManagedStorageMem read GetRange write SetRange;
|
||||||
|
property Flags[Index: Integer]: TSynEditStringFlags read GetFlags write SetFlags;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TSynEditStringList }
|
{ TSynEditStringList }
|
||||||
@ -122,7 +111,6 @@ type
|
|||||||
TSynEditStringList = class(TSynEditStrings)
|
TSynEditStringList = class(TSynEditStrings)
|
||||||
private
|
private
|
||||||
FList: TSynEditStringMemory;
|
FList: TSynEditStringMemory;
|
||||||
FAttributeList: Array of TSynEditStringAttribute;
|
|
||||||
|
|
||||||
FAttachedSynEditList: TFPList;
|
FAttachedSynEditList: TFPList;
|
||||||
FNotifyLists: Array [TSynEditNotifyReason] of TSynMethodList;
|
FNotifyLists: Array [TSynEditNotifyReason] of TSynMethodList;
|
||||||
@ -145,8 +133,6 @@ type
|
|||||||
function GetFlags(Index: Integer): TSynEditStringFlags;
|
function GetFlags(Index: Integer): TSynEditStringFlags;
|
||||||
procedure Grow;
|
procedure Grow;
|
||||||
procedure InsertItem(Index: integer; const S: string);
|
procedure InsertItem(Index: integer; const S: string);
|
||||||
function ClassIndexForAttribute(AttrIndex: TClass): Integer;
|
|
||||||
Procedure SetAttributeSize(NewSize: Integer);
|
|
||||||
procedure SetFlags(Index: Integer; const AValue: TSynEditStringFlags);
|
procedure SetFlags(Index: Integer; const AValue: TSynEditStringFlags);
|
||||||
procedure SetModified(const AValue: Boolean);
|
procedure SetModified(const AValue: Boolean);
|
||||||
procedure SendCachedNotify;
|
procedure SendCachedNotify;
|
||||||
@ -167,8 +153,6 @@ 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 GetAttribute(const Owner: TClass; const Index: Integer): Pointer; override;
|
|
||||||
procedure SetAttribute(const Owner: TClass; const Index: Integer; const AValue: Pointer); override;
|
|
||||||
function Get(Index: integer): string; override;
|
function Get(Index: integer): string; override;
|
||||||
function GetCapacity: integer;
|
function GetCapacity: integer;
|
||||||
{$IFDEF SYN_COMPILER_3_UP} override; {$ENDIF} //mh 2000-10-18
|
{$IFDEF SYN_COMPILER_3_UP} override; {$ENDIF} //mh 2000-10-18
|
||||||
@ -190,7 +174,6 @@ type
|
|||||||
procedure AddStrings(AStrings: TStrings); override;
|
procedure AddStrings(AStrings: TStrings); override;
|
||||||
procedure Clear; override;
|
procedure Clear; override;
|
||||||
procedure Delete(Index: integer); override;
|
procedure Delete(Index: integer); override;
|
||||||
procedure RegisterAttribute(const Index: TClass; const Size: Word); override;
|
|
||||||
procedure DeleteLines(Index, NumLines: integer); override;
|
procedure DeleteLines(Index, NumLines: integer); override;
|
||||||
procedure Insert(Index: integer; const S: string); override;
|
procedure Insert(Index: integer; const S: string); override;
|
||||||
procedure InsertLines(Index, NumLines: integer); override;
|
procedure InsertLines(Index, NumLines: integer); override;
|
||||||
@ -491,8 +474,6 @@ begin
|
|||||||
for r := low(TSynEditNotifyReason) to high(TSynEditNotifyReason) do
|
for r := low(TSynEditNotifyReason) to high(TSynEditNotifyReason) do
|
||||||
FIgnoreSendNotification[r] := 0;
|
FIgnoreSendNotification[r] := 0;
|
||||||
inherited Create;
|
inherited Create;
|
||||||
SetAttributeSize(0);
|
|
||||||
RegisterAttribute(TSynEditFlagsClass, SizeOf(TSynEditStringFlag));
|
|
||||||
fDosFileFormat := TRUE;
|
fDosFileFormat := TRUE;
|
||||||
{begin} //mh 2000-10-19
|
{begin} //mh 2000-10-19
|
||||||
fIndexOfLongestLine := -1;
|
fIndexOfLongestLine := -1;
|
||||||
@ -503,7 +484,6 @@ destructor TSynEditStringList.Destroy;
|
|||||||
var
|
var
|
||||||
i: TSynEditNotifyReason;
|
i: TSynEditNotifyReason;
|
||||||
begin
|
begin
|
||||||
fAttributeList := nil;
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
SetCount(0);
|
SetCount(0);
|
||||||
SetCapacity(0);
|
SetCapacity(0);
|
||||||
@ -600,7 +580,7 @@ end;
|
|||||||
function TSynEditStringList.GetFlags(Index: Integer): TSynEditStringFlags;
|
function TSynEditStringList.GetFlags(Index: Integer): TSynEditStringFlags;
|
||||||
begin
|
begin
|
||||||
if (Index >= 0) and (Index < Count) then
|
if (Index >= 0) and (Index < Count) then
|
||||||
Result := TSynEditStringFlags(Integer(PtrUInt(GetAttribute(TSynEditFlagsClass, Index))))
|
Result := FList.Flags[Index]
|
||||||
else
|
else
|
||||||
Result := [];
|
Result := [];
|
||||||
end;
|
end;
|
||||||
@ -882,72 +862,9 @@ begin
|
|||||||
FList.RangeList[Index] := ARange;
|
FList.RangeList[Index] := ARange;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynEditStringList.GetAttribute(const Owner: TClass; const Index: Integer): Pointer;
|
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
begin
|
|
||||||
if (Index = 0) and (Count = 0) then
|
|
||||||
exit(nil);
|
|
||||||
if (Index < 0) or (Index >= Count) then
|
|
||||||
ListIndexOutOfBounds(Index);
|
|
||||||
i := ClassIndexForAttribute(Owner);
|
|
||||||
if i < 0 then
|
|
||||||
raise ESynEditStringList.CreateFmt('Unknown Attribute', []);
|
|
||||||
Result := FList.Attribute[Index, FAttributeList[i].Pos, FAttributeList[i].Size]
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSynEditStringList.SetAttribute(const Owner: TClass; const Index: Integer; const AValue: Pointer);
|
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
begin
|
|
||||||
if (Index = 0) and (Count = 0) then
|
|
||||||
Add('');
|
|
||||||
if (Index < 0) or (Index >= Count) then
|
|
||||||
ListIndexOutOfBounds(Index);
|
|
||||||
i := ClassIndexForAttribute(Owner);
|
|
||||||
if i < 0 then
|
|
||||||
raise ESynEditStringList.CreateFmt('Unknown Attribute', []);
|
|
||||||
FList.Attribute[Index, FAttributeList[i].Pos, FAttributeList[i].Size] := AValue;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSynEditStringList.RegisterAttribute(const Index: TClass; const Size: Word);
|
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
begin
|
|
||||||
if ClassIndexForAttribute(Index) >= 0 then
|
|
||||||
raise ESynEditStringList.CreateFmt('Duplicate Attribute', []);
|
|
||||||
i := Length(fAttributeList);
|
|
||||||
SetLength(fAttributeList, i+1);
|
|
||||||
fAttributeList[i].Index := Index;
|
|
||||||
fAttributeList[i].Size := Size;
|
|
||||||
if i= 0 then
|
|
||||||
fAttributeList[i].Pos := 0
|
|
||||||
else
|
|
||||||
fAttributeList[i].Pos := fAttributeList[i-1].Pos + fAttributeList[i-1].Size;
|
|
||||||
SetAttributeSize(fAttributeList[i].Pos + Size);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSynEditStringList.ClassIndexForAttribute(AttrIndex: TClass): Integer;
|
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
begin
|
|
||||||
for i := 0 to high(fAttributeList) do
|
|
||||||
if fAttributeList[i].Index = AttrIndex then
|
|
||||||
exit(i);
|
|
||||||
result := -1;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSynEditStringList.SetAttributeSize(NewSize: Integer);
|
|
||||||
begin
|
|
||||||
if FList.AttributeSize = NewSize then exit;
|
|
||||||
if Count > 0 then
|
|
||||||
raise ESynEditStringList.CreateFmt('Add Attribute only allowed with zero lines', []);
|
|
||||||
FList.AttributeSize := NewSize;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSynEditStringList.SetFlags(Index: Integer; const AValue: TSynEditStringFlags);
|
procedure TSynEditStringList.SetFlags(Index: Integer; const AValue: TSynEditStringFlags);
|
||||||
begin
|
begin
|
||||||
SetAttribute(TSynEditFlagsClass, Index, Pointer(PtrUInt(Integer(AValue))));
|
FList.Flags[Index] := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditStringList.SetModified(const AValue: Boolean);
|
procedure TSynEditStringList.SetModified(const AValue: Boolean);
|
||||||
@ -1233,15 +1150,11 @@ end;
|
|||||||
type
|
type
|
||||||
PObject = ^TObject;
|
PObject = ^TObject;
|
||||||
|
|
||||||
const
|
|
||||||
AttributeOfset = SizeOf(String) + SizeOf(TObject);
|
|
||||||
|
|
||||||
constructor TSynEditStringMemory.Create;
|
constructor TSynEditStringMemory.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
FRangeList := TSynManagedStorageMemList.Create;
|
FRangeList := TSynManagedStorageMemList.Create;
|
||||||
FRangeListLock := 0;
|
FRangeListLock := 0;
|
||||||
AttributeSize := 0;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TSynEditStringMemory.Destroy;
|
destructor TSynEditStringMemory.Destroy;
|
||||||
@ -1301,37 +1214,28 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynEditStringMemory.GetAttributeSize: Integer;
|
|
||||||
begin
|
|
||||||
Result := FAttributeSize - SizeOf(String) - SizeOf(TObject)
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSynEditStringMemory.SetAttributeSize(const AValue: Integer);
|
|
||||||
var
|
|
||||||
c: LongInt;
|
|
||||||
begin
|
|
||||||
if FAttributeSize = AValue + SizeOf(String) + SizeOf(TObject) then exit;;
|
|
||||||
c := Capacity;
|
|
||||||
Capacity := 0;
|
|
||||||
FAttributeSize := AValue + SizeOf(String) + SizeOf(TObject);
|
|
||||||
Capacity := c;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TSynEditStringMemory.GetString(Index: Integer): String;
|
function TSynEditStringMemory.GetString(Index: Integer): String;
|
||||||
begin
|
begin
|
||||||
Result := (PString(Mem + Index * FAttributeSize))^;
|
Result := (PString(ItemPointer[Index]))^;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSynEditStringMemory.SetFlags(Index: Integer; const AValue: TSynEditStringFlags);
|
||||||
|
begin
|
||||||
|
(PSynEditStringFlags(ItemPointer[Index] + SizeOf(String) + SizeOf(TObject) ))^ := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditStringMemory.SetString(Index: Integer; const AValue: String);
|
procedure TSynEditStringMemory.SetString(Index: Integer; const AValue: String);
|
||||||
begin
|
begin
|
||||||
(PString(Mem + Index * FAttributeSize))^ := AValue;
|
(PString(ItemPointer[Index]))^ := AValue;
|
||||||
if FRangeListLock = 0 then
|
if FRangeListLock = 0 then
|
||||||
FRangeList.CallLineTextChanged(Index);
|
FRangeList.CallLineTextChanged(Index);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynEditStringMemory.ItemSize: Integer;
|
function TSynEditStringMemory.ItemSize: Integer;
|
||||||
|
const
|
||||||
|
FlagSize = ((SizeOf(TSynEditStringFlags) + 1 ) Div 2) * 2; // ensure boundary
|
||||||
begin
|
begin
|
||||||
Result := FAttributeSize;
|
Result := SizeOf(String) + SizeOf(TObject) + FlagSize;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditStringMemory.SetCapacity(const AValue: Integer);
|
procedure TSynEditStringMemory.SetCapacity(const AValue: Integer);
|
||||||
@ -1342,7 +1246,12 @@ end;
|
|||||||
|
|
||||||
function TSynEditStringMemory.GetObject(Index: Integer): TObject;
|
function TSynEditStringMemory.GetObject(Index: Integer): TObject;
|
||||||
begin
|
begin
|
||||||
Result := (PObject(Mem + Index * FAttributeSize + SizeOf(String)))^;
|
Result := (PObject(ItemPointer[Index] + SizeOf(String)))^;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSynEditStringMemory.GetFlags(Index: Integer): TSynEditStringFlags;
|
||||||
|
begin
|
||||||
|
Result := (PSynEditStringFlags(ItemPointer[Index] + SizeOf(String) + SizeOf(TObject) ))^;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynEditStringMemory.GetRange(Index: Pointer): TSynManagedStorageMem;
|
function TSynEditStringMemory.GetRange(Index: Pointer): TSynManagedStorageMem;
|
||||||
@ -1352,7 +1261,7 @@ end;
|
|||||||
|
|
||||||
procedure TSynEditStringMemory.SetObject(Index: Integer; const AValue: TObject);
|
procedure TSynEditStringMemory.SetObject(Index: Integer; const AValue: TObject);
|
||||||
begin
|
begin
|
||||||
(PObject(Mem + Index * FAttributeSize + SizeOf(String)))^ := AValue;
|
(PObject(ItemPointer[Index] + SizeOf(String)))^ := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditStringMemory.SetRange(Index: Pointer; const AValue: TSynManagedStorageMem);
|
procedure TSynEditStringMemory.SetRange(Index: Pointer; const AValue: TSynManagedStorageMem);
|
||||||
@ -1365,26 +1274,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynEditStringMemory.GetAttribute(Index: Integer; Pos: Integer; Size: Word): Pointer;
|
|
||||||
begin
|
|
||||||
case Size of
|
|
||||||
1 : Result := Pointer(PtrUInt((PByte(Mem + Index * FAttributeSize + AttributeOfset + Pos))^));
|
|
||||||
2 : Result := Pointer(PtrUInt((PWord(Mem + Index * FAttributeSize + AttributeOfset + Pos))^));
|
|
||||||
4 : Result := Pointer(PtrUInt((PLongWord(Mem + Index * FAttributeSize + AttributeOfset + Pos))^));
|
|
||||||
8 : Result := Pointer(PtrUInt((PQWord(Mem + Index * FAttributeSize + AttributeOfset + Pos))^));
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSynEditStringMemory.SetAttribute(Index: Integer; Pos: Integer; Size: Word; const AValue: Pointer);
|
|
||||||
begin
|
|
||||||
case Size of
|
|
||||||
1 : (PByte(Mem + Index * FAttributeSize + AttributeOfset + Pos))^ := Byte(PtrUInt(AValue));
|
|
||||||
2 : (PWord(Mem + Index * FAttributeSize + AttributeOfset + Pos))^ := Word(PtrUInt(AValue));
|
|
||||||
4 : (PLongWord(Mem + Index * FAttributeSize + AttributeOfset + Pos))^ := LongWord(PtrUInt(AValue));
|
|
||||||
8 : (PQWord(Mem + Index * FAttributeSize + AttributeOfset + Pos))^ := QWord(PtrUInt(AValue));
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TLineRangeNotificationList }
|
{ TLineRangeNotificationList }
|
||||||
|
|
||||||
procedure TLineRangeNotificationList.CallRangeNotifyEvents(Sender: TSynEditStrings;
|
procedure TLineRangeNotificationList.CallRangeNotifyEvents(Sender: TSynEditStrings;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user