Changeset 55 for branches/DelphiToC/Forms/UMainForm.pas
- Timestamp:
- Aug 10, 2010, 1:48:38 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DelphiToC/Forms/UMainForm.pas
r54 r55 20 20 ButtonCompile: TButton; 21 21 ComboBox1: TComboBox; 22 ListBox 1: TListBox;22 ListBoxMessages: TListBox; 23 23 Panel1: TPanel; 24 SynEdit 1: TSynEdit;24 SynEditSource: TSynEdit; 25 25 SynPasSyn1: TSynPasSyn; 26 26 TreeViewProject: TTreeView; … … 31 31 procedure FormCreate(Sender: TObject); 32 32 procedure FormDestroy(Sender: TObject); 33 procedure ListBox 1Click(Sender: TObject);33 procedure ListBoxMessagesClick(Sender: TObject); 34 34 procedure TreeViewProjectChange(Sender: TObject; Node: TTreeNode); 35 35 private … … 79 79 80 80 // Compile all project files 81 Compiler.Init; 81 82 for I := 0 to Project.Items.Count - 1 do begin 82 if TProjectNode(Project.Items[I]) is TProjectFile then begin83 Compiler.Compile(TProjectFile(Project.Items[I]).Source,84 TProjectFile(Project.Items[I]).ProducedCode);83 if TProjectNode(Project.Items[I]) is TProjectFile then 84 with TProjectFile(Project.Items[I]) do begin 85 Compiler.Compile(Parent.GetDir + Name, Source, ProducedCode); 85 86 end; 86 87 end; … … 113 114 end; 114 115 115 procedure TMainForm.ListBox1Click(Sender: TObject); 116 begin 117 if ListBox1.ItemIndex <> - 1 then begin 118 SynEdit1.CaretXY := TErrorMessage(Compiler.ErrorMessages[ListBox1.ItemIndex]).Position; 119 SynEdit1.SetFocus; 116 procedure TMainForm.ListBoxMessagesClick(Sender: TObject); 117 var 118 ProjectFile: TProjectFile; 119 begin 120 if ListBoxMessages.ItemIndex <> -1 then 121 with TErrorMessage(Compiler.ErrorMessages[ListBoxMessages.ItemIndex]) do begin 122 ProjectFile := Project.SearchFile(fileName); 123 if Assigned(ProjectFile) then 124 SynEditSource.Lines.Assign(ProjectFile.Source); 125 SynEditSource.CaretXY := Position; 126 SynEditSource.SetFocus; 120 127 end; 121 128 end; … … 125 132 I: Integer; 126 133 begin 127 ListBox 1.Clear;134 ListBoxMessages.Clear; 128 135 for I := 0 to Compiler.ErrorMessages.Count - 1 do 129 136 with TErrorMessage(Compiler.ErrorMessages[I]) do 130 MainForm.ListBox 1.Items.Add('(' + IntToStr(Position.X) +137 MainForm.ListBoxMessages.Items.Add(FileName + '(' + IntToStr(Position.X) + 131 138 ',' + IntToStr(Position.Y) + ') ' + Text); 132 139 end; … … 136 143 if Assigned(Node) then begin 137 144 if TProjectNode(Node.Data) is TProjectFile then begin 138 SynEdit 1.Lines.Assign(TProjectFile(Node.Data).Source);145 SynEditSource.Lines.Assign(TProjectFile(Node.Data).Source); 139 146 if ProducerControl is TMemo then 140 147 TMemo(ProducerControl).Lines.Assign(TProjectFile(Node.Data).ProducedCode); … … 193 200 NewProjectFile: TProjectFile; 194 201 begin 202 Project.RootDir := '../../Project/'; 195 203 Project.Name := 'Project'; 204 196 205 NewProjectFile := TProjectFile.Create; 206 NewProjectFile.Parent := Project; 197 207 NewProjectFile.Name := 'Project.pas'; 198 NewProjectFile.FileName := ProjectDir + 'Project.pas';199 208 Project.Items.Add(NewProjectFile); 209 200 210 NewProjectFile := TProjectFile.Create; 211 NewProjectFile.Parent := Project; 201 212 NewProjectFile.Name := 'System.pas'; 202 NewProjectFile.FileName := ProjectDir + 'System.pas';203 213 Project.Items.Add(NewProjectFile); 214 215 NewProjectFile := TProjectFile.Create; 216 NewProjectFile.Parent := Project; 217 NewProjectFile.Name := 'Console.pas'; 218 Project.Items.Add(NewProjectFile); 219 204 220 Project.Load; 205 221 UpdateProjectTree;
Note:
See TracChangeset
for help on using the changeset viewer.