OSDN Git Service

Tab設定がロードされない問題を修正
[gikonavigoeson/gikonavi.git] / Option.pas
1 unit Option;
2
3 interface
4
5 uses
6         Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
7         ComCtrls, StdCtrls, ExtCtrls, Dialogs, FileCtrl, MMSystem,
8         GikoSystem, GikoUtil, Buttons, UrlMon, Menus, ImgList, OleCtrls,
9         SHDocVw_TLB, BoardGroup;
10
11 type
12         TOptionDialog = class(TForm)
13                 OkBotton: TButton;
14                 CancelBotton: TButton;
15                 OptionTab: TPageControl;
16                 ConnectSheet: TTabSheet;
17                 Font1Sheet: TTabSheet;
18                 ApplyButton: TButton;
19                 FontDialog: TFontDialog;
20                 ColorDialog: TColorDialog;
21                 ReadProxyGroupBox: TGroupBox;
22                 ReadAddressLabel: TLabel;
23                 ReadPortLabel: TLabel;
24                 ReadProxyCheck: TCheckBox;
25                 ReadProxyAddressEdit: TEdit;
26                 ReadPortEdit: TEdit;
27                 ReadProxyUserIDEdit: TEdit;
28                 ReadProxyPasswordEdit: TEdit;
29                 ReadUserIDLabel: TLabel;
30                 ReadPasswordLabel: TLabel;
31                 FolderSheet: TTabSheet;
32                 FolderGroupBox: TGroupBox;
33                 LogFolderEdit: TEdit;
34                 LogFolderButton: TButton;
35                 Label1: TLabel;
36                 Label2: TLabel;
37                 ThreadSheet: TTabSheet;
38                 SoundSheet: TTabSheet;
39                 SoundEventGroupBox: TGroupBox;
40                 SoundListView: TListView;
41                 SoundReferButton: TButton;
42                 SoundFileEdit: TEdit;
43                 OpenDialog: TOpenDialog;
44                 WriteProxyGroupBox: TGroupBox;
45                 WriteAddressLabel: TLabel;
46                 WritePortLabel: TLabel;
47                 WriteUserIDLabel: TLabel;
48                 WritePasswordLabel: TLabel;
49                 WriteProxyCheck: TCheckBox;
50                 WriteProxyAddressEdit: TEdit;
51                 WritePortEdit: TEdit;
52                 WriteProxyUserIDEdit: TEdit;
53                 WriteProxyPasswordEdit: TEdit;
54                 BoardSheet: TTabSheet;
55                 GroupBox4: TGroupBox;
56                 Label13: TLabel;
57                 UserIDSheet: TTabSheet;
58                 GroupBox3: TGroupBox;
59                 Label9: TLabel;
60                 Label10: TLabel;
61                 UserIDEdit: TEdit;
62                 PasswordEdit: TEdit;
63                 SoundPlayButton: TBitBtn;
64                 AutoLoginCheckBox: TCheckBox;
65                 Tora3URLLabel: TLabel;
66                 Label12: TLabel;
67                 Label5: TLabel;
68                 CabinetFontBotton: TButton;
69                 CabinetColorBotton: TButton;
70                 CabinetDefaultButton: TButton;
71                 CabinetMemo: TMemo;
72                 ListMemo: TMemo;
73                 ListFontBotton: TButton;
74                 ListColorBotton: TButton;
75                 ListDefaultBotton: TButton;
76                 HintFontButton: TButton;
77                 HintBackButton: TButton;
78                 HintDefaultButton: TButton;
79                 HintMemo: TMemo;
80                 EditorMemo: TMemo;
81                 EditorFontBotton: TButton;
82                 EditorColorBotton: TButton;
83                 EditorDefaultBotton: TButton;
84                 BrowserTabMemo: TMemo;
85                 BruwserTabFontButton: TButton;
86                 BrowserTabDefaultButton: TButton;
87                 Bevel1: TBevel;
88                 Bevel2: TBevel;
89                 GroupBox1: TGroupBox;
90                 GroupBox2: TGroupBox;
91                 URLAppCheckBox: TCheckBox;
92                 AppFolderLabel: TLabel;
93                 AppFolderEdit: TEdit;
94                 AppFolderButton: TButton;
95                 OpenMailerCheckBox: TCheckBox;
96                 TabSheet1: TTabSheet;
97                 PopupPositionRadioGroup: TRadioGroup;
98                 TabAddRadioGroup: TRadioGroup;
99                 TabSheet2: TTabSheet;
100                 GroupBox7: TGroupBox;
101                 URLDisplayCheckBox: TCheckBox;
102                 Label3: TLabel;
103                 Label11: TLabel;
104                 TabStopAddressBarCheckBox: TCheckBox;
105                 AddressHistoryCountEdit: TEdit;
106                 LinkAddCheckBox: TCheckBox;
107                 GroupBox8: TGroupBox;
108                 PreviewVisibleCheckBox: TCheckBox;
109                 PreviewSizeComboBox: TComboBox;
110                 Label14: TLabel;
111                 Label15: TLabel;
112                 PreviewWaitEdit: TEdit;
113                 Label16: TLabel;
114                 ShowMailCheckBox: TCheckBox;
115                 TabSheet3: TTabSheet;
116                 GroupBox9: TGroupBox;
117                 ThreadListIconCheckBox: TCheckBox;
118                 NonAcquiredCountCheckBox: TCheckBox;
119                 GroupBox6: TGroupBox;
120                 LogDeleteMessageCheckBox: TCheckBox;
121                 GroupBox10: TGroupBox;
122                 UnActivePopupCheckBox: TCheckBox;
123                 GroupBox11: TGroupBox;
124                 RecvBufferSize: TEdit;
125                 Label17: TLabel;
126                 ProxyProtocolCheckBox: TCheckBox;
127                 ProtocolCheckBox: TCheckBox;
128                 Label18: TLabel;
129                 Label19: TLabel;
130                 Bevel5: TBevel;
131                 Label20: TLabel;
132                 Label21: TLabel;
133                 Label22: TLabel;
134                 Label23: TLabel;
135                 CSSTabSheet: TTabSheet;
136                 lblSFont: TLabel;
137                 GroupBox12: TGroupBox;
138                 CSSCheckBox: TCheckBox;
139                 CSSListLabel: TLabel;
140                 CSSListView: TListView;
141                 GroupBox13: TGroupBox;
142                 PostTimeCheckBox: TCheckBox;
143                 Label24: TLabel;
144                 Label25: TLabel;
145                 PostTimeEdit: TEdit;
146                 PostTimeLabel: TLabel;
147                 Label27: TLabel;
148                 PutPostTimeRadioButton: TRadioButton;
149                 BackPostTimeRadioButton: TRadioButton;
150                 ResPopupBoldCheckBox: TCheckBox;
151                 NGwordSheet: TTabSheet;
152                 GroupBox14: TGroupBox;
153                 RloCheckBox: TCheckBox;
154                 ReplaceulCheckBox: TCheckBox;
155                 PopUpAbonCheckBox: TCheckBox;
156                 CSSBrowser: TWebBrowser;
157                 CSSFontCheckBox: TCheckBox;
158                 CSSBackColorCheckBox: TCheckBox;
159                 CSSFontButton: TButton;
160                 CSSBackColorButton: TButton;
161                 ShowNGLineCheckBox: TCheckBox;
162                 AddResAnchorCheckBox: TCheckBox;
163     ResRangeHoldCheckBox: TCheckBox;
164                 BoardURLComboBox: TComboBox;
165                 AddURLButton: TButton;
166                 RemoveURLButton: TButton;
167                 GroupBox15: TGroupBox;
168                 ShowDialogForEndCheckBox: TCheckBox;
169     OddResNumCheckBox: TCheckBox;
170     OddResNumColorBox: TColorBox;
171     ForcedLoginCheckBox: TCheckBox;
172     ForcedLoginLabel: TLabel;
173     GroupBox16: TGroupBox;
174     CreationTimeLogsCheckBox: TCheckBox;
175     FutureThreadCheckBox: TCheckBox;
176     DeleteSyriaCheckBox: TCheckBox;
177     TabSheet4: TTabSheet;
178     SambaGroupBox: TGroupBox;
179     UseSambaCheckBox: TCheckBox;
180     Label26: TLabel;
181     ResAnchorGroupBox: TGroupBox;
182     ResAnchorCheckBox: TCheckBox;
183     AllTabCloseCheckBox: TCheckBox;
184     GroupBox5: TGroupBox;
185     BrowserMaxLabel: TLabel;
186     BrowserMaxCombo: TComboBox;
187     GroupBox17: TGroupBox;
188     SelectIntervalLabel: TLabel;
189     SelectIntervalEdit: TEdit;
190     Label4: TLabel;
191     Label6: TLabel;
192     TabAutoSaveLoad: TGroupBox;
193     CloseTabAutoSave: TCheckBox;
194                 OpenTabAutoLoad: TCheckBox;
195                 ResRangeHoldComboBox: TComboBox;
196                 procedure FormCreate(Sender: TObject);
197                 procedure FormDestroy(Sender: TObject);
198                 procedure ApplyButtonClick(Sender: TObject);
199                 procedure CabinetFontBottonClick(Sender: TObject);
200                 procedure CabinetColorBottonClick(Sender: TObject);
201                 procedure EditorFontBottonClick(Sender: TObject);
202                 procedure OkBottonClick(Sender: TObject);
203                 procedure ReadProxyCheckClick(Sender: TObject);
204                 procedure ListFontBottonClick(Sender: TObject);
205                 procedure ListColorBottonClick(Sender: TObject);
206                 procedure EditorColorBottonClick(Sender: TObject);
207                 procedure CabinetDefaultButtonClick(Sender: TObject);
208                 procedure ReadPortEditExit(Sender: TObject);
209                 procedure ListDefaultBottonClick(Sender: TObject);
210                 procedure EditorDefaultBottonClick(Sender: TObject);
211                 procedure HintFontButtonClick(Sender: TObject);
212                 procedure HintBackButtonClick(Sender: TObject);
213                 procedure HintDefaultButtonClick(Sender: TObject);
214                 procedure LogFolderButtonClick(Sender: TObject);
215                 procedure FormClose(Sender: TObject; var Action: TCloseAction);
216                 procedure SoundReferButtonClick(Sender: TObject);
217                 procedure SoundPlayButtonClick(Sender: TObject);
218                 procedure SoundListViewChanging(Sender: TObject; Item: TListItem;
219                         Change: TItemChange; var AllowChange: Boolean);
220                 procedure SoundFileEditChange(Sender: TObject);
221                 procedure OptionTabChange(Sender: TObject);
222                 procedure AppFolderButtonClick(Sender: TObject);
223                 procedure WriteProxyCheckClick(Sender: TObject);
224                 procedure WritePortEditExit(Sender: TObject);
225                 procedure Tora3URLLabelClick(Sender: TObject);
226                 procedure HotKeyEnter(Sender: TObject);
227                 procedure HotKeyExit(Sender: TObject);
228                 procedure URLAppCheckBoxClick(Sender: TObject);
229                 procedure BruwserTabFontButtonClick(Sender: TObject);
230                 procedure BrowserTabDefaultButtonClick(Sender: TObject);
231                 procedure AddressHistoryCountEditExit(Sender: TObject);
232                 procedure PreviewWaitEditExit(Sender: TObject);
233                 procedure RecvBufferSizeExit(Sender: TObject);
234                 procedure CSSCheckBoxClick(Sender: TObject);
235                 procedure PostTimeEditExit(Sender: TObject);
236                 procedure PostTimeCheckBoxClick(Sender: TObject);
237                 procedure CSSFontButtonClick(Sender: TObject);
238                 procedure CSSBackColorButtonClick(Sender: TObject);
239                 procedure CSSFontCheckBoxClick(Sender: TObject);
240                 procedure CSSBackColorCheckBoxClick(Sender: TObject);
241                 procedure CSSListViewChange(Sender: TObject; Item: TListItem;
242                         Change: TItemChange);
243                 procedure AddURLButtonClick(Sender: TObject);
244                 procedure RemoveURLButtonClick(Sender: TObject);
245     procedure OddResNumCheckBoxClick(Sender: TObject);
246     procedure ResRangeHoldCheckBoxClick(Sender: TObject);
247         private
248                 { Private \90é\8c¾ }
249                 FClose: Boolean;
250                 FRepaintThread: Boolean;
251                 FCSSFont: TFont;
252                 FCSSBackColor: TColor;
253                 FCSSStrings: TStringList;
254                 function GetMemoText(font: TFont; text: string): string;
255 //              function GetFontText(Font: TFont; Text: string): string;
256                 procedure SetValue;
257 //                procedure SaveSetting;
258                 procedure SettingApply;
259                 function CheckFolder: Boolean;
260                 procedure SetAbonpropertys;
261                 procedure CSSSetContent(Content: string);
262                 procedure CSSPreview;
263         public
264                 { Public \90é\8c¾ }
265                 TabAddRadio: Integer;                          
266                 procedure SaveSetting;
267                 property TabAddPro: TRadioGroup read TabAddRadioGroup write TabAddRadioGroup;
268                 property TabAutoSave: TCheckBox read CloseTabAutoSave write CloseTabAutoSave;
269                 property TabAutoLoad: TCheckBox read OpenTabAutoLoad write OpenTabAutoLoad;
270         end;
271
272 var
273         OptionDialog: TOptionDialog;
274
275 implementation
276
277 uses
278         Giko, Editor, Setting, ActnList;
279
280 const
281         FONT_TEXT: string = '%s %d pt';
282         MEMO_CABINET: string = '\83L\83\83\83r\83l\83b\83g';
283         MEMO_THREAD: string = '\83X\83\8c\83b\83h\83\8a\83X\83g';
284         MEMO_BROWSERPOPUP: string = '\83u\83\89\83E\83U\83|\83b\83v\83A\83b\83v';
285         MEMO_BROWSERTAB: string = '\83u\83\89\83E\83U\83^\83u';
286         MEMO_EDITOR: string = '\83G\83f\83B\83^\83e\83L\83X\83g';
287         DEFAULT_FONT_NAME: string = '\82l\82\82o\83S\83V\83b\83N';
288         DEFAULT_FONT_SIZE: Integer = 9;
289         DEFAULT_TABFONT_NAME: string = '\82l\82\82o\83S\83V\83b\83N';
290         DEFAULT_TABFONT_SIZE: Integer = 9;
291         URL_TORA3: WideString = 'http://2ch.tora3.net/';
292
293 {$R *.DFM}
294
295 procedure TOptionDialog.FormCreate(Sender: TObject);
296 begin
297
298         CSSBrowser.Navigate('about:blank');
299         FClose := True;
300
301         OptionTab.ActivePage := ConnectSheet;
302         SetValue;
303
304         CabinetMemo.Text := GetMemoText(CabinetMemo.Font, MEMO_CABINET);
305         ListMemo.Text := GetMemoText(ListMemo.Font, MEMO_THREAD);
306         HintMemo.Text := GetMemoText(HintMemo.Font, MEMO_BROWSERPOPUP);
307         BrowserTabMemo.Text := GetMemoText(BrowserTabMemo.Font, MEMO_BROWSERTAB);
308         EditorMemo.Text := GetMemoText(EditorMemo.Font, MEMO_EDITOR);
309
310         Tora3URLLabel.Cursor := 5;
311         lblSFont.Caption := '\81\9a\8fd\97v\81\9a'#13#10#13#10
312                                                                                 + '\83X\83\8c\83b\83h\95\\8e¦\83G\83\8a\83A\82Ì\83t\83H\83\93\83g\95Ï\8dX\82Í\81A'#13#10
313                                                                                 + '\81uCSS \82Æ\83X\83L\83\93\81v\83^\83u\82Å\90Ý\92è\8fo\97\88\82Ü\82·';
314
315     ForcedLoginLabel.Caption := '- \83`\83F\83b\83N\82ð\93ü\82ê\82é\82Ì\82Í\83Z\83L\83\85\83\8a\83e\83B\8fã\8dD\82Ü\82µ\82­\82 \82è\82Ü\82¹\82ñ\81B' + #13#10
316                                                                 + '\81@\82â\82Þ\82ð\93¾\82È\82¢\8e\9e\82¾\82¯\82É\82µ\82Ä\82­\82¾\82³\82¢\81B';
317     CSSCheckBoxClick(Sender);
318         PostTimeCheckBoxClick(Sender);
319         BrowserMaxLabel.Caption :=
320                 '\83u\83\89\83E\83U\82ª\8dÅ\8f¬\89»\82³\82ê\82Ä\82¢\82é\82Æ\82«\82É\88È\89º\82Ì\91\80\8dì\82Å\83u\83\89\83E\83U\82ð\8dÅ\91å\89»\82µ\82Ü\82·\81B'#13#10 +
321                 '\82Ü\82½\81A\83z\83C\81[\83\8b\83N\83\8a\83b\83N\82É\82æ\82è\8dÅ\91å\89»\82ð\83L\83\83\83\93\83Z\83\8b\82·\82é\82±\82Æ\82ª\8fo\97\88\82Ü\82·\81B';
322
323         if OptionTab.PageCount > GikoSys.Setting.OptionDialogTabIndex then begin
324                 OptionTab.ActivePageIndex := GikoSys.Setting.OptionDialogTabIndex;
325                 OptionTabChange( nil );
326         end;
327         
328 end;
329
330 procedure TOptionDialog.FormDestroy(Sender: TObject);
331 begin
332         CSSListView.OnChange := nil;
333         if FCSSStrings <> nil then
334                 FCSSStrings.Free;
335         if FCSSFont <> nil then
336                 FCSSFont.Free;
337         sndPlaySound(nil, SND_ASYNC);
338
339 end;
340
341 procedure TOptionDialog.OkBottonClick(Sender: TObject);
342 begin
343         FClose := True;
344         RecvBufferSizeExit(Sender);
345         ReadPortEditExit(Sender);
346         WritePortEditExit(Sender);
347         AddressHistoryCountEditExit(Sender);
348         PreviewWaitEditExit(Sender);
349         PostTimeEditExit(Sender);
350
351         if not CheckFolder then begin
352                 FClose := False;
353                 Exit;
354         end;
355     SetAbonpropertys;
356         SaveSetting;
357         SettingApply;
358
359 end;
360
361 procedure TOptionDialog.ApplyButtonClick(Sender: TObject);
362 begin
363         RecvBufferSizeExit(Sender);
364         ReadPortEditExit(Sender);
365         WritePortEditExit(Sender);
366         AddressHistoryCountEditExit(Sender);
367         PreviewWaitEditExit(Sender);
368         PostTimeEditExit(Sender);
369
370         if not CheckFolder then begin
371                 FClose := False;
372                 Exit;
373         end;
374     SetAbonpropertys;
375         SaveSetting;
376         SettingApply;
377         FClose := False;
378 end;
379
380 //function TOptionDialog.GetFontText(Font: TFont; Text: string): string;
381 //begin
382 //      result := Format(Text, [Font.Name, Font.Size]);
383 //end;
384
385 function TOptionDialog.GetMemoText(font: TFont; text: string): string;
386 var
387         s: string;
388 begin
389         s := '';
390         if font <> nil then
391                 s := Format(FONT_TEXT, [Font.Name, Font.Size]) + #13#10;
392         Result := s + text;
393 end;
394
395 //\83L\83\83\83r\83l\83b\83g\83t\83H\83\93\83g\83{\83^\83\93
396 procedure TOptionDialog.CabinetFontBottonClick(Sender: TObject);
397 begin
398         FontDialog.Options := [fdAnsiOnly, fdEffects];
399         FontDialog.Font.Assign(CabinetMemo.Font);
400         if FontDialog.Execute then begin
401                 FontDialog.Font.Style := FontDialog.Font.Style - [fsUnderline] - [fsStrikeout];
402                 CabinetMemo.Font.Assign(FontDialog.Font);
403                 CabinetMemo.Text := GetMemoText(CabinetMemo.Font, MEMO_CABINET);
404                 CabinetMemo.Font.Charset := SHIFTJIS_CHARSET;
405         end;
406 end;
407
408 //\83L\83\83\83r\83l\83b\83g\94w\8ci\90F\83{\83^\83\93
409 procedure TOptionDialog.CabinetColorBottonClick(Sender: TObject);
410 begin
411         ColorDialog.Color := CabinetMemo.Color;
412         if ColorDialog.Execute then begin
413                 CabinetMemo.Color := ColorDialog.Color;
414         end;
415 end;
416
417 //\83L\83\83\83r\83l\83b\83g\83f\83t\83H\83\8b\83g\83{\83^\83\93
418 procedure TOptionDialog.CabinetDefaultButtonClick(Sender: TObject);
419 begin
420         CabinetMemo.Font.Name := DEFAULT_FONT_NAME;
421         CabinetMemo.Font.Size := DEFAULT_FONT_SIZE;
422         CabinetMemo.Font.Color := clWindowText;
423         CabinetMemo.Font.Style := [];
424         CabinetMemo.Color := clWindow;
425         CabinetMemo.Text := GetMemoText(CabinetMemo.Font, MEMO_CABINET);
426 end;
427
428 //\83X\83\8c\83b\83h\83\8a\83X\83g\83t\83H\83\93\83g\83{\83^\83\93
429 procedure TOptionDialog.ListFontBottonClick(Sender: TObject);
430 begin
431         FontDialog.Options := [fdAnsiOnly, fdEffects];
432         FontDialog.Font.Assign(ListMemo.Font);
433         if FontDialog.Execute then begin
434                 ListMemo.Font.Assign(FontDialog.Font);
435                 ListMemo.Text := GetMemoText(ListMemo.Font, MEMO_THREAD);
436                 ListMemo.Font.Charset := SHIFTJIS_CHARSET;
437         end;
438 end;
439
440 //\83X\83\8c\83b\83h\83\8a\83X\83g\94w\8ci\90F\83{\83^\83\93
441 procedure TOptionDialog.ListColorBottonClick(Sender: TObject);
442 begin
443         ColorDialog.Color := ListMemo.Color;
444         if ColorDialog.Execute then begin
445                 ListMemo.Color := ColorDialog.Color;
446         end;
447 end;
448
449 //\83X\83\8c\83b\83h\83\8a\83X\83g\83f\83t\83H\83\8b\83g\83{\83^\83\93
450 procedure TOptionDialog.ListDefaultBottonClick(Sender: TObject);
451 begin
452         ListMemo.Font.Name := DEFAULT_FONT_NAME;
453         ListMemo.Font.Size := DEFAULT_FONT_SIZE;
454         ListMemo.Font.Color := clWindowText;
455         ListMemo.Font.Style := [];
456         ListMemo.Color := clWindow;
457         ListMemo.Text := GetMemoText(ListMemo.Font, MEMO_THREAD);
458 end;
459
460 //\83u\83\89\83E\83U\83|\83b\83v\83A\83b\83v\83t\83H\83\93\83g\83{\83^\83\93
461 procedure TOptionDialog.HintFontButtonClick(Sender: TObject);
462 begin
463         FontDialog.Options := [fdAnsiOnly, fdEffects];
464         FontDialog.Font.Assign(HintMemo.Font);
465         if FontDialog.Execute then begin
466                 HintMemo.Font.Assign(FontDialog.Font);
467                 HintMemo.Text := GetMemoText(HintMemo.Font, MEMO_BROWSERPOPUP);
468                 HintMemo.Font.Charset := SHIFTJIS_CHARSET;
469         end;
470 end;
471
472 //\83u\83\89\83E\83U\83|\83b\83v\83A\83b\83v\94w\8ci\90F\83{\83^\83\93
473 procedure TOptionDialog.HintBackButtonClick(Sender: TObject);
474 begin
475         ColorDialog.Color := HintMemo.Color;
476         if ColorDialog.Execute then begin
477                 HintMemo.Color := ColorDialog.Color;
478         end;
479 end;
480
481 //\83u\83\89\83E\83U\83|\83b\83v\83A\83b\83v\83f\83t\83H\83\8b\83g\83{\83^\83\93
482 procedure TOptionDialog.HintDefaultButtonClick(Sender: TObject);
483 begin
484         HintMemo.Font.Name := DEFAULT_FONT_NAME;
485         HintMemo.Font.Size := DEFAULT_FONT_SIZE;
486         HintMemo.Font.Color := clWindowText;
487         HintMemo.Font.Style := [];
488         HintMemo.Color := clInfoBk;
489         HintMemo.Text := GetMemoText(HintMemo.Font, MEMO_BROWSERPOPUP);
490 end;
491
492 //\83u\83\89\83E\83U\83^\83u\83t\83H\83\93\83g\83{\83^\83\93
493 procedure TOptionDialog.BruwserTabFontButtonClick(Sender: TObject);
494 begin
495         FontDialog.Options := [fdAnsiOnly];
496         FontDialog.Font.Assign(BrowserTabMemo.Font);
497         if FontDialog.Execute then begin
498                 BrowserTabMemo.Font.Assign(FontDialog.Font);
499                 BrowserTabMemo.Text := GetMemoText(FontDialog.Font, MEMO_BROWSERTAB);
500                 BrowserTabMemo.Font.Charset := SHIFTJIS_CHARSET;
501         end;
502 end;
503
504 //\83u\83\89\83E\83U\83^\83u\83f\83t\83H\83\8b\83g\83{\83^\83\93
505 procedure TOptionDialog.BrowserTabDefaultButtonClick(Sender: TObject);
506 begin
507         BrowserTabMemo.Font.Name := DEFAULT_TABFONT_NAME;
508         BrowserTabMemo.Font.Size := DEFAULT_TABFONT_SIZE;
509         BrowserTabMemo.Font.Color := clWindowText;
510         BrowserTabMemo.Font.Style := [];
511         BrowserTabMemo.Color := clBtnFace;
512         BrowserTabMemo.Text := GetMemoText(BrowserTabMemo.Font, MEMO_BROWSERTAB);
513 end;
514
515 //\83G\83f\83B\83^\83t\83H\83\93\83g\83{\83^\83\93
516 procedure TOptionDialog.EditorFontBottonClick(Sender: TObject);
517 begin
518         FontDialog.Options := [fdAnsiOnly, fdEffects];
519         FontDialog.Font.Assign(EditorMemo.Font);
520         if FontDialog.Execute then begin
521                 EditorMemo.Font.Assign(FontDialog.Font);
522                 EditorMemo.Text := GetMemoText(EditorMemo.Font, MEMO_EDITOR);
523                 EditorMemo.Font.Charset := SHIFTJIS_CHARSET;
524         end;
525 end;
526
527 //\83G\83f\83B\83^\94w\8ci\90F\83{\83^\83\93
528 procedure TOptionDialog.EditorColorBottonClick(Sender: TObject);
529 begin
530         ColorDialog.Color := EditorMemo.Font.Color;
531         if ColorDialog.Execute then begin
532                 EditorMemo.Color := ColorDialog.Color;
533         end;
534 end;
535
536 //\83G\83f\83B\83^\83f\83t\83H\83\8b\83g\83{\83^\83\93
537 procedure TOptionDialog.EditorDefaultBottonClick(Sender: TObject);
538 begin
539         EditorMemo.Font.Name := DEFAULT_FONT_NAME;
540         EditorMemo.Font.Size := DEFAULT_FONT_SIZE;
541         EditorMemo.Font.Color := clWindowText;
542         EditorMemo.Font.Style := [];
543         EditorMemo.Color := clWindow;
544         EditorMemo.Text := GetMemoText(EditorMemo.Font, MEMO_EDITOR);
545 end;
546
547 procedure TOptionDialog.SetValue;
548 var
549         i: Integer;
550         Item: TListItem;
551 //      s: string;
552         idx: Integer;
553         FileList: TStringList;
554 begin
555         //\8eó\90M\83o\83b\83t\83@\83T\83C\83Y
556         RecvBufferSize.Text := IntToStr(Gikosys.Setting.RecvBufferSize);
557         //HTTP1.1\8eg\97p
558         ProtocolCheckBox.Checked := GikoSys.Setting.Protocol;
559         //\83v\83\8d\83L\83V\90Ú\91±HTTP1.1\8eg\97p
560         ProxyProtocolCheckBox.Checked := Gikosys.Setting.ProxyProtocol;
561
562         //\93Ç\82Ý\8d\9e\82Ý\97p\83v\83\8d\83L\83V
563         ReadProxyCheck.Checked := GikoSys.Setting.ReadProxy;
564         ReadProxyCheckClick(nil);
565         ReadProxyAddressEdit.Text := GikoSys.Setting.ReadProxyAddress;
566         ReadPortEdit.Text := IntToStr(GikoSys.Setting.ReadProxyPort);
567         ReadProxyUserIDEdit.Text := GikoSys.Setting.ReadProxyUserID;
568         ReadProxyPasswordEdit.Text := GikoSys.Setting.ReadProxyPassword;
569         //\8f\91\82«\8d\9e\82Ý\97p\83v\83\8d\83L\83V
570         WriteProxyCheck.Checked := GikoSys.Setting.WriteProxy;
571         WriteProxyCheckClick(nil);
572         WriteProxyAddressEdit.Text := GikoSys.Setting.WriteProxyAddress;
573         WritePortEdit.Text := IntToStr(GikoSys.Setting.WriteProxyPort);
574         WriteProxyUserIDEdit.Text := GikoSys.Setting.WriteProxyUserID;
575         WriteProxyPasswordEdit.Text := GikoSys.Setting.WriteProxyPassword;
576         //\83L\83\83\83r\83l\83b\83g\83t\83H\83\93\83g
577         CabinetMemo.Font.Name := GikoSys.Setting.CabinetFontName;
578         CabinetMemo.Font.Size := GikoSys.Setting.CabinetFontSize;
579         CabinetMemo.Font.Color := GikoSys.Setting.CabinetFontColor;
580         CabinetMemo.Color := GikoSys.Setting.CabinetBackColor;
581         //\83X\83\8c\83b\83h\83\8a\83X\83g\83t\83H\83\93\83g
582         ListMemo.Font.Name := GikoSys.Setting.ListFontName;
583         ListMemo.Font.Size := GikoSys.Setting.ListFontSize;
584         ListMemo.Font.Color := GikoSys.Setting.ListFontColor;
585         ListMemo.Color := GikoSys.Setting.ListBackColor;
586         //\83\8c\83X\90\94\91\9d\8c¸\83X\83\8c\8b­\92²\95\\8e¦\83`\83F\83b\83N\83{\83b\83N\83X\81\95\83J\83\89\81[\83_\83C\83A\83\8d\83O
587         OddResNumCheckBox.Checked := GikoSys.Setting.UseOddColorOddResNum;
588         OddResNumColorBox.Selected := GikoSys.Setting.OddColor;
589         OddResNumColorBox.Enabled := OddResNumCheckBox.Checked;
590
591         //\83u\83\89\83E\83U\83|\83b\83v\83A\83b\83v\83t\83H\83\93\83g
592         HintMemo.Font.Name := GikoSys.Setting.HintFontName;
593         HintMemo.Font.Size := GikoSys.Setting.HintFontSize;
594         HintMemo.Font.Color := GikoSys.Setting.HintFontColor;
595         HintMemo.Color := GikoSys.Setting.HintBackColor;
596         //\83u\83\89\83E\83U\83^\83u\83t\83H\83\93\83g
597         BrowserTabMemo.Font.Name := GikoSys.Setting.BrowserTabFontName;
598         BrowserTabMemo.Font.Size := GikoSys.Setting.BrowserTabFontSize;
599         BrowserTabMemo.Font.Style := [];
600         if GikoSys.Setting.BrowserTabFontBold then
601                 BrowserTabMemo.Font.Style := BrowserTabMemo.Font.Style + [fsBold];
602         if GikoSys.Setting.BrowserTabFontItalic then
603                 BrowserTabMemo.Font.Style := BrowserTabMemo.Font.Style + [fsItalic];
604         //\83G\83f\83B\83^\83\81\83\82\83t\83H\83\93\83g
605         EditorMemo.Font.Name := GikoSys.Setting.EditorFontName;
606         EditorMemo.Font.Size := GikoSys.Setting.EditorFontSize;
607         EditorMemo.Font.Color := GikoSys.Setting.EditorFontColor;
608         EditorMemo.Color := GikoSys.Setting.EditorBackColor;
609         //CSS\95\\8e¦
610         CSSCheckBox.Checked := GikoSys.Setting.UseCSS;
611         if FCSSFont <> nil then
612                 FCSSFont.Free;
613         FCSSFont := TFont.Create;
614         if (GikoSys.Setting.BrowserFontName <> '') or
615                  (GikoSys.Setting.BrowserFontSize <> 0) or
616                  (GikoSys.Setting.BrowserFontBold <> 0) or
617                  (GikoSys.Setting.BrowserFontItalic <> 0) or
618                  (GikoSys.Setting.BrowserFontColor <> -1 ) then begin
619                 CSSFontCheckBox.Checked := True;
620                 FCSSFont.Name := GikoSys.Setting.BrowserFontName;
621                 FCSSFont.Size := GikoSys.Setting.BrowserFontSize;
622                 FCSSFont.Style := [];
623                 if GikoSys.Setting.BrowserFontBold = 1 then
624                         FCSSFont.Style := FCSSFont.Style + [fsBold];
625                 if GikoSys.Setting.BrowserFontItalic = 1 then
626                         FCSSFont.Style := FCSSFont.Style + [fsItalic];
627                 i := GikoSys.Setting.BrowserFontColor;
628                 i := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
629                 FCSSFont.Color := i;
630         end;
631         if GikoSys.Setting.BrowserBackColor <> -1 then begin
632                 CSSBackColorCheckBox.Checked := True;
633
634                 i := GikoSys.Setting.BrowserBackColor;
635                 i := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
636                 FCSSBackColor := i;
637         end;
638         //
639         //\83X\83^\83C\83\8b\83V\81[\83g\83t\83@\83C\83\8b\96¼\88ê\97\97
640         FileList := TStringList.Create;
641         try
642                 GikoSys.GetFileList(GikoSys.GetStyleSheetDir, '*.css', FileList, True, True);
643
644                 Idx := Length(GikoSys.GetStyleSheetDir);
645                 for i := 0 to FileList.Count - 1 do
646                         FileList[i] := Copy(FileList[i], Idx + 1, Length(FileList[i]));
647                 FileList.Sort;
648                 for i := 0 to FileList.Count - 1 do begin
649                         //s := ExtractFileName(FileList[i]);
650                         if LowerCase(FileList[i]) = 'default.css' then
651                                 Item := CSSListView.Items.Insert(0)
652                         else
653                                 Item := CSSListView.Items.Add;
654                         Item.Caption := ChangeFileExt(FileList[i], '');
655                         if LowerCase(FileList[i]) = LowerCase(GikoSys.Setting.CSSFileName) then
656                                 Item.Selected := True;
657                 end;
658         finally
659                 FileList.Free;
660         end;
661         //\83X\83L\83\93\83t\83@\83C\83\8b\96¼\88ê\97\97
662         //FileList := TStringList.Create;
663         if FCSSStrings <> nil then
664                 FCSSStrings.Clear;
665         FCSSStrings := TStringList.Create;
666         try
667                 //GikoSys.GetDirectoryList(GikoSys.GetSkinDir, '*', FileList, False);
668                 GikoSys.GetDirectoryList(GikoSys.GetSkinDir, '*', FCSSStrings, False);
669
670                 Idx := Length(GikoSys.GetSkinDir);
671                 //FileList.Sort;
672                 FCSSStrings.Sort;
673                 //for i := 0 to FileList.Count - 1 do begin
674                 for i := 0 to FCSSStrings.Count - 1 do begin
675                         //s := ExtractFileName(FileList[i]);
676                         Item := CSSListView.Items.Add;
677                         {Item.Data := PChar( FileList[i] );
678                         Item.Caption := Copy( FileList[i], Idx + 1, Length(FileList[i]) );
679                         if LowerCase(FileList[i]) = LowerCase(GikoSys.Setting.CSSFileName) then
680                                 Item.Selected := True;
681                         }
682                         Item.Data := PChar( FCSSStrings[i] );
683                         Item.Caption := Copy( FCSSStrings[i], Idx + 1, Length(FCSSStrings[i]) );
684                         if LowerCase(FCSSStrings[i]) = LowerCase(GikoSys.Setting.CSSFileName) then
685                                 Item.Selected := True;
686                 end;
687         finally
688                 // Item.Data \82É\83|\83C\83\93\83^\93Ë\82Á\8d\9e\82ñ\82Å\82é\82©\82ç\8aJ\95ú\82Å\82«\82È\82¢\82æ\82§\81`
689                 //FileList.Free;
690         end;
691
692         if (CSSListView.ItemIndex = -1) and (CSSListView.Items.Count > 0) then
693                 CSSListView.Items[0].Selected := True;
694
695         // \8bN\93®\8e\9e\83\8c\83X\95\\8e¦\94Í\88Í\82Ì\8cÅ\92è
696         ResRangeHoldCheckBox.Checked := GikoSys.Setting.ResRangeHold;
697         case GikoSys.Setting.ResRange of
698         Ord( grrAll ):  ResRangeHoldComboBox.ItemIndex := 0;
699         Ord( grrKoko ): ResRangeHoldComboBox.ItemIndex := 2;
700         Ord( grrNew ):  ResRangeHoldComboBox.ItemIndex := 3;
701         100:                                            ResRangeHoldComboBox.ItemIndex := 1;
702         end;
703         ResRangeHoldComboBox.Enabled := GikoSys.Setting.ResRangeHold;
704         //\83^\83u\92Ç\89Á\88Ê\92u
705         TabAddRadioGroup.ItemIndex := Ord(GikoSys.Setting.BrowserTabAppend);
706         //\94Â\8dX\90VURL
707         //BoardURL2chEdit.Text := GikoSys.Setting.BoardURL2ch;
708                 BoardURLComboBox.Clear;
709                 BoardURLComboBox.Items.AddStrings(GikoSys.Setting.BoardURLs);
710                 try
711                         BoardURLComboBox.ItemIndex := GikoSys.Setting.BoardURLSelected - 1;
712                 except
713                         BoardURLComboBox.ItemIndex := 0;
714                 end;
715         //\94F\8fØ
716         UserIDEdit.Text := GikoSys.Setting.UserID;
717         PasswordEdit.Text := GikoSys.Setting.Password;
718         AutoLoginCheckBox.Checked := GikoSys.Setting.AutoLogin;
719         ForcedLoginCheckBox.Checked := GikoSys.Setting.ForcedLogin;
720         //\83\8d\83O\83t\83H\83\8b\83_
721         if GikoSys.Setting.NewLogFolder = '' then
722                 LogFolderEdit.Text := GikoSys.Setting.LogFolder
723         else
724                 LogFolderEdit.Text := GikoSys.Setting.NewLogFolder;
725         //\83T\83E\83\93\83h
726         for i := 0 to GikoSys.Setting.GetSoundCount - 1 do begin
727                 Item := SoundListView.Items.Add;
728                 Item.Caption := GikoSys.Setting.SoundViewName[i];
729                 if FileExists(GikoSys.Setting.SoundFileName[i]) then
730                         Item.SubItems.Add(GikoSys.Setting.SoundFileName[i])
731                 else
732                         Item.SubItems.Add('');
733         end;
734         //URL\83N\83\8a\83b\83N\8e\9e\93®\8dì
735         URLAppCheckBox.Checked := GikoSys.Setting.URLApp;
736         URLAppCheckBoxClick(nil);
737         AppFolderEdit.Text := GikoSys.Setting.URLAppFile;
738
739         //mailto\83N\83\8a\83b\83N\8e\9e\93®\8dì
740         OpenMailerCheckBox.Checked := GikoSys.Setting.OpenMailer;
741
742         //\83\8d\83O\8dí\8f\9c\8e\9e\83\81\83b\83Z\81[\83W
743         LogDeleteMessageCheckBox.Checked := GikoSys.Setting.DeleteMsg;
744
745         //\8fI\97¹\8e\9e\8am\94F\83_\83C\83A\83\8d\83O
746         ShowDialogForEndCheckBox.Checked := GikoSys.Setting.ShowDialogForEnd;
747         //AllTabClose
748         AllTabCloseCheckBox.Checked := GikoSys.Setting.ShowDialogForAllTabClose;
749         //Samba
750         UseSambaCheckBox.Checked := GikoSys.Setting.UseSamba;
751         ResAnchorCheckBox.Checked := GikoSys.Setting.ResAnchorJamp;
752         // \83u\83\89\83E\83U\8dÅ\91å\89»
753         BrowserMaxCombo.ItemIndex := Ord( GikoSys.Setting.BrowserAutoMaximize );
754         //\83|\83b\83v\83A\83b\83v\88Ê\92u
755         case GikoSys.Setting.PopupPosition of
756                 gppRightTop:            PopupPositionRadioGroup.ItemIndex := 0;
757                 gppRight:                       PopupPositionRadioGroup.ItemIndex := 1;
758                 gppRightBottom: PopupPositionRadioGroup.ItemIndex := 2;
759                 gppTop:                                 PopupPositionRadioGroup.ItemIndex := 3;
760                 gppCenter:                      PopupPositionRadioGroup.ItemIndex := 4;
761                 gppBottom:                      PopupPositionRadioGroup.ItemIndex := 5;
762                 gppLeftTop:             PopupPositionRadioGroup.ItemIndex := 6;
763                 gppLeft:                                PopupPositionRadioGroup.ItemIndex := 7;
764                 gppLeftBottom:  PopupPositionRadioGroup.ItemIndex := 8;
765         end;
766
767         //\94ñ\83A\83N\83e\83B\83u\8e\9e\83|\83b\83v\83A\83b\83v\95\\8e¦
768         UnActivePopupCheckBox.Checked := GikoSys.Setting.UnActivePopup;
769         //\83\8c\83X\83|\83b\83v\83A\83b\83v\83{\81[\83\8b\83h\95\\8e¦
770         ResPopupBoldCheckBox.Checked := GikoSys.Setting.ResPopupHeaderBold;
771
772         //\83A\83h\83\8c\83X\83o\81[
773         URLDisplayCheckBox.Checked := GikoSys.Setting.URLDisplay;
774         TabStopAddressBarCheckBox.Checked := GikoSys.Setting.AddressBarTabStop;
775         LinkAddCheckBox.Checked := GikoSys.Setting.LinkAddAddressBar;
776         AddressHistoryCountEdit.Text := IntToStr(GikoSys.Setting.AddressHistoryCount);
777
778         //HTML\83v\83\8c\83r\83\85\81[
779         PreviewVisibleCheckBox.Checked := GikoSys.Setting.PreviewVisible;
780         PreviewWaitEdit.Text := IntToStr(GikoSys.Setting.PreviewWait);
781         PreviewSizeComboBox.ItemIndex := 2;
782         case GikoSys.Setting.PreviewSize of
783                 gpsXLarge: PreviewSizeComboBox.ItemIndex := 4;
784                 gpsLarge: PreviewSizeComboBox.ItemIndex := 3;
785                 gpsMedium: PreviewSizeComboBox.ItemIndex := 2;
786                 gpsSmall: PreviewSizeComboBox.ItemIndex := 1;
787                 gpsXSmall: PreviewSizeComboBox.ItemIndex := 0;
788         end;
789
790         //\83X\83\8c\83b\83h\88ê\97\97\8dX\90V\83A\83C\83R\83\93
791         ThreadListIconCheckBox.Checked := GikoSys.Setting.ListIconVisible;
792         NonAcquiredCountCheckBox.Checked := GikoSys.Setting.NonAcquiredCount;
793         CreationTimeLogsCheckBox.Checked := GikoSys.Setting.CreationTimeLogs;
794         FutureThreadCheckBox.Checked := GikoSys.Setting.FutureThread;
795         SelectIntervalEdit.Text := IntToStr(GikoSys.Setting.SelectInterval);
796         
797         //\83X\83\8c\83b\83h\88ê\97\97\82ÅLog\82Ì\82 \82é\83X\83\8c\83b\83h\82Ì\82Ý\83X\83\8c\8dì\90¬\93ú\82ð\95\\8e¦\82·\82é\82©
798         //ExistLogCheckBox.Checked :=
799
800         //\8f\91\82«\8d\9e\82Ý\8e\9e\83}\83V\83\93\8e\9e\8aÔ\8eg\97p\90Ý\92è
801         PostTimeCheckBox.Checked := GikoSys.Setting.UseMachineTime;
802         PostTimeEdit.Text := IntToStr(GikoSys.Setting.TimeAdjustSec);
803         if GikoSys.Setting.TimeAdjust then
804                 PutPostTimeRadioButton.Checked := True
805         else
806                 BackPostTimeRadioButton.Checked := True;
807         //\82 \82Ú\81`\82ñ
808         RloCheckBox.Checked := GikoSys.Setting.AbonDeleterlo;
809         ReplaceulCheckBox.Checked := GikoSys.Setting.AbonReplaceul;
810         PopUpAbonCheckBox.Checked := GikoSys.Setting.PopUpAbon;
811         ShowNGLineCheckBox.Checked := GikoSys.Setting.ShowNGLinesNum;
812         AddResAnchorCheckBox.Checked := GikoSys.Setting.AddResAnchor;
813         DeleteSyriaCheckBox.Checked := GikoSys.Setting.DeleteSyria;
814
815         //TabAutoLoad
816         TabAutoSave.Checked := GikoSys.Setting.TabAutoSave;
817         TabAutoLoad.Checked := GikoSys.Setting.TabAutoLoad
818
819 end;
820
821 procedure TOptionDialog.SaveSetting;
822 var
823         i: Integer;
824         tmp: string;
825 //      Item: TListItem;
826 begin
827         //\8eó\90M\83o\83b\83t\83@\83T\83C\83Y
828         Gikosys.Setting.RecvBufferSize := StrToInt(RecvBufferSize.Text);
829         //HTTP1.1\8eg\97p
830         GikoSys.Setting.Protocol := ProtocolCheckBox.Checked;
831         //\83v\83\8d\83L\83V\90Ú\91±HTTP1.1\8eg\97p
832         Gikosys.Setting.ProxyProtocol := ProxyProtocolCheckBox.Checked;
833
834         GikoSys.Setting.OptionDialogTabIndex := OptionTab.TabIndex;
835
836         GikoSys.Setting.ReadProxy := ReadProxyCheck.Checked;
837         GikoSys.Setting.ReadProxyAddress := ReadProxyAddressEdit.Text;
838         GikoSys.Setting.ReadProxyPort := StrToInt(ReadPortEdit.Text);
839         GikoSys.Setting.ReadProxyUserID := ReadProxyUserIDEdit.Text;
840         GikoSys.Setting.ReadProxyPassword := ReadProxyPasswordEdit.Text;
841
842         GikoSys.Setting.WriteProxy := WriteProxyCheck.Checked;
843         GikoSys.Setting.WriteProxyAddress := WriteProxyAddressEdit.Text;
844         GikoSys.Setting.WriteProxyPort := StrToInt(WritePortEdit.Text);
845         GikoSys.Setting.WriteProxyUserID := WriteProxyUserIDEdit.Text;
846         GikoSys.Setting.WriteProxyPassword := WriteProxyPasswordEdit.Text;
847
848         GikoSys.Setting.CabinetFontName := CabinetMemo.Font.Name;
849         GikoSys.Setting.CabinetFontSize := CabinetMemo.Font.Size;
850         GikoSys.Setting.CabinetFontColor := CabinetMemo.Font.Color;
851         GikoSys.Setting.CabinetBackColor := CabinetMemo.Color;
852
853         GikoSys.Setting.ListFontName := ListMemo.Font.Name;
854         GikoSys.Setting.ListFontSize := ListMemo.Font.Size;
855         GikoSys.Setting.ListFontColor := ListMemo.Font.Color;
856         GikoSys.Setting.ListBackColor := ListMemo.Color;
857         GikoSys.Setting.UseOddColorOddResNum := OddResNumCheckBox.Checked;
858         GikoSys.Setting.OddColor := OddResNumColorBox.Selected;
859
860         GikoSys.Setting.HintFontName := HintMemo.Font.Name;
861         GikoSys.Setting.HintFontSize := HintMemo.Font.Size;
862         GikoSys.Setting.HintFontColor := HintMemo.Font.Color;
863         GikoSys.Setting.HintBackColor := HintMemo.Color;
864
865         GikoSys.Setting.BrowserTabFontName := BrowserTabMemo.Font.Name;
866         GikoSys.Setting.BrowserTabFontSize := BrowserTabMemo.Font.Size;
867
868         GikoSys.Setting.EditorFontName := EditorMemo.Font.Name;
869         GikoSys.Setting.EditorFontSize := EditorMemo.Font.Size;
870         GikoSys.Setting.EditorFontColor := EditorMemo.Font.Color;
871         GikoSys.Setting.EditorBackColor := EditorMemo.Color;
872         {FRepaintThread : \95\\8e¦\8dÏ\82Ý\83X\83\8c\83b\83h\82Ì\8dÄ\95`\89æ\82ª\95K\97v\82©\82Ç\82¤\82©
873         \90Ý\92è\82ª\95Ï\82í\82Á\82Ä\82¢\82½\8fê\8d\87\81Atrue\82É\82µ\82Ä\8aù\82É\95\\8e¦\82µ\82Ä\82¢\82é\91S\82Ä\82Ì
874         \83X\83\8c\83b\83h\82ÌRepaint\82ðtrue\82É\82·\82é
875         }
876         //CSS\95\\8e¦
877         if GikoSys.Setting.UseCSS <> CSSCheckBox.Checked then FRepaintThread := true;
878         GikoSys.Setting.UseCSS := CSSCheckBox.Checked;
879         //CSS\83t\83@\83C\83\8b\96¼
880         tmp := GikoSys.Setting.CSSFileName;
881         GikoSys.Setting.CSSFileName := 'default.css';
882         if CSSListView.Items.Count > 0 then begin
883                 try
884                         if CSSListView.Items[CSSListView.ItemIndex].Data <> nil then
885                                 GikoSys.Setting.CSSFileName := string( CSSListView.Items[CSSListView.ItemIndex].data )
886                         else
887                                 GikoSys.Setting.CSSFileName := CSSListView.Items[CSSListView.ItemIndex].Caption + '.css';
888                 except
889                 end;
890         end;
891         if tmp <> GikoSys.Setting.CSSFileName then FRepaintThread := true;
892         // CSS \82Ì\83t\83H\83\93\83g\8ew\92è
893         if CSSFontCheckBox.Checked then begin
894                 if GikoSys.Setting.BrowserFontName <> FCSSFont.Name then FRepaintThread := true;
895                 GikoSys.Setting.BrowserFontName := FCSSFont.Name;
896                 if GikoSys.Setting.BrowserFontSize <> FCSSFont.Size then FRepaintThread := true;
897                 GikoSys.Setting.BrowserFontSize := FCSSFont.Size;
898                 if fsBold in FCSSFont.Style then begin
899                         if GikoSys.Setting.BrowserFontBold <> 1 then FRepaintThread := true;
900                         GikoSys.Setting.BrowserFontBold := 1;
901                 end else begin
902                         if GikoSys.Setting.BrowserFontBold <> -1 then FRepaintThread := true;
903                         GikoSys.Setting.BrowserFontBold := -1;
904                 end;
905                 if fsItalic in FCSSFont.Style then begin
906                         if GikoSys.Setting.BrowserFontItalic <> 1 then FRepaintThread := true;
907                         GikoSys.Setting.BrowserFontItalic := 1;
908                 end else begin
909                         if GikoSys.Setting.BrowserFontItalic <> -1 then FRepaintThread := true;
910                         GikoSys.Setting.BrowserFontItalic := -1;
911                 end;
912                 i := ColorToRGB( FCSSFont.Color );
913                 if (GikoSys.Setting.BrowserFontColor <> (i shr 16) or (i and $ff00) or ((i and $ff) shl 16)) then
914                         FRepaintThread := true;
915                 GikoSys.Setting.BrowserFontColor := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
916         end else begin
917                 if GikoSys.Setting.BrowserFontName <> '' then FRepaintThread := true;
918                 GikoSys.Setting.BrowserFontName := '';
919                 if GikoSys.Setting.BrowserFontSize <> 0 then FRepaintThread := true;
920                 GikoSys.Setting.BrowserFontSize := 0;
921                 if GikoSys.Setting.BrowserFontBold <> 0 then FRepaintThread := true;
922                 GikoSys.Setting.BrowserFontBold := 0;
923                 if GikoSys.Setting.BrowserFontItalic <> 0 then FRepaintThread := true;
924                 GikoSys.Setting.BrowserFontItalic := 0;
925                 if GikoSys.Setting.BrowserFontColor <> -1 then FRepaintThread := true;
926                 GikoSys.Setting.BrowserFontColor := -1;
927         end;
928         if CSSBackColorCheckBox.Checked then begin
929                 i := ColorToRGB( FCSSBackColor );
930                 if(GikoSys.Setting.BrowserBackColor <> (i shr 16) or (i and $ff00) or ((i and $ff) shl 16)) then
931                         FRepaintThread := true;
932                 GikoSys.Setting.BrowserBackColor := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
933         end else begin
934                 if GikoSys.Setting.BrowserBackColor <> -1 then FRepaintThread := true;
935                 GikoSys.Setting.BrowserBackColor := -1;
936         end;
937
938         //Mail\97\93\95\\8e¦
939         if GikoSys.Setting.ShowMail <> ShowMailCheckBox.Checked then FRepaintThread := true;
940         GikoSys.Setting.ShowMail := ShowMailCheckBox.Checked;
941         // \8bN\93®\8e\9e\83\8c\83X\95\\8e¦\94Í\88Í\82Ì\8cÅ\92è
942         GikoSys.Setting.ResRangeHold := ResRangeHoldCheckBox.Checked;
943         case ResRangeHoldComboBox.ItemIndex of
944         0: GikoSys.Setting.ResRange := Ord( grrAll );
945         1: GikoSys.Setting.ResRange := 100;
946         2: GikoSys.Setting.ResRange := Ord( grrKoko );
947         3: GikoSys.Setting.ResRange := Ord( grrNew );
948         end;
949
950         GikoSys.Setting.BrowserTabAppend := TGikoTabAppend(TabAddRadioGroup.ItemIndex);
951
952 //      GikoSys.Setting.BoardURL2ch := BoardURL2chEdit.Text;
953         GikoSys.Setting.BoardURLs.Clear;
954         GikoSys.Setting.BoardURLs.AddStrings(BoardURLComboBox.Items);
955         GikoSys.Setting.BoardURLSelected := BoardURLComboBox.ItemIndex + 1;
956         GikoSys.Setting.UserID := UserIDEdit.Text;
957         GikoSys.Setting.Password := PasswordEdit.Text;
958         GikoSys.Setting.AutoLogin := AutoLoginCheckBox.Checked;
959         GikoSys.Setting.ForcedLogin := ForcedLoginCheckBox.Checked;
960         GikoSys.Setting.URLApp := URLAppCheckBox.Checked;
961         GikoSys.Setting.URLAppFile := AppFolderEdit.Text;
962
963         GikoSys.Setting.OpenMailer := OpenMailerCheckBox.Checked;
964         GikoSys.Setting.DeleteMsg := LogDeleteMessageCheckBox.Checked;
965         //\8fI\97¹\8e\9e\8am\94F\83_\83C\83A\83\8d\83O
966         GikoSys.Setting.ShowDialogForEnd := ShowDialogForEndCheckBox.Checked;
967         //AllTabClose
968         GikoSys.Setting.ShowDialogForAllTabClose := AllTabCloseCheckBox.Checked;
969     //Samba
970         GikoSys.Setting.UseSamba := UseSambaCheckBox.Checked;
971         GikoSys.Setting.ResAnchorJamp := ResAnchorCheckBox.Checked;
972         // \83u\83\89\83E\83U\8dÅ\91å\89»
973         GikoSys.Setting.BrowserAutoMaximize := TGikoBrowserAutoMaximize( BrowserMaxCombo.ItemIndex );
974         //\83|\83b\83v\83A\83b\83v\88Ê\92u
975         case PopupPositionRadioGroup.ItemIndex of
976                 0: GikoSys.Setting.PopupPosition := gppRightTop;
977                 1: GikoSys.Setting.PopupPosition := gppRight;
978                 2: GikoSys.Setting.PopupPosition := gppRightBottom;
979                 3: GikoSys.Setting.PopupPosition := gppTop;
980                 4: GikoSys.Setting.PopupPosition := gppCenter;
981                 5: GikoSys.Setting.PopupPosition := gppBottom;
982                 6: GikoSys.Setting.PopupPosition := gppLeftTop;
983                 7: GikoSys.Setting.PopupPosition := gppLeft;
984                 8: GikoSys.Setting.PopupPosition := gppLeftBottom;
985         end;
986
987         //\94ñ\83A\83N\83e\83B\83u\8e\9e\83|\83b\83v\83A\83b\83v\95\\8e¦
988         GikoSys.Setting.UnActivePopup := UnActivePopupCheckBox.Checked;
989         //\83\8c\83X\83|\83b\83v\83A\83b\83v\83{\81[\83\8b\83h\95\\8e¦
990         GikoSys.Setting.ResPopupHeaderBold := ResPopupBoldCheckBox.Checked;
991
992         //\83A\83h\83\8c\83X\83o\81[
993         GikoSys.Setting.URLDisplay := URLDisplayCheckBox.Checked;
994         GikoSys.Setting.AddressBarTabStop := TabStopAddressBarCheckBox.Checked;
995         GikoSys.Setting.LinkAddAddressBar := LinkAddCheckBox.Checked;
996         if GikoSys.IsNumeric(AddressHistoryCountEdit.Text) then
997                 GikoSys.Setting.AddressHistoryCount := StrToInt(AddressHistoryCountEdit.Text)
998         else
999                 GikoSys.Setting.AddressHistoryCount := 100;
1000
1001         //HTML\83v\83\8c\83r\83\85\81[
1002         GikoSys.Setting.PreviewVisible := PreviewVisibleCheckBox.Checked;
1003         if GikoSys.IsNumeric(PreviewWaitEdit.Text) then
1004                 GikoSys.Setting.PreviewWait := StrToInt(PreviewWaitEdit.Text)
1005         else
1006                 GikoSys.Setting.PreviewWait := 500;
1007         case PreviewSizeComboBox.ItemIndex of
1008                 0: GikoSys.Setting.PreviewSize := gpsXSmall;
1009                 1: GikoSys.Setting.PreviewSize := gpsSmall;
1010                 2: GikoSys.Setting.PreviewSize := gpsMedium;
1011                 3: GikoSys.Setting.PreviewSize := gpsLarge;
1012                 4: GikoSys.Setting.PreviewSize := gpsXLarge;
1013         end;
1014
1015         //\83X\83\8c\83b\83h\88ê\97\97\8dX\90V\83A\83C\83R\83\93
1016         GikoSys.Setting.ListIconVisible := ThreadListIconCheckBox.Checked;
1017         GikoSys.Setting.NonAcquiredCount := NonAcquiredCountCheckBox.Checked;
1018     GikoSys.Setting.CreationTimeLogs := CreationTimeLogsCheckBox.Checked;
1019         GikoSys.Setting.FutureThread := FutureThreadCheckBox.Checked;
1020         if StrToIntDef(SelectIntervalEdit.Text, 110) > 55 then
1021                 GikoSys.Setting.SelectInterval := StrToIntDef(SelectIntervalEdit.Text, 110)
1022         else
1023                 GikoSys.Setting.SelectInterval := 55;
1024                 
1025         //\8f\91\82«\8d\9e\82Ý\8e\9e\83}\83V\83\93\8e\9e\8aÔ\8eg\97p\90Ý\92è
1026         GikoSys.Setting.UseMachineTime := PostTimeCheckBox.Checked;
1027         if GikoSys.IsNumeric(PostTimeEdit.Text) then
1028                 GikoSys.Setting.TimeAdjustSec := StrToInt(PostTimeEdit.Text)
1029         else
1030                 GikoSys.Setting.TimeAdjustSec := 0;
1031         GikoSys.Setting.TimeAdjust := PutPostTimeRadioButton.Checked;
1032
1033
1034         GikoSys.Setting.WriteSystemSettingFile;
1035         GikoSys.Setting.WriteBoardURLSettingFile;
1036 //      GikoForm.SetBrowserTabState;
1037
1038         if LogFolderEdit.Text <> '' then begin
1039                 GikoSys.Setting.NewLogFolder := LogFolderEdit.Text;
1040                 GikoSys.Setting.WriteFolderSettingFile;
1041         end;
1042
1043         for i := 0 to SoundListView.Items.Count - 1 do begin
1044                 if FileExists(SoundListView.Items[i].SubItems[0]) then
1045                         GikoSys.Setting.SoundFileName[i] := SoundListView.Items[i].SubItems[0]
1046                 else
1047                         GikoSys.Setting.SoundFileName[i] := '';
1048         end;
1049
1050         //\82 \82Ú\81`\82ñ
1051         GikoSys.Setting.AbonDeleterlo := RloCheckBox.Checked;
1052         GikoSys.Setting.AbonReplaceul := ReplaceulCheckBox.Checked;
1053         GikoSys.Setting.PopUpAbon := PopUpAbonCheckBox.Checked;
1054         GikoSys.Setting.ShowNGLinesNum := ShowNGLineCheckBox.Checked;
1055         GikoSys.Setting.AddResAnchor := AddResAnchorCheckBox.Checked;
1056         GikoSys.Setting.DeleteSyria := DeleteSyriaCheckBox.Checked;
1057
1058         //Tab\8e©\93®\95Û\91
1059         GikoSys.Setting.TabAutoSave := CloseTabAutoSave.Checked;
1060         GikoSys.Setting.TabAutoLoad := OpenTabAutoLoad.Checked;
1061 end;
1062
1063 procedure TOptionDialog.SettingApply;
1064 var
1065         i: Integer;
1066 begin
1067         GikoForm.TreeView.Items.BeginUpdate;
1068         GikoForm.FavoriteTreeView.Items.BeginUpdate;
1069         GikoForm.ListView.Items.BeginUpdate;
1070         try
1071                 GikoForm.TreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1072                 GikoForm.TreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1073                 GikoForm.TreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1074                 GikoForm.TreeView.Color := GikoSys.Setting.CabinetBackColor;
1075
1076                 GikoForm.FavoriteTreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1077                 GikoForm.FavoriteTreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1078                 GikoForm.FavoriteTreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1079                 GikoForm.FavoriteTreeView.Color := GikoSys.Setting.CabinetBackColor;
1080
1081                 GikoForm.ListView.Font.Name := GikoSys.Setting.ListFontName;
1082                 GikoForm.ListView.Font.Size := GikoSys.Setting.ListFontSize;
1083                 GikoForm.ListView.Font.Color := GikoSys.Setting.ListFontColor;
1084                 //GikoForm.ListView.Color := GikoSys.Setting.ListBackColor;
1085                                 GikoForm.ListViewBackGroundColor := GikoSys.Setting.ListBackColor;
1086         GikoForm.UseOddResOddColor := GikoSys.Setting.UseOddColorOddResNum;
1087         GikoForm.OddColor := GikoSys.Setting.OddColor;
1088
1089                 GikoForm.BrowserTab.Font.Name := GikoSys.Setting.BrowserTabFontName;
1090                 GikoForm.BrowserTab.Font.Size := GikoSys.Setting.BrowserTabFontSize;
1091 //              GikoForm.BrowserTab.Height := (GikoSys.Setting.BrowserTabFontSize * 2) + 1;
1092 //              GikoForm.BrowserBottomPanel.Height := GikoForm.BrowserTab.Height;
1093
1094                 for i := 0 to Screen.CustomFormCount - 1 do begin
1095                         if TObject(Screen.CustomForms[i]) is TEditorForm then begin
1096                                 TEditorForm(Screen.CustomForms[i]).SetFont;
1097                         end;
1098                 end;
1099
1100         finally
1101                 GikoForm.TreeView.Items.EndUpdate;
1102                 GikoForm.FavoriteTreeView.Items.EndUpdate;
1103                 GikoForm.ListView.Items.EndUpdate;
1104         end;
1105
1106         //\83A\83h\83\8c\83X\83o\81[
1107         for i := GikoForm.AddressComboBox.Items.Count - 1 downto 0 do begin
1108                 if GikoSys.Setting.AddressHistoryCount >= GikoForm.AddressComboBox.Items.Count then
1109                         Break;
1110                 GikoForm.AddressComboBox.Items.Delete(i);
1111         end;
1112         GikoForm.AddressComboBox.TabStop := GikoSys.Setting.AddressBarTabStop;
1113
1114         // \83X\83\8c\83b\83h\82Ì\83\8a\83t\83\8c\83b\83V\83\85
1115         if FRepaintThread then begin
1116                 for i := GikoForm.BrowserTab.Tabs.Count - 1 downto 0 do begin
1117                         TBrowserRecord(GikoForm.BrowserTab.Tabs.Objects[i]).Repaint := true;
1118                 end;
1119                 GikoForm.BrowserTab.OnChange(nil);
1120         end;
1121 end;
1122
1123 procedure TOptionDialog.ReadProxyCheckClick(Sender: TObject);
1124 begin
1125         ReadProxyAddressEdit.Enabled := ReadProxyCheck.Checked;
1126         ReadPortEdit.Enabled := ReadProxyCheck.Checked;
1127         ReadProxyUserIDEdit.Enabled := ReadProxyCheck.Checked;
1128         ReadProxyPasswordEdit.Enabled := ReadProxyCheck.Checked;
1129
1130         ReadAddressLabel.Enabled := ReadProxyCheck.Checked;
1131         ReadPortLabel.Enabled := ReadProxyCheck.Checked;
1132         ReadUserIDLabel.Enabled := ReadProxyCheck.Checked;
1133         ReadPasswordLabel.Enabled := ReadProxyCheck.Checked;
1134 end;
1135
1136 procedure TOptionDialog.ReadPortEditExit(Sender: TObject);
1137 begin
1138         if not GikoSys.IsNumeric(ReadPortEdit.Text) then
1139                 ReadPortEdit.Text := '0';
1140 end;
1141
1142 procedure TOptionDialog.LogFolderButtonClick(Sender: TObject);
1143 var
1144         Root: WideString;
1145         Dir: string;
1146 begin
1147         Root := '';
1148         if SelectDirectory('\83\8d\83O\83t\83H\83\8b\83_\91I\91ð', Root, Dir) then begin
1149                 LogFolderEdit.Text := Dir;
1150         end;
1151 end;
1152
1153 function TOptionDialog.CheckFolder: Boolean;
1154 begin
1155         if Trim(LogFolderEdit.Text) = '' then
1156                 LogFolderEdit.Text := ExtractFilePath(Application.ExeName) + 'Log';
1157
1158         if DirectoryExists(LogFolderEdit.Text) then begin
1159                 Result := True;
1160         end else begin
1161                 if MsgBox(Handle, '\83\8d\83O\83t\83H\83\8b\83_\82ª\91\8dÝ\82µ\82Ü\82¹\82ñ\81B\8dì\90¬\82µ\82Ü\82·\82©\81H', '\83M\83R\83i\83r', MB_YESNO or MB_ICONQUESTION) = IDYES        then begin
1162                         //\83t\83H\83\8b\83_\82ð\8dì\90¬
1163                         try
1164                                 GikoSys.ForceDirectoriesEx(LogFolderEdit.Text);
1165                                 Result := True
1166                         except
1167                                 MsgBox(Handle, '\83\8d\83O\83t\83H\83\8b\83_\82Ì\8ew\92è\82ª\95s\90³\82Å\82·\81B', '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
1168                                 OptionTab.ActivePage := FolderSheet;
1169                                 LogFolderEdit.SetFocus;
1170                                 Result := False;
1171                         end;
1172                 end else
1173                         Result := False;
1174         end;
1175 end;
1176
1177 procedure TOptionDialog.FormClose(Sender: TObject; var Action: TCloseAction);
1178 begin
1179         if not FClose then
1180                 Action := caNone;
1181         FClose := True;
1182 end;
1183
1184 procedure TOptionDialog.SoundReferButtonClick(Sender: TObject);
1185 begin
1186         OpenDialog.Filter := '\83T\83E\83\93\83h (*.wav)|*.wav|\82·\82×\82Ä\82Ì\83t\83@\83C\83\8b (*.*)|*.*';
1187         sndPlaySound(nil, SND_ASYNC);
1188         if OpenDialog.Execute then begin
1189                 SoundFileEdit.Text := OpenDialog.FileName;
1190         end;
1191 end;
1192
1193 procedure TOptionDialog.SoundPlayButtonClick(Sender: TObject);
1194 begin
1195         if not FileExists(SoundFileEdit.Text) then begin
1196                 MsgBox(Handle, '\91\8dÝ\82µ\82È\82¢\83t\83@\83C\83\8b\82Å\82·', '\83G\83\89\81[', MB_ICONSTOP or MB_OK);
1197                 SoundFileEdit.Text := '';
1198                 Exit;
1199         end;
1200         if not sndPlaySound(PChar(SoundFileEdit.Text), SND_ASYNC or SND_NOSTOP) then begin
1201                 sndPlaySound(nil, SND_ASYNC);
1202         end;
1203 end;
1204
1205 procedure TOptionDialog.SoundListViewChanging(Sender: TObject;
1206         Item: TListItem; Change: TItemChange; var AllowChange: Boolean);
1207 begin
1208         if Item.SubItems.Count > 0 then
1209                 SoundFileEdit.Text := Item.SubItems[0];
1210 end;
1211
1212 procedure TOptionDialog.SoundFileEditChange(Sender: TObject);
1213 var
1214         Item: TListItem;
1215 begin
1216         sndPlaySound(nil, SND_ASYNC);
1217         Item := SoundListView.Selected;
1218         if Item = nil then Exit;
1219
1220         if FileExists(SoundFileEdit.Text) then
1221                 Item.SubItems[0] := SoundFileEdit.Text;
1222         if Trim(SoundFileEdit.Text) = '' then
1223                 Item.SubItems[0] := '';
1224 end;
1225
1226 procedure TOptionDialog.OptionTabChange(Sender: TObject);
1227 begin
1228         sndPlaySound(nil, SND_ASYNC);
1229
1230         if OptionTab.ActivePage = CSSTabSheet then
1231                 CSSPreview;
1232 end;
1233
1234 procedure TOptionDialog.AppFolderButtonClick(Sender: TObject);
1235 begin
1236         OpenDialog.Filter := '\8eÀ\8ds\83t\83@\83C\83\8b (*.exe)|*.exe|\82·\82×\82Ä\82Ì\83t\83@\83C\83\8b (*.*)|*.*';
1237         if OpenDialog.Execute then
1238                 AppFolderEdit.Text := OpenDialog.FileName;
1239 end;
1240
1241 procedure TOptionDialog.WriteProxyCheckClick(Sender: TObject);
1242 begin
1243         WriteProxyAddressEdit.Enabled := WriteProxyCheck.Checked;
1244         WritePortEdit.Enabled := WriteProxyCheck.Checked;
1245         WriteProxyUserIDEdit.Enabled := WriteProxyCheck.Checked;
1246         WriteProxyPasswordEdit.Enabled := WriteProxyCheck.Checked;
1247
1248         WriteAddressLabel.Enabled := WriteProxyCheck.Checked;
1249         WritePortLabel.Enabled := WriteProxyCheck.Checked;
1250         WriteUserIDLabel.Enabled := WriteProxyCheck.Checked;
1251         WritePasswordLabel.Enabled := WriteProxyCheck.Checked;
1252 end;
1253
1254 procedure TOptionDialog.WritePortEditExit(Sender: TObject);
1255 begin
1256         if not GikoSys.IsNumeric(WritePortEdit.Text) then
1257                 WritePortEdit.Text := '0';
1258 end;
1259
1260 procedure TOptionDialog.Tora3URLLabelClick(Sender: TObject);
1261 begin
1262         GikoSys.OpenBrowser(URL_TORA3, gbtAuto);
1263 end;
1264
1265 procedure TOptionDialog.HotKeyEnter(Sender: TObject);
1266 begin
1267         OkBotton.Default := False;
1268         CancelBotton.Cancel := False;
1269 end;
1270
1271 procedure TOptionDialog.HotKeyExit(Sender: TObject);
1272 begin
1273         OkBotton.Default := True;
1274         CancelBotton.Cancel := True;
1275 end;
1276
1277 procedure TOptionDialog.URLAppCheckBoxClick(Sender: TObject);
1278 begin
1279         AppFolderLabel.Enabled := URLAppCheckBox.Checked;
1280         AppFolderEdit.Enabled := URLAppCheckBox.Checked;
1281         AppFolderButton.Enabled := URLAppCheckBox.Checked;
1282 end;
1283
1284 procedure TOptionDialog.AddressHistoryCountEditExit(Sender: TObject);
1285 begin
1286         if not GikoSys.IsNumeric(AddressHistoryCountEdit.Text) then
1287                 AddressHistoryCountEdit.Text := '100';
1288 end;
1289
1290 procedure TOptionDialog.PreviewWaitEditExit(Sender: TObject);
1291 begin
1292         if not GikoSys.IsNumeric(PreviewWaitEdit.Text) then
1293                 PreviewWaitEdit.Text := '500';
1294         if StrToInt(PreviewWaitEdit.Text) < 500 then
1295                 PreviewWaitEdit.Text := '500';
1296         if StrToInt(PreviewWaitEdit.Text) > 9999 then
1297                 PreviewWaitEdit.Text := '9999';
1298 end;
1299
1300 procedure TOptionDialog.RecvBufferSizeExit(Sender: TObject);
1301 begin
1302         if not GikoSys.IsNumeric(RecvBufferSize.Text) then
1303                 RecvBufferSize.Text := '4096';
1304         if StrToInt(RecvBufferSize.Text) < 256 then
1305                 RecvBufferSize.Text := '4096';
1306 end;
1307
1308 procedure TOptionDialog.CSSCheckBoxClick(Sender: TObject);
1309 begin
1310         CSSListLabel.Enabled := CSSCheckBox.Checked;
1311         CSSListView.Enabled := CSSCheckBox.Checked;
1312 end;
1313
1314 procedure TOptionDialog.PostTimeEditExit(Sender: TObject);
1315 begin
1316         if not GikoSys.IsNumeric(PostTimeEdit.Text) then
1317                 PostTimeEdit.Text := '0';
1318 end;
1319
1320 procedure TOptionDialog.PostTimeCheckBoxClick(Sender: TObject);
1321 begin
1322         PostTimeLabel.Enabled := PostTimeCheckBox.Checked;
1323         PostTimeEdit.Enabled := PostTimeCheckBox.Checked;
1324         PutPostTimeRadioButton.Enabled := PostTimeCheckBox.Checked;
1325         BackPostTimeRadioButton.Enabled := PostTimeCheckBox.Checked;
1326 end;
1327 procedure TOptionDialog.SetAbonpropertys;
1328 begin
1329   //\82 \82Ú\81`\82ñ
1330   GikoSys.FAbon.Deleterlo := RloCheckBox.Checked;
1331   GikoSys.FAbon.Replaceul := ReplaceulCheckBox.Checked;
1332   GikoSys.FAbon.AbonPopupRes := PopUpAbonCheckBox.Checked;
1333         GikoSys.FAbon.ReturnNGwordLineNum := ShowNGLineCheckBox.Checked;
1334         GikoSys.FAbon.SetNGResAnchor := AddResAnchorCheckBox.Checked;
1335     GikoSys.FAbon.DeleteSyria := DeleteSyriaCheckBox.Checked;
1336 end;
1337 procedure TOptionDialog.CSSFontButtonClick(Sender: TObject);
1338 begin
1339
1340         FontDialog.Options := [fdAnsiOnly, fdEffects];
1341         FontDialog.Font.Assign(FCSSFont);
1342         if FontDialog.Execute then begin
1343                 FontDialog.Font.Style := FontDialog.Font.Style - [fsUnderline] - [fsStrikeout];
1344                 FCSSFont.Assign(FontDialog.Font);
1345                 //FCSSFont := FontDialog.Font;
1346         end;
1347
1348         CSSPreview;
1349
1350 end;
1351
1352 procedure TOptionDialog.CSSBackColorButtonClick(Sender: TObject);
1353 begin
1354
1355         ColorDialog.Color := FCSSBackColor;
1356         if ColorDialog.Execute then begin
1357                 FCSSBackColor := ColorDialog.Color;
1358         end;
1359
1360         CSSPreview;
1361
1362 end;
1363
1364 procedure TOptionDialog.CSSFontCheckBoxClick(Sender: TObject);
1365 begin
1366
1367         CSSFontButton.Enabled := CSSFontCheckBox.Checked;
1368         CSSPreview;
1369
1370 end;
1371
1372 procedure TOptionDialog.CSSBackColorCheckBoxClick(Sender: TObject);
1373 begin
1374
1375         CSSBackColorButton.Enabled := CSSBackColorCheckBox.Checked;
1376         CSSPreview;
1377
1378 end;
1379
1380 procedure TOptionDialog.CSSSetContent(Content: string);
1381 var
1382         doc : Variant;
1383 begin
1384         if CSSBrowser.Document <> nil then begin
1385                 doc := CSSBrowser.Document;
1386                 doc.open;
1387                                 doc.Clear;
1388                 doc.charset := 'Shift_JIS';
1389                 doc.Write(Content);
1390                 doc.Close;
1391   end;
1392 end;
1393
1394 procedure TOptionDialog.CSSPreview;
1395 var
1396         Board: TBoard;
1397         ThreadItem: TThreadItem;
1398         html: string;
1399         Res: array [0..1] of TResRec;
1400         UserOptionalStyle: string;
1401         i: Integer;
1402         fileName: string;
1403 begin
1404
1405         fileName := GikoSys.Setting.CSSFileName;
1406
1407         GikoSys.Setting.CSSFileName := 'default.css';
1408         if CSSListView.Items.Count > 0 then begin
1409                 try
1410                         if CSSListView.ItemIndex >= 0 then begin
1411                                 if CSSListView.Items[CSSListView.ItemIndex].Data <> nil then
1412                                         GikoSys.Setting.CSSFileName := string( CSSListView.Items[CSSListView.ItemIndex].data )
1413                                 else
1414                                         GikoSys.Setting.CSSFileName := CSSListView.Items[CSSListView.ItemIndex].Caption + '.css';
1415       end;
1416                 except
1417                 end;
1418         end;
1419
1420         Board := TBoard.Create( nil, 'about://sample/' );
1421         ThreadItem := TThreadItem.Create( nil, 'about://sample/test/read.cgi/sample/' );
1422
1423         try
1424                 Board.Title := '\83T\83\93\83v\83\8b\94Â';
1425                 ThreadItem.ParentBoard := Board;
1426                 ThreadItem.AllResCount := High( Res );
1427                 ThreadItem.NewResCount := 1;
1428                 ThreadItem.NewReceive := 2;
1429                 ThreadItem.Title := '\83T\83\93\83v\83\8b\83v\83\8c\83r\83\85\81[';
1430
1431                 Res[0].FName := '\96¼\96³\82µ\82³\82ñ';
1432                 Res[0].FMailTo := 'sage';
1433                 Res[0].FDateTime := 'ID:Sample';
1434                 Res[0].FBody := 'CSS \82Æ\83X\83L\83\93\82Ì\83T\83\93\83v\83\8b';
1435                 Res[1].FName := '\96¼\96³\82µ\82³\82ñ';
1436                 Res[1].FMailTo := 'age';
1437                 Res[1].FDateTime := 'ID:Sample';
1438                 Res[1].FBody := '\83I\83}\83G\83\82\83i\81[';
1439
1440                 // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
1441                 if CSSFontCheckBox.Checked then begin
1442                         i := ColorToRGB( FCSSFont.Color );
1443                         i := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
1444
1445                         UserOptionalStyle := UserOptionalStyle +
1446                                 'font-family:"' + FCSSFont.Name + '";' +
1447                                 'font-size:' + IntToStr( FCSSFont.Size ) + 'pt;' +
1448                                 'color:#' + IntToHex( i, 6 ) + ';';
1449                         if fsBold in FCSSFont.Style then
1450                                 UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;'
1451                         else
1452                                 UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1453                         if fsItalic in FCSSFont.Style then
1454                                 UserOptionalStyle := UserOptionalStyle + 'font-style:italic;'
1455                         else
1456                                 UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1457                 end;
1458                 if CSSBackColorCheckBox.Checked then begin
1459                         i := ColorToRGB( FCSSBackColor );
1460                         i := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
1461
1462                         UserOptionalStyle := UserOptionalStyle +
1463                                 'background-color:#' + IntToHex( i, 6 ) + ';';
1464                 end;
1465
1466                 if FileExists( GikoSys.GetSkinHeaderFileName ) then begin
1467                         html :=
1468                                 GikoSys.LoadFromSkin( GikoSys.GetSkinHeaderFileName, ThreadItem, 0 ) +
1469                                 '<a name="top"></a>' +
1470                                 GikoSys.SkinedRes( GikoSYs.LoadFromSkin( GikoSys.GetSkinResFileName, ThreadItem, 0 ), Res[0], '1' ) +
1471                                 GikoSys.SkinedRes( GikoSYs.LoadFromSkin( GikoSys.GetSkinNewResFileName, ThreadItem, 0 ), Res[1], '2' ) +
1472                                 '<a name="bottom"></a>' +
1473                                 GikoSys.LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, 0 );
1474
1475                         html := StringReplace( html, '</head>',
1476                                 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>', [rfReplaceAll] );
1477                 end else begin
1478                         html :=
1479                                 '<html><head>' +
1480                                 '<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">' +
1481                                 '<title>' + ThreadItem.Title + '</title>' +
1482                                 '<link rel="stylesheet" href="' + GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName + '" type="text/css">' +
1483                                 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' +
1484                                 '</head><body>' +
1485                                 '<div class="title">' + ThreadItem.Title + '</div>';
1486
1487                                 for i := 0 to High( Res ) do
1488                                 begin
1489                                         html := html +
1490                                                 '<div class="header"><span class="no">' + IntToStr( i + 1 ) + '</span>' +
1491                                                 '<span class="name_label"> \96¼\91O\81F </span>' +
1492                                                 '<a class="name_mail" href="mailto:' + Res[i].FMailTo + '">' +
1493                                                 '<b>' + Res[i].FName + '</b></a><span class="mail"> [' + Res[i].FMailTo + ']</span>' +
1494                                                 '<span class="date_label"> \93\8a\8de\93ú\81F</span>' +
1495                                                 '<span class="date"> ' + Res[i].FDateTime+ '</span></div>' +
1496                                                 '<div class="mes">' + Res[i].FBody + ' </div>';
1497                                 end;
1498
1499                                 html := html + '</body></html>';
1500                 end;
1501
1502                 try
1503                         CSSSetContent( html );
1504                 except
1505                 end;
1506
1507         finally
1508                 ThreadItem.Free;
1509                 Board.Free;
1510                 GikoSys.Setting.CSSFileName := fileName;
1511         end;
1512
1513 end;
1514
1515 procedure TOptionDialog.CSSListViewChange(Sender: TObject; Item: TListItem;
1516         Change: TItemChange);
1517 begin
1518
1519         if OptionTab.ActivePage = CSSTabSheet then
1520                 CSSPreview;
1521
1522 end;
1523
1524 procedure TOptionDialog.AddURLButtonClick(Sender: TObject);
1525 begin
1526         BoardURLComboBox.Items.Append(BoardURLComboBox.Text);
1527   BoardURLComboBox.ItemIndex := BoardURLComboBox.Items.Count - 1;
1528 end;
1529
1530 procedure TOptionDialog.RemoveURLButtonClick(Sender: TObject);
1531 begin
1532         BoardURLComboBox.DeleteSelected;
1533 end;
1534
1535 procedure TOptionDialog.OddResNumCheckBoxClick(Sender: TObject);
1536 begin
1537         OddResNumColorBox.Enabled := OddResNumCheckBox.Checked;
1538 end;
1539
1540 procedure TOptionDialog.ResRangeHoldCheckBoxClick(Sender: TObject);
1541 begin
1542         ResRangeHoldComboBox.Enabled := ResRangeHoldCheckBox.Checked;
1543 end;
1544
1545 end.
1546