-
Notifications
You must be signed in to change notification settings - Fork 0
/
castle_setup_sounds.pas
137 lines (122 loc) · 3.32 KB
/
castle_setup_sounds.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
unit castle_setup_sounds;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
castle_setup,
Dialogs,
StdCtrls,
ImgList,
Buttons;
type
TfrmCastle_setup_sounds = class(TFrameSetup)
Edit1: TEdit;
Label1: TLabel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
ImageList1: TImageList;
Edit2: TEdit;
Label2: TLabel;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
Edit3: TEdit;
Label3: TLabel;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
Label4: TLabel;
SpeedButton7: TSpeedButton;
SpeedButton8: TSpeedButton;
Label5: TLabel;
SpeedButton9: TSpeedButton;
SpeedButton10: TSpeedButton;
Label6: TLabel;
SpeedButton11: TSpeedButton;
SpeedButton12: TSpeedButton;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Label7: TLabel;
SpeedButton13: TSpeedButton;
SpeedButton14: TSpeedButton;
Label8: TLabel;
SpeedButton15: TSpeedButton;
SpeedButton16: TSpeedButton;
Edit7: TEdit;
Edit8: TEdit;
OpenDialog: TOpenDialog;
procedure FormCreate(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
procedure InitParams; override;
procedure SaveParams; override;
end;
implementation
uses castle_utils,
castle_interface;
{$R *.dfm}
procedure TfrmCastle_setup_sounds.InitParams;
begin
edit1.Text := Config.Value_Str['Sound_Message'];
edit2.Text := Config.Value_Str['Sound_Private'];
edit3.Text := Config.Value_Str['Sound_Mail'];
edit4.Text := Config.Value_Str['Sound_Online'];
edit5.Text := Config.Value_Str['Sound_Offline'];
edit6.Text := Config.Value_Str['Sound_Login'];
edit7.Text := Config.Value_Str['Sound_Admin'];
edit8.Text := Config.Value_Str['Sound_Problem'];
end;
procedure TfrmCastle_setup_sounds.SaveParams;
begin
Config.Value_Str['Sound_Message'] := edit1.Text;
Config.Value_Str['Sound_Private'] := edit2.Text;
Config.Value_Str['Sound_Mail'] := edit3.Text;
Config.Value_Str['Sound_Online'] := edit4.Text;
Config.Value_Str['Sound_Offline'] := edit5.Text;
Config.Value_Str['Sound_Login'] := edit6.Text;
Config.Value_Str['Sound_Admin'] := edit7.Text;
Config.Value_Str['Sound_Problem'] := edit8.Text;
end;
procedure TfrmCastle_setup_sounds.FormCreate(Sender: TObject);
var
i: Integer;
begin
for i := 0 to ComponentCount - 1 do
if Components[i] is TSpeedButton then
begin
case TSpeedButton(Components[i]).caption[1] of
't': ImageList1.GetBitmap(0, TSpeedButton(Components[i]).Glyph);
'p': ImageList1.GetBitmap(1, TSpeedButton(Components[i]).Glyph);
end;
TSpeedButton(Components[i]).caption := '';
end;
end;
procedure TfrmCastle_setup_sounds.SpeedButton2Click(Sender: TObject);
var
com: TComponent;
begin
com := FindComponent('Edit' + IntToStr(TSpeedButton(Sender).Tag));
if Assigned(com) then
PlayWav(TEdit(com).Text);
end;
procedure TfrmCastle_setup_sounds.SpeedButton1Click(Sender: TObject);
var
com: TComponent;
begin
com := FindComponent('Edit' + IntToStr(TSpeedButton(Sender).Tag));
if Assigned(com) then
begin
OpenDialog.FileName := TEdit(com).Text;
if OpenDialog.Execute then
TEdit(com).Text := OpenDialog.FileName;
end;
end;
end.