OSDN Git Service

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