IDE: designer: not setting ancesto during reading

git-svn-id: trunk@15271 -
This commit is contained in:
mattias 2008-05-28 17:47:24 +00:00
parent 6db258bc44
commit e015a8abdf
4 changed files with 7 additions and 24 deletions

View File

@ -156,7 +156,6 @@ type
function AddNewJITComponent(const NewUnitName: shortstring;
AncestorClass: TClass): integer;
function AddJITComponentFromStream(BinStream: TStream;
Ancestor: TComponent;// can be nil
AncestorClass: TClass;
const NewUnitName: ShortString;
Interactive, Visible: Boolean;
@ -753,7 +752,6 @@ begin
end;
function TJITComponentList.AddJITComponentFromStream(BinStream: TStream;
Ancestor: TComponent;// can be nil
AncestorClass: TClass;
const NewUnitName: ShortString;
Interactive, Visible: Boolean;
@ -761,8 +759,7 @@ function TJITComponentList.AddJITComponentFromStream(BinStream: TStream;
// returns new index
// -1 = invalid stream
procedure ReadStream(AStream: TStream; StreamClass: TClass;
AnAncestor: TComponent);
procedure ReadStream(AStream: TStream; StreamClass: TClass);
var
Reader: TReader;
DestroyDriver: Boolean;
@ -775,10 +772,9 @@ function TJITComponentList.AddJITComponentFromStream(BinStream: TStream;
DestroyDriver:=false;
InitReading(AStream,Reader,DestroyDriver);
{ $IFDEF VerboseJITForms}
DebugLn(['TJITComponentList.AddJITComponentFromStream.ReadStream Reading: FCurReadJITComponent=',DbgSName(FCurReadJITComponent),' StreamClass=',DbgSName(StreamClass),' Ancestor=',DbgSName(Ancestor)]);
DebugLn(['TJITComponentList.AddJITComponentFromStream.ReadStream Reading: FCurReadJITComponent=',DbgSName(FCurReadJITComponent),' StreamClass=',DbgSName(StreamClass)]);
{ $ENDIF}
try
Reader.Ancestor:=AnAncestor;
Reader.ReadRootComponent(FCurReadJITComponent);
{$IFDEF VerboseJITForms}
debugln('[TJITComponentList.AddJITComponentFromStream] Finish Reading ...');
@ -808,12 +804,9 @@ function TJITComponentList.AddJITComponentFromStream(BinStream: TStream;
OnFindAncestors(Self,AncestorClass,Ancestors,AncestorStreams,Abort);
if Abort then exit(false);
if Ancestors<>nil then begin
Ancestor:=nil;
for i:=Ancestors.Count-1 downto 0 do begin
ReadStream(TExtMemoryStream(AncestorStreams[i]),
TComponent(Ancestors[i]).ClassType,
Ancestor);
Ancestor:=TComponent(Ancestors[i]);
TComponent(Ancestors[i]).ClassType);
end;
end;
finally
@ -848,7 +841,7 @@ begin
Result:=DoCreateJITComponent('',NewClassName,NewUnitName,AncestorClass,Visible);
if Result<0 then exit;
ReadAncestorStreams;
ReadStream(BinStream,FCurReadJITComponent.ClassType,Ancestor);
ReadStream(BinStream,FCurReadJITComponent.ClassType);
if FCurReadJITComponent.Name='' then begin
NewName:=FCurReadJITComponent.ClassName;

View File

@ -238,14 +238,12 @@ each control that's dropped onto the form
const NewUnitName: ShortString;
Interactive: boolean;
Visible: boolean = true;
Ancestor: TComponent = nil;
ContextObj: TObject = nil): TIComponentInterface; override;
function CreateRawComponentFromStream(BinStream: TStream;
AncestorType: TComponentClass;
const NewUnitName: ShortString;
Interactive: boolean;
Visible: boolean = true;
Ancestor: TComponent = nil;
ContextObj: TObject = nil): TComponent;
function CreateChildComponentFromStream(BinStream: TStream;
ComponentClass: TComponentClass; Root: TComponent;
@ -1700,13 +1698,12 @@ function TCustomFormEditor.CreateComponentFromStream(
AncestorType: TComponentClass;
const NewUnitName: ShortString;
Interactive: boolean; Visible: boolean;
Ancestor: TComponent;
ContextObj: TObject): TIComponentInterface;
var
NewComponent: TComponent;
begin
NewComponent:=CreateRawComponentFromStream(BinStream,
AncestorType,NewUnitName,Interactive,Visible,Ancestor,ContextObj);
AncestorType,NewUnitName,Interactive,Visible,ContextObj);
Result:=CreateComponentInterface(NewComponent,true);
end;
@ -1714,7 +1711,6 @@ function TCustomFormEditor.CreateRawComponentFromStream(BinStream: TStream;
AncestorType: TComponentClass;
const NewUnitName: ShortString;
Interactive: boolean; Visible: boolean;
Ancestor: TComponent;
ContextObj: TObject): TComponent;
var
NewJITIndex: integer;
@ -1726,7 +1722,7 @@ begin
RaiseException('TCustomFormEditor.CreateComponentFromStream ClassName='+
AncestorType.ClassName);
NewJITIndex := JITList.AddJITComponentFromStream(BinStream,
Ancestor,AncestorType,NewUnitName,Interactive,Visible,ContextObj);
AncestorType,NewUnitName,Interactive,Visible,ContextObj);
if NewJITIndex < 0 then begin
Result:=nil;
exit;

View File

@ -5373,7 +5373,6 @@ var
NestedClassName: string;
NestedClass: TComponentClass;
NestedUnitInfo: TUnitInfo;
Ancestor: TComponent;
begin
debugln('TMainIDE.DoLoadLFM A ',AnUnitInfo.Filename,' IsPartOfProject=',dbgs(AnUnitInfo.IsPartOfProject),' ');
@ -5437,9 +5436,6 @@ begin
DebugLn(['TMainIDE.DoLoadLFM DoLoadAncestorDependencyHidden failed for ',AnUnitInfo.Filename]);
exit;
end;
Ancestor:=nil;
if AncestorUnitInfo<>nil then
Ancestor:=AncestorUnitInfo.Component;
if MissingClasses<>nil then begin
for i:=MissingClasses.Count-1 downto 0 do begin
@ -5504,8 +5500,7 @@ begin
NewUnitName:=ExtractFileNameOnly(AnUnitInfo.Filename);
// ToDo: create AncestorBinStream(s) via hook, not via parameters
NewComponent:=FormEditor1.CreateRawComponentFromStream(BinStream,
AncestorType,copy(NewUnitName,1,255),true,true,Ancestor,
AnUnitInfo);
AncestorType,copy(NewUnitName,1,255),true,true,AnUnitInfo);
Project1.InvalidateUnitComponentDesignerDependencies;
AnUnitInfo.Component:=NewComponent;
if (AncestorUnitInfo<>nil) then

View File

@ -112,7 +112,6 @@ type
const NewUnitName: ShortString;
Interactive: boolean;
Visible: boolean = true;
Ancestor: TComponent = nil;
ContextObj: TObject = nil): TIComponentInterface; virtual; abstract;
function CreateChildComponentFromStream(BinStream: TStream;
ComponentClass: TComponentClass;