Changeset 162


Ignore:
Timestamp:
Jul 17, 2018, 11:50:38 PM (6 years ago)
Author:
chronos
Message:
  • Fixed: Do not close existing project before open dialog user confirmation on Open project action.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/generator/Forms/UFormMain.pas

    r137 r162  
    224224procedure TFormMain.ProjectOpen(FileName: string);
    225225begin
    226   if Assigned(Core.Grammer) then FreeAndNil(Core.Grammer);
    227   LastOpenedList1.AddItem(FileName);
    228   Core.Grammer := TGrammer.Create;
    229   Core.Grammer.OnChange := GrammerChange;
    230   Core.Grammer.OnDestroy := GrammerDestroy;
    231   Core.Grammer.LoadFromXmlFile(FileName);
    232   Core.Grammer.Change;
     226  AProjectClose.Execute;
     227  if not Assigned(Core.Grammer) then begin
     228    LastOpenedList1.AddItem(FileName);
     229    ProjectNew;
     230    Core.Grammer := TGrammer.Create;
     231    Core.Grammer.OnChange := GrammerChange;
     232    Core.Grammer.OnDestroy := GrammerDestroy;
     233    Core.Grammer.LoadFromXmlFile(FileName);
     234    Core.Grammer.Change;
     235  end;
    233236end;
    234237
     
    326329procedure TFormMain.AProjectOpenExecute(Sender: TObject);
    327330begin
    328   AProjectClose.Execute;
    329   if not Assigned(Core.Grammer) then begin
    330     OpenDialog1.InitialDir := ExtractFileDir(LastOpenedList1.GetFirstFileName);
    331     OpenDialog1.FileName := ExtractFileName(LastOpenedList1.GetFirstFileName);
    332     if OpenDialog1.Execute then begin
    333       ProjectOpen(OpenDialog1.FileName);
    334     end;
     331  OpenDialog1.InitialDir := ExtractFileDir(LastOpenedList1.GetFirstFileName);
     332  OpenDialog1.FileName := ExtractFileName(LastOpenedList1.GetFirstFileName);
     333  if OpenDialog1.Execute then begin
     334    ProjectOpen(OpenDialog1.FileName);
    335335  end;
    336336end;
Note: See TracChangeset for help on using the changeset viewer.