mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 03:56:12 +02:00
IDE: designer: set default ancestor when writing component
git-svn-id: trunk@15242 -
This commit is contained in:
parent
16cf6730fd
commit
c52071e8b7
@ -1339,8 +1339,12 @@ function TCustomFormEditor.SaveUnitComponentToBinStream(AnUnitInfo: TUnitInfo;
|
||||
var
|
||||
Writer: TWriter;
|
||||
DestroyDriver: Boolean;
|
||||
AncestorUnitInfo: TUnitInfo;
|
||||
{ $IFDEF VerboseSaveUnitComponent}
|
||||
memStream: TMemoryStream;
|
||||
s: string;
|
||||
AncestorUnit: TUnitInfo;
|
||||
Ancestor: TComponent;
|
||||
{ $ENDIF}
|
||||
begin
|
||||
// save designer form properties to the component
|
||||
SaveHiddenDesignerFormProperties(AnUnitInfo.Component);
|
||||
@ -1359,10 +1363,27 @@ begin
|
||||
BinCompStream.Position:=0;
|
||||
Writer:=CreateLRSWriter(BinCompStream,DestroyDriver);
|
||||
Writer.OnFindAncestor:=@WriterFindAncestor;
|
||||
Writer.WriteDescendent(AnUnitInfo.Component,nil);
|
||||
AncestorUnit:=AnUnitInfo.FindAncestorUnit;
|
||||
Ancestor:=nil;
|
||||
if AncestorUnit<>nil then
|
||||
Ancestor:=AncestorUnit.Component;
|
||||
Writer.WriteDescendent(AnUnitInfo.Component,Ancestor);
|
||||
if DestroyDriver then Writer.Driver.Free;
|
||||
FreeAndNil(Writer);
|
||||
AnUnitInfo.ComponentLastBinStreamSize:=BinCompStream.Size;
|
||||
|
||||
{ $IFDEF VerboseSaveUnitComponent}
|
||||
BinCompStream.Position:=0;
|
||||
memStream:=TMemoryStream.Create;
|
||||
LRSObjectBinaryToText(BinCompStream,memStream);
|
||||
memStream.Position:=0;
|
||||
SetLength(s,memStream.Size);
|
||||
memStream.Read(s[1],length(s));
|
||||
DebugLn(['TCustomFormEditor.SaveUnitComponentToBinStream START ==================']);
|
||||
debugln(s);
|
||||
DebugLn(['TCustomFormEditor.SaveUnitComponentToBinStream END ==================']);
|
||||
memStream.Free;
|
||||
{ $ENDIF}
|
||||
except
|
||||
on E: Exception do begin
|
||||
DumpExceptionBackTrace;
|
||||
|
@ -4650,6 +4650,8 @@ var
|
||||
ADesigner: TDesigner;
|
||||
Grubber: TLRTGrubber;
|
||||
LRTFilename: String;
|
||||
AncestorUnit: TUnitInfo;
|
||||
Ancestor: TComponent;
|
||||
begin
|
||||
Result:=mrCancel;
|
||||
|
||||
@ -4699,6 +4701,11 @@ begin
|
||||
{$ENDIF}
|
||||
//DebugLn(['TMainIDE.DoSaveUnitComponent AncestorInstance=',dbgsName(AncestorInstance)]);
|
||||
Writer.OnFindAncestor:=@FormEditor1.WriterFindAncestor;
|
||||
AncestorUnit:=AnUnitInfo.FindAncestorUnit;
|
||||
Ancestor:=nil;
|
||||
if AncestorUnit<>nil then
|
||||
Ancestor:=AncestorUnit.Component;
|
||||
Writer.WriteDescendent(AnUnitInfo.Component,Ancestor);
|
||||
Writer.WriteDescendent(AnUnitInfo.Component,nil);
|
||||
if DestroyDriver then Writer.Driver.Free;
|
||||
FreeAndNil(Writer);
|
||||
|
Loading…
Reference in New Issue
Block a user