-
Notifications
You must be signed in to change notification settings - Fork 2
/
Main.pas
69 lines (55 loc) · 1.64 KB
/
Main.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
unit Main;
interface
implementation
uses
Windows, ToolsAPI;
type
TOTACompileNotifier = class(TInterfacedObject, IOTACompileNotifier)
protected
procedure ProjectCompileStarted(const Project: IOTAProject; Mode: TOTACompileMode);
procedure ProjectCompileFinished(const Project: IOTAProject; Result: TOTACompileResult);
procedure ProjectGroupCompileStarted(Mode: TOTACompileMode);
procedure ProjectGroupCompileFinished(Result: TOTACompileResult);
end;
{ TOTACompileNotifier }
const
SDelphiProjectCompileMode = 'DelphiProjectCompileMode';
procedure TOTACompileNotifier.ProjectCompileStarted(const Project: IOTAProject; Mode: TOTACompileMode);
var
Value: string;
begin
case Mode of
cmOTAMake:
Value := 'Make';
cmOTABuild:
Value := 'Build';
cmOTACheck:
Value := 'Check';
cmOTAMakeUnit:
Value := 'MakeUnit';
else
Value := 'Unrecognised';
end;
SetEnvironmentVariable(SDelphiProjectCompileMode, PChar(Value));
end;
procedure TOTACompileNotifier.ProjectCompileFinished(const Project: IOTAProject; Result: TOTACompileResult);
begin
SetEnvironmentVariable(SDelphiProjectCompileMode, nil);
end;
procedure TOTACompileNotifier.ProjectGroupCompileFinished(Result: TOTACompileResult);
begin
end;
procedure TOTACompileNotifier.ProjectGroupCompileStarted(Mode: TOTACompileMode);
begin
end;
var
NotifierIndex: Integer;
initialization
NotifierIndex := (BorlandIDEServices as IOTACompileServices).AddNotifier(
TOTACompileNotifier.Create
);
finalization
(BorlandIDEServices as IOTACompileServices).RemoveNotifier(
NotifierIndex
);
end.