Changeset 47 for trunk/IDE/Forms


Ignore:
Timestamp:
Mar 4, 2012, 3:38:44 PM (13 years ago)
Author:
chronos
Message:
  • Modified: Project now hold file list as linear list each include relative path to source instead of tree structure. This allow link to files outside of project folder.
Location:
trunk/IDE/Forms
Files:
3 edited

Legend:

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

    r46 r47  
    232232      else Compiler.Analyzer.OnDebugLog := nil;
    233233
    234     if Project.Items.Count > 0 then
    235     with TProjectFile(Project.Items[0]) do begin
     234    if Project.Files.Count > 0 then
     235    with TProjectFile(Project.Files[0]) do begin
    236236      Compiler.SourceFiles.Clear;
    237       Project.DumpFileList(Compiler.SourceFiles);
    238       Compiler.TargetFolder := Project.RootDir;
     237      Project.Files.DumpFileList(Compiler.SourceFiles);
     238      Compiler.TargetFolder := ExtractFileDir(Project.FileName);
    239239      Compiler.Compile;
    240240    end;
    241     FormProject.TreeViewProjectChange(Self, FormProject.TreeViewProject.Selected);
     241    //FormProject.TreeViewProjectChange(Self, FormProject.TreeViewProject.Selected);
    242242    FormMessages.Reload;
    243243end;
     
    283283  F: TFileStream;
    284284begin
    285   FileName := Project.GetDir(True) + Name + '.pas';
     285  FileName := ExtractFileDir(Project.FileName) + Name + '.pas';
    286286  if FileExists(FileName) then
    287287  try
     
    302302begin
    303303  Title := ApplicationInfo.Name;
    304   if Project.Name <> '' then Title := Project.Name + ' - ' + Title;
     304  if Project.FileName <> '' then Title := Project.FileName + ' - ' + Title;
    305305  if Project.Modified then Title := Title + ' *';
    306306  Caption := Title;
     
    557557
    558558procedure TFormMain.AProjectNewExecute(Sender: TObject);
     559var
     560  NewFile: TProjectFile;
    559561begin
    560562  AProjectClose.Execute;
    561563  Project.Active := True;
    562   Project.Name := SNewProject;
     564  Project.FileName := SNewProject;
     565  Project.Files.AddFile('Unit1.pas');
    563566  UpdateInterface;
    564567end;
  • trunk/IDE/Forms/UFormMessages.pas

    r46 r47  
    7070  if Assigned(ListView1.Selected) then
    7171  with TErrorMessage(ListView1.Selected.Data) do begin
    72     ProjectFile := Project.SearchFile(FileName);
     72    ProjectFile := Project.Files.SearchFile(FileName);
    7373    if Assigned(ProjectFile) then
    7474      SynEditSource.Lines.Assign(ProjectFile.Source);
  • trunk/IDE/Forms/UFormProject.pas

    r45 r47  
    1515    procedure TreeViewProjectChange(Sender: TObject; Node: TTreeNode);
    1616  private
    17     procedure UpdateProjectGroup(Node: TTreeNode; Group: TProjectGroup);
     17    procedure UpdateProjectFiles(Node: TTreeNode; Files: TProjectFileList);
    1818  public
    1919    procedure UpdateProjectTree;
     
    3838  with FormMain, FormSourceCode do
    3939  if Assigned(Node) then begin
    40     if TProjectNode(Node.Data) is TProjectFile then begin
     40    if TProjectFile(Node.Data) is TProjectFile then begin
    4141      ProjectFile := TProjectFile(Node.Data);
    4242      SynEditSource.Lines.Assign(TProjectFile(Node.Data).Source);
     
    7575    Clear;
    7676    if Project.Active then begin
    77       NewNode := AddChild(nil, Project.Name);
    78       UpdateProjectGroup(NewNode, Project);
     77      NewNode := AddChild(nil, ExtractFileNameOnly(Project.FileName));
     78      UpdateProjectFiles(NewNode, Project.Files);
    7979      NewNode.Expand(True);
    8080    end;
     
    9292end;
    9393
    94 procedure TFormProject.UpdateProjectGroup(Node: TTreeNode; Group: TProjectGroup);
     94procedure TFormProject.UpdateProjectFiles(Node: TTreeNode; Files: TProjectFileList);
    9595var
    9696  I: Integer;
    9797  NewNode: TTreeNode;
     98  FileName: string;
     99  NamePart: string;
     100  SelNode: TTreeNode;
     101  SubNode: TTreeNode;
    98102begin
    99   with FormMain do
    100   for I := 0 to Group.Items.Count - 1 do begin
    101     NewNode := TreeViewProject.Items.AddChild(Node,
    102       TProjectNode(Group.Items[I]).Name);
    103     NewNode.Data := Pointer(Group.Items[I]);
    104     if TProjectNode(Group.Items[I]) is TProjectGroup then
    105       UpdateProjectGroup(NewNode, TProjectGroup(Group.Items[I]));
     103  for I := 0 to Files.Count - 1 do begin
     104    FileName := TProjectFile(Files[I]).FileName;
     105    SelNode := Node;
     106    while Pos(DirectorySeparator, FileName) > 0 do begin
     107      NamePart := Copy(FileName, 1, Pos(DirectorySeparator, FileName) - 1);
     108      Delete(FileName, 1, Length(NamePart) + 1);
     109      SubNode := SelNode.FindNode(NamePart);
     110      if Assigned(SubNode) then SelNode := SubNode
     111      else begin
     112        SelNode := TreeViewProject.Items.AddChild(SelNode, NamePart);
     113      end;
     114    end;
     115    NewNode := TreeViewProject.Items.AddChild(SelNode, FileName);
     116    NewNode.Data := Pointer(Files[I]);
    106117  end;
    107118end;
    108119
    109 
    110 
    111120end.
    112121
Note: See TracChangeset for help on using the changeset viewer.