Changeset 47 for trunk/IDE/Forms/UFormProject.pas
- Timestamp:
- Mar 4, 2012, 3:38:44 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IDE/Forms/UFormProject.pas
r45 r47 15 15 procedure TreeViewProjectChange(Sender: TObject; Node: TTreeNode); 16 16 private 17 procedure UpdateProject Group(Node: TTreeNode; Group: TProjectGroup);17 procedure UpdateProjectFiles(Node: TTreeNode; Files: TProjectFileList); 18 18 public 19 19 procedure UpdateProjectTree; … … 38 38 with FormMain, FormSourceCode do 39 39 if Assigned(Node) then begin 40 if TProject Node(Node.Data) is TProjectFile then begin40 if TProjectFile(Node.Data) is TProjectFile then begin 41 41 ProjectFile := TProjectFile(Node.Data); 42 42 SynEditSource.Lines.Assign(TProjectFile(Node.Data).Source); … … 75 75 Clear; 76 76 if Project.Active then begin 77 NewNode := AddChild(nil, Project.Name);78 UpdateProject Group(NewNode, Project);77 NewNode := AddChild(nil, ExtractFileNameOnly(Project.FileName)); 78 UpdateProjectFiles(NewNode, Project.Files); 79 79 NewNode.Expand(True); 80 80 end; … … 92 92 end; 93 93 94 procedure TFormProject.UpdateProject Group(Node: TTreeNode; Group: TProjectGroup);94 procedure TFormProject.UpdateProjectFiles(Node: TTreeNode; Files: TProjectFileList); 95 95 var 96 96 I: Integer; 97 97 NewNode: TTreeNode; 98 FileName: string; 99 NamePart: string; 100 SelNode: TTreeNode; 101 SubNode: TTreeNode; 98 102 begin 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]); 106 117 end; 107 118 end; 108 119 109 110 111 120 end. 112 121
Note:
See TracChangeset
for help on using the changeset viewer.