OSDN Git Service

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