OSDN Git Service

9ec98e1b8c99bcd6ed192c20f76aece97d34b897
[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 {$IFDEF DEBUG}
821         SpamFilterAlgorithmComboBox.Clear;
822         SpamFilterAlgorithmComboBox.AddItem( '\8eg\97p\82µ\82È\82¢', nil );
823         SpamFilterAlgorithmComboBox.AddItem( 'Paul Graham \96@', nil );
824         SpamFilterAlgorithmComboBox.AddItem( 'Gary Robinson \96@', nil );
825         SpamFilterAlgorithmComboBox.AddItem( 'Gary Robinson-Fisher \96@', nil );
826 {$ENDIF}
827         SpamFilterAlgorithmComboBox.ItemIndex :=
828                 Ord( GikoSys.Setting.SpamFilterAlgorithm );
829
830         //TabAutoLoad
831         TabLoadSave.Checked := Gikosys.Setting.TabAutoLoadSave;
832 end;
833
834 procedure TOptionDialog.SaveSetting;
835 var
836         i: Integer;
837         tmp: string;
838 //      Item: TListItem;
839 begin
840         GikoSys.Setting.OptionDialogTabIndex := OptionTab.TabIndex;
841
842         GikoSys.Setting.ReadProxy := ReadProxyCheck.Checked;
843         GikoSys.Setting.ReadProxyAddress := ReadProxyAddressEdit.Text;
844         GikoSys.Setting.ReadProxyPort := StrToInt(ReadPortEdit.Text);
845         GikoSys.Setting.ReadProxyUserID := ReadProxyUserIDEdit.Text;
846         GikoSys.Setting.ReadProxyPassword := ReadProxyPasswordEdit.Text;
847
848         GikoSys.Setting.WriteProxy := WriteProxyCheck.Checked;
849         GikoSys.Setting.WriteProxyAddress := WriteProxyAddressEdit.Text;
850         GikoSys.Setting.WriteProxyPort := StrToInt(WritePortEdit.Text);
851         GikoSys.Setting.WriteProxyUserID := WriteProxyUserIDEdit.Text;
852         GikoSys.Setting.WriteProxyPassword := WriteProxyPasswordEdit.Text;
853
854         GikoSys.Setting.CabinetFontName := CabinetMemo.Font.Name;
855         GikoSys.Setting.CabinetFontSize := CabinetMemo.Font.Size;
856         GikoSys.Setting.CabinetFontColor := CabinetMemo.Font.Color;
857         GikoSys.Setting.CabinetFontBold  := fsBold in CabinetMemo.Font.Style;
858         GikoSys.Setting.CabinetFontItalic:= fsItalic in CabinetMemo.Font.Style;
859         GikoSys.Setting.CabinetBackColor := CabinetMemo.Color;
860
861         GikoSys.Setting.ListFontName    := ListMemo.Font.Name;
862         GikoSys.Setting.ListFontSize    := ListMemo.Font.Size;
863         GikoSys.Setting.ListFontColor   := ListMemo.Font.Color;
864         GikoSys.Setting.ListFontBold    := fsBold in ListMemo.Font.Style;
865         GikoSys.Setting.ListFontItalic  := fsItalic in ListMemo.Font.Style;
866         GikoSys.Setting.ListBackColor := ListMemo.Color;
867         GikoSys.Setting.UseOddColorOddResNum := OddResNumCheckBox.Checked;
868         GikoSys.Setting.OddColor := OddResNumColorBox.Selected;
869
870         GikoSys.Setting.HintFontName := HintMemo.Font.Name;
871         GikoSys.Setting.HintFontSize := HintMemo.Font.Size;
872         GikoSys.Setting.HintFontColor := HintMemo.Font.Color;
873         GikoSys.Setting.HintBackColor := HintMemo.Color;
874
875         GikoSys.Setting.BrowserTabFontName := BrowserTabMemo.Font.Name;
876         GikoSys.Setting.BrowserTabFontSize := BrowserTabMemo.Font.Size;
877         GikoSys.Setting.BrowserTabFontBold := fsBold in BrowserTabMemo.Font.Style;
878         GikoSys.Setting.BrowserTabFontItalic := fsItalic in BrowserTabMemo.Font.Style;
879         GikoSys.Setting.EditorFontName := EditorMemo.Font.Name;
880         GikoSys.Setting.EditorFontSize := EditorMemo.Font.Size;
881         GikoSys.Setting.EditorFontColor := EditorMemo.Font.Color;
882         GikoSys.Setting.EditorBackColor := EditorMemo.Color;
883         {FRepaintThread : \95\\8e¦\8dÏ\82Ý\83X\83\8c\83b\83h\82Ì\8dÄ\95`\89æ\82ª\95K\97v\82©\82Ç\82¤\82©
884         \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Ì
885         \83X\83\8c\83b\83h\82ÌRepaint\82ðtrue\82É\82·\82é
886         }
887         //CSS\95\\8e¦
888         if GikoSys.Setting.UseCSS <> CSSCheckBox.Checked then FRepaintThread := true;
889         GikoSys.Setting.UseCSS := CSSCheckBox.Checked;
890         //CSS\83t\83@\83C\83\8b\96¼
891         tmp := GikoSys.Setting.CSSFileName;
892         GikoSys.Setting.CSSFileName := 'default.css';
893         if CSSListView.Items.Count > 0 then begin
894                 try
895                         if CSSListView.Items[CSSListView.ItemIndex].Data <> nil then
896                                 GikoSys.Setting.CSSFileName := string( CSSListView.Items[CSSListView.ItemIndex].data )
897                         else
898                                 GikoSys.Setting.CSSFileName := CSSListView.Items[CSSListView.ItemIndex].Caption + '.css';
899                 except
900                 end;
901         end;
902         if tmp <> GikoSys.Setting.CSSFileName then FRepaintThread := true;
903         // CSS \82Ì\83t\83H\83\93\83g\8ew\92è
904         if CSSFontCheckBox.Checked then begin
905                 if GikoSys.Setting.BrowserFontName <> FCSSFont.Name then FRepaintThread := true;
906                 GikoSys.Setting.BrowserFontName := FCSSFont.Name;
907                 if GikoSys.Setting.BrowserFontSize <> FCSSFont.Size then FRepaintThread := true;
908                 GikoSys.Setting.BrowserFontSize := FCSSFont.Size;
909                 if fsBold in FCSSFont.Style then begin
910                         if GikoSys.Setting.BrowserFontBold <> 1 then FRepaintThread := true;
911                         GikoSys.Setting.BrowserFontBold := 1;
912                 end else begin
913                         if GikoSys.Setting.BrowserFontBold <> -1 then FRepaintThread := true;
914                         GikoSys.Setting.BrowserFontBold := -1;
915                 end;
916                 if fsItalic in FCSSFont.Style then begin
917                         if GikoSys.Setting.BrowserFontItalic <> 1 then FRepaintThread := true;
918                         GikoSys.Setting.BrowserFontItalic := 1;
919                 end else begin
920                         if GikoSys.Setting.BrowserFontItalic <> -1 then FRepaintThread := true;
921                         GikoSys.Setting.BrowserFontItalic := -1;
922                 end;
923                 i := ColorToRGB( FCSSFont.Color );
924                 if (GikoSys.Setting.BrowserFontColor <> (i shr 16) or (i and $ff00) or ((i and $ff) shl 16)) then
925                         FRepaintThread := true;
926                 GikoSys.Setting.BrowserFontColor := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
927         end else begin
928                 if GikoSys.Setting.BrowserFontName <> '' then FRepaintThread := true;
929                 GikoSys.Setting.BrowserFontName := '';
930                 if GikoSys.Setting.BrowserFontSize <> 0 then FRepaintThread := true;
931                 GikoSys.Setting.BrowserFontSize := 0;
932                 if GikoSys.Setting.BrowserFontBold <> 0 then FRepaintThread := true;
933                 GikoSys.Setting.BrowserFontBold := 0;
934                 if GikoSys.Setting.BrowserFontItalic <> 0 then FRepaintThread := true;
935                 GikoSys.Setting.BrowserFontItalic := 0;
936                 if GikoSys.Setting.BrowserFontColor <> -1 then FRepaintThread := true;
937                 GikoSys.Setting.BrowserFontColor := -1;
938         end;
939         if CSSBackColorCheckBox.Checked then begin
940                 i := ColorToRGB( FCSSBackColor );
941                 if(GikoSys.Setting.BrowserBackColor <> (i shr 16) or (i and $ff00) or ((i and $ff) shl 16)) then
942                         FRepaintThread := true;
943                 GikoSys.Setting.BrowserBackColor := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
944         end else begin
945                 if GikoSys.Setting.BrowserBackColor <> -1 then FRepaintThread := true;
946                 GikoSys.Setting.BrowserBackColor := -1;
947         end;
948
949         //Mail\97\93\95\\8e¦
950         if GikoSys.Setting.ShowMail <> ShowMailCheckBox.Checked then FRepaintThread := true;
951         GikoSys.Setting.ShowMail := ShowMailCheckBox.Checked;
952         // \8bN\93®\8e\9e\83\8c\83X\95\\8e¦\94Í\88Í\82Ì\8cÅ\92è
953         GikoSys.Setting.ResRangeHold := ResRangeHoldCheckBox.Checked;
954         case ResRangeHoldComboBox.ItemIndex of
955         0: GikoSys.Setting.ResRange := Ord( grrAll );
956         1: GikoSys.Setting.ResRange := 100;
957         2: GikoSys.Setting.ResRange := Ord( grrKoko );
958         3: GikoSys.Setting.ResRange := Ord( grrNew );
959         end;
960
961         GikoSys.Setting.BrowserTabAppend := TGikoTabAppend(TabAddRadioGroup.ItemIndex);
962
963 //      GikoSys.Setting.BoardURL2ch := BoardURL2chEdit.Text;
964         GikoSys.Setting.BoardURLs.Clear;
965         GikoSys.Setting.BoardURLs.AddStrings(BoardURLComboBox.Items);
966         GikoSys.Setting.BoardURLSelected := BoardURLComboBox.ItemIndex + 1;
967         GikoSys.Setting.UserID := UserIDEdit.Text;
968         GikoSys.Setting.Password := PasswordEdit.Text;
969         GikoSys.Setting.AutoLogin := AutoLoginCheckBox.Checked;
970         GikoSys.Setting.ForcedLogin := ForcedLoginCheckBox.Checked;
971         GikoSys.Setting.URLApp := URLAppCheckBox.Checked;
972         GikoSys.Setting.URLAppFile := AppFolderEdit.Text;
973
974         GikoSys.Setting.OpenMailer := OpenMailerCheckBox.Checked;
975         GikoSys.Setting.DeleteMsg := LogDeleteMessageCheckBox.Checked;
976         //\8fI\97¹\8e\9e\8am\94F\83_\83C\83A\83\8d\83O
977         GikoSys.Setting.ShowDialogForEnd := ShowDialogForEndCheckBox.Checked;
978         //AllTabClose
979         GikoSys.Setting.ShowDialogForAllTabClose := AllTabCloseCheckBox.Checked;
980     //Samba
981         GikoSys.Setting.UseSamba := UseSambaCheckBox.Checked;
982         GikoSys.Setting.ResAnchorJamp := ResAnchorCheckBox.Checked;
983         // \83u\83\89\83E\83U\8dÅ\91å\89»
984         GikoSys.Setting.BrowserAutoMaximize := TGikoBrowserAutoMaximize( BrowserMaxCombo.ItemIndex );
985         //\83|\83b\83v\83A\83b\83v\88Ê\92u
986         case PopupPositionRadioGroup.ItemIndex of
987                 0: GikoSys.Setting.PopupPosition := gppRightTop;
988                 1: GikoSys.Setting.PopupPosition := gppRight;
989                 2: GikoSys.Setting.PopupPosition := gppRightBottom;
990                 3: GikoSys.Setting.PopupPosition := gppTop;
991                 4: GikoSys.Setting.PopupPosition := gppCenter;
992                 5: GikoSys.Setting.PopupPosition := gppBottom;
993                 6: GikoSys.Setting.PopupPosition := gppLeftTop;
994                 7: GikoSys.Setting.PopupPosition := gppLeft;
995                 8: GikoSys.Setting.PopupPosition := gppLeftBottom;
996         end;
997
998         //\94ñ\83A\83N\83e\83B\83u\8e\9e\83|\83b\83v\83A\83b\83v\95\\8e¦
999         GikoSys.Setting.UnActivePopup := UnActivePopupCheckBox.Checked;
1000         //\83\8c\83X\83|\83b\83v\83A\83b\83v\83{\81[\83\8b\83h\95\\8e¦
1001         GikoSys.Setting.ResPopupHeaderBold := ResPopupBoldCheckBox.Checked;
1002
1003         //\83A\83h\83\8c\83X\83o\81[
1004         GikoSys.Setting.URLDisplay := URLDisplayCheckBox.Checked;
1005         GikoSys.Setting.AddressBarTabStop := TabStopAddressBarCheckBox.Checked;
1006         GikoSys.Setting.LinkAddAddressBar := LinkAddCheckBox.Checked;
1007         if GikoSys.IsNumeric(AddressHistoryCountEdit.Text) then
1008                 GikoSys.Setting.AddressHistoryCount := StrToInt(AddressHistoryCountEdit.Text)
1009         else
1010                 GikoSys.Setting.AddressHistoryCount := 100;
1011
1012         //HTML\83v\83\8c\83r\83\85\81[
1013         GikoSys.Setting.PreviewVisible := PreviewVisibleCheckBox.Checked;
1014         if GikoSys.IsNumeric(PreviewWaitEdit.Text) then
1015                 GikoSys.Setting.PreviewWait := StrToInt(PreviewWaitEdit.Text)
1016         else
1017                 GikoSys.Setting.PreviewWait := 500;
1018         case PreviewSizeComboBox.ItemIndex of
1019                 0: GikoSys.Setting.PreviewSize := gpsXSmall;
1020                 1: GikoSys.Setting.PreviewSize := gpsSmall;
1021                 2: GikoSys.Setting.PreviewSize := gpsMedium;
1022                 3: GikoSys.Setting.PreviewSize := gpsLarge;
1023                 4: GikoSys.Setting.PreviewSize := gpsXLarge;
1024         end;
1025
1026         //\83X\83\8c\83b\83h\88ê\97\97\8dX\90V\83A\83C\83R\83\93
1027         GikoSys.Setting.ListIconVisible := ThreadListIconCheckBox.Checked;
1028
1029         GikoSys.Setting.CreationTimeLogs := CreationTimeLogsCheckBox.Checked;
1030         GikoSys.Setting.FutureThread := FutureThreadCheckBox.Checked;
1031         if StrToIntDef(SelectIntervalEdit.Text, 110) > 55 then
1032                 GikoSys.Setting.SelectInterval := StrToIntDef(SelectIntervalEdit.Text, 110)
1033         else
1034                 GikoSys.Setting.SelectInterval := 55;
1035
1036         //dat\97\8e\82¿\83X\83\8c\83\\81[\83g\8f\87
1037         case DatOchiSortCombo.ItemIndex of
1038                 0: GikoSys.Setting.DatOchiSortIndex := -1;      //\95À\82Ñ\91Ö\82¦\82µ\82È\82¢
1039                 1: begin        //\83X\83\8c\94Ô\8d\86(\8f¸\8f\87)
1040                         GikoSys.Setting.DatOchiSortOrder := true;
1041                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcTitle );
1042                    end;
1043                 2: begin        //\83X\83\8c\94Ô\8d\86(\8d~\8f\87)
1044                         GikoSys.Setting.DatOchiSortOrder := false;
1045                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcTitle );
1046                    end;
1047                 3: begin        //\8eæ\93¾\93ú\8e\9e(\8f¸\8f\87)
1048                         GikoSys.Setting.DatOchiSortOrder := true;
1049                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcRoundDate );{gbcLastModified}
1050                    end;
1051                 4: begin        //\8eæ\93¾\93ú\8e\9e(\8d~\8f\87)
1052                         GikoSys.Setting.DatOchiSortOrder := false;
1053                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcRoundDate );{gbcLastModified}
1054                    end;
1055                 5: begin        //\83X\83\8c\8dì\90¬\93ú\8e\9e(\8f¸\8f\87)
1056                         GikoSys.Setting.DatOchiSortOrder := true;
1057                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcCreated );
1058                    end;
1059                 6: begin        //\83X\83\8c\8dì\90¬\93ú\8e\9e(\8d~\8f\87)
1060                         GikoSys.Setting.DatOchiSortOrder := false;
1061                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcCreated );
1062                    end;
1063                 7:      begin  //\83X\83\8c\8dÅ\8fI\8dX\90V\93ú\8e\9e\81i\8f¸\8f\87\81j
1064                         GikoSys.Setting.DatOchiSortOrder := true;
1065                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcLastModified );{gbcLastModified}
1066                         end;
1067                 8:      begin  //\83X\83\8c\8dÅ\8fI\8dX\90V\93ú\8e\9e\81i\8d~\8f\87\81j
1068                         GikoSys.Setting.DatOchiSortOrder := false;
1069                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcLastModified );{gbcLastModified}
1070                         end;
1071         end;
1072
1073         GikoSys.Setting.WriteSystemSettingFile;
1074         GikoSys.Setting.WriteBoardURLSettingFile;
1075 //      GikoForm.SetBrowserTabState;
1076
1077         if LogFolderEdit.Text <> '' then begin
1078                 GikoSys.Setting.NewLogFolder := LogFolderEdit.Text;
1079                 GikoSys.Setting.WriteFolderSettingFile;
1080         end;
1081
1082         for i := 0 to SoundListView.Items.Count - 1 do begin
1083                 if FileExists(SoundListView.Items[i].SubItems[0]) then
1084                         GikoSys.Setting.SoundFileName[i] := SoundListView.Items[i].SubItems[0]
1085                 else
1086                         GikoSys.Setting.SoundFileName[i] := '';
1087         end;
1088
1089         //\82 \82Ú\81`\82ñ
1090         GikoSys.Setting.AbonDeleterlo := RloCheckBox.Checked;
1091         GikoSys.Setting.AbonReplaceul := ReplaceulCheckBox.Checked;
1092         GikoSys.Setting.PopUpAbon := PopUpAbonCheckBox.Checked;
1093         GikoSys.Setting.ShowNGLinesNum := ShowNGLineCheckBox.Checked;
1094         GikoSys.Setting.AddResAnchor := AddResAnchorCheckBox.Checked;
1095                                 GikoSys.Setting.DeleteSyria := DeleteSyriaCheckBox.Checked;
1096         // \8eg\97p\82·\82é\83X\83p\83\80\83t\83B\83\8b\83^
1097         if GikoSys.Setting.SpamFilterAlgorithm <> TGikoSpamFilterAlgorithm(
1098                 SpamFilterAlgorithmComboBox.ItemIndex ) then begin
1099                 GikoSys.Setting.SpamFilterAlgorithm := TGikoSpamFilterAlgorithm(
1100                         SpamFilterAlgorithmComboBox.ItemIndex );
1101                 FRepaintThread := True;
1102         end;
1103
1104         //Tab\8e©\93®\95Û\91
1105         GikoSys.Setting.TabAutoLoadSave := TabLoadSave.Checked;
1106 end;
1107
1108 procedure TOptionDialog.SettingApply;
1109 var
1110         i: Integer;
1111 begin
1112         GikoForm.TreeView.Items.BeginUpdate;
1113         GikoForm.FavoriteTreeView.Items.BeginUpdate;
1114         GikoForm.ListView.Items.BeginUpdate;
1115         try
1116                 GikoForm.TreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1117                 GikoForm.TreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1118                 GikoForm.TreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1119                 GikoForm.TreeView.Color := GikoSys.Setting.CabinetBackColor;
1120
1121                 {GikoForm.TreeView.Font.Style := [];
1122                 if GikoSys.Setting.CabinetFontBold then
1123                         GikoForm.TreeView.Font.Style := [fsBold];
1124                 if GikoSys.Setting.CabinetFontItalic then
1125                         GikoForm.TreeView.Font.Style := GikoForm.TreeView.Font.Style + [fsItalic];
1126                 }
1127                 {GikoForm.FavoriteTreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1128                 GikoForm.FavoriteTreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1129                 GikoForm.FavoriteTreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1130                 }
1131                 GikoForm.FavoriteTreeView.Font.Assign(GikoForm.TreeView.Font);
1132                 GikoForm.FavoriteTreeView.Color := GikoSys.Setting.CabinetBackColor;
1133
1134                 GikoForm.ListView.Font.Name := GikoSys.Setting.ListFontName;
1135                 GikoForm.ListView.Font.Size := GikoSys.Setting.ListFontSize;
1136                 GikoForm.ListView.Font.Color := GikoSys.Setting.ListFontColor;
1137                 GikoForm.ListView.Font.Style := [];
1138                 if GikoSys.Setting.ListFontBold then
1139                         GikoForm.ListView.Font.Style := [fsbold];
1140                 if GikoSys.Setting.ListFontItalic then
1141                         GikoForm.ListView.Font.Style := GikoForm.ListView.Font.Style + [fsitalic];
1142
1143                 //GikoForm.ListView.Color := GikoSys.Setting.ListBackColor;
1144                 GikoForm.ListViewBackGroundColor := GikoSys.Setting.ListBackColor;
1145         GikoForm.UseOddResOddColor := GikoSys.Setting.UseOddColorOddResNum;
1146         GikoForm.OddColor := GikoSys.Setting.OddColor;
1147
1148                 GikoForm.BrowserTab.Font.Name := GikoSys.Setting.BrowserTabFontName;
1149                 GikoForm.BrowserTab.Font.Size := GikoSys.Setting.BrowserTabFontSize;
1150                 GikoForm.BrowserTab.Font.Style := [];
1151                 if GikoSys.Setting.BrowserTabFontBold then
1152                         GikoForm.BrowserTab.Font.Style := [fsBold];
1153                 if GikoSys.Setting.BrowserTabFontItalic then
1154                         GikoForm.BrowserTab.Font.Style := GikoForm.BrowserTab.Font.Style + [fsItalic];
1155 //              GikoForm.BrowserTab.Height := (GikoSys.Setting.BrowserTabFontSize * 2) + 1;
1156 //              GikoForm.BrowserBottomPanel.Height := GikoForm.BrowserTab.Height;
1157
1158                 for i := 0 to Screen.CustomFormCount - 1 do begin
1159                         if TObject(Screen.CustomForms[i]) is TEditorForm then begin
1160                                 TEditorForm(Screen.CustomForms[i]).SetFont;
1161                         end;
1162                 end;
1163
1164         finally
1165                 GikoForm.TreeView.Items.EndUpdate;
1166                 GikoForm.FavoriteTreeView.Items.EndUpdate;
1167                 GikoForm.ListView.Items.EndUpdate;
1168         end;
1169
1170         //\83A\83h\83\8c\83X\83o\81[
1171         for i := GikoForm.AddressComboBox.Items.Count - 1 downto 0 do begin
1172                 if GikoSys.Setting.AddressHistoryCount >= GikoForm.AddressComboBox.Items.Count then
1173                         Break;
1174                 GikoForm.AddressComboBox.Items.Delete(i);
1175         end;
1176         GikoForm.AddressComboBox.TabStop := GikoSys.Setting.AddressBarTabStop;
1177
1178         //\83X\83\8c\88ê\97\97\82Ì\83\8a\83t\83\8c\83b\83V\83\85
1179         if FRepaintList then begin
1180                 // SetActiveList\82ð\8eÀ\8ds
1181                 GikoForm.ActiveList := GikoForm.ActiveList;
1182         end;
1183
1184         // \83X\83\8c\83b\83h\82Ì\83\8a\83t\83\8c\83b\83V\83\85
1185         if FRepaintThread then begin
1186                 for i := GikoForm.BrowserTab.Tabs.Count - 1 downto 0 do begin
1187                         TBrowserRecord(GikoForm.BrowserTab.Tabs.Objects[i]).Repaint := true;
1188                 end;
1189                 GikoForm.BrowserTab.OnChange(nil);
1190         end;
1191 end;
1192
1193 procedure TOptionDialog.ReadProxyCheckClick(Sender: TObject);
1194 begin
1195         ReadProxyAddressEdit.Enabled := ReadProxyCheck.Checked;
1196         ReadPortEdit.Enabled := ReadProxyCheck.Checked;
1197         ReadProxyUserIDEdit.Enabled := ReadProxyCheck.Checked;
1198         ReadProxyPasswordEdit.Enabled := ReadProxyCheck.Checked;
1199
1200         ReadAddressLabel.Enabled := ReadProxyCheck.Checked;
1201         ReadPortLabel.Enabled := ReadProxyCheck.Checked;
1202         ReadUserIDLabel.Enabled := ReadProxyCheck.Checked;
1203         ReadPasswordLabel.Enabled := ReadProxyCheck.Checked;
1204 end;
1205
1206 procedure TOptionDialog.ReadPortEditExit(Sender: TObject);
1207 begin
1208         if not GikoSys.IsNumeric(ReadPortEdit.Text) then
1209                 ReadPortEdit.Text := '0';
1210 end;
1211
1212 procedure TOptionDialog.LogFolderButtonClick(Sender: TObject);
1213 var
1214         Root: WideString;
1215         Dir: string;
1216 begin
1217         Root := '';
1218         if SelectDirectory('\83\8d\83O\83t\83H\83\8b\83_\91I\91ð', Root, Dir) then begin
1219                 LogFolderEdit.Text := Dir;
1220         end;
1221 end;
1222
1223 function TOptionDialog.CheckFolder: Boolean;
1224 begin
1225         if Trim(LogFolderEdit.Text) = '' then
1226                 LogFolderEdit.Text := ExtractFilePath(Application.ExeName) + 'Log';
1227
1228         if DirectoryExists(LogFolderEdit.Text) then begin
1229                 Result := True;
1230         end else begin
1231                 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
1232                         //\83t\83H\83\8b\83_\82ð\8dì\90¬
1233                         try
1234                                 GikoSys.ForceDirectoriesEx(LogFolderEdit.Text);
1235                                 Result := True
1236                         except
1237                                 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);
1238                                 OptionTab.ActivePage := FolderSheet;
1239                                 LogFolderEdit.SetFocus;
1240                                 Result := False;
1241                         end;
1242                 end else
1243                         Result := False;
1244         end;
1245 end;
1246
1247 procedure TOptionDialog.FormClose(Sender: TObject; var Action: TCloseAction);
1248 begin
1249         if not FClose then
1250                 Action := caNone;
1251         FClose := True;
1252 end;
1253
1254 procedure TOptionDialog.SoundReferButtonClick(Sender: TObject);
1255 begin
1256         OpenDialog.Filter := '\83T\83E\83\93\83h (*.wav)|*.wav|\82·\82×\82Ä\82Ì\83t\83@\83C\83\8b (*.*)|*.*';
1257         sndPlaySound(nil, SND_ASYNC);
1258         if OpenDialog.Execute then begin
1259                 SoundFileEdit.Text := OpenDialog.FileName;
1260         end;
1261 end;
1262
1263 procedure TOptionDialog.SoundPlayButtonClick(Sender: TObject);
1264 begin
1265         if not FileExists(SoundFileEdit.Text) then begin
1266                 MsgBox(Handle, '\91\8dÝ\82µ\82È\82¢\83t\83@\83C\83\8b\82Å\82·', '\83G\83\89\81[', MB_ICONSTOP or MB_OK);
1267                 SoundFileEdit.Text := '';
1268                 Exit;
1269         end;
1270         if not sndPlaySound(PChar(SoundFileEdit.Text), SND_ASYNC or SND_NOSTOP) then begin
1271                 sndPlaySound(nil, SND_ASYNC);
1272         end;
1273 end;
1274
1275 procedure TOptionDialog.SoundListViewChanging(Sender: TObject;
1276         Item: TListItem; Change: TItemChange; var AllowChange: Boolean);
1277 begin
1278         if Item.SubItems.Count > 0 then
1279                 SoundFileEdit.Text := Item.SubItems[0];
1280 end;
1281
1282 procedure TOptionDialog.SoundFileEditChange(Sender: TObject);
1283 var
1284         Item: TListItem;
1285 begin
1286         sndPlaySound(nil, SND_ASYNC);
1287         Item := SoundListView.Selected;
1288         if Item = nil then Exit;
1289
1290         if FileExists(SoundFileEdit.Text) then
1291                 Item.SubItems[0] := SoundFileEdit.Text;
1292         if Trim(SoundFileEdit.Text) = '' then
1293                 Item.SubItems[0] := '';
1294 end;
1295
1296 procedure TOptionDialog.OptionTabChange(Sender: TObject);
1297 begin
1298         sndPlaySound(nil, SND_ASYNC);
1299
1300         if OptionTab.ActivePage = CSSTabSheet then
1301                 CSSPreview;
1302 end;
1303
1304 procedure TOptionDialog.AppFolderButtonClick(Sender: TObject);
1305 begin
1306         OpenDialog.Filter := '\8eÀ\8ds\83t\83@\83C\83\8b (*.exe)|*.exe|\82·\82×\82Ä\82Ì\83t\83@\83C\83\8b (*.*)|*.*';
1307         if OpenDialog.Execute then
1308                 AppFolderEdit.Text := OpenDialog.FileName;
1309 end;
1310
1311 procedure TOptionDialog.WriteProxyCheckClick(Sender: TObject);
1312 begin
1313         WriteProxyAddressEdit.Enabled := WriteProxyCheck.Checked;
1314         WritePortEdit.Enabled := WriteProxyCheck.Checked;
1315         WriteProxyUserIDEdit.Enabled := WriteProxyCheck.Checked;
1316         WriteProxyPasswordEdit.Enabled := WriteProxyCheck.Checked;
1317
1318         WriteAddressLabel.Enabled := WriteProxyCheck.Checked;
1319         WritePortLabel.Enabled := WriteProxyCheck.Checked;
1320         WriteUserIDLabel.Enabled := WriteProxyCheck.Checked;
1321         WritePasswordLabel.Enabled := WriteProxyCheck.Checked;
1322 end;
1323
1324 procedure TOptionDialog.WritePortEditExit(Sender: TObject);
1325 begin
1326         if not GikoSys.IsNumeric(WritePortEdit.Text) then
1327                 WritePortEdit.Text := '0';
1328 end;
1329
1330 procedure TOptionDialog.Tora3URLLabelClick(Sender: TObject);
1331 begin
1332         GikoSys.OpenBrowser(URL_TORA3, gbtAuto);
1333 end;
1334
1335 procedure TOptionDialog.HotKeyEnter(Sender: TObject);
1336 begin
1337         OkBotton.Default := False;
1338         CancelBotton.Cancel := False;
1339 end;
1340
1341 procedure TOptionDialog.HotKeyExit(Sender: TObject);
1342 begin
1343         OkBotton.Default := True;
1344         CancelBotton.Cancel := True;
1345 end;
1346
1347 procedure TOptionDialog.URLAppCheckBoxClick(Sender: TObject);
1348 begin
1349         AppFolderLabel.Enabled := URLAppCheckBox.Checked;
1350         AppFolderEdit.Enabled := URLAppCheckBox.Checked;
1351         AppFolderButton.Enabled := URLAppCheckBox.Checked;
1352 end;
1353
1354 procedure TOptionDialog.AddressHistoryCountEditExit(Sender: TObject);
1355 begin
1356         if not GikoSys.IsNumeric(AddressHistoryCountEdit.Text) then
1357                 AddressHistoryCountEdit.Text := '100';
1358 end;
1359
1360 procedure TOptionDialog.PreviewWaitEditExit(Sender: TObject);
1361 begin
1362         if not GikoSys.IsNumeric(PreviewWaitEdit.Text) then
1363                 PreviewWaitEdit.Text := '500';
1364         if StrToInt(PreviewWaitEdit.Text) < 500 then
1365                 PreviewWaitEdit.Text := '500';
1366         if StrToInt(PreviewWaitEdit.Text) > 9999 then
1367                 PreviewWaitEdit.Text := '9999';
1368 end;
1369
1370 procedure TOptionDialog.CSSCheckBoxClick(Sender: TObject);
1371 begin
1372         CSSListLabel.Enabled := CSSCheckBox.Checked;
1373         CSSListView.Enabled := CSSCheckBox.Checked;
1374 end;
1375
1376 procedure TOptionDialog.SetAbonpropertys;
1377 begin
1378   //\82 \82Ú\81`\82ñ
1379   GikoSys.FAbon.Deleterlo := RloCheckBox.Checked;
1380   GikoSys.FAbon.Replaceul := ReplaceulCheckBox.Checked;
1381   GikoSys.FAbon.AbonPopupRes := PopUpAbonCheckBox.Checked;
1382         GikoSys.FAbon.ReturnNGwordLineNum := ShowNGLineCheckBox.Checked;
1383         GikoSys.FAbon.SetNGResAnchor := AddResAnchorCheckBox.Checked;
1384     GikoSys.FAbon.DeleteSyria := DeleteSyriaCheckBox.Checked;
1385 end;
1386 procedure TOptionDialog.CSSFontButtonClick(Sender: TObject);
1387 begin
1388
1389         FontDialog.Options := [fdAnsiOnly, fdEffects];
1390         FontDialog.Font.Assign(FCSSFont);
1391         if FontDialog.Execute then begin
1392                 FontDialog.Font.Style := FontDialog.Font.Style - [fsUnderline] - [fsStrikeout];
1393                 FCSSFont.Assign(FontDialog.Font);
1394                 //FCSSFont := FontDialog.Font;
1395         end;
1396
1397         CSSPreview;
1398
1399 end;
1400
1401 procedure TOptionDialog.CSSBackColorButtonClick(Sender: TObject);
1402 begin
1403
1404         ColorDialog.Color := FCSSBackColor;
1405         if ColorDialog.Execute then begin
1406                 FCSSBackColor := ColorDialog.Color;
1407         end;
1408
1409         CSSPreview;
1410
1411 end;
1412
1413 procedure TOptionDialog.CSSFontCheckBoxClick(Sender: TObject);
1414 begin
1415
1416         CSSFontButton.Enabled := CSSFontCheckBox.Checked;
1417         CSSPreview;
1418
1419 end;
1420
1421 procedure TOptionDialog.CSSBackColorCheckBoxClick(Sender: TObject);
1422 begin
1423
1424         CSSBackColorButton.Enabled := CSSBackColorCheckBox.Checked;
1425         CSSPreview;
1426
1427 end;
1428
1429 procedure TOptionDialog.CSSSetContent(Content: string);
1430 var
1431         doc : Variant;
1432 begin
1433         if CSSBrowser.Document <> nil then begin
1434                 doc := CSSBrowser.Document;
1435                 doc.open;
1436                                 doc.Clear;
1437                 doc.charset := 'Shift_JIS';
1438                 doc.Write(Content);
1439                 doc.Close;
1440   end;
1441 end;
1442
1443 procedure TOptionDialog.CSSPreview;
1444 var
1445         Board: TBoard;
1446         ThreadItem: TThreadItem;
1447         html: string;
1448         Res: array [0..1] of TResRec;
1449         UserOptionalStyle: string;
1450         i: Integer;
1451         fileName: string;
1452 begin
1453
1454         fileName := GikoSys.Setting.CSSFileName;
1455
1456         GikoSys.Setting.CSSFileName := 'default.css';
1457         if CSSListView.Items.Count > 0 then begin
1458                 try
1459                         if CSSListView.ItemIndex >= 0 then begin
1460                                 if CSSListView.Items[CSSListView.ItemIndex].Data <> nil then
1461                                         GikoSys.Setting.CSSFileName := string( CSSListView.Items[CSSListView.ItemIndex].data )
1462                                 else
1463                                         GikoSys.Setting.CSSFileName := CSSListView.Items[CSSListView.ItemIndex].Caption + '.css';
1464       end;
1465                 except
1466                 end;
1467         end;
1468
1469         Board := TBoard.Create( nil, 'about://sample/' );
1470         ThreadItem := TThreadItem.Create( nil, 'about://sample/test/read.cgi/sample/' );
1471
1472         try
1473                 Board.Title := '\83T\83\93\83v\83\8b\94Â';
1474                 ThreadItem.ParentBoard := Board;
1475                 ThreadItem.AllResCount := High( Res );
1476                 ThreadItem.NewResCount := 1;
1477                 ThreadItem.NewReceive := 2;
1478                 ThreadItem.Title := '\83T\83\93\83v\83\8b\83v\83\8c\83r\83\85\81[';
1479
1480                 Res[0].FName := '\96¼\96³\82µ\82³\82ñ';
1481                 Res[0].FMailTo := 'sage';
1482                 Res[0].FDateTime := 'ID:Sample';
1483                 Res[0].FBody := 'CSS \82Æ\83X\83L\83\93\82Ì\83T\83\93\83v\83\8b';
1484                 Res[1].FName := '\96¼\96³\82µ\82³\82ñ';
1485                 Res[1].FMailTo := 'age';
1486                 Res[1].FDateTime := 'ID:Sample';
1487                 Res[1].FBody := '\83I\83}\83G\83\82\83i\81[';
1488
1489                 // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
1490                 if CSSFontCheckBox.Checked then begin
1491                         i := ColorToRGB( FCSSFont.Color );
1492                         i := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
1493
1494                         UserOptionalStyle := UserOptionalStyle +
1495                                 'font-family:"' + FCSSFont.Name + '";' +
1496                                 'font-size:' + IntToStr( FCSSFont.Size ) + 'pt;' +
1497                                 'color:#' + IntToHex( i, 6 ) + ';';
1498                         if fsBold in FCSSFont.Style then
1499                                 UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;'
1500                         else
1501                                 UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1502                         if fsItalic in FCSSFont.Style then
1503                                 UserOptionalStyle := UserOptionalStyle + 'font-style:italic;'
1504                         else
1505                                 UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1506                 end;
1507                 if CSSBackColorCheckBox.Checked then begin
1508                         i := ColorToRGB( FCSSBackColor );
1509                         i := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
1510
1511                         UserOptionalStyle := UserOptionalStyle +
1512                                 'background-color:#' + IntToHex( i, 6 ) + ';';
1513                 end;
1514
1515                 if FileExists( GikoSys.GetSkinHeaderFileName ) then begin
1516                         html :=
1517                                 GikoSys.LoadFromSkin( GikoSys.GetSkinHeaderFileName, ThreadItem, 0 ) +
1518                                 '<a name="top"></a>' +
1519                                 GikoSys.SkinedRes( GikoSYs.LoadFromSkin( GikoSys.GetSkinResFileName, ThreadItem, 0 ), Res[0], '1' ) +
1520                                 GikoSys.SkinedRes( GikoSYs.LoadFromSkin( GikoSys.GetSkinNewResFileName, ThreadItem, 0 ), Res[1], '2' ) +
1521                                 '<a name="bottom"></a>' +
1522                                 GikoSys.LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, 0 );
1523
1524                         html := StringReplace( html, '</head>',
1525                                 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>', [rfReplaceAll] );
1526                 end else begin
1527                         html :=
1528                                 '<html><head>' +
1529                                 '<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">' +
1530                                 '<title>' + ThreadItem.Title + '</title>' +
1531                                 '<link rel="stylesheet" href="' + GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName + '" type="text/css">' +
1532                                 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' +
1533                                 '</head><body>' +
1534                                 '<div class="title">' + ThreadItem.Title + '</div>';
1535
1536                                 for i := 0 to High( Res ) do
1537                                 begin
1538                                         html := html +
1539                                                 '<div class="header"><span class="no">' + IntToStr( i + 1 ) + '</span>' +
1540                                                 '<span class="name_label"> \96¼\91O\81F </span>' +
1541                                                 '<a class="name_mail" href="mailto:' + Res[i].FMailTo + '">' +
1542                                                 '<b>' + Res[i].FName + '</b></a><span class="mail"> [' + Res[i].FMailTo + ']</span>' +
1543                                                 '<span class="date_label"> \93\8a\8de\93ú\81F</span>' +
1544                                                 '<span class="date"> ' + Res[i].FDateTime+ '</span></div>' +
1545                                                 '<div class="mes">' + Res[i].FBody + ' </div>';
1546                                 end;
1547
1548                                 html := html + '</body></html>';
1549                 end;
1550
1551                 try
1552                         CSSSetContent( html );
1553                 except
1554                 end;
1555
1556         finally
1557                 ThreadItem.Free;
1558                 Board.Free;
1559                 GikoSys.Setting.CSSFileName := fileName;
1560         end;
1561
1562 end;
1563
1564 procedure TOptionDialog.CSSListViewChange(Sender: TObject; Item: TListItem;
1565         Change: TItemChange);
1566 begin
1567
1568         if OptionTab.ActivePage = CSSTabSheet then
1569                 CSSPreview;
1570
1571 end;
1572
1573 procedure TOptionDialog.AddURLButtonClick(Sender: TObject);
1574 begin
1575         BoardURLComboBox.Items.Append(BoardURLComboBox.Text);
1576   BoardURLComboBox.ItemIndex := BoardURLComboBox.Items.Count - 1;
1577 end;
1578
1579 procedure TOptionDialog.RemoveURLButtonClick(Sender: TObject);
1580 begin
1581         BoardURLComboBox.DeleteSelected;
1582 end;
1583
1584 procedure TOptionDialog.OddResNumCheckBoxClick(Sender: TObject);
1585 begin
1586         OddResNumColorBox.Enabled := OddResNumCheckBox.Checked;
1587 end;
1588
1589 procedure TOptionDialog.ResRangeHoldCheckBoxClick(Sender: TObject);
1590 begin
1591         ResRangeHoldComboBox.Enabled := ResRangeHoldCheckBox.Checked;
1592 end;
1593
1594 procedure TOptionDialog.CroutOptionClick(Sender: TObject);
1595 var
1596         KuroutOption: TKuroutOption;
1597 begin
1598         KuroutOption := TKuroutOption.Create(Self);
1599         try
1600                 KuroutOption.ShowModal;
1601         finally
1602                 KuroutOption.Release;
1603         end;
1604 end;
1605
1606 end.
1607