Changeset 131 for branches/generator/UCore.pas
- Timestamp:
- Dec 24, 2017, 3:54:08 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/generator/UCore.pas
r129 r131 6 6 7 7 uses 8 Classes, SysUtils, XMLConf, FileUtil, Controls, ActnList, UGrammer, DOM,9 UPersistentForm ;8 Classes, SysUtils, XMLConf, FileUtil, Controls, ActnList, UGrammer, 9 UPersistentForm, ULastOpenedList; 10 10 11 11 type … … 22 22 { private declarations } 23 23 public 24 LastOpenedFile: string;25 24 ReopenLastFile: Boolean; 26 25 Grammer: TGrammer; … … 28 27 procedure SaveConfig; 29 28 procedure Initialize; 29 procedure Finalize; 30 30 end; 31 31 … … 46 46 ForceDirectories(GetAppConfigDir(False)); 47 47 XMLConfig1.Filename := GetAppConfigDir(False) + 'Config.xml'; 48 LoadConfig;49 48 end; 50 49 51 50 procedure TCore.DataModuleDestroy(Sender: TObject); 52 51 begin 53 SaveConfig;54 52 end; 55 53 … … 57 55 begin 58 56 with XMLConfig1 do begin 59 LastOpenedFile := string(GetValue('LastOpenedFile', 'pascal.grm'));60 57 ReopenLastFile := GetValue('ReopenLastFile', True); 61 58 end; … … 65 62 begin 66 63 with XMLConfig1 do begin 67 SetValue('LastOpenedFile', DOMString(LastOpenedFile));68 64 SetValue('ReopenLastFile', ReopenLastFile); 69 65 Flush; … … 73 69 procedure TCore.Initialize; 74 70 begin 75 FormMain.AProjectNew.Execute; 76 if ReopenLastFile and FileExists(LastOpenedFile) then 77 Grammer.LoadFromXmlFile(LastOpenedFile) 71 LoadConfig; 72 FormMain.LoadConfig(XMLConfig1); 73 if ReopenLastFile and FileExists(FormMain.LastOpenedList1.GetFirstFileName) then 74 FormMain.ProjectOpen(FormMain.LastOpenedList1.GetFirstFileName) 75 else FormMain.AProjectNew.Execute; 76 end; 77 78 procedure TCore.Finalize; 79 begin 80 FormMain.SaveConfig(XMLConfig1); 81 SaveConfig; 78 82 end; 79 83
Note:
See TracChangeset
for help on using the changeset viewer.