startlazarus:

* fixed disabling splashscreen
* fixed passing file parameters to Lazarus (issue #13983)

git-svn-id: trunk@20649 -
This commit is contained in:
vincents 2009-06-17 11:45:51 +00:00
parent 84fd1ca4ce
commit 13b4382535
4 changed files with 38 additions and 17 deletions

View File

@ -43,7 +43,8 @@ interface
uses
Classes, SysUtils;
procedure ParseCommandLine(aCmdLineParams : TStrings; out IDEPid : Integer);
procedure ParseCommandLine(aCmdLineParams : TStrings; out IDEPid : Integer;
out ShowSplashScreen: boolean);
function GetCommandLineParameters(aCmdLineParams : TStrings;
isStartLazarus : Boolean = False) : String;
@ -65,7 +66,8 @@ function GetLazarusDirectory : String;
implementation
uses FileUtil, LazConf, LCLProc, LazarusIDEStrConsts;
procedure ParseCommandLine(aCmdLineParams : TStrings; out IDEPid : Integer);
procedure ParseCommandLine(aCmdLineParams: TStrings; out IDEPid: Integer; out
ShowSplashScreen: boolean);
const
LazarusPidOpt = '--lazarus-pid=';
LazarusDebugOpt = '--debug';
@ -89,6 +91,11 @@ begin
IDEPid := 0;
end;
end
else if ParamIsOption(i, NoSplashScreenOptLong) or
ParamIsOption(i, NoSplashScreenOptShort) then
begin
ShowSplashScreen := false;
end
else
begin
// Do not add file to the parameter list
@ -210,10 +217,10 @@ begin
begin
Filename := ParamStrUTF8(i);
if (Filename = '') or (Filename[1] = '-') then
break;
continue;
if Result = nil then
Result := TStringList.Create;
Result.Insert(0,Filename);
Result.Add(Filename);
end;
end;

View File

@ -81,7 +81,7 @@ uses
{$IFDEF unix}
BaseUnix,
{$ENDIF}
Classes, SysUtils, Process, AsyncProcess, UTF8Process,
Classes, SysUtils, Process, UTF8Process,
LCLProc, FileUtil, Forms, Controls, Dialogs,
LazConf, Splash;
@ -110,6 +110,7 @@ type
FLazarusPath: string;
FLazarusPID: Integer;
FCmdLineParams: TStrings;
FCmdLineFiles: string;
FShowSplashOption: boolean;
function RenameLazarusExecutable(const Directory: string): TModalResult;
procedure LazarusProcessStart(Sender: TObject);
@ -214,13 +215,25 @@ begin
end;
procedure TLazarusManager.Initialize;
var
CmdLineFiles: TStrings;
i: integer;
begin
FShowSplashOption:=true;
SplashForm := nil;
FCmdLineParams := TStringList.Create;
ParseCommandLine(FCmdLineParams, FLazarusPID);
ParseCommandLine(FCmdLineParams, FLazarusPID, FShowSplashOption);
if FShowSplashOption then
ShowSplash;
CmdLineFiles := ExtractCmdLineFilenames;
if CmdLineFiles<>nil then
begin
for i := 0 to CmdLineFiles.Count-1 do
if pos(' ',CmdLineFiles[i])>0 then
CmdLineFiles[i] := '"' + CmdLineFiles[i] + '"';
CmdLineFiles.Delimiter:=' ';
FCmdLineFiles:=CmdLineFiles.DelimitedText;
end;
end;
procedure TLazarusManager.Run;
@ -251,8 +264,9 @@ begin
CustomDir:=AppendPathDelim(GetPrimaryConfigPath) + 'bin' + PathDelim;
repeat
ShowSplash;
Restart := false;
if FShowSplashOption then
ShowSplash;
{ There are four places where the newest lazarus exe can be:
1. in the same directory as the startlazarus exe
1.1 as lazarus.new(.exe) (if the executable was write locked (windows))
@ -315,7 +329,7 @@ begin
break;
end;
end;
{$IFDEF LCLCarbon}
{$IFDEF darwin}
if FileExists(FLazarusPath+'.app') then begin
// start the bundle instead
FLazarusPath:=FLazarusPath+'.app/Contents/MacOS/'+ExtractFileName(FLazarusPath);
@ -323,14 +337,11 @@ begin
{$ENDIF}
DebugLn(['TLazarusManager.Run starting ',FLazarusPath,' ...']);
if not Assigned(FCmdLineParams) then
begin
FCmdLineParams := TStringList.Create;
ParseCommandLine(FCmdLineParams, FLazarusPID);
end;
FLazarusProcess :=
TLazarusProcess.Create(FLazarusPath,
GetCommandLineParameters(FCmdLineParams, True));
GetCommandLineParameters(FCmdLineParams, True)+' '+FCmdLineFiles);
// clear the command line files, so that they are passed only once.
FCmdLineFiles:='';
FLazarusProcess.OnStart := @LazarusProcessStart;
FLazarusProcess.Execute;
FLazarusProcess.WaitOnExit;

View File

@ -9797,6 +9797,7 @@ const
ExeName : string;
Params : TStrings;
Dummy : Integer;
Unused : boolean;
CmdLine: string;
begin
StartLazProcess := TProcessUTF8.Create(nil);
@ -9805,7 +9806,7 @@ const
StartLazProcess.CurrentDirectory := GetLazarusDirectory;
//DebugLn('Parsing commandLine: ');
Params := TStringList.Create;
ParseCommandLine(Params, Dummy);
ParseCommandLine(Params, Dummy, Unused);
//DebugLn('Done parsing CommandLine');
{$ifndef darwin}
ExeName := AppendPathDelim(StartLazProcess.CurrentDirectory) +

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="InIDEConfig"/>
<MainUnit Value="0"/>
<TargetFileExt Value=".exe"/>