mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-03 18:48:19 +01:00
ide: pass Project to NewFileDescriptor.Init
This commit is contained in:
parent
2fc4aa79cb
commit
bd1bc6ebb5
@ -2098,6 +2098,22 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
if NewOwner is TProject then
|
||||
AProject:=TProject(NewOwner)
|
||||
else
|
||||
AProject:=Project1;
|
||||
if NewOwner is TLazPackage then
|
||||
APackage:=TLazPackage(NewOwner)
|
||||
else
|
||||
APackage:=nil;
|
||||
|
||||
IsPartOfProject:=(nfIsPartOfProject in NewFlags)
|
||||
or (NewOwner is TProject)
|
||||
or (AProject.FileIsInProjectDir(NewFilename)
|
||||
and (not (nfIsNotPartOfProject in NewFlags)));
|
||||
if IsPartOfProject then
|
||||
NewOwner:=AProject;
|
||||
|
||||
Result:=NewFileDescriptor.Init(NewFilename,NewOwner,NewSource,nfQuiet in NewFlags);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
@ -2109,15 +2125,6 @@ begin
|
||||
exit(mrCancel);
|
||||
end;
|
||||
|
||||
if NewOwner is TProject then
|
||||
AProject:=TProject(NewOwner)
|
||||
else
|
||||
AProject:=Project1;
|
||||
if NewOwner is TLazPackage then
|
||||
APackage:=TLazPackage(NewOwner)
|
||||
else
|
||||
APackage:=nil;
|
||||
|
||||
OldUnitIndex:=AProject.IndexOfFilename(NewFilename);
|
||||
if OldUnitIndex>=0 then begin
|
||||
// the file is not really new
|
||||
@ -2131,11 +2138,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
IsPartOfProject:=(nfIsPartOfProject in NewFlags)
|
||||
or (NewOwner is TProject)
|
||||
or (AProject.FileIsInProjectDir(NewFilename)
|
||||
and (not (nfIsNotPartOfProject in NewFlags)));
|
||||
|
||||
// add required packages
|
||||
//debugln(['NewFile NewFileDescriptor.RequiredPackages="',NewFileDescriptor.RequiredPackages,'" ',DbgSName(NewFileDescriptor)]);
|
||||
RequiredPackages:=NewFileDescriptor.RequiredPackages;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user