From e015a8abdf2a518b47d87c193f7016a21fc4f5d9 Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 28 May 2008 17:47:24 +0000 Subject: [PATCH] IDE: designer: not setting ancesto during reading git-svn-id: trunk@15271 - --- designer/jitforms.pp | 15 ++++----------- ide/customformeditor.pp | 8 ++------ ide/main.pp | 7 +------ ideintf/formeditingintf.pas | 1 - 4 files changed, 7 insertions(+), 24 deletions(-) diff --git a/designer/jitforms.pp b/designer/jitforms.pp index f9108507d8..6f173ab8c9 100644 --- a/designer/jitforms.pp +++ b/designer/jitforms.pp @@ -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; diff --git a/ide/customformeditor.pp b/ide/customformeditor.pp index f848fdc367..4ff727e5f0 100644 --- a/ide/customformeditor.pp +++ b/ide/customformeditor.pp @@ -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; diff --git a/ide/main.pp b/ide/main.pp index 3bd35c5796..ed742e4d77 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -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 diff --git a/ideintf/formeditingintf.pas b/ideintf/formeditingintf.pas index 37b2ca0cb2..3c756ba938 100644 --- a/ideintf/formeditingintf.pas +++ b/ideintf/formeditingintf.pas @@ -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;