1
0
mirror of https://github.com/moparisthebest/Simba synced 2025-01-11 05:38:00 -05:00

Made it possible to create a TClient without letting it create a new IOManager :).

This commit is contained in:
Raymond 2010-05-20 13:35:38 +02:00
parent 952f0c6d5e
commit 1ef12150dc
2 changed files with 14 additions and 6 deletions

View File

@ -2135,7 +2135,7 @@ begin
FillThread.NormalProc:= @CCFillCore; FillThread.NormalProc:= @CCFillCore;
UpdateTimer.OnTimer:= @UpdateTimerCheck; UpdateTimer.OnTimer:= @UpdateTimerCheck;
Application.CreateForm(TSimbaUpdateForm, SimbaUpdateForm); Application.CreateForm(TSimbaUpdateForm, SimbaUpdateForm);
if FileExists(SimbaSettingsFile) then if FileExistsUTF8(SimbaSettingsFile) then
begin begin
Application.CreateForm(TSettingsForm,SettingsForm); Application.CreateForm(TSettingsForm,SettingsForm);
Self.LoadFormSettings; Self.LoadFormSettings;

View File

@ -42,6 +42,8 @@ It binds all the components together.
type type
TClient = class(TObject) TClient = class(TObject)
private
FOwnIOManager : boolean;
public public
IOManager: TIOManager; IOManager: TIOManager;
MFiles: TMFiles; MFiles: TMFiles;
@ -51,7 +53,7 @@ type
MOCR: TMOCR; MOCR: TMOCR;
WritelnProc : TWritelnProc; WritelnProc : TWritelnProc;
procedure WriteLn(s : string); procedure WriteLn(s : string);
constructor Create(plugin_dir: string); constructor Create(const plugin_dir: string = ''; const UseIOManager : TIOManager = nil);
destructor Destroy; override; destructor Destroy; override;
end; end;
@ -68,11 +70,15 @@ begin
end; end;
// Possibly pass arguments to a default window. // Possibly pass arguments to a default window.
constructor TClient.Create(plugin_dir: string); constructor TClient.Create(const plugin_dir: string = ''; const UseIOManager : TIOManager = nil);
begin begin
inherited Create; inherited Create;
WritelnProc:= nil; WritelnProc:= nil;
IOManager:= TIOManager.Create(plugin_dir); if UseIOManager = nil then
IOManager := TIOManager.Create(plugin_dir)
else
IOManager := UseIOManager;
FOwnIOManager := (UseIOManager = nil);
MFiles := TMFiles.Create(self); MFiles := TMFiles.Create(self);
MFinder := TMFinder.Create(Self); MFinder := TMFinder.Create(Self);
MBitmaps := TMBitmaps.Create(self); MBitmaps := TMBitmaps.Create(self);
@ -82,6 +88,7 @@ end;
destructor TClient.Destroy; destructor TClient.Destroy;
begin begin
if FOwnIOManager then
IOManager.SetState(True); IOManager.SetState(True);
MOCR.Free; MOCR.Free;
@ -89,6 +96,7 @@ begin
MBitmaps.Free; MBitmaps.Free;
MFinder.Free; MFinder.Free;
MFiles.Free; MFiles.Free;
if FOwnIOManager then
IOManager.Free; IOManager.Free;
inherited; inherited;