1 | unit FormMessages;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
---|
7 | ComCtrls, Project, Compiler;
|
---|
8 |
|
---|
9 | type
|
---|
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 |
|
---|
29 | implementation
|
---|
30 |
|
---|
31 | {$R *.lfm}
|
---|
32 |
|
---|
33 | uses
|
---|
34 | Core, FormMain, FormSourceCode;
|
---|
35 |
|
---|
36 | { TFormMessages }
|
---|
37 |
|
---|
38 | procedure TFormMessages.ListBoxMessagesSelectionChange(Sender: TObject;
|
---|
39 | User: Boolean);
|
---|
40 | begin
|
---|
41 | end;
|
---|
42 |
|
---|
43 | procedure TFormMessages.ListView1Click(Sender: TObject);
|
---|
44 | begin
|
---|
45 | if Assigned(ListView1.Selected) then
|
---|
46 | ListView1SelectItem(Self, ListView1.Selected, ListView1.Selected.Selected);
|
---|
47 | end;
|
---|
48 |
|
---|
49 | procedure TFormMessages.ListView1Data(Sender: TObject; Item: TListItem);
|
---|
50 | begin
|
---|
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;
|
---|
59 | end;
|
---|
60 |
|
---|
61 | procedure TFormMessages.ListView1SelectItem(Sender: TObject; Item: TListItem;
|
---|
62 | Selected: Boolean);
|
---|
63 | var
|
---|
64 | ProjectFile: TProjectFile;
|
---|
65 | P: TPoint;
|
---|
66 | begin
|
---|
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;
|
---|
74 | end;
|
---|
75 |
|
---|
76 | procedure TFormMessages.Reload;
|
---|
77 | begin
|
---|
78 | ListView1.Items.Count := Core.Core.Compiler.ErrorMessages.Count;
|
---|
79 | ListView1.Refresh;
|
---|
80 | end;
|
---|
81 |
|
---|
82 | end.
|
---|
83 |
|
---|