-
Notifications
You must be signed in to change notification settings - Fork 20
/
LogViewer.DisplayValues.Settings.pas
252 lines (200 loc) · 6.83 KB
/
LogViewer.DisplayValues.Settings.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
{
Copyright (C) 2013-2022 Tim Sinaeve tim.sinaeve@gmail.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
}
unit LogViewer.DisplayValues.Settings;
{ Persistable settings for data displayed in the message viewer. }
interface
uses
System.Classes,
Vcl.Forms, Vcl.Controls, Vcl.Graphics,
Spring,
DDuce.Settings.TextFormat;
type
TDisplayValuesSettings = class(TPersistent)
private
FTimeStamp : TTextFormatSettings;
FValueName : TTextFormatSettings;
FValueType : TTextFormatSettings;
FValue : TTextFormatSettings;
FId : TTextFormatSettings;
FWarning : TTextFormatSettings;
FInfo : TTextFormatSettings;
FError : TTextFormatSettings;
FCheckPoint : TTextFormatSettings;
FCounter : TTextFormatSettings;
FTracing : TTextFormatSettings;
FEnter : TTextFormatSettings;
FLeave : TTextFormatSettings;
FConditional : TTextFormatSettings;
FAction : TTextFormatSettings;
FOnChanged : Event<TNotifyEvent>;
function GetOnChanged: IEvent<TNotifyEvent>;
procedure FormatSettingsChanged(Sender: TObject);
protected
procedure Changed;
procedure InitializeObjects;
public
procedure AfterConstruction; override;
destructor Destroy; override;
property Action: TTextFormatSettings
read FAction;
property TimeStamp: TTextFormatSettings
read FTimeStamp;
property ValueName: TTextFormatSettings
read FValueName;
property ValueType: TTextFormatSettings
read FValueType;
property Value: TTextFormatSettings
read FValue;
property Id: TTextFormatSettings
read FId;
property Warning: TTextFormatSettings
read FWarning;
property Info: TTextFormatSettings
read FInfo;
property Error: TTextFormatSettings
read FError;
property CheckPoint: TTextFormatSettings
read FCheckPoint;
property Counter: TTextFormatSettings
read FCounter;
property Tracing: TTextFormatSettings
read FTracing;
property Enter: TTextFormatSettings
read FEnter;
property Leave: TTextFormatSettings
read FLeave;
property Conditional: TTextFormatSettings
read FConditional;
property OnChanged: IEvent<TNotifyEvent>
read GetOnChanged;
end;
implementation
{$REGION 'construction and destruction'}
procedure TDisplayValuesSettings.AfterConstruction;
begin
inherited AfterConstruction;
InitializeObjects;
end;
destructor TDisplayValuesSettings.Destroy;
begin
FTimeStamp.Free;
FValueName.Free;
FValueType.Free;
FValue.Free;
FId.Free;
FInfo.Free;
FWarning.Free;
FError.Free;
FCheckPoint.Free;
FCounter.Free;
FTracing.Free;
FConditional.Free;
FAction.Free;
FEnter.Free;
FLeave.Free;
inherited Destroy;
end;
{$ENDREGION}
{$REGION 'property access methods'}
function TDisplayValuesSettings.GetOnChanged: IEvent<TNotifyEvent>;
begin
Result := FOnChanged;
end;
{$ENDREGION}
{$REGION 'event dispatch methods'}
procedure TDisplayValuesSettings.Changed;
begin
FOnChanged.Invoke(Self);
end;
{$ENDREGION}
{$REGION 'event handlers'}
procedure TDisplayValuesSettings.FormatSettingsChanged(Sender: TObject);
begin
Changed;
end;
{$ENDREGION}
{$REGION 'protected methods'}
procedure TDisplayValuesSettings.InitializeObjects;
begin
FTimeStamp := TTextFormatSettings.Create;
FTimeStamp.Name := 'TimeStamp';
FTimeStamp.Font.Color := clBlue;
FTimeStamp.OnChanged.Add(FormatSettingsChanged);
FValueName := TTextFormatSettings.Create;
FValueName.Name := 'ValueName';
FValueName.Font.Color := clMaroon;
FValueName.Font.Style := [fsUnderline];
FValueName.OnChanged.Add(FormatSettingsChanged);
FValueType := TTextFormatSettings.Create;
FValueType.Name := 'ValueType';
FValueType.Font.Color := clNavy;
FValueType.OnChanged.Add(FormatSettingsChanged);
FValue := TTextFormatSettings.Create;
FValue.Name := 'Value';
FValue.Font.Color := clBlack;
FValue.OnChanged.Add(FormatSettingsChanged);
FId := TTextFormatSettings.Create;
FId.Name := 'Id';
FId.Font.Color := clGray;
FId.OnChanged.Add(FormatSettingsChanged);
FInfo := TTextFormatSettings.Create;
FInfo.Name := 'Info';
FInfo.Font.Color := clBlue;
FInfo.Font.Style := [fsBold];
FInfo.OnChanged.Add(FormatSettingsChanged);
FWarning := TTextFormatSettings.Create;
FWarning.Font.Color := clWebOrange;
FWarning.Font.Style := [fsBold];
FWarning.Name := 'Warning';
FWarning.OnChanged.Add(FormatSettingsChanged);
FError := TTextFormatSettings.Create;
FError.Name := 'Error';
FError.Font.Color := clRed;
FError.Font.Style := [fsBold];
FError.OnChanged.Add(FormatSettingsChanged);
FConditional := TTextFormatSettings.Create;
FConditional.Font.Color := clTeal;
FConditional.Name := 'Conditional';
FConditional.OnChanged.Add(FormatSettingsChanged);
FCheckPoint := TTextFormatSettings.Create;
FCheckPoint.Name := 'CheckPoint';
FCheckPoint.Font.Color := clGreen;
FCheckPoint.OnChanged.Add(FormatSettingsChanged);
FCounter := TTextFormatSettings.Create;
FCounter.Name := 'Counter';
FCounter.Font.Color := clPurple;
FCounter.OnChanged.Add(FormatSettingsChanged);
FAction := TTextFormatSettings.Create;
FAction.Name := 'Action';
FAction.Font.Color := clMaroon;
FAction.OnChanged.Add(FormatSettingsChanged);
// used when collapsed
FTracing := TTextFormatSettings.Create;
FTracing.Name := 'Tracing';
FTracing.BackgroundColor := clSilver;
FTracing.OnChanged.Add(FormatSettingsChanged);
// used when expanded
FEnter := TTextFormatSettings.Create;
FEnter.Font.Color := clGreen;
FEnter.BackgroundColor := clSilver;
FEnter.Name := 'Enter';
FEnter.OnChanged.Add(FormatSettingsChanged);
// used when expanded
FLeave := TTextFormatSettings.Create;
FLeave.Name := 'Leave';
FLeave.Font.Color := clRed;
FLeave.BackgroundColor := clSilver;
FLeave.OnChanged.Add(FormatSettingsChanged);
end;
{$ENDREGION}
end.