fix showing splash screen on restart

git-svn-id: trunk@5917 -
This commit is contained in:
vincents 2004-09-03 21:14:50 +00:00
parent f96cb57823
commit 9f010fcf41
3 changed files with 40 additions and 17 deletions

View File

@ -1,3 +1,4 @@
{ $Id$ }
unit LazarusManager;
{$mode objfpc}{$H+}
@ -27,24 +28,28 @@ type
end;
type
TLazarusManager = class
TLazarusManager = class(TComponent)
private
FStartLazarusOptions: TStartLazarusOptions;
FLazarusProcess: TLazarusProcess;
FLazarusPath: string;
function GetLazarusPath(name: string): string;
function GetLazarusPath(const FileName: string): string;
procedure RenameLazarusExecutables;
procedure LazarusProcessStart(Sender: TObject);
public
constructor Create;
destructor Destroy; override;
procedure Run;
procedure ShowSplash;
end;
implementation
constructor TLazarusManager.Create;
begin
inherited Create(nil);
SplashForm := TSplashForm.Create(Self);
ShowSplash;
FStartLazarusOptions := TStartLazarusOptions.Create;
end;
@ -54,9 +59,9 @@ begin
inherited Destroy;
end;
function TLazarusManager.GetLazarusPath(name: string) : string;
function TLazarusManager.GetLazarusPath(const FileName: string) : string;
begin
result := AppendPathDelim(FStartLazarusOptions.LazarusDir) + name +
result := AppendPathDelim(FStartLazarusOptions.LazarusDir) + FileName +
GetDefaultExecutableExt;
end;
@ -91,6 +96,7 @@ var
begin
repeat
SplashForm.Show;
Application.ProcessMessages;
RenameLazarusExecutables();
FLazarusProcess := TLazarusProcess.Create(FLazarusPath);
FLazarusProcess.OnStart := @LazarusProcessStart;
@ -102,6 +108,15 @@ begin
Application.Terminate;
end;
procedure TLazarusManager.ShowSplash;
begin
with SplashForm do begin
Show;
Paint;
end;
Application.ProcessMessages; // process splash paint message
end;
{ TLazarusProcess }
constructor TLazarusProcess.Create(const LazarusPath: string);
@ -135,4 +150,10 @@ begin
end;
end.
{
$Log$
Revision 1.3 2004/09/03 21:14:50 vincents
fix showing splash screen on restart
}

View File

@ -1,3 +1,4 @@
{ $Id$ }
program StartLazarus;
{$mode objfpc}{$H+}
@ -5,27 +6,21 @@ program StartLazarus;
uses
Interfaces, SysUtils,
Forms,
Splash, LazarusManager;
LazarusManager;
var
ALazarusManager: TLazarusManager;
procedure ShowSplash;
begin
SplashForm := TSplashForm.Create(Application);
with SplashForm do begin
Show;
Paint;
StartTimer;
end;
Application.ProcessMessages; // process splash paint message
end;
begin
Application.Initialize;
ShowSplash;
ALazarusManager := TLazarusManager.Create;
ALazarusManager.Run;
FreeAndNil(ALazarusManager);
end.
{
$Log$
Revision 1.2 2004/09/03 21:14:50 vincents
fix showing splash screen on restart
}

View File

@ -1,3 +1,4 @@
{ $Id$ }
unit StartLazOpts;
{$mode objfpc}{$H+}
@ -54,4 +55,10 @@ begin
end;
end.
{
$Log$
Revision 1.3 2004/09/03 21:14:50 vincents
fix showing splash screen on restart
}