OSDN Git Service

スレッドの最後に関連キーワードのリンクを加えるオプションを追加
[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     HTMLGroupBox: TGroupBox;
72     AddKeywordCheckBox: TCheckBox;
73         procedure OkBottonClick(Sender: TObject);
74         procedure FormCreate(Sender: TObject);
75         procedure CDeleteButtonClick(Sender: TObject);
76         procedure CAddButtonClick(Sender: TObject);
77         procedure BAddButtonClick(Sender: TObject);
78         procedure BDeleteButtonClick(Sender: TObject);
79     procedure CUpButtonClick(Sender: TObject);
80     procedure CDownButtonClick(Sender: TObject);
81     procedure BUpButtonClick(Sender: TObject);
82     procedure BDownButtonClick(Sender: TObject);
83     procedure MoveHistoryMaxEditExit(Sender: TObject);
84     procedure AHandredLabeledEditExit(Sender: TObject);
85   private
86         { Private \90é\8c¾ }
87         procedure SetValue;
88         procedure SaveSetting;
89         procedure RecvBufferSizeExit(Sender: TObject);
90         procedure PostTimeEditExit(Sender: TObject);
91         procedure PostTimeCheckBoxClick(Sender: TObject);
92         procedure SetColumnData();
93         procedure PostColumnData();
94   public
95         { Public \90é\8c¾ }
96   end;
97
98 var
99   KuroutOption: TKuroutOption;
100
101 implementation
102
103 uses
104         Giko, Setting;
105
106 {$R *.dfm}
107
108 procedure TKuroutOption.SetValue;
109 begin
110         //\8eó\90M\83o\83b\83t\83@\83T\83C\83Y
111         RecvBufferSize.Text := IntToStr(Gikosys.Setting.RecvBufferSize);
112         //HTTP1.1\8eg\97p
113         ProtocolCheckBox.Checked := GikoSys.Setting.Protocol;
114         //\83v\83\8d\83L\83V\90Ú\91±HTTP1.1\8eg\97p
115         ProxyProtocolCheckBox.Checked := Gikosys.Setting.ProxyProtocol;
116         ReadTimeOut.Text := IntToStr(GikoSys.Setting.ReadTimeOut);
117
118                 //\8f\91\82«\8d\9e\82Ý\8e\9e\83}\83V\83\93\8e\9e\8aÔ\8eg\97p\90Ý\92è
119         PostTimeCheckBox.Checked := GikoSys.Setting.UseMachineTime;
120         PostTimeEdit.Text := IntToStr(GikoSys.Setting.TimeAdjustSec);
121         if GikoSys.Setting.TimeAdjust then
122                 PutPostTimeRadioButton.Checked := True
123         else
124                 BackPostTimeRadioButton.Checked := True;
125
126         SetColumnData();
127
128         PageControl1.ActivePageIndex := GikoSys.Setting.KuroutSettingTabIndex;
129
130         //2chAnnai
131         GengoSupport.Checked := GikoSys.Setting.GengoSupport;
132         //FusianaSet
133         LocalTrapAtt.Checked := GikoSys.Setting.LocalTrapAtt;
134         RemoteTrapAtt.Checked := GikoSys.Setting.RemoteTrapAtt;
135         // Cookie
136     FixedCookieEdit.Text := GikoSys.Setting.FixedCookie;
137     // \83\8a\83\93\83N\88Ú\93®\97\9a\97ð
138     MoveHistoryMaxEdit.Text := IntToStr( GikoSys.Setting.MoveHistorySize );
139     //\81@\90æ\93ª\95\\8e¦\83\8c\83X\90\94
140     AHandredLabeledEdit.Text := IntToStr( GikoSys.Setting.HeadResCount );
141     // \8aÖ\98A\83L\81[\83\8f\81[\83h\92Ç\89Á\83t\83\89\83O
142     AddKeywordCheckBox.Checked := GikoSys.Setting.AddKeywordLink;
143 end;
144
145 procedure TKuroutOption.SaveSetting;
146 begin
147         //\8eó\90M\83o\83b\83t\83@\83T\83C\83Y
148         Gikosys.Setting.RecvBufferSize := StrToIntDef(RecvBufferSize.Text, Gikosys.Setting.RecvBufferSize);
149         GikoSys.Setting.ReadTimeOut := StrToIntDef(ReadTimeOut.Text, GikoSys.Setting.ReadTimeOut);
150         //HTTP1.1\8eg\97p
151         GikoSys.Setting.Protocol := ProtocolCheckBox.Checked;
152         //\83v\83\8d\83L\83V\90Ú\91±HTTP1.1\8eg\97p
153         Gikosys.Setting.ProxyProtocol := ProxyProtocolCheckBox.Checked;
154         //\8f\91\82«\8d\9e\82Ý\8e\9e\83}\83V\83\93\8e\9e\8aÔ\8eg\97p\90Ý\92è
155         GikoSys.Setting.UseMachineTime := PostTimeCheckBox.Checked;
156         if GikoSys.IsNumeric(PostTimeEdit.Text) then
157                 GikoSys.Setting.TimeAdjustSec := StrToIntDef(PostTimeEdit.Text, GikoSys.Setting.TimeAdjustSec)
158         else
159                 GikoSys.Setting.TimeAdjustSec := 0;
160         GikoSys.Setting.TimeAdjust := PutPostTimeRadioButton.Checked;
161         //2ch\8c¾\8cê\83T\83|\81[\83g
162         GikoSys.Setting.GengoSupport := GengoSupport.Checked;
163         GikoSys.SetGikoMessage;
164         //\83\8d\81[\83J\83\8b\81E\83\8a\83\82\81[\83g̼±Å\8cx\8d\90
165         GikoSys.Setting.LocalTrapAtt := LocalTrapAtt.Checked;
166         GikoSys.Setting.RemoteTrapAtt := RemoteTrapAtt.Checked;
167         // Cookie
168         GikoSys.Setting.FixedCookie := FixedCookieEdit.Text;
169
170     // \83\8a\83\93\83N\88Ú\93®\97\9a\97ð
171     GikoSys.Setting.MoveHistorySize :=
172         StrToIntDef( MoveHistoryMaxEdit.Text, 20 );
173
174     //\81@\90æ\93ª\95\\8e¦\83\8c\83X\90\94
175     GikoSys.Setting.HeadResCount :=
176         StrToIntDef( AHandredLabeledEdit.Text , 1);
177
178         GikoSys.Setting.KuroutSettingTabIndex := PageControl1.ActivePageIndex;
179     // \8aÖ\98A\83L\81[\83\8f\81[\83h\92Ç\89Á\83t\83\89\83O
180     GikoSys.Setting.AddKeywordLink := AddKeywordCheckBox.Checked;
181
182 end;
183
184 procedure TKuroutOption.RecvBufferSizeExit(Sender: TObject);
185 begin
186         if not GikoSys.IsNumeric(RecvBufferSize.Text) then
187                 RecvBufferSize.Text := '4096';
188         if StrToInt(RecvBufferSize.Text) < 256 then
189                 RecvBufferSize.Text := '4096';
190 end;
191
192 procedure TKuroutOption.PostTimeEditExit(Sender: TObject);
193 begin
194         if not GikoSys.IsNumeric(PostTimeEdit.Text) then
195                 PostTimeEdit.Text := '0';
196 end;
197
198 procedure TKuroutOption.PostTimeCheckBoxClick(Sender: TObject);
199 begin
200         PostTimeLabel.Enabled := PostTimeCheckBox.Checked;
201         PostTimeEdit.Enabled := PostTimeCheckBox.Checked;
202         PutPostTimeRadioButton.Enabled := PostTimeCheckBox.Checked;
203         BackPostTimeRadioButton.Enabled := PostTimeCheckBox.Checked;
204 end;
205
206 procedure TKuroutOption.OkBottonClick(Sender: TObject);
207 begin
208         RecvBufferSizeExit(Sender);
209         PostTimeEditExit(Sender);
210     MoveHistoryMaxEditExit(Sender);
211     AHandredLabeledEditExit(Sender);
212     PostColumnData();
213         SaveSetting;
214 end;
215
216 procedure TKuroutOption.FormCreate(Sender: TObject);
217 begin
218         SetValue;
219         PostTimeCheckBoxClick(Sender);
220
221 end;
222 procedure TKuroutOption.SetColumnData();
223 var
224         i, j : Integer;
225         flag : Boolean;
226 begin
227
228         //===== \94Â\83\8a\83X\83g =====
229         for i := 0 to GikoSys.Setting.CategoryColumnOrder.Count - 1 do begin
230                 for j := 1 to Length( GikoCategoryColumnCaption ) - 1 do begin
231                         if GikoSys.Setting.CategoryColumnOrder[ i ] = TGikoCategoryColumnID( j ) then begin
232                                 CVisibledListBox.AddItem(GikoCategoryColumnCaption[ j ], nil);
233                                 break;
234                         end;
235                 end;
236         end;
237
238         for i := 1 to Length( GikoCategoryColumnCaption ) - 1 do begin
239                 flag := false;
240                 for j := 0 to GikoSys.Setting.CategoryColumnOrder.Count - 1 do begin
241                         if GikoSys.Setting.CategoryColumnOrder[ j ] = TGikoCategoryColumnID( i ) then begin
242                                 flag := true;
243                                 break;
244                         end;
245                 end;
246                 if not flag then
247                         CUnVisibledListBox.AddItem(GikoCategoryColumnCaption[ i ], nil);
248         end;
249
250         //===== \83X\83\8c\83\8a\83X\83g =====
251         for i := 0 to GikoSys.Setting.BoardColumnOrder.Count - 1 do begin
252                 for j := 1 to Length( GikoBoardColumnCaption ) - 1 do begin
253                         if GikoSys.Setting.BoardColumnOrder[ i ] = TGikoBoardColumnID( j ) then begin
254                                 BVisibledListBox.AddItem(GikoBoardColumnCaption[ j ], nil);
255                                 Break;
256                         end;
257                 end;
258         end;
259
260         for i := 1 to Length( GikoBoardColumnCaption ) - 1 do begin
261                 flag := false;
262                 for j := GikoSys.Setting.BoardColumnOrder.Count - 1 downto 0 do begin
263                         if GikoSys.Setting.BoardColumnOrder[ j ] = TGikoBoardColumnID( i ) then begin
264                                 flag := true;
265                                 Break;
266                         end;
267                 end;
268                 if not flag then
269                         BUnVisibledListBox.AddItem(GikoBoardColumnCaption[ i ], nil);
270
271         end;
272 end;
273 procedure TKuroutOption.CDeleteButtonClick(Sender: TObject);
274 var
275         i: Integer;
276 begin
277         for i := 0 to CVisibledListBox.Count - 1 do begin
278                 if CVisibledListBox.Selected[i] then begin
279                         CUnVisibledListBox.AddItem(     CVisibledListBox.Items.Strings[ i ], nil);
280                         CVisibledListBox.DeleteSelected;
281                         break;
282                 end;
283         end;
284 end;
285
286 procedure TKuroutOption.CAddButtonClick(Sender: TObject);
287 var
288         i: Integer;
289 begin
290         for i := 0 to CUnVisibledListBox.Count - 1 do begin
291                 if CUnVisibledListBox.Selected[i] then begin
292                         CVisibledListBox.AddItem(       CUnVisibledListBox.Items.Strings[ i ], nil);
293                         CUnVisibledListBox.DeleteSelected;
294                         break;
295                 end;
296         end;
297 end;
298
299 procedure TKuroutOption.BAddButtonClick(Sender: TObject);
300 var
301         i: Integer;
302 begin
303         for i := 0 to BUnVisibledListBox.Count - 1 do begin
304                 if BUnVisibledListBox.Selected[i] then begin
305                         BVisibledListBox.AddItem(       BUnVisibledListBox.Items.Strings[ i ], nil);
306                         BUnVisibledListBox.DeleteSelected;
307                         break;
308                 end;
309         end;
310 end;
311
312 procedure TKuroutOption.BDeleteButtonClick(Sender: TObject);
313 var
314         i: Integer;
315 begin
316         for i := 0 to BVisibledListBox.Count - 1 do begin
317                 if BVisibledListBox.Selected[i] then begin
318                         BUnVisibledListBox.AddItem(     BVisibledListBox.Items.Strings[ i ], nil);
319                         BVisibledListBox.DeleteSelected;
320                         break;
321                 end;
322         end;
323 end;
324
325 procedure TKuroutOption.CUpButtonClick(Sender: TObject);
326 var
327         i: Integer;
328 begin
329         for i := 1 to CVisibledListBox.Count - 1 do begin
330                 if CVisibledListBox.Selected[i] then begin
331                         CVisibledListBox.Items.Exchange(i, i -1);
332                         break;
333                 end;
334         end;
335 end;
336
337 procedure TKuroutOption.CDownButtonClick(Sender: TObject);
338 var
339         i: Integer;
340 begin
341         for i := 0 to CVisibledListBox.Count - 2 do begin
342                 if CVisibledListBox.Selected[i] then begin
343                         CVisibledListBox.Items.Exchange(i, i + 1);
344                         break;
345                 end;
346         end;
347 end;
348
349 procedure TKuroutOption.BUpButtonClick(Sender: TObject);
350 var
351         i: Integer;
352 begin
353         for i := 1 to BVisibledListBox.Count - 1 do begin
354                 if BVisibledListBox.Selected[i] then begin
355                         BVisibledListBox.Items.Exchange(i, i -1);
356                         break;
357                 end;
358         end;
359 end;
360
361 procedure TKuroutOption.BDownButtonClick(Sender: TObject);
362 var
363         i: Integer;
364 begin
365         for i := 0 to BVisibledListBox.Count - 2 do begin
366                 if BVisibledListBox.Selected[i] then begin
367                         BVisibledListBox.Items.Exchange(i, i + 1);
368                         break;
369                 end;
370         end;
371 end;
372
373
374 procedure TKuroutOption.PostColumnData();
375 var
376         i, j : Integer;
377 begin
378         GikoForm.ActiveListColumnSave;
379
380         //===== \94Â\83\8a\83X\83g =====
381         for i := GikoSys.Setting.CategoryColumnOrder.Count -1 downto 1 do
382                 GikoSys.Setting.CategoryColumnOrder.Delete(i);
383
384         for i := 0 to CVisibledListBox.Count - 1 do begin
385                 for j := 1 to Length( GikoCategoryColumnCaption ) - 1 do begin
386                         if CVisibledListBox.Items.Strings[ i ] = GikoCategoryColumnCaption[ j ] then begin
387                                 GikoSys.Setting.CategoryColumnOrder.Add(  TGikoCategoryColumnID(j) );
388                                 break;
389                         end;
390                 end;
391         end;
392
393         //===== \83X\83\8c\83\8a\83X\83g =====
394         for i := GikoSys.Setting.BoardColumnOrder.Count - 1 downto 1 do
395                 GikoSys.Setting.BoardColumnOrder.Delete(i);
396
397         for i := 0 to BVisibledListBox.Count - 1 do begin
398                 for j := 1 to Length( GikoBoardColumnCaption ) - 1 do begin
399                         if BVisibledListBox.Items.Strings[ i ] = GikoBoardColumnCaption[ j ] then begin
400                                 GikoSys.Setting.BoardColumnOrder.Add( TGikoBoardColumnID(j) );
401                                 Break;
402                         end;
403                 end;
404         end;
405         //\83X\83\8c\88ê\97\97\82Ì\95`\89æ\82Ì\8dX\90V
406         GikoForm.SetActiveList(GikoForm.ActiveList);
407 end;
408 // \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
409 procedure TKuroutOption.MoveHistoryMaxEditExit(Sender: TObject);
410 begin
411         if not GikoSys.IsNumeric(MoveHistoryMaxEdit.Text) then
412                 MoveHistoryMaxEdit.Text := '20';
413     if StrToInt(MoveHistoryMaxEdit.Text) < 1 then
414         MoveHistoryMaxEdit.Text := '1';
415 end;
416 // \90æ\93ª\95\\8e¦\83\8c\83X\90\94\82Ì\95Ò\8fW\8cã\82Ì\90Ý\92è\95\8e\9a\97ñ\83`\83F\83b\83N
417 procedure TKuroutOption.AHandredLabeledEditExit(Sender: TObject);
418 begin
419         if not GikoSys.IsNumeric(AHandredLabeledEdit.Text) then
420                 AHandredLabeledEdit.Text := '1';
421     if StrToInt(AHandredLabeledEdit.Text) < 1 then
422         AHandredLabeledEdit.Text := '1';
423
424 end;
425
426 end.