OSDN Git Service

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