Changeset 75 for trunk/IDE/Project.pas


Ignore:
Timestamp:
Jun 4, 2024, 12:22:49 AM (5 months ago)
Author:
chronos
Message:
  • Modified: Removed U prefix from unit names.
  • Modified: Updated Common package.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/IDE/Project.pas

    r74 r75  
    1 unit UProject;
    2 
    3 {$mode Delphi}{$H+}
     1unit Project;
    42
    53interface
     
    75uses
    86  Classes, SysUtils, Dialogs, DOM, XMLWrite, XMLRead, FileUtil,
    9   SpecializedList;
     7  Generics.Collections;
    108
    119const
     
    1917  end;
    2018
    21   { TProjectPackageList }
    22 
    23   TProjectPackageList = class(TListObject)
     19  { TProjectPackages }
     20
     21  TProjectPackages = class(TObjectList<TProjectPackage>)
    2422    Parent: TProject;
    2523    procedure Load;
     
    3331  end;
    3432
    35   TProjectBuildConfigList = class(TListObject)
     33  TProjectBuildConfigs = class(TObjectList<TProjectBuildConfig>)
    3634  end;
    3735
     
    5755  end;
    5856
    59   { TProjectFileList }
    60 
    61   TProjectFileList = class(TListObject)
     57  { TProjectFiles }
     58
     59  TProjectFiles = class(TObjectList<TProjectFile>)
    6260    Parent: TProject;
    63     procedure DumpFileList(Files: TListString);
    64     procedure LoadFromList(Files: TListString);
     61    procedure DumpFileList(Files: TStringList);
     62    procedure LoadFromList(Files: TStringList);
    6563    procedure Load;
    6664    procedure Save;
     
    7876  public
    7977    FileName: string;
    80     Files: TProjectFileList;
    81     Packages: TProjectPackageList;
    82     BuildConfigs: TProjectBuildConfigList;
     78    Files: TProjectFiles;
     79    Packages: TProjectPackages;
     80    BuildConfigs: TProjectBuildConfigs;
    8381    MainSource: TProjectFile;
    8482    procedure LoadFromFile(FileName: string);
     
    104102  end;
    105103
    106   { TProjectTemplateList }
    107 
    108   TProjectTemplateList = class(TListObject)
     104  { TProjectTemplates }
     105
     106  TProjectTemplates = class(TObjectList<TProjectTemplate>)
    109107    procedure AddTemplate(Template: TProjectTemplate);
    110108  end;
     
    113111  SNewProject = 'New project';
    114112
     113
    115114implementation
    116115
    117 { TProjectTemplateList }
    118 
    119 procedure TProjectTemplateList.AddTemplate(Template: TProjectTemplate);
     116{ TProjectTemplates }
     117
     118procedure TProjectTemplates.AddTemplate(Template: TProjectTemplate);
    120119begin
    121120  Add(Template);
     
    136135destructor TProjectTemplate.Destroy;
    137136begin
    138   Description.Free;
    139   inherited Destroy;
    140 end;
    141 
    142 { TProjectPackageList }
    143 
    144 procedure TProjectPackageList.Load;
    145 begin
    146 
    147 end;
    148 
    149 procedure TProjectPackageList.Save;
    150 begin
    151 
    152 end;
    153 
    154 procedure TProjectPackageList.SaveToXMLNode(Node: TDOMNode);
    155 begin
    156 
    157 end;
    158 
    159 procedure TProjectPackageList.LoadFromXMLNode(Node: TDOMNode);
    160 begin
    161 
     137  FreeAndNil(Description);
     138  inherited;
     139end;
     140
     141{ TProjectPackages }
     142
     143procedure TProjectPackages.Load;
     144begin
     145end;
     146
     147procedure TProjectPackages.Save;
     148begin
     149end;
     150
     151procedure TProjectPackages.SaveToXMLNode(Node: TDOMNode);
     152begin
     153end;
     154
     155procedure TProjectPackages.LoadFromXMLNode(Node: TDOMNode);
     156begin
    162157end;
    163158
    164159{ TProjectGroup }
    165160
    166 procedure TProjectFileList.DumpFileList(Files: TListString);
     161procedure TProjectFiles.DumpFileList(Files: TStringList);
    167162var
    168163  I: Integer;
     
    173168end;
    174169
    175 procedure TProjectFileList.LoadFromList(Files: TListString);
     170procedure TProjectFiles.LoadFromList(Files: TStringList);
    176171var
    177172  I: Integer;
     
    190185end;
    191186
    192 procedure TProjectFileList.Load;
     187procedure TProjectFiles.Load;
    193188var
    194189  I: Integer;
     
    198193end;
    199194
    200 procedure TProjectFileList.Save;
     195procedure TProjectFiles.Save;
    201196var
    202197  I: Integer;
     
    206201end;
    207202
    208 procedure TProjectFileList.SaveToXMLNode(Node: TDOMNode);
     203procedure TProjectFiles.SaveToXMLNode(Node: TDOMNode);
    209204var
    210205  I: Integer;
     
    219214end;
    220215
    221 procedure TProjectFileList.LoadFromXMLNode(Node: TDOMNode);
     216procedure TProjectFiles.LoadFromXMLNode(Node: TDOMNode);
    222217var
    223218  NewNode: TDomNode;
     
    236231end;
    237232
    238 function TProjectFileList.SearchFile(FileName: string): TProjectFile;
     233function TProjectFiles.SearchFile(FileName: string): TProjectFile;
    239234var
    240235  I: Integer;
     
    250245end;
    251246
    252 function TProjectFileList.AddFile(FileName: string): TProjectFile;
    253 begin
    254   Result := TProjectFile(AddNew(TProjectFile.Create));
     247function TProjectFiles.AddFile(FileName: string): TProjectFile;
     248begin
     249  Result := TProjectFile.Create;
    255250  Result.Parent := Parent;
    256251  Result.FileName := FileName;
     252  Add(Result);
    257253end;
    258254
     
    278274destructor TProjectFile.Destroy;
    279275begin
    280   Source.Free;
    281   inherited Destroy;
     276  FreeAndNil(Source);
     277  inherited;
    282278end;
    283279
     
    419415constructor TProject.Create;
    420416begin
    421   Files := TProjectFileList.Create;
     417  Files := TProjectFiles.Create;
    422418  Files.Parent := Self;
    423   Packages := TProjectPackageList.Create;
     419  Packages := TProjectPackages.Create;
    424420  Packages.Parent := Self;
    425421end;
     
    427423destructor TProject.Destroy;
    428424begin
    429   Files.Free;
    430   Packages.Free;
    431   BuildConfigs.Free;
    432   inherited Destroy;
     425  FreeAndNil(Files);
     426  FreeAndNil(Packages);
     427  FreeAndNil(BuildConfigs);
     428  inherited;
    433429end;
    434430
Note: See TracChangeset for help on using the changeset viewer.