OSDN Git Service

This commit was manufactured by cvs2svn to create branch 'Bb54'.
[gikonavigoeson/gikonavi.git] / KuroutSetting.pas
1 unit KuroutSetting;
2
3 interface
4
5 uses
6   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7   Dialogs, StdCtrls, ComCtrls, GikoSystem, GikoUtil, ExtCtrls;
8
9 type
10   TKuroutOption = class(TForm)
11         PageControl1: TPageControl;
12         TabSheet1: TTabSheet;
13         GroupBox11: TGroupBox;
14         Label17: TLabel;
15         Label18: TLabel;
16         RecvBufferSize: TEdit;
17         ProxyProtocolCheckBox: TCheckBox;
18         ProtocolCheckBox: TCheckBox;
19         GroupBox13: TGroupBox;
20         Label24: TLabel;
21         Label25: TLabel;
22         PostTimeLabel: TLabel;
23         Label27: TLabel;
24         PostTimeCheckBox: TCheckBox;
25         PostTimeEdit: TEdit;
26         PutPostTimeRadioButton: TRadioButton;
27         BackPostTimeRadioButton: TRadioButton;
28         OkBotton: TButton;
29         CancelBotton: TButton;
30         ApplyButton: TButton;
31         ColumnTabSheet: TTabSheet;
32         CategoryColumnGroupBox: TGroupBox;
33         CUnVisibledListBox: TListBox;
34         CVisibledListBox: TListBox;
35         CAddButton: TButton;
36         CDeleteButton: TButton;
37         BoardColumnGroupBox: TGroupBox;
38         BUnVisibledListBox: TListBox;
39         BVisibledListBox: TListBox;
40         BAddButton: TButton;
41         BDeleteButton: TButton;
42         Label1: TLabel;
43         Label2: TLabel;
44         Label3: TLabel;
45         Label4: TLabel;
46         CUpButton: TButton;
47         CDownButton: TButton;
48         BUpButton: TButton;
49         BDownButton: TButton;
50     GroupBox1: TGroupBox;
51     GengoSupport: TCheckBox;
52     Label5: TLabel;
53     GroupBox2: TGroupBox;
54     LocalTrapAtt: TCheckBox;
55     RemoteTrapAtt: TCheckBox;
56     Label6: TLabel;
57     ReadTimeOut: TEdit;
58     Label7: TLabel;
59     KakikomiTabSheet: TTabSheet;
60     CookieGroupBox: TGroupBox;
61     Label8: TLabel;
62     FixedCookieEdit: TEdit;
63     Label9: TLabel;
64     GroupBox3: TGroupBox;
65     Label10: TLabel;
66     MoveHistoryMaxEdit: TEdit;
67     Label11: TLabel;
68     AHandredGroupBox: TGroupBox;
69     AHandredLabeledEdit: TLabeledEdit;
70     UpDown1: TUpDown;
71         procedure OkBottonClick(Sender: TObject);
72         procedure FormCreate(Sender: TObject);
73         procedure CDeleteButtonClick(Sender: TObject);
74         procedure CAddButtonClick(Sender: TObject);
75         procedure BAddButtonClick(Sender: TObject);
76         procedure BDeleteButtonClick(Sender: TObject);
77     procedure CUpButtonClick(Sender: TObject);
78     procedure CDownButtonClick(Sender: TObject);
79     procedure BUpButtonClick(Sender: TObject);
80     procedure BDownButtonClick(Sender: TObject);
81     procedure MoveHistoryMaxEditExit(Sender: TObject);
82     procedure AHandredLabeledEditExit(Sender: TObject);
83   private
84         { Private \90é\8c¾ }
85         procedure SetValue;
86         procedure SaveSetting;
87         procedure RecvBufferSizeExit(Sender: TObject);
88         procedure PostTimeEditExit(Sender: TObject);
89         procedure PostTimeCheckBoxClick(Sender: TObject);
90         procedure SetColumnData();
91         procedure PostColumnData();
92   public
93         { Public \90é\8c¾ }
94   end;
95
96 var
97   KuroutOption: TKuroutOption;
98
99 implementation
100
101 uses
102         Giko, Setting;
103
104 {$R *.dfm}
105
106 procedure TKuroutOption.SetValue;
107 begin
108         //\8eó\90M\83o\83b\83t\83@\83T\83C\83Y
109         RecvBufferSize.Text := IntToStr(Gikosys.Setting.RecvBufferSize);
110         //HTTP1.1\8eg\97p
111         ProtocolCheckBox.Checked := GikoSys.Setting.Protocol;
112         //\83v\83\8d\83L\83V\90Ú\91±HTTP1.1\8eg\97p
113         ProxyProtocolCheckBox.Checked := Gikosys.Setting.ProxyProtocol;
114         ReadTimeOut.Text := IntToStr(GikoSys.Setting.ReadTimeOut);
115
116                 //\8f\91\82«\8d\9e\82Ý\8e\9e\83}\83V\83\93\8e\9e\8aÔ\8eg\97p\90Ý\92è
117         PostTimeCheckBox.Checked := GikoSys.Setting.UseMachineTime;
118         PostTimeEdit.Text := IntToStr(GikoSys.Setting.TimeAdjustSec);
119         if GikoSys.Setting.TimeAdjust then
120                 PutPostTimeRadioButton.Checked := True
121         else
122                 BackPostTimeRadioButton.Checked := True;
123
124         SetColumnData();
125
126         PageControl1.ActivePageIndex := GikoSys.Setting.KuroutSettingTabIndex;
127
128         //2chAnnai
129         GengoSupport.Checked := GikoSys.Setting.GengoSupport;
130         //FusianaSet
131         LocalTrapAtt.Checked := GikoSys.Setting.LocalTrapAtt;
132         RemoteTrapAtt.Checked := GikoSys.Setting.RemoteTrapAtt;
133         // Cookie
134     FixedCookieEdit.Text := GikoSys.Setting.FixedCookie;
135     // \83\8a\83\93\83N\88Ú\93®\97\9a\97ð
136     MoveHistoryMaxEdit.Text := IntToStr( GikoSys.Setting.MoveHistorySize );
137     //\81@\90æ\93ª\95\\8e¦\83\8c\83X\90\94
138     AHandredLabeledEdit.Text := IntToStr( GikoSys.Setting.HeadResCount );
139 end;
140
141 procedure TKuroutOption.SaveSetting;
142 begin
143         //\8eó\90M\83o\83b\83t\83@\83T\83C\83Y
144         Gikosys.Setting.RecvBufferSize := StrToIntDef(RecvBufferSize.Text, Gikosys.Setting.RecvBufferSize);
145         GikoSys.Setting.ReadTimeOut := StrToIntDef(ReadTimeOut.Text, GikoSys.Setting.ReadTimeOut);
146         //HTTP1.1\8eg\97p
147         GikoSys.Setting.Protocol := ProtocolCheckBox.Checked;
148         //\83v\83\8d\83L\83V\90Ú\91±HTTP1.1\8eg\97p
149         Gikosys.Setting.ProxyProtocol := ProxyProtocolCheckBox.Checked;
150         //\8f\91\82«\8d\9e\82Ý\8e\9e\83}\83V\83\93\8e\9e\8aÔ\8eg\97p\90Ý\92è
151         GikoSys.Setting.UseMachineTime := PostTimeCheckBox.Checked;
152         if GikoSys.IsNumeric(PostTimeEdit.Text) then
153                 GikoSys.Setting.TimeAdjustSec := StrToIntDef(PostTimeEdit.Text, GikoSys.Setting.TimeAdjustSec)
154         else
155                 GikoSys.Setting.TimeAdjustSec := 0;
156         GikoSys.Setting.TimeAdjust := PutPostTimeRadioButton.Checked;
157         //2ch\8c¾\8cê\83T\83|\81[\83g
158         GikoSys.Setting.GengoSupport := GengoSupport.Checked;
159         GikoSys.SetGikoMessage;
160         //\83\8d\81[\83J\83\8b\81E\83\8a\83\82\81[\83g̼±Å\8cx\8d\90
161         GikoSys.Setting.LocalTrapAtt := LocalTrapAtt.Checked;
162         GikoSys.Setting.RemoteTrapAtt := RemoteTrapAtt.Checked;
163         // Cookie
164         GikoSys.Setting.FixedCookie := FixedCookieEdit.Text;
165
166     // \83\8a\83\93\83N\88Ú\93®\97\9a\97ð
167     GikoSys.Setting.MoveHistorySize :=
168         StrToIntDef( MoveHistoryMaxEdit.Text, 20 );
169
170     //\81@\90æ\93ª\95\\8e¦\83\8c\83X\90\94
171     GikoSys.Setting.HeadResCount :=
172         StrToIntDef( AHandredLabeledEdit.Text , 1);
173
174         GikoSys.Setting.KuroutSettingTabIndex := PageControl1.ActivePageIndex;
175 end;
176
177 procedure TKuroutOption.RecvBufferSizeExit(Sender: TObject);
178 begin
179         if not GikoSys.IsNumeric(RecvBufferSize.Text) then
180                 RecvBufferSize.Text := '4096';
181         if StrToInt(RecvBufferSize.Text) < 256 then
182                 RecvBufferSize.Text := '4096';
183 end;
184
185 procedure TKuroutOption.PostTimeEditExit(Sender: TObject);
186 begin
187         if not GikoSys.IsNumeric(PostTimeEdit.Text) then
188                 PostTimeEdit.Text := '0';
189 end;
190
191 procedure TKuroutOption.PostTimeCheckBoxClick(Sender: TObject);
192 begin
193         PostTimeLabel.Enabled := PostTimeCheckBox.Checked;
194         PostTimeEdit.Enabled := PostTimeCheckBox.Checked;
195         PutPostTimeRadioButton.Enabled := PostTimeCheckBox.Checked;
196         BackPostTimeRadioButton.Enabled := PostTimeCheckBox.Checked;
197 end;
198
199 procedure TKuroutOption.OkBottonClick(Sender: TObject);
200 begin
201         RecvBufferSizeExit(Sender);
202         PostTimeEditExit(Sender);
203     MoveHistoryMaxEditExit(Sender);
204     AHandredLabeledEditExit(Sender);
205     PostColumnData();
206         SaveSetting;
207 end;
208
209 procedure TKuroutOption.FormCreate(Sender: TObject);
210 begin
211         SetValue;
212         PostTimeCheckBoxClick(Sender);
213
214 end;
215 procedure TKuroutOption.SetColumnData();
216 var
217         i, j : Integer;
218         flag : Boolean;
219 begin
220
221         //===== \94Â\83\8a\83X\83g =====
222         for i := 0 to GikoSys.Setting.CategoryColumnOrder.Count - 1 do begin
223                 for j := 1 to Length( GikoCategoryColumnCaption ) - 1 do begin
224                         if GikoSys.Setting.CategoryColumnOrder[ i ] = TGikoCategoryColumnID( j ) then begin
225                                 CVisibledListBox.AddItem(GikoCategoryColumnCaption[ j ], nil);
226                                 break;
227                         end;
228                 end;
229         end;
230
231         for i := 1 to Length( GikoCategoryColumnCaption ) - 1 do begin
232                 flag := false;
233                 for j := 0 to GikoSys.Setting.CategoryColumnOrder.Count - 1 do begin
234                         if GikoSys.Setting.CategoryColumnOrder[ j ] = TGikoCategoryColumnID( i ) then begin
235                                 flag := true;
236                                 break;
237                         end;
238                 end;
239                 if not flag then
240                         CUnVisibledListBox.AddItem(GikoCategoryColumnCaption[ i ], nil);
241         end;
242
243         //===== \83X\83\8c\83\8a\83X\83g =====
244         for i := 0 to GikoSys.Setting.BoardColumnOrder.Count - 1 do begin
245                 for j := 1 to Length( GikoBoardColumnCaption ) - 1 do begin
246                         if GikoSys.Setting.BoardColumnOrder[ i ] = TGikoBoardColumnID( j ) then begin
247                                 BVisibledListBox.AddItem(GikoBoardColumnCaption[ j ], nil);
248                                 Break;
249                         end;
250                 end;
251         end;
252
253         for i := 1 to Length( GikoBoardColumnCaption ) - 1 do begin
254                 flag := false;
255                 for j := GikoSys.Setting.BoardColumnOrder.Count - 1 downto 0 do begin
256                         if GikoSys.Setting.BoardColumnOrder[ j ] = TGikoBoardColumnID( i ) then begin
257                                 flag := true;
258                                 Break;
259                         end;
260                 end;
261                 if not flag then
262                         BUnVisibledListBox.AddItem(GikoBoardColumnCaption[ i ], nil);
263
264         end;
265 end;
266 procedure TKuroutOption.CDeleteButtonClick(Sender: TObject);
267 var
268         i: Integer;
269 begin
270         for i := 0 to CVisibledListBox.Count - 1 do begin
271                 if CVisibledListBox.Selected[i] then begin
272                         CUnVisibledListBox.AddItem(     CVisibledListBox.Items.Strings[ i ], nil);
273                         CVisibledListBox.DeleteSelected;
274                         break;
275                 end;
276         end;
277 end;
278
279 procedure TKuroutOption.CAddButtonClick(Sender: TObject);
280 var
281         i: Integer;
282 begin
283         for i := 0 to CUnVisibledListBox.Count - 1 do begin
284                 if CUnVisibledListBox.Selected[i] then begin
285                         CVisibledListBox.AddItem(       CUnVisibledListBox.Items.Strings[ i ], nil);
286                         CUnVisibledListBox.DeleteSelected;
287                         break;
288                 end;
289         end;
290 end;
291
292 procedure TKuroutOption.BAddButtonClick(Sender: TObject);
293 var
294         i: Integer;
295 begin
296         for i := 0 to BUnVisibledListBox.Count - 1 do begin
297                 if BUnVisibledListBox.Selected[i] then begin
298                         BVisibledListBox.AddItem(       BUnVisibledListBox.Items.Strings[ i ], nil);
299                         BUnVisibledListBox.DeleteSelected;
300                         break;
301                 end;
302         end;
303 end;
304
305 procedure TKuroutOption.BDeleteButtonClick(Sender: TObject);
306 var
307         i: Integer;
308 begin
309         for i := 0 to BVisibledListBox.Count - 1 do begin
310                 if BVisibledListBox.Selected[i] then begin
311                         BUnVisibledListBox.AddItem(     BVisibledListBox.Items.Strings[ i ], nil);
312                         BVisibledListBox.DeleteSelected;
313                         break;
314                 end;
315         end;
316 end;
317
318 procedure TKuroutOption.CUpButtonClick(Sender: TObject);
319 var
320         i: Integer;
321 begin
322         for i := 1 to CVisibledListBox.Count - 1 do begin
323                 if CVisibledListBox.Selected[i] then begin
324                         CVisibledListBox.Items.Exchange(i, i -1);
325                         break;
326                 end;
327         end;
328 end;
329
330 procedure TKuroutOption.CDownButtonClick(Sender: TObject);
331 var
332         i: Integer;
333 begin
334         for i := 0 to CVisibledListBox.Count - 2 do begin
335                 if CVisibledListBox.Selected[i] then begin
336                         CVisibledListBox.Items.Exchange(i, i + 1);
337                         break;
338                 end;
339         end;
340 end;
341
342 procedure TKuroutOption.BUpButtonClick(Sender: TObject);
343 var
344         i: Integer;
345 begin
346         for i := 1 to BVisibledListBox.Count - 1 do begin
347                 if BVisibledListBox.Selected[i] then begin
348                         BVisibledListBox.Items.Exchange(i, i -1);
349                         break;
350                 end;
351         end;
352 end;
353
354 procedure TKuroutOption.BDownButtonClick(Sender: TObject);
355 var
356         i: Integer;
357 begin
358         for i := 0 to BVisibledListBox.Count - 2 do begin
359                 if BVisibledListBox.Selected[i] then begin
360                         BVisibledListBox.Items.Exchange(i, i + 1);
361                         break;
362                 end;
363         end;
364 end;
365
366
367 procedure TKuroutOption.PostColumnData();
368 var
369         i, j : Integer;
370 begin
371         GikoForm.ActiveListColumnSave;
372
373         //===== \94Â\83\8a\83X\83g =====
374         for i := GikoSys.Setting.CategoryColumnOrder.Count -1 downto 1 do
375                 GikoSys.Setting.CategoryColumnOrder.Delete(i);
376
377         for i := 0 to CVisibledListBox.Count - 1 do begin
378                 for j := 1 to Length( GikoCategoryColumnCaption ) - 1 do begin
379                         if CVisibledListBox.Items.Strings[ i ] = GikoCategoryColumnCaption[ j ] then begin
380                                 GikoSys.Setting.CategoryColumnOrder.Add(  TGikoCategoryColumnID(j) );
381                                 break;
382                         end;
383                 end;
384         end;
385
386         //===== \83X\83\8c\83\8a\83X\83g =====
387         for i := GikoSys.Setting.BoardColumnOrder.Count - 1 downto 1 do
388                 GikoSys.Setting.BoardColumnOrder.Delete(i);
389
390         for i := 0 to BVisibledListBox.Count - 1 do begin
391                 for j := 1 to Length( GikoBoardColumnCaption ) - 1 do begin
392                         if BVisibledListBox.Items.Strings[ i ] = GikoBoardColumnCaption[ j ] then begin
393                                 GikoSys.Setting.BoardColumnOrder.Add( TGikoBoardColumnID(j) );
394                                 Break;
395                         end;
396                 end;
397         end;
398         //\83X\83\8c\88ê\97\97\82Ì\95`\89æ\82Ì\8dX\90V
399         GikoForm.SetActiveList(GikoForm.ActiveList);
400 end;
401 // \83\8a\83\93\83N\88Ú\93®\97\9a\97ð\82Ì\95Ò\8fW\8cã\82Ì\90Ý\92è\95\8e\9a\97ñ\83`\83F\83b\83N
402 procedure TKuroutOption.MoveHistoryMaxEditExit(Sender: TObject);
403 begin
404         if not GikoSys.IsNumeric(MoveHistoryMaxEdit.Text) then
405                 MoveHistoryMaxEdit.Text := '20';
406     if StrToInt(MoveHistoryMaxEdit.Text) < 1 then
407         MoveHistoryMaxEdit.Text := '1';
408 end;
409 // \90æ\93ª\95\\8e¦\83\8c\83X\90\94\82Ì\95Ò\8fW\8cã\82Ì\90Ý\92è\95\8e\9a\97ñ\83`\83F\83b\83N
410 procedure TKuroutOption.AHandredLabeledEditExit(Sender: TObject);
411 begin
412         if not GikoSys.IsNumeric(AHandredLabeledEdit.Text) then
413                 AHandredLabeledEdit.Text := '1';
414     if StrToInt(AHandredLabeledEdit.Text) < 1 then
415         AHandredLabeledEdit.Text := '1';
416
417 end;
418
419 end.