Changeset 48 for trunk/IDE/Forms


Ignore:
Timestamp:
Mar 4, 2012, 4:28:12 PM (13 years ago)
Author:
chronos
Message:
  • Added: New project and files templates.
Location:
trunk/IDE/Forms
Files:
3 added
3 edited

Legend:

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

    r45 r48  
    629629    object AProjectNew: TAction
    630630      Category = 'Project'
    631       Caption = 'New'
     631      Caption = 'New...'
    632632      Hint = 'Create new project'
    633633      ImageIndex = 10
  • trunk/IDE/Forms/UFormMain.lrt

    r45 r48  
    1616TFORMMAIN.MENUITEM22.CAPTION=-
    1717TFORMMAIN.MENUITEM9.CAPTION=Help
    18 TFORMMAIN.APROJECTNEW.CAPTION=New
     18TFORMMAIN.APROJECTNEW.CAPTION=New...
    1919TFORMMAIN.APROJECTNEW.HINT=Create new project
    2020TFORMMAIN.APROJECTOPEN.CAPTION=Open...
  • 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.