mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-23 04:59:22 +02:00
rtti controls: implemented streaming Link.AliasValues
git-svn-id: trunk@11773 -
This commit is contained in:
parent
4c6912f05a
commit
ac47999c2d
@ -14,26 +14,6 @@
|
|||||||
<Title Value="exampleprojectgrid1"/>
|
<Title Value="exampleprojectgrid1"/>
|
||||||
<ActiveEditorIndexAtStart Value="0"/>
|
<ActiveEditorIndexAtStart Value="0"/>
|
||||||
</General>
|
</General>
|
||||||
<Units Count="2">
|
|
||||||
<Unit0>
|
|
||||||
<Filename Value="exampleprojectgrid1.lpr"/>
|
|
||||||
<IsPartOfProject Value="True"/>
|
|
||||||
<UnitName Value="ExampleProjectGrid1"/>
|
|
||||||
<UsageCount Value="23"/>
|
|
||||||
</Unit0>
|
|
||||||
<Unit1>
|
|
||||||
<CursorPos X="24" Y="28"/>
|
|
||||||
<EditorIndex Value="0"/>
|
|
||||||
<Filename Value="examplegrid1.pas"/>
|
|
||||||
<ComponentName Value="Form1"/>
|
|
||||||
<IsPartOfProject Value="True"/>
|
|
||||||
<Loaded Value="True"/>
|
|
||||||
<ResourceFilename Value="examplegrid1.lrs"/>
|
|
||||||
<TopLine Value="1"/>
|
|
||||||
<UnitName Value="ExampleGrid1"/>
|
|
||||||
<UsageCount Value="23"/>
|
|
||||||
</Unit1>
|
|
||||||
</Units>
|
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
<IgnoreBinaries Value="False"/>
|
<IgnoreBinaries Value="False"/>
|
||||||
@ -55,6 +35,26 @@
|
|||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item2>
|
</Item2>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
|
<Units Count="2">
|
||||||
|
<Unit0>
|
||||||
|
<Filename Value="exampleprojectgrid1.lpr"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="ExampleProjectGrid1"/>
|
||||||
|
<UsageCount Value="26"/>
|
||||||
|
</Unit0>
|
||||||
|
<Unit1>
|
||||||
|
<Filename Value="examplegrid1.pas"/>
|
||||||
|
<ComponentName Value="Form1"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ResourceFilename Value="examplegrid1.lrs"/>
|
||||||
|
<UnitName Value="ExampleGrid1"/>
|
||||||
|
<CursorPos X="12" Y="65"/>
|
||||||
|
<TopLine Value="42"/>
|
||||||
|
<EditorIndex Value="0"/>
|
||||||
|
<UsageCount Value="26"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit1>
|
||||||
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="5"/>
|
<Version Value="5"/>
|
||||||
|
@ -193,6 +193,11 @@ Type
|
|||||||
{ TPropertyLink }
|
{ TPropertyLink }
|
||||||
|
|
||||||
TPropertyLink = class(TCustomPropertyLink)
|
TPropertyLink = class(TCustomPropertyLink)
|
||||||
|
private
|
||||||
|
procedure ReadAliasValuesData(Reader: TReader);
|
||||||
|
procedure WriteAliasValuesData(Writer: TWriter);
|
||||||
|
protected
|
||||||
|
procedure DefineProperties(Filer: TFiler); override;
|
||||||
published
|
published
|
||||||
property AliasValues;
|
property AliasValues;
|
||||||
property Options;
|
property Options;
|
||||||
@ -3993,6 +3998,50 @@ begin
|
|||||||
FLink.EditingDone;
|
FLink.EditingDone;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TPropertyLink }
|
||||||
|
|
||||||
|
procedure TPropertyLink.ReadAliasValuesData(Reader: TReader);
|
||||||
|
begin
|
||||||
|
Reader.ReadListBegin;
|
||||||
|
AliasValues.BeginUpdate;
|
||||||
|
try
|
||||||
|
AliasValues.Clear;
|
||||||
|
while not Reader.EndOfList do
|
||||||
|
AliasValues.Add(Reader.ReadString);
|
||||||
|
finally
|
||||||
|
AliasValues.EndUpdate;
|
||||||
|
end;
|
||||||
|
Reader.ReadListEnd;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPropertyLink.WriteAliasValuesData(Writer: TWriter);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
Writer.WriteListBegin;
|
||||||
|
for i := 0 to AliasValues.Count - 1 do
|
||||||
|
Writer.WriteString(AliasValues[i]);
|
||||||
|
Writer.WriteListEnd;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPropertyLink.DefineProperties(Filer: TFiler);
|
||||||
|
var
|
||||||
|
HasAliasValuesData: Boolean;
|
||||||
|
AncestorPropList: TCustomPropertyLink;
|
||||||
|
begin
|
||||||
|
inherited DefineProperties(Filer);
|
||||||
|
HasAliasValuesData := AliasValues.Count > 0;
|
||||||
|
if Assigned(Filer.Ancestor) then begin
|
||||||
|
// Only serialize if string list is different from ancestor
|
||||||
|
if Filer.Ancestor.InheritsFrom(TCustomPropertyLink) then begin
|
||||||
|
AncestorPropList:=TCustomPropertyLink(Filer.Ancestor);
|
||||||
|
HasAliasValuesData := not AliasValues.Equals(AncestorPropList.AliasValues);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Filer.DefineProperty('AliasValuesStrings',
|
||||||
|
@ReadAliasValuesData, @WriteAliasValuesData, HasAliasValuesData);
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
{$I rttictrls.lrs}
|
{$I rttictrls.lrs}
|
||||||
// TPropertyLink
|
// TPropertyLink
|
||||||
|
Loading…
Reference in New Issue
Block a user