-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUnit2.pas
196 lines (165 loc) · 5.05 KB
/
Unit2.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
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, AdvGlassButton;
type
TForm2 = class(TForm)
RadioGroup1: TRadioGroup;
RadioGroup2: TRadioGroup;
RadioGroup3: TRadioGroup;
RadioGroup4: TRadioGroup;
AdvGlassButton12: TAdvGlassButton;
AdvGlassButton1: TAdvGlassButton;
Label1: TLabel;
Shape2: TShape;
RadioGroup5: TRadioGroup;
Shape1: TShape;
RadioGroup6: TRadioGroup;
RadioGroup7: TRadioGroup;
RadioGroup8: TRadioGroup;
RadioGroup9: TRadioGroup;
RadioGroup10: TRadioGroup;
procedure AdvGlassButton1Click(Sender: TObject);
procedure AdvGlassButton12Click(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure RadioGroup7Click(Sender: TObject);
private
send_cmd:bool;
public
end;
var
Form2: TForm2;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm2.AdvGlassButton12Click(Sender: TObject);
begin
if (settings_type=7) or (settings_type=6) then begin
RadioGroup6.ItemIndex:=1;
end;
if (RadioGroup6.ItemIndex=0)then begin
if MessageDlg ('Íà äàííîì áëîêå âêëþ÷åíà ðåòðàíñëÿöèÿ êîìàíä nooLite! Îäíîâðåìåííàÿ ðàáîòà íåñêîëüêèõ áëîêîâ ñ ýòîé âêëþ÷¸ííîé ôóíêöèåé ìîæåò ïðèâåñòè ê ñáîÿì â ïåðåäà÷å êîìàíä. Âñåãäà èñïîëüçóéòå òîëüêî îäèí áëîê ñ âêëþ÷¸ííîé ðåòðàíñëÿöèåé. Õîòèòå ïðèìåíèòü íàñòðîéêè?',
mtCustom, [mbYes, mbNo], 0) = mrYes then
begin
settings_data := 0;
if RadioGroup1.ItemIndex = 0 then
settings_data := settings_data + (1 shl 0);
if RadioGroup2.ItemIndex = 1 then
settings_data := settings_data + (1 shl 1);
if RadioGroup3.ItemIndex = 1 then
settings_data := settings_data + (1 shl 2);
settings_data := settings_data + ((RadioGroup4.ItemIndex and 3) shl 3);
if RadioGroup5.ItemIndex = 0 then
settings_data := settings_data + (1 shl 5);
if RadioGroup6.ItemIndex = 0 then
settings_data := settings_data + (1 shl 6);
if (settings_type=9) then begin
settings_mask := 1023; // 0...9 áèò
if RadioGroup8.ItemIndex = 0 then
settings_data := settings_data + (1 shl 7);
settings_data := settings_data + ((RadioGroup9.ItemIndex and 3) shl 8);
end
else if (settings_type=5) then begin
settings_mask := 255; // 0...7 áèò
if RadioGroup8.ItemIndex = 0 then
settings_data := settings_data + (1 shl 7);
end
else if (settings_type=4) then begin
settings_mask := 255; // 0...7 áèò
if RadioGroup8.ItemIndex = 0 then
settings_data := settings_data + (1 shl 7);
end
else begin
settings_mask := 127; // 0...6 áèò
end;
send_cmd:=true;
Form2.Close;
send_new_settings(16);
end;
end
else begin
settings_data := 0;
if RadioGroup2.ItemIndex = 1 then
settings_data := settings_data + (1 shl 1);
if RadioGroup3.ItemIndex = 1 then
settings_data := settings_data + (1 shl 2);
if (settings_type=6) then begin
//sensor
if RadioGroup7.ItemIndex = 1 then
settings_data := settings_data + (1 shl 3)
else if RadioGroup7.ItemIndex = 2 then
settings_data := settings_data + (1 shl 1);
//mode
if RadioGroup10.ItemIndex = 1 then
settings_data := settings_data + (1 shl 0);
end
else begin //for other devices- last state in memory
if RadioGroup1.ItemIndex = 0 then
settings_data := settings_data + (1 shl 0);
settings_data := settings_data + ((RadioGroup4.ItemIndex and 3) shl 3);
end;
if RadioGroup5.ItemIndex = 0 then
settings_data := settings_data + (1 shl 5);
if RadioGroup6.ItemIndex = 0 then
settings_data := settings_data + (1 shl 6);
if (settings_type=9) then begin
settings_mask := 1023; // 0...9 áèò
if RadioGroup8.ItemIndex = 0 then
settings_data := settings_data + (1 shl 7);
settings_data := settings_data + ((RadioGroup9.ItemIndex and 3) shl 8);
end
else if (settings_type=5) then begin
settings_mask := 255; // 0...7 áèò
if RadioGroup8.ItemIndex = 0 then
settings_data := settings_data + (1 shl 7);
end
else if (settings_type=4) then begin
settings_mask := 255; // 0...7 áèò
if RadioGroup8.ItemIndex = 0 then
settings_data := settings_data + (1 shl 7);
end
else begin
settings_mask := 127; // 0...6 áèò
end;
send_cmd:=true;
Form2.Close;
send_new_settings(16);
end;
end;
procedure TForm2.AdvGlassButton1Click(Sender: TObject);
begin
send_cmd:=false;
Form2.Close;
end;
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if send_cmd=false then
Form1.AdvGlassButton12.Click;
end;
procedure TForm2.FormShow(Sender: TObject);
begin
send_cmd:=false;
end;
procedure TForm2.RadioGroup1Click(Sender: TObject);
begin
if RadioGroup1.ItemIndex = 0 then begin
RadioGroup5.Enabled := false;
RadioGroup5.ItemIndex:=1;
end
else
RadioGroup5.Enabled := true;
end;
procedure TForm2.RadioGroup7Click(Sender: TObject);
begin
if RadioGroup7.ItemIndex=2 then begin
RadioGroup3.Enabled:=false;
RadioGroup3.ItemIndex:=0;
end
else begin
RadioGroup3.Enabled:=true;
end;
end;
end.