Changeset 36 for trunk/IDE


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:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/IDE

    • Property svn:ignore
      •  

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

    r34 r36  
    2323    property ProjectFile: TProjectFile read FProjectFile write SetProjectFile;
    2424    procedure Save;
     25    procedure UpdateInterface;
    2526  end;
    2627
     
    5758end;
    5859
     60procedure TCodeForm.UpdateInterface;
     61begin
     62  SynPasSyn1.Enabled := MainForm.Project.Active;
     63end;
     64
    5965end.
    6066
  • trunk/IDE/Forms/UMainForm.lfm

    r35 r36  
    11object MainForm: TMainForm
    2   Left = 240
     2  Left = 217
    33  Height = 501
    4   Top = 119
     4  Top = 104
    55  Width = 695
    66  Caption = 'Transpascal IDE'
     
    320320  end
    321321  object OpenDialog1: TOpenDialog
    322     Filter = 'Project file (*.*)|*.tppr|Any file (*.*)|*.*'
     322    DefaultExt = '.tppr'
     323    Filter = 'Project file (*.tppr)|*.tppr|Any file (*.*)|*.*'
    323324    left = 115
    324325    top = 52
    325326  end
    326327  object SaveDialog1: TSaveDialog
    327     Filter = 'Project file (*.*)|*.tppr|Any file (*.*)|*.*'
     328    DefaultExt = '.tppr'
     329    Filter = 'Project file (*.tppr)|*.tppr|Any file (*.*)|*.*'
    328330    left = 115
    329331    top = 104
  • 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
  • trunk/IDE/Forms/UProjectManager.pas

    r24 r36  
    1818  public
    1919    procedure UpdateProjectTree;
     20    procedure UpdateInterface;
    2021  end;
    2122
     
    8485end;
    8586
     87procedure TProjectManager.UpdateInterface;
     88begin
     89  UpdateProjectTree;
     90end;
     91
    8692procedure TProjectManager.UpdateProjectGroup(Node: TTreeNode; Group: TProjectGroup);
    8793var
  • trunk/IDE/Transpascal.lpi

    r35 r36  
    247247        <UseMsgFile Value="True"/>
    248248      </CompilerMessages>
     249      <CustomOptions Value="-dDEBUG"/>
    249250      <CompilerPath Value="$(CompPath)"/>
    250251    </Other>
  • trunk/IDE/Transpascal.lpr

    r35 r36  
    1616{$R *.res}
    1717
     18{$IFDEF DEBUG}
    1819const
    1920  HeapTraceLog = 'heaptrclog.trc';
     21{$ENDIF}
    2022
    2123begin
    2224  Application.Title := 'Transpascal IDE';
     25  {$IFDEF DEBUG}
    2326  // Heap trace
    24 //  DeleteFile(ExtractFilePath(ParamStr(0)) + HeapTraceLog);
    25 //  SetHeapTraceOutput(ExtractFilePath(ParamStr(0)) + HeapTraceLog);
     27  DeleteFile(ExtractFilePath(ParamStr(0)) + HeapTraceLog);
     28  SetHeapTraceOutput(ExtractFilePath(ParamStr(0)) + HeapTraceLog);
     29  {$ENDIF}
    2630
    2731  Application.Initialize;
  • trunk/IDE/UProject.pas

    r35 r36  
    99  Classes, SysUtils, Dialogs, DOM, XMLWrite, XMLRead, FileUtil,
    1010  SpecializedList;
     11
     12const
     13  ProjectExt = '.tppr';
    1114
    1215type
     
    6366    FActive: Boolean;
    6467    function GetActive: Boolean;
     68    function GetFileName: string;
    6569    procedure SetActive(AValue: Boolean);
    6670  public
     
    7579    procedure Clear;
    7680    property Active: Boolean read GetActive write SetActive;
     81    property FileName: string read GetFileName;
    7782  end;
    7883
     
    236241end;
    237242
     243function TProject.GetFileName: string;
     244begin
     245  Result := GetDir(True) + Name + ProjectExt;
     246end;
     247
    238248procedure TProject.SetActive(AValue: Boolean);
    239249begin
     250  if FActive = AValue then Exit;
    240251  FActive := AValue;
     252  if FActive then Clear;
    241253end;
    242254
     
    264276    Doc.Free;
    265277  end;
     278  FModified := False;
    266279end;
    267280
     
    310323    Free;
    311324  end;
     325  FModified := False;
    312326  inherited Save;
    313327end;
Note: See TracChangeset for help on using the changeset viewer.