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