Ignore:
Timestamp:
Mar 4, 2012, 4:28:12 PM (13 years ago)
Author:
chronos
Message:
  • Added: New project and files templates.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IDE/Forms/UFormMain.pas

    r47 r48  
    141141  private
    142142    LastOpenedFiles: TLastOpenedList;
     143    procedure ProjectTemplatesInit;
    143144    procedure CompilerDebugLog(Text: string);
    144145    procedure MenuItemTargetClick(Sender: TObject);
     
    153154    LogParsing: Boolean;
    154155    Project: TProject;
     156    ProjectTemplates: TProjectTemplateList;
    155157    TargetProject: TProject;
    156158    Compiler: TCustomCompiler;
     
    169171uses
    170172  UFormMessages, UFormSourceCode, UFormProject, UCommon, UFormAbout, UFormOptions,
    171   UFormTargets, UTarget, UAnalyzer, UProducer, UExecutor;
     173  UFormTargets, UTarget, UAnalyzer, UProducer, UExecutor, UFormProjectNew,
     174  UProjectTemplates;
    172175
    173176resourcestring
     
    239242      Compiler.Compile;
    240243    end;
    241     //FormProject.TreeViewProjectChange(Self, FormProject.TreeViewProject.Selected);
     244    FormProject.TreeViewProjectChange(Self, FormProject.TreeViewProject.Selected);
    242245    FormMessages.Reload;
    243246end;
     
    483486  Compiler := TCustomCompiler.Create;
    484487  Project := TProject.Create;
     488  ProjectTemplates := TProjectTemplateList.Create;
    485489  TargetProject := TProject.Create;
    486490  LastOpenedFiles := TLastOpenedList.Create;
     
    491495procedure TFormMain.FormDestroy(Sender: TObject);
    492496begin
     497  ProjectTemplates.Free;
    493498  LastOpenedFiles.Free;
    494499  TargetProject.Free;
     
    497502end;
    498503
     504procedure TFormMain.ProjectTemplatesInit;
     505begin
     506  ProjectTemplates.AddTemplate(TProjectTemplateConsoleApp.Create);
     507  ProjectTemplates.AddTemplate(TProjectTemplateGUIApp.Create);
     508  ProjectTemplates.AddTemplate(TProjectTemplatePackage.Create);
     509  ProjectTemplates.AddTemplate(TProjectTemplateUnit.Create);
     510end;
     511
    499512procedure TFormMain.CompilerDebugLog(Text: string);
    500513begin
     
    514527  LoadFromRegistry(RegistryRootKey, ApplicationInfo.RegistryKey);
    515528  DockInit;
     529  ProjectTemplatesInit;
    516530
    517531  if ReopenLastOpenedFile and (LastOpenedFiles.Count > 0) then begin
     
    560574  NewFile: TProjectFile;
    561575begin
    562   AProjectClose.Execute;
    563   Project.Active := True;
    564   Project.FileName := SNewProject;
    565   Project.Files.AddFile('Unit1.pas');
     576  if FormProjectNew.ShowModal = mrOk then begin
     577    if Assigned(FormProjectNew.ListView1.Selected) then
     578      TProjectTemplate(FormProjectNew.ListView1.Selected.Data).InitProject(Project);
     579  end;
    566580  UpdateInterface;
    567581end;
Note: See TracChangeset for help on using the changeset viewer.