Ignore:
Timestamp:
Dec 24, 2017, 3:54:08 PM (7 years ago)
Author:
chronos
Message:
  • Added: Open recent files menu action.
  • Added: Generate BNF and EBNF output separately.
  • Added: Allow to hide main toolbar.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/generator/UCore.pas

    r129 r131  
    66
    77uses
    8   Classes, SysUtils, XMLConf, FileUtil, Controls, ActnList, UGrammer, DOM,
    9   UPersistentForm;
     8  Classes, SysUtils, XMLConf, FileUtil, Controls, ActnList, UGrammer,
     9  UPersistentForm, ULastOpenedList;
    1010
    1111type
     
    2222    { private declarations }
    2323  public
    24     LastOpenedFile: string;
    2524    ReopenLastFile: Boolean;
    2625    Grammer: TGrammer;
     
    2827    procedure SaveConfig;
    2928    procedure Initialize;
     29    procedure Finalize;
    3030  end;
    3131
     
    4646  ForceDirectories(GetAppConfigDir(False));
    4747  XMLConfig1.Filename := GetAppConfigDir(False) + 'Config.xml';
    48   LoadConfig;
    4948end;
    5049
    5150procedure TCore.DataModuleDestroy(Sender: TObject);
    5251begin
    53   SaveConfig;
    5452end;
    5553
     
    5755begin
    5856  with XMLConfig1 do begin
    59     LastOpenedFile := string(GetValue('LastOpenedFile', 'pascal.grm'));
    6057    ReopenLastFile := GetValue('ReopenLastFile', True);
    6158  end;
     
    6562begin
    6663  with XMLConfig1 do begin
    67     SetValue('LastOpenedFile', DOMString(LastOpenedFile));
    6864    SetValue('ReopenLastFile', ReopenLastFile);
    6965    Flush;
     
    7369procedure TCore.Initialize;
    7470begin
    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;
     76end;
     77
     78procedure TCore.Finalize;
     79begin
     80  FormMain.SaveConfig(XMLConfig1);
     81  SaveConfig;
    7882end;
    7983
Note: See TracChangeset for help on using the changeset viewer.