OSDN Git Service

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