Ignore:
Timestamp:
Feb 13, 2012, 4:07:34 PM (13 years ago)
Author:
chronos
Message:
  • Modified: Partialy solved project open/close/save management.
Location:
trunk/IDE
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/IDE

    • Property svn:ignore
      •  

        old new  
        44Transpascal.lps
        55Transpascal.exe
         6heaptrclog.trc
  • trunk/IDE/Forms/UMainForm.pas

    r35 r36  
    119119    procedure LoadFromRegistry(Root: HKEY; Key: string);
    120120    procedure SaveToRegistry(Root: HKEY; Key: string);
    121     procedure OpenProject(FileName: string);
     121    procedure ProjectOpen(FileName: string);
    122122    procedure UpdateMenu;
    123123  public
     
    235235  AProgramStop.Enabled := Project.Active and (BrainFuckInterpreter.State <> rsStopped);*)
    236236  UpdateMenu;
     237  CodeForm.UpdateInterface;
     238  ProjectManager.UpdateInterface;
    237239end;
    238240
     
    332334end;
    333335
    334 procedure TMainForm.OpenProject(FileName: string);
     336procedure TMainForm.ProjectOpen(FileName: string);
    335337begin
    336338  Project.LoadFromFile(FileName);
     
    382384procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
    383385begin
    384   Project.Save;
     386  AProjectClose.Execute;
    385387  SaveToRegistry(RegistryRootKey, ApplicationInfo.RegistryKey);
    386388end;
     
    413415begin
    414416  if Sender is TMenuItem then
    415      OpenProject(StringReplace(TMenuItem(Sender).Caption, '&', '', [rfReplaceAll]));
     417    ProjectOpen(StringReplace(TMenuItem(Sender).Caption, '&', '', [rfReplaceAll]));
    416418end;
    417419
     
    424426
    425427  if ReopenLastOpenedFile and (LastOpenedFiles.Count > 0) then begin
    426     OpenProject(LastOpenedFiles[0]);
     428    ProjectOpen(LastOpenedFiles[0]);
    427429  end;
    428430
     
    438440begin
    439441  if OpenDialog1.Execute then begin
    440     OpenProject(OpenDialog1.FileName);
     442    ProjectOpen(OpenDialog1.FileName);
    441443  end;
    442444end;
     
    444446procedure TMainForm.AProjectCloseExecute(Sender: TObject);
    445447begin
     448  //if Project.Modified then ;
     449  Project.Active := False;
     450  UpdateInterface;
     451end;
     452
     453procedure TMainForm.AExitExecute(Sender: TObject);
     454begin
    446455  Close;
    447456end;
    448457
    449 procedure TMainForm.AExitExecute(Sender: TObject);
    450 begin
    451   Close;
    452 end;
    453 
    454458procedure TMainForm.AAboutExecute(Sender: TObject);
    455459begin
     
    464468procedure TMainForm.AProjectNewExecute(Sender: TObject);
    465469begin
    466   Project.Clear;
     470  AProjectClose.Execute;
     471  Project.Active := True;
    467472  Project.Name := SNewProject;
    468   ProjectManager.UpdateProjectTree;
    469   Caption := ApplicationInfo.Name + ' - ' + Project.Name;
     473  UpdateInterface;
    470474end;
    471475
     
    473477begin
    474478  if SaveDialog1.Execute then begin
     479    Project.Active := True;
    475480    Project.SaveToFile(SaveDialog1.FileName);
    476481    CodeForm.Save;
    477482    Project.Save;
     483    UpdateInterface;
     484    LastOpenedFiles.AddItem(SaveDialog1.FileName);
     485    LastOpenedFiles.ReloadMenu;
    478486  end;
    479487end;
     
    482490begin
    483491  CodeForm.Save;
    484   Project.SaveToFile(Project.GetDir(True) + Project.Name + '.tppr');
     492  if not FileExistsUTF8(Project.FileName) then AProjectSaveAs.Execute
     493    else Project.SaveToFile(Project.FileName);
    485494end;
    486495
Note: See TracChangeset for help on using the changeset viewer.