forked from CyberShadow/ProSnooper
/
preferform.pas
342 lines (280 loc) · 9.47 KB
/
preferform.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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
(*
This program is licensed under the rndware License, which can be found in LICENSE.TXT
Copyright (c) Simon Hughes 2007-2008
*)
unit preferform;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, Registry, MPlayer;
type
TfrmSettings = class(TForm)
Button1: TButton;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
Bevel1: TBevel;
Label9: TLabel;
Label6: TLabel;
Label5: TLabel;
Label4: TLabel;
Label3: TLabel;
Label2: TLabel;
Label10: TLabel;
Label1: TLabel;
colText2: TColorBox;
colText1: TColorBox;
colQuits: TColorBox;
colPrivate: TColorBox;
colParts: TColorBox;
colJoins: TColorBox;
colBackground: TColorBox;
colActions: TColorBox;
Label7: TLabel;
edTimeStamp: TEdit;
cbTimeStamps: TCheckBox;
cbQuits: TCheckBox;
cbParts: TCheckBox;
cbJoins: TCheckBox;
Label8: TLabel;
Bevel2: TBevel;
Bevel3: TBevel;
Label11: TLabel;
TabSheet3: TTabSheet;
Label12: TLabel;
Bevel4: TBevel;
edsndBuddy: TEdit;
Button2: TButton;
Label13: TLabel;
Bevel5: TBevel;
edsndHiLite: TEdit;
Button3: TButton;
Label14: TLabel;
Bevel6: TBevel;
edsndMsg: TEdit;
Button4: TButton;
OpenDialog1: TOpenDialog;
Button5: TButton;
Button6: TButton;
Button7: TButton;
mp: TMediaPlayer;
TabSheet4: TTabSheet;
Label15: TLabel;
Bevel7: TBevel;
cbHostGameAnn: TCheckBox;
cbHostGameAway: TCheckBox;
Label17: TLabel;
edHostGameAway: TEdit;
cbGetIP: TCheckBox;
TabSheet5: TTabSheet;
Label21: TLabel;
Bevel9: TBevel;
cbAwayAnnounce: TCheckBox;
cbResumeAnnounce: TCheckBox;
cbSendAwayPriv: TCheckBox;
cbSendAwayHiLite: TCheckBox;
Label16: TLabel;
Bevel10: TBevel;
Label19: TLabel;
cbJoinGameAway: TCheckBox;
edJoinGameAway: TEdit;
Label20: TLabel;
Label18: TLabel;
Bevel8: TBevel;
edFntSize: TComboBox;
TabSheet6: TTabSheet;
lbBuddies: TListBox;
Button8: TButton;
Button9: TButton;
cbBlink: TCheckBox;
Button10: TButton;
Label22: TLabel;
edExe: TEdit;
Button11: TButton;
Bevel11: TBevel;
OpenDialog2: TOpenDialog;
cbDisableScroll: TCheckBox;
procedure SetColors;
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure mpNotify(Sender: TObject);
procedure Button11Click(Sender: TObject);
private
{ Private declarations }
public
procedure PlaySound(Path: String);
end;
var
frmSettings: TfrmSettings;
implementation
uses mainform, gamedock, nickdock, loginform;
{$R *.dfm}
procedure TfrmSettings.SetColors;
begin
mainform.gmfrm.lvGames.Color := colBackground.Selected;
mainform.gmfrm.lvGames.Font.Color := coltext2.Selected;
frmMain.rechat.Color := colBackground.Selected;
frmMain.rechat.Font.Color := colText2.Selected;
frmMain.Memo1.Color := colBackground.Selected;
frmMain.Memo1.Font.Color := coltext2.Selected;
mainform.nickfrm.lvnicks.Color := colBackground.Selected;
mainform.nickfrm.lvnicks.Font.Color := coltext2.Selected;
end;
procedure TfrmSettings.Button1Click(Sender: TObject);
begin
//save settings
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','colBackground',
rdInteger, colBackground.Selected);
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','colText1',
rdInteger, colText1.Selected);
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','colText2',
rdInteger, colText2.Selected);
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','colPrivate',
rdInteger, colprivate.Selected);
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','colActions',
rdInteger, colactions.Selected);
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','colJoins',
rdInteger, coljoins.Selected);
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','colParts',
rdInteger, colparts.Selected);
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','colQuits',
rdInteger, colquits.Selected);
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','EnableTimestamps',
rdString, BoolToStr(cbTimestamps.Checked));
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','TimeStampFormat',
rdString, edTimeStamp.Text);
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','ShowJoins',
rdString, BoolToStr(cbJoins.Checked));
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','ShowParts',
rdString, BoolToStr(cbParts.Checked));
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','ShowQuits',
rdString, BoolToStr(cbQuits.Checked));
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','BuddySound',
rdString, edsndBuddy.Text);
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','HiLiteSound',
rdString, edsndhilite.Text);
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','MsgSound',
rdString, edsndmsg.Text);
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','HostAwayText',
rdString, edHostGameAway.Text);
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','JoinAwayText',
rdString, edJoinGameAway.Text);
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','HostGameAnn',
rdString, BoolToStr(cbHostGameAnn.Checked));
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','HostGameAway',
rdString, BoolToStr(cbHostGameAway.Checked));
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','GetIP',
rdString, BoolToStr(cbGetIP.Checked));
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','JoinGameAway',
rdString, BoolToStr(cbJoinGameAway.Checked));
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','AwayAnnounce',
rdString, BoolToStr(cbAwayAnnounce.Checked));
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','ResumeAnnounce',
rdString, BoolToStr(cbResumeAnnounce.Checked));
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','SendAwayPriv',
rdString, BoolToStr(cbSendAwayPriv.Checked));
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','SendAwayHiLite',
rdString, BoolToStr(cbSendAwayHiLite.Checked));
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','FntSize',
rdString, edFntSize.Text);
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','Buddies',
rdString,lbBuddies.Items.CommaText);
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','Blink',
rdString, BoolToStr(cbBlink.Checked));
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','Waexe',
rdString, edExe.Text);
frmLogin.SetRegistryData(HKEY_CURRENT_USER,'\Software\ProSnooper','DisableScroll',
rdString, BoolToStr(cbDisableScroll.Checked));
SetColors;
Close;
end;
procedure TfrmSettings.FormShow(Sender: TObject);
begin
PageControl1.TabIndex := 0;
end;
procedure TfrmSettings.Button5Click(Sender: TObject);
begin
if OpenDialog1.Execute then
edsndBuddy.Text := OpenDialog1.FileName;
end;
procedure TfrmSettings.Button3Click(Sender: TObject);
begin
if OpenDialog1.Execute then
edsndHiLite.Text := OpenDialog1.FileName;
end;
procedure TfrmSettings.Button4Click(Sender: TObject);
begin
if OpenDialog1.Execute then
edsndMsg.Text := OpenDialog1.FileName;
end;
procedure TfrmSettings.Button2Click(Sender: TObject);
begin
Button10.Show;
if edsndBuddy.Text <> '' then begin
mp.Close;
mp.FileName := edsndBuddy.Text;
mp.Open;
mp.Play;
end;
end;
procedure TfrmSettings.Button6Click(Sender: TObject);
begin
Button10.Show;
if edsndHiLite.Text <> '' then begin
mp.Close;
mp.FileName := edsndHiLite.Text;
mp.Open;
mp.Play;
end;
end;
procedure TfrmSettings.Button7Click(Sender: TObject);
begin
Button10.Show;
if edsndMsg.Text <> '' then begin
mp.Close;
mp.FileName := edsndMsg.Text;
mp.Open;
mp.Play;
end;
end;
procedure TfrmSettings.Button9Click(Sender: TObject);
var
S: String;
begin
if InputQuery('Add a buddy','Enter the nickname your buddy uses.',S) then
lbBuddies.Items.Add(S);
end;
procedure TfrmSettings.Button8Click(Sender: TObject);
begin
if lbBuddies.ItemIndex <> -1 then
lbBuddies.Items.Delete(lbBuddies.ItemIndex);
end;
procedure TfrmSettings.Button10Click(Sender: TObject);
begin
mp.Stop;
Button10.Hide;
end;
procedure TfrmSettings.mpNotify(Sender: TObject);
begin
if mp.Mode <> mpPlaying then
Button10.Hide;
mp.Notify := True;
end;
procedure TfrmSettings.PlaySound(Path: String);
begin
end;
procedure TfrmSettings.Button11Click(Sender: TObject);
begin
if OpenDialog2.Execute then
edExe.Text := OpenDialog2.FileName;
end;
end.