IDE: when no lps file: open main unit

git-svn-id: trunk@22939 -
This commit is contained in:
mattias 2009-12-03 10:59:32 +00:00
parent ca869ce1fc
commit 1d47d3d54a
6 changed files with 35 additions and 28 deletions

View File

@ -24,13 +24,10 @@
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
<Item2>
<PackageName Value="CodeTools"/>
</Item2>
</Item1>
</RequiredPackages>
<Units Count="3">
<Unit0>

View File

@ -4,6 +4,8 @@
<Version Value="7"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>

View File

@ -4,6 +4,8 @@
<Version Value="7"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>

View File

@ -1,9 +1,11 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="/"/>
<Version Value="6"/>
<Version Value="7"/>
<General>
<Flags>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<TargetFileExt Value=""/>

View File

@ -1,12 +1,15 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="/"/>
<Version Value="6"/>
<Version Value="7"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=""/>
</General>
<PublishOptions>
@ -39,13 +42,10 @@
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<Version Value="8"/>
<SearchPaths>
<OtherUnitFiles Value="scanexamples/"/>
</SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>

View File

@ -2450,23 +2450,27 @@ var
BestUnitInfo:=nil;
if (MainUnitID>=0)
and ([pfMainUnitHasCreateFormStatements,pfMainUnitHasTitleStatement]*Flags=[])
then begin
// the main unit contains no automatic statements
// open the main unit
BestUnitInfo:=MainUnitInfo;
if (MainUnitID>=0) then begin
if Requires(PackageGraph.LCLPackage,true)
and (Flags*[pfMainUnitHasCreateFormStatements,pfMainUnitHasTitleStatement]<>[])
then begin
// this is a probably a LCL project where the main source only contains
// automatic code
end else
BestUnitInfo:=MainUnitInfo;
end;
AnUnitInfo:=FirstPartOfProject;
while AnUnitInfo<>nil do begin
if (BestUnitInfo=nil)
or (FilenameIsPascalUnit(AnUnitInfo.Filename)
and (not FilenameIsPascalUnit(BestUnitInfo.Filename)))
then begin
BestUnitInfo:=AnUnitInfo;
if BestUnitInfo=nil then begin
AnUnitInfo:=FirstPartOfProject;
while AnUnitInfo<>nil do begin
if (BestUnitInfo=nil)
or (FilenameIsPascalUnit(AnUnitInfo.Filename)
and (not FilenameIsPascalUnit(BestUnitInfo.Filename)))
then begin
BestUnitInfo:=AnUnitInfo;
end;
AnUnitInfo:=AnUnitInfo.NextPartOfProject;
end;
AnUnitInfo:=AnUnitInfo.NextPartOfProject;
end;
if BestUnitInfo<>nil then begin
BestUnitInfo.EditorIndex:=0;