From 1ef12150dc27939cebae0d685702a6cd560eef1b Mon Sep 17 00:00:00 2001 From: Raymond Date: Thu, 20 May 2010 13:35:38 +0200 Subject: [PATCH] Made it possible to create a TClient without letting it create a new IOManager :). --- Projects/Simba/simbaunit.pas | 2 +- Units/MMLCore/client.pas | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Projects/Simba/simbaunit.pas b/Projects/Simba/simbaunit.pas index 2358164..55bdea5 100644 --- a/Projects/Simba/simbaunit.pas +++ b/Projects/Simba/simbaunit.pas @@ -2135,7 +2135,7 @@ begin FillThread.NormalProc:= @CCFillCore; UpdateTimer.OnTimer:= @UpdateTimerCheck; Application.CreateForm(TSimbaUpdateForm, SimbaUpdateForm); - if FileExists(SimbaSettingsFile) then + if FileExistsUTF8(SimbaSettingsFile) then begin Application.CreateForm(TSettingsForm,SettingsForm); Self.LoadFormSettings; diff --git a/Units/MMLCore/client.pas b/Units/MMLCore/client.pas index c9214af..fcaf665 100644 --- a/Units/MMLCore/client.pas +++ b/Units/MMLCore/client.pas @@ -42,6 +42,8 @@ It binds all the components together. type TClient = class(TObject) + private + FOwnIOManager : boolean; public IOManager: TIOManager; MFiles: TMFiles; @@ -51,7 +53,7 @@ type MOCR: TMOCR; WritelnProc : TWritelnProc; procedure WriteLn(s : string); - constructor Create(plugin_dir: string); + constructor Create(const plugin_dir: string = ''; const UseIOManager : TIOManager = nil); destructor Destroy; override; end; @@ -68,11 +70,15 @@ begin end; // 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 inherited Create; 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); MFinder := TMFinder.Create(Self); MBitmaps := TMBitmaps.Create(self); @@ -82,14 +88,16 @@ end; destructor TClient.Destroy; begin - IOManager.SetState(True); + if FOwnIOManager then + IOManager.SetState(True); MOCR.Free; MDTMs.Free; MBitmaps.Free; MFinder.Free; MFiles.Free; - IOManager.Free; + if FOwnIOManager then + IOManager.Free; inherited; end;