OSDN Git Service

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