Ignore:
Timestamp:
Aug 3, 2012, 1:34:09 PM (12 years ago)
Author:
chronos
Message:
  • Added: Form for application runtime module management.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/StudioPackage/UDataModule.pas

    r8 r9  
    66
    77uses
    8   Classes, SysUtils, FileUtil, UProject, Forms, SpecializedList, USource;
     8  Classes, SysUtils, FileUtil, UProject, Forms, SpecializedList, USource,
     9  UModularSystem, ULDStudioAPI;
    910
    1011type
     
    3031    FOnOpenFile: TOpenFileEvent;
    3132  public
     33    Selected: TOpenedFile;
     34    procedure CloseFile(OpenedFile: TOpenedFile);
    3235    procedure OpenFile(FileName: string);
    3336    procedure NewFile;
     
    4144    procedure DataModuleDestroy(Sender: TObject);
    4245  private
    43     { private declarations }
     46    API: TLDStudioAPI;
    4447  public
     48    ModuleManager: TModuleManager;
    4549    Project: TProject;
    4650    FileTypes: TFileTypes;
     
    5761
    5862uses
    59   UFormSourceCode, UFormMain, UFormProject, UFormSettings;
     63  UFormSourceCode, UFormMain, UFormProject, UFormSettings, UFormModuleList;
    6064
    6165procedure TOpenedFile.SetFileName(AValue: string);
     
    6973{ TOpenedFiles }
    7074
     75procedure TOpenedFiles.CloseFile(OpenedFile: TOpenedFile);
     76begin
     77  FreeAndNil(OpenedFile.Form);
     78end;
     79
    7180procedure TOpenedFiles.OpenFile(FileName: string);
    7281var
     
    7887  NewFile.Form.Caption := ExtractFileName(NewFile.FileName);
    7988  NewFile.Form.Visible := True;
     89  Selected := NewFile;
    8090  if Assigned(FOnOpenFile) then
    8191    FOnOpenFile(NewFile);
     
    94104  FileTypes.OwnsObjects := False;
    95105  OpenedFiles := TOpenedFiles.Create;
     106  API := TLDStudioAPI.Create;
     107  ModuleManager := TModuleManager.Create(nil);
     108  ModuleManager.API := API;
    96109
    97110  Application.CreateForm(TFormMain, FormMain);
     
    100113  Application.CreateForm(TFormSourceCode, FormSourceCode);
    101114  Application.CreateForm(TFormSettings, FormSettings);
     115  Application.CreateForm(TFormModuleList, FormModuleList);
     116
     117  TLDStudioAPI(ModuleManager.API).MainForm := FormMain;
     118  TLDStudioAPI(ModuleManager.API).MainMenu := FormMain.MainMenu;
     119  TLDStudioAPI(ModuleManager.API).FileTypes := FileTypes;
    102120end;
    103121
    104122procedure TDataModule1.DataModuleDestroy(Sender: TObject);
    105123begin
     124  FreeAndNil(ModuleManager);
     125  FreeAndNil(API);
    106126  FreeAndNil(OpenedFiles);
    107127  FreeAndNil(FileTypes);
Note: See TracChangeset for help on using the changeset viewer.