source: trunk/IDE/Forms/FormMessages.pas

Last change on this file was 75, checked in by chronos, 6 months ago
  • Modified: Removed U prefix from unit names.
  • Modified: Updated Common package.
File size: 2.0 KB
Line 
1unit FormMessages;
2
3interface
4
5uses
6 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
7 ComCtrls, Project, Compiler;
8
9type
10 TSelectFileEvent = procedure(FileName: string; Position: TPoint);
11
12 { TFormMessages }
13
14 TFormMessages = class(TForm)
15 ListView1: TListView;
16 procedure ListBoxMessagesSelectionChange(Sender: TObject; User: Boolean);
17 procedure ListView1Click(Sender: TObject);
18 procedure ListView1Data(Sender: TObject; Item: TListItem);
19 procedure ListView1SelectItem(Sender: TObject; Item: TListItem;
20 Selected: Boolean);
21 private
22 FOnSelectFile: TSelectFileEvent;
23 public
24 procedure Reload;
25 property OnSelectFile: TSelectFileEvent read FOnSelectFile write FOnSelectFile;
26 end;
27
28
29implementation
30
31{$R *.lfm}
32
33uses
34 Core, FormMain, FormSourceCode;
35
36{ TFormMessages }
37
38procedure TFormMessages.ListBoxMessagesSelectionChange(Sender: TObject;
39 User: Boolean);
40begin
41end;
42
43procedure TFormMessages.ListView1Click(Sender: TObject);
44begin
45 if Assigned(ListView1.Selected) then
46 ListView1SelectItem(Self, ListView1.Selected, ListView1.Selected.Selected);
47end;
48
49procedure TFormMessages.ListView1Data(Sender: TObject; Item: TListItem);
50begin
51 with Core.Core, FormMain.FormMain do
52 with TErrorMessage(Compiler.ErrorMessages[Item.Index]) do begin
53 if FileName = '' then Item.Caption := ' '
54 else Item.Caption := FileName;
55 Item.Data := Compiler.ErrorMessages[Item.Index];
56 Item.SubItems.Add(IntToStr(Position.X) + ',' + IntToStr(Position.Y));
57 Item.SubItems.Add(Text);
58 end;
59end;
60
61procedure TFormMessages.ListView1SelectItem(Sender: TObject; Item: TListItem;
62 Selected: Boolean);
63var
64 ProjectFile: TProjectFile;
65 P: TPoint;
66begin
67 with Core.Core do
68 if Assigned(ListView1.Selected) then
69 with TErrorMessage(ListView1.Selected.Data) do
70 if FileName <> '' then begin
71 if Assigned(FOnSelectFile) then
72 FOnSelectFile(FileName, Position);
73 end;
74end;
75
76procedure TFormMessages.Reload;
77begin
78 ListView1.Items.Count := Core.Core.Compiler.ErrorMessages.Count;
79 ListView1.Refresh;
80end;
81
82end.
83
Note: See TracBrowser for help on using the repository browser.