IDE: when there is no lps file: open the main unit if it does not contain automatic statements

git-svn-id: trunk@22938 -
This commit is contained in:
mattias 2009-12-03 10:40:59 +00:00
parent 1efc58041e
commit ca869ce1fc

View File

@ -2447,9 +2447,18 @@ var
BestUnitInfo: TUnitInfo;
begin
if FirstUnitWithEditorIndex<>nil then exit;
AnUnitInfo:=FirstPartOfProject;
BestUnitInfo:=nil;
if (MainUnitID>=0)
and ([pfMainUnitHasCreateFormStatements,pfMainUnitHasTitleStatement]*Flags=[])
then begin
// the main unit contains no automatic statements
// open the main unit
BestUnitInfo:=MainUnitInfo;
end;
AnUnitInfo:=FirstPartOfProject;
while AnUnitInfo<>nil do begin
if (BestUnitInfo=nil)
or (FilenameIsPascalUnit(AnUnitInfo.Filename)