finished to remove old centralized option system

This commit is contained in:
Basile Burg 2015-05-11 09:11:45 +02:00
parent 0a73c2f9af
commit 8379d50a8a
1 changed files with 7 additions and 69 deletions

View File

@ -20,7 +20,7 @@ type
{ TCEMainForm } { TCEMainForm }
TCEMainForm = class(TForm, ICEMultiDocObserver, ICESessionOptionsObserver, ICEEditableShortCut) TCEMainForm = class(TForm, ICEMultiDocObserver, ICEEditableShortCut)
actFileCompAndRun: TAction; actFileCompAndRun: TAction;
actFileSaveAll: TAction; actFileSaveAll: TAction;
actFileClose: TAction; actFileClose: TAction;
@ -231,20 +231,13 @@ type
function scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean; function scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean;
procedure scedSendItem(const category, identifier: string; aShortcut: TShortcut); procedure scedSendItem(const category, identifier: string; aShortcut: TShortcut);
// ICESessionOptionsObserver
procedure sesoptBeforeSave;
procedure sesoptDeclareProperties(aFiler: TFiler);
procedure sesoptAfterLoad;
procedure optset_RunnableSw(aReader: TReader);
procedure optget_RunnableSw(aWriter: Twriter);
//Init - Fina //Init - Fina
procedure getCMdParams; procedure getCMdParams;
procedure checkCompilo; procedure checkCompilo;
procedure InitMRUs; procedure InitMRUs;
procedure InitWidgets; procedure InitWidgets;
procedure InitDocking; procedure InitDocking;
procedure InitSettings; procedure LoadSettings;
procedure SaveSettings; procedure SaveSettings;
procedure LoadDocking; procedure LoadDocking;
procedure SaveDocking; procedure SaveDocking;
@ -336,7 +329,7 @@ implementation
{$R *.lfm} {$R *.lfm}
uses uses
SynMacroRecorder, ce_options, ce_symstring; SynMacroRecorder, ce_symstring;
{$REGION Actions shortcuts -----------------------------------------------------} {$REGION Actions shortcuts -----------------------------------------------------}
constructor TCEPersistentMainShortcuts.create(aOwner: TComponent); constructor TCEPersistentMainShortcuts.create(aOwner: TComponent);
@ -427,16 +420,17 @@ begin
InitMRUs; InitMRUs;
InitWidgets; InitWidgets;
InitDocking; InitDocking;
InitSettings; LoadSettings;
layoutUpdateMenu; layoutUpdateMenu;
fMultidoc := getMultiDocHandler; fMultidoc := getMultiDocHandler;
// //
newProj;
checkCompilo; checkCompilo;
getCMdParams; getCMdParams;
// //
updateMainMenuProviders; updateMainMenuProviders;
EntitiesConnector.forceUpdate; EntitiesConnector.forceUpdate;
//
if fProject = nil then newProj;
fInitialized := true; fInitialized := true;
end; end;
@ -632,31 +626,10 @@ begin
end; end;
end; end;
procedure TCEMainForm.InitSettings; procedure TCEMainForm.LoadSettings;
var var
fname1: string; fname1: string;
fname2: string;
opts: TCEOptions;
begin begin
// old centralized options
fname1 := getCoeditDocPath + 'options2.txt';
fname2 := getCoeditDocPath + 'options2.bak';
opts := TCEOptions.create(nil);
try
if fileExists(fname1) then
begin
opts.loadFromFile(fname1);
if opts.hasLoaded then
begin
if fileExists(fname2) then
sysutils.deleteFile(fname2);
if not fileExists(fname2) then
fileutil.copyFile(fname1, fname2, false);
end;
end;
finally
opts.Free;
end;
// project and files MRU // project and files MRU
fname1 := getCoeditDocPath + 'mostrecent.txt'; fname1 := getCoeditDocPath + 'mostrecent.txt';
if fileExists(fname1) then with TCEPersistentMainMrus.create(nil) do if fileExists(fname1) then with TCEPersistentMainMrus.create(nil) do
@ -678,19 +651,9 @@ begin
end; end;
procedure TCEMainForm.SaveSettings; procedure TCEMainForm.SaveSettings;
var
opts: TCEOptions;
begin begin
if not fInitialized then if not fInitialized then
exit; exit;
// old centralized options
opts := TCEOptions.create(nil);
try
forceDirectory(getCoeditDocPath);
opts.saveToFile(getCoeditDocPath + 'options2.txt');
finally
opts.Free;
end;
// project and files MRU // project and files MRU
with TCEPersistentMainMrus.create(nil) do with TCEPersistentMainMrus.create(nil) do
try try
@ -1876,31 +1839,6 @@ begin
end; end;
{$ENDREGION} {$ENDREGION}
{$REGION ICESessionOptionsObserver ---------------------------------------------}
procedure TCEMainForm.sesoptBeforeSave;
begin
end;
procedure TCEMainForm.sesoptDeclareProperties(aFiler: TFiler);
begin
aFiler.DefineProperty('Runnable_Switches', @optset_RunnableSw, @optget_RunnableSw, true);
end;
procedure TCEMainForm.sesoptAfterLoad;
begin
end;
procedure TCEMainForm.optset_RunnableSw(aReader: TReader);
begin
fRunnableSw := aReader.ReadString;
end;
procedure TCEMainForm.optget_RunnableSw(aWriter: Twriter);
begin
aWriter.WriteString(fRunnableSw);
end;
{$ENDREGION}
initialization initialization
registerClasses([TCEPersistentMainShortcut, TCEPersistentMainShortcuts]); registerClasses([TCEPersistentMainShortcut, TCEPersistentMainShortcuts]);
end. end.