OSDN Git Service

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