OSDN Git Service

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