IDE: load designer form: fixed loading .pas or .pp

git-svn-id: trunk@40098 -
This commit is contained in:
mattias 2013-01-31 21:03:25 +00:00
parent 2e47a30822
commit 2c1a0a9089
2 changed files with 6 additions and 1 deletions

View File

@ -643,7 +643,7 @@ type
function RemoveUnitFromAllUsesSections(Code: TCodeBuffer;
const AnUnitName: string): boolean;
function FindUsedUnitFiles(Code: TCodeBuffer; var MainUsesSection: TStrings
): boolean; // only main uses section
): boolean; // only main uses section, if unit not found, returns "unitname" or "unitname in 'filename'"
function FindUsedUnitFiles(Code: TCodeBuffer; var MainUsesSection,
ImplementationUsesSection: TStrings): boolean;
function FindUsedUnitNames(Code: TCodeBuffer; var MainUsesSection,

View File

@ -4517,6 +4517,7 @@ var
begin
Result:=false;
TheModalResult:=mrCancel;
if not FilenameIsPascalSource(UnitFilename) then exit;
CurLFMFilename:=ChangeFileExt(UnitFilename,'.lfm');
if not FileExistsUTF8(CurLFMFilename) then
CurLFMFilename:=ChangeFileExt(UnitFilename,'.dfm');
@ -4679,6 +4680,7 @@ var
begin
Result:=false;
TheModalResult:=mrCancel;
if not FilenameIsPascalSource(UnitFilename) then exit;
AncestorClassName:='';
Code:=CodeToolBoss.LoadFile(UnitFilename,true,false);
if Code=nil then begin
@ -4831,6 +4833,9 @@ function TLazSourceFileManager.LoadComponentDependencyHidden(
end;
end else begin
// load unit source
UnitFilename:=ChangeFileExt(LFMFilename,'.pas');
if not FileExistsUTF8(UnitFilename) then
UnitFilename:=ChangeFileExt(LFMFilename,'.pp');
TheModalResult:=LoadCodeBuffer(UnitCode,UnitFilename,[lbfCheckIfText],true);
if TheModalResult<>mrOk then exit(TheModalResult=mrAbort);
// create unit info