OSDN Git Service

Add Be2chOption & Source IndentChange
[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                 GikoSys.GetFileList(GikoSys.GetStyleSheetDir, '*.css', FileList, True, True);
639
640                 Idx := Length(GikoSys.GetStyleSheetDir);
641                 for i := 0 to FileList.Count - 1 do
642                         FileList[i] := Copy(FileList[i], Idx + 1, Length(FileList[i]));
643                 FileList.Sort;
644                 for i := 0 to FileList.Count - 1 do begin
645                         //s := ExtractFileName(FileList[i]);
646                         if LowerCase(FileList[i]) = 'default.css' then
647                                 Item := CSSListView.Items.Insert(0)
648                         else
649                                 Item := CSSListView.Items.Add;
650                         Item.Caption := ChangeFileExt(FileList[i], '');
651                         if LowerCase(FileList[i]) = LowerCase(GikoSys.Setting.CSSFileName) then
652                                 Item.Selected := True;
653                 end;
654         finally
655                 FileList.Free;
656         end;
657         //\83X\83L\83\93\83t\83@\83C\83\8b\96¼\88ê\97\97
658         //FileList := TStringList.Create;
659         if FCSSStrings <> nil then
660                 FCSSStrings.Clear;
661         FCSSStrings := TStringList.Create;
662         try
663                 //GikoSys.GetDirectoryList(GikoSys.GetSkinDir, '*', FileList, False);
664                 GikoSys.GetDirectoryList(GikoSys.GetSkinDir, '*', FCSSStrings, False);
665
666                 Idx := Length(GikoSys.GetSkinDir);
667                 //FileList.Sort;
668                 FCSSStrings.Sort;
669                 //for i := 0 to FileList.Count - 1 do begin
670                 for i := 0 to FCSSStrings.Count - 1 do begin
671                         //s := ExtractFileName(FileList[i]);
672                         Item := CSSListView.Items.Add;
673                         {Item.Data := PChar( FileList[i] );
674                         Item.Caption := Copy( FileList[i], Idx + 1, Length(FileList[i]) );
675                         if LowerCase(FileList[i]) = LowerCase(GikoSys.Setting.CSSFileName) then
676                                 Item.Selected := True;
677                         }
678                         Item.Data := PChar( FCSSStrings[i] );
679                         Item.Caption := Copy( FCSSStrings[i], Idx + 1, Length(FCSSStrings[i]) );
680                         if LowerCase(FCSSStrings[i]) = LowerCase(GikoSys.Setting.CSSFileName) then
681                                 Item.Selected := True;
682                 end;
683         finally
684                 // 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`
685                 //FileList.Free;
686         end;
687
688         if (CSSListView.ItemIndex = -1) and (CSSListView.Items.Count > 0) then
689                 CSSListView.Items[0].Selected := True;
690
691         //Mail\97\93\95\\8e¦
692         ShowMailCheckBox.Checked := GikoSys.Setting.ShowMail;
693
694         // \8bN\93®\8e\9e\83\8c\83X\95\\8e¦\94Í\88Í\82Ì\8cÅ\92è
695         ResRangeHoldCheckBox.Checked := GikoSys.Setting.ResRangeHold;
696         case GikoSys.Setting.ResRange of
697         Ord( grrAll ):  ResRangeHoldComboBox.ItemIndex := 0;
698         Ord( grrKoko ): ResRangeHoldComboBox.ItemIndex := 2;
699         Ord( grrNew ):  ResRangeHoldComboBox.ItemIndex := 3;
700         100:                                            ResRangeHoldComboBox.ItemIndex := 1;
701         end;
702         ResRangeHoldComboBox.Enabled := GikoSys.Setting.ResRangeHold;
703         //\83^\83u\92Ç\89Á\88Ê\92u
704         TabAddRadioGroup.ItemIndex := Ord(GikoSys.Setting.BrowserTabAppend);
705         //\94Â\8dX\90VURL
706         //BoardURL2chEdit.Text := GikoSys.Setting.BoardURL2ch;
707                 BoardURLComboBox.Clear;
708                 BoardURLComboBox.Items.AddStrings(GikoSys.Setting.BoardURLs);
709                 try
710                         BoardURLComboBox.ItemIndex := GikoSys.Setting.BoardURLSelected - 1;
711                 except
712                         BoardURLComboBox.ItemIndex := 0;
713                 end;
714         //\94F\8fØ
715         UserIDEdit.Text := GikoSys.Setting.UserID;
716         PasswordEdit.Text := GikoSys.Setting.Password;
717         AutoLoginCheckBox.Checked := GikoSys.Setting.AutoLogin;
718         ForcedLoginCheckBox.Checked := GikoSys.Setting.ForcedLogin;
719         //\83\8d\83O\83t\83H\83\8b\83_
720         if GikoSys.Setting.NewLogFolder = '' then
721                 LogFolderEdit.Text := GikoSys.Setting.LogFolder
722         else
723                 LogFolderEdit.Text := GikoSys.Setting.NewLogFolder;
724         //\83T\83E\83\93\83h
725         for i := 0 to GikoSys.Setting.GetSoundCount - 1 do begin
726                 Item := SoundListView.Items.Add;
727                 Item.Caption := GikoSys.Setting.SoundViewName[i];
728                 if FileExists(GikoSys.Setting.SoundFileName[i]) then
729                         Item.SubItems.Add(GikoSys.Setting.SoundFileName[i])
730                 else
731                         Item.SubItems.Add('');
732         end;
733         //URL\83N\83\8a\83b\83N\8e\9e\93®\8dì
734         URLAppCheckBox.Checked := GikoSys.Setting.URLApp;
735         URLAppCheckBoxClick(nil);
736         AppFolderEdit.Text := GikoSys.Setting.URLAppFile;
737
738         //mailto\83N\83\8a\83b\83N\8e\9e\93®\8dì
739         OpenMailerCheckBox.Checked := GikoSys.Setting.OpenMailer;
740
741         //\83\8d\83O\8dí\8f\9c\8e\9e\83\81\83b\83Z\81[\83W
742         LogDeleteMessageCheckBox.Checked := GikoSys.Setting.DeleteMsg;
743
744         //\8fI\97¹\8e\9e\8am\94F\83_\83C\83A\83\8d\83O
745         ShowDialogForEndCheckBox.Checked := GikoSys.Setting.ShowDialogForEnd;
746         //AllTabClose
747         AllTabCloseCheckBox.Checked := GikoSys.Setting.ShowDialogForAllTabClose;
748         //Samba
749         UseSambaCheckBox.Checked := GikoSys.Setting.UseSamba;
750         ResAnchorCheckBox.Checked := GikoSys.Setting.ResAnchorJamp;
751         // \83u\83\89\83E\83U\8dÅ\91å\89»
752         BrowserMaxCombo.ItemIndex := Ord( GikoSys.Setting.BrowserAutoMaximize );
753         //\83|\83b\83v\83A\83b\83v\88Ê\92u
754         case GikoSys.Setting.PopupPosition of
755                 gppRightTop:            PopupPositionRadioGroup.ItemIndex := 0;
756                 gppRight:                       PopupPositionRadioGroup.ItemIndex := 1;
757                 gppRightBottom: PopupPositionRadioGroup.ItemIndex := 2;
758                 gppTop:                                 PopupPositionRadioGroup.ItemIndex := 3;
759                 gppCenter:                      PopupPositionRadioGroup.ItemIndex := 4;
760                 gppBottom:                      PopupPositionRadioGroup.ItemIndex := 5;
761                 gppLeftTop:             PopupPositionRadioGroup.ItemIndex := 6;
762                 gppLeft:                                PopupPositionRadioGroup.ItemIndex := 7;
763                 gppLeftBottom:  PopupPositionRadioGroup.ItemIndex := 8;
764         end;
765
766         //\94ñ\83A\83N\83e\83B\83u\8e\9e\83|\83b\83v\83A\83b\83v\95\\8e¦
767         UnActivePopupCheckBox.Checked := GikoSys.Setting.UnActivePopup;
768         //\83\8c\83X\83|\83b\83v\83A\83b\83v\83{\81[\83\8b\83h\95\\8e¦
769         ResPopupBoldCheckBox.Checked := GikoSys.Setting.ResPopupHeaderBold;
770
771         //\83A\83h\83\8c\83X\83o\81[
772         URLDisplayCheckBox.Checked := GikoSys.Setting.URLDisplay;
773         TabStopAddressBarCheckBox.Checked := GikoSys.Setting.AddressBarTabStop;
774         LinkAddCheckBox.Checked := GikoSys.Setting.LinkAddAddressBar;
775         AddressHistoryCountEdit.Text := IntToStr(GikoSys.Setting.AddressHistoryCount);
776
777         //HTML\83v\83\8c\83r\83\85\81[
778         PreviewVisibleCheckBox.Checked := GikoSys.Setting.PreviewVisible;
779         PreviewWaitEdit.Text := IntToStr(GikoSys.Setting.PreviewWait);
780         PreviewSizeComboBox.ItemIndex := 2;
781         case GikoSys.Setting.PreviewSize of
782                 gpsXLarge: PreviewSizeComboBox.ItemIndex := 4;
783                 gpsLarge: PreviewSizeComboBox.ItemIndex := 3;
784                 gpsMedium: PreviewSizeComboBox.ItemIndex := 2;
785                 gpsSmall: PreviewSizeComboBox.ItemIndex := 1;
786                 gpsXSmall: PreviewSizeComboBox.ItemIndex := 0;
787         end;
788
789         //\83X\83\8c\83b\83h\88ê\97\97\8dX\90V\83A\83C\83R\83\93
790         ThreadListIconCheckBox.Checked := GikoSys.Setting.ListIconVisible;
791         CreationTimeLogsCheckBox.Checked := GikoSys.Setting.CreationTimeLogs;
792         FutureThreadCheckBox.Checked := GikoSys.Setting.FutureThread;
793         SelectIntervalEdit.Text := IntToStr(GikoSys.Setting.SelectInterval);
794
795         //dat\97\8e\82¿\83X\83\8c\83\\81[\83g\8f\87
796         case TGikoBoardColumnID( GikoSys.Setting.DatOchiSortIndex ) of
797                 gbcTitle:
798                         if GikoSys.Setting.DatOchiSortOrder then
799                                 DatOchiSortCombo.ItemIndex := 1
800                         else
801                                 DatOchiSortCombo.ItemIndex := 2;
802                 gbcRoundDate://gbcLastModified:
803                         if GikoSys.Setting.DatOchiSortOrder then
804                                 DatOchiSortCombo.ItemIndex := 3
805                         else
806                                 DatOchiSortCombo.ItemIndex := 4;
807                 gbcCreated:
808                         if GikoSys.Setting.DatOchiSortOrder then
809                                 DatOchiSortCombo.ItemIndex := 5
810                         else
811                                 DatOchiSortCombo.ItemIndex := 6;
812                 gbcLastModified:
813                         if GikoSys.Setting.DatOchiSortOrder then
814                                 DatOchiSortCombo.ItemIndex := 7
815                         else
816                                 DatOchiSortCombo.ItemIndex := 8;
817         else
818                 DatOchiSortCombo.ItemIndex := 0;
819         end;
820
821         //\82 \82Ú\81`\82ñ
822         RloCheckBox.Checked := GikoSys.Setting.AbonDeleterlo;
823         ReplaceulCheckBox.Checked := GikoSys.Setting.AbonReplaceul;
824                                 PopUpAbonCheckBox.Checked := GikoSys.Setting.PopUpAbon;
825                                 ShowNGLineCheckBox.Checked := GikoSys.Setting.ShowNGLinesNum;
826                                 AddResAnchorCheckBox.Checked := GikoSys.Setting.AddResAnchor;
827         DeleteSyriaCheckBox.Checked := GikoSys.Setting.DeleteSyria;
828 {$IFDEF SPAM_FILTER_ENABLED}
829         // \83X\83p\83\80\83t\83B\83\8b\83^\82Ì\90Ý\92è\82ð\95\\8e¦\82·\82é
830         SpamFilterGroupBox.Visible := True;
831 {$ENDIF}
832         // \8eg\97p\82·\82é\83X\83p\83\80\83t\83B\83\8b\83^
833 {$IFDEF DEBUG}
834         SpamFilterAlgorithmComboBox.Clear;
835         SpamFilterAlgorithmComboBox.AddItem( '\8eg\97p\82µ\82È\82¢', nil );
836         SpamFilterAlgorithmComboBox.AddItem( 'Paul Graham \96@', nil );
837         SpamFilterAlgorithmComboBox.AddItem( 'Gary Robinson \96@', nil );
838         SpamFilterAlgorithmComboBox.AddItem( 'Gary Robinson-Fisher \96@', nil );
839 {$ENDIF}
840         SpamFilterAlgorithmComboBox.ItemIndex :=
841                 Ord( GikoSys.Setting.SpamFilterAlgorithm );
842
843         //TabAutoLoad
844         TabLoadSave.Checked := Gikosys.Setting.TabAutoLoadSave;
845         UseUndecidedCheckBox.Checked := GikoSys.Setting.UseUndecided;
846
847         //Be2ch\94F\8fØ
848         BeUserIDEdit.Text := GikoSys.Setting.BeUserID;
849         BePasswordEdit.Text := GikoSys.Setting.BePassword;
850         BeAutoLoginCheckBox.Checked := GikoSys.Setting.BeAutoLogin;
851 end;
852
853 procedure TOptionDialog.SaveSetting;
854 var
855         i: Integer;
856         tmp: string;
857 //      Item: TListItem;
858 begin
859         GikoSys.Setting.OptionDialogTabIndex := OptionTab.TabIndex;
860
861         GikoSys.Setting.ReadProxy := ReadProxyCheck.Checked;
862         GikoSys.Setting.ReadProxyAddress := ReadProxyAddressEdit.Text;
863         GikoSys.Setting.ReadProxyPort := StrToInt(ReadPortEdit.Text);
864         GikoSys.Setting.ReadProxyUserID := ReadProxyUserIDEdit.Text;
865         GikoSys.Setting.ReadProxyPassword := ReadProxyPasswordEdit.Text;
866
867         GikoSys.Setting.WriteProxy := WriteProxyCheck.Checked;
868         GikoSys.Setting.WriteProxyAddress := WriteProxyAddressEdit.Text;
869         GikoSys.Setting.WriteProxyPort := StrToInt(WritePortEdit.Text);
870         GikoSys.Setting.WriteProxyUserID := WriteProxyUserIDEdit.Text;
871         GikoSys.Setting.WriteProxyPassword := WriteProxyPasswordEdit.Text;
872
873         GikoSys.Setting.CabinetFontName := CabinetMemo.Font.Name;
874         GikoSys.Setting.CabinetFontSize := CabinetMemo.Font.Size;
875         GikoSys.Setting.CabinetFontColor := CabinetMemo.Font.Color;
876         GikoSys.Setting.CabinetFontBold  := fsBold in CabinetMemo.Font.Style;
877         GikoSys.Setting.CabinetFontItalic:= fsItalic in CabinetMemo.Font.Style;
878         GikoSys.Setting.CabinetBackColor := CabinetMemo.Color;
879
880         GikoSys.Setting.ListFontName    := ListMemo.Font.Name;
881         GikoSys.Setting.ListFontSize    := ListMemo.Font.Size;
882         GikoSys.Setting.ListFontColor   := ListMemo.Font.Color;
883         GikoSys.Setting.ListFontBold    := fsBold in ListMemo.Font.Style;
884         GikoSys.Setting.ListFontItalic  := fsItalic in ListMemo.Font.Style;
885         GikoSys.Setting.ListBackColor := ListMemo.Color;
886         GikoSys.Setting.UseOddColorOddResNum := OddResNumCheckBox.Checked;
887         GikoSys.Setting.OddColor := OddResNumColorBox.Selected;
888
889         GikoSys.Setting.HintFontName := HintMemo.Font.Name;
890         GikoSys.Setting.HintFontSize := HintMemo.Font.Size;
891         GikoSys.Setting.HintFontColor := HintMemo.Font.Color;
892         GikoSys.Setting.HintBackColor := HintMemo.Color;
893
894         GikoSys.Setting.BrowserTabFontName := BrowserTabMemo.Font.Name;
895         GikoSys.Setting.BrowserTabFontSize := BrowserTabMemo.Font.Size;
896         GikoSys.Setting.BrowserTabFontBold := fsBold in BrowserTabMemo.Font.Style;
897         GikoSys.Setting.BrowserTabFontItalic := fsItalic in BrowserTabMemo.Font.Style;
898         GikoSys.Setting.EditorFontName := EditorMemo.Font.Name;
899         GikoSys.Setting.EditorFontSize := EditorMemo.Font.Size;
900         GikoSys.Setting.EditorFontColor := EditorMemo.Font.Color;
901         GikoSys.Setting.EditorBackColor := EditorMemo.Color;
902         {FRepaintThread : \95\\8e¦\8dÏ\82Ý\83X\83\8c\83b\83h\82Ì\8dÄ\95`\89æ\82ª\95K\97v\82©\82Ç\82¤\82©
903         \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Ì
904         \83X\83\8c\83b\83h\82ÌRepaint\82ðtrue\82É\82·\82é
905         }
906         //CSS\95\\8e¦
907         if GikoSys.Setting.UseCSS <> CSSCheckBox.Checked then FRepaintThread := true;
908         GikoSys.Setting.UseCSS := CSSCheckBox.Checked;
909         //CSS\83t\83@\83C\83\8b\96¼
910         tmp := GikoSys.Setting.CSSFileName;
911         GikoSys.Setting.CSSFileName := 'default.css';
912         if CSSListView.Items.Count > 0 then begin
913                 try
914                         if CSSListView.Items[CSSListView.ItemIndex].Data <> nil then
915                                 GikoSys.Setting.CSSFileName := string( CSSListView.Items[CSSListView.ItemIndex].data )
916                         else
917                                 GikoSys.Setting.CSSFileName := CSSListView.Items[CSSListView.ItemIndex].Caption + '.css';
918                 except
919                 end;
920         end;
921         if tmp <> GikoSys.Setting.CSSFileName then FRepaintThread := true;
922         // CSS \82Ì\83t\83H\83\93\83g\8ew\92è
923         if CSSFontCheckBox.Checked then begin
924                 if GikoSys.Setting.BrowserFontName <> FCSSFont.Name then FRepaintThread := true;
925                 GikoSys.Setting.BrowserFontName := FCSSFont.Name;
926                 if GikoSys.Setting.BrowserFontSize <> FCSSFont.Size then FRepaintThread := true;
927                 GikoSys.Setting.BrowserFontSize := FCSSFont.Size;
928                 if fsBold in FCSSFont.Style then begin
929                         if GikoSys.Setting.BrowserFontBold <> 1 then FRepaintThread := true;
930                         GikoSys.Setting.BrowserFontBold := 1;
931                 end else begin
932                         if GikoSys.Setting.BrowserFontBold <> -1 then FRepaintThread := true;
933                         GikoSys.Setting.BrowserFontBold := -1;
934                 end;
935                 if fsItalic in FCSSFont.Style then begin
936                         if GikoSys.Setting.BrowserFontItalic <> 1 then FRepaintThread := true;
937                         GikoSys.Setting.BrowserFontItalic := 1;
938                 end else begin
939                         if GikoSys.Setting.BrowserFontItalic <> -1 then FRepaintThread := true;
940                         GikoSys.Setting.BrowserFontItalic := -1;
941                 end;
942                 i := ColorToRGB( FCSSFont.Color );
943                 if (GikoSys.Setting.BrowserFontColor <> (i shr 16) or (i and $ff00) or ((i and $ff) shl 16)) then
944                         FRepaintThread := true;
945                 GikoSys.Setting.BrowserFontColor := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
946         end else begin
947                 if GikoSys.Setting.BrowserFontName <> '' then FRepaintThread := true;
948                 GikoSys.Setting.BrowserFontName := '';
949                 if GikoSys.Setting.BrowserFontSize <> 0 then FRepaintThread := true;
950                 GikoSys.Setting.BrowserFontSize := 0;
951                 if GikoSys.Setting.BrowserFontBold <> 0 then FRepaintThread := true;
952                 GikoSys.Setting.BrowserFontBold := 0;
953                 if GikoSys.Setting.BrowserFontItalic <> 0 then FRepaintThread := true;
954                 GikoSys.Setting.BrowserFontItalic := 0;
955                 if GikoSys.Setting.BrowserFontColor <> -1 then FRepaintThread := true;
956                 GikoSys.Setting.BrowserFontColor := -1;
957         end;
958         if CSSBackColorCheckBox.Checked then begin
959                 i := ColorToRGB( FCSSBackColor );
960                 if(GikoSys.Setting.BrowserBackColor <> (i shr 16) or (i and $ff00) or ((i and $ff) shl 16)) then
961                         FRepaintThread := true;
962                 GikoSys.Setting.BrowserBackColor := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
963         end else begin
964                 if GikoSys.Setting.BrowserBackColor <> -1 then FRepaintThread := true;
965                 GikoSys.Setting.BrowserBackColor := -1;
966         end;
967
968         //Mail\97\93\95\\8e¦
969         if GikoSys.Setting.ShowMail <> ShowMailCheckBox.Checked then FRepaintThread := true;
970         GikoSys.Setting.ShowMail := ShowMailCheckBox.Checked;
971         // \8bN\93®\8e\9e\83\8c\83X\95\\8e¦\94Í\88Í\82Ì\8cÅ\92è
972         GikoSys.Setting.ResRangeHold := ResRangeHoldCheckBox.Checked;
973         case ResRangeHoldComboBox.ItemIndex of
974                 0: GikoSys.Setting.ResRange := Ord( grrAll );
975                 1: GikoSys.Setting.ResRange := 100;
976                 2: GikoSys.Setting.ResRange := Ord( grrKoko );
977                 3: GikoSys.Setting.ResRange := Ord( grrNew );
978         end;
979
980         GikoSys.Setting.BrowserTabAppend := TGikoTabAppend(TabAddRadioGroup.ItemIndex);
981
982 //      GikoSys.Setting.BoardURL2ch := BoardURL2chEdit.Text;
983         GikoSys.Setting.BoardURLs.Clear;
984         GikoSys.Setting.BoardURLs.AddStrings(BoardURLComboBox.Items);
985         GikoSys.Setting.BoardURLSelected := BoardURLComboBox.ItemIndex + 1;
986         GikoSys.Setting.UserID := UserIDEdit.Text;
987         GikoSys.Setting.Password := PasswordEdit.Text;
988         GikoSys.Setting.AutoLogin := AutoLoginCheckBox.Checked;
989         GikoSys.Setting.ForcedLogin := ForcedLoginCheckBox.Checked;
990         GikoSys.Setting.URLApp := URLAppCheckBox.Checked;
991         GikoSys.Setting.URLAppFile := AppFolderEdit.Text;
992
993         GikoSys.Setting.OpenMailer := OpenMailerCheckBox.Checked;
994         GikoSys.Setting.DeleteMsg := LogDeleteMessageCheckBox.Checked;
995         //\8fI\97¹\8e\9e\8am\94F\83_\83C\83A\83\8d\83O
996         GikoSys.Setting.ShowDialogForEnd := ShowDialogForEndCheckBox.Checked;
997         //AllTabClose
998         GikoSys.Setting.ShowDialogForAllTabClose := AllTabCloseCheckBox.Checked;
999         //Samba
1000         GikoSys.Setting.UseSamba := UseSambaCheckBox.Checked;
1001         GikoSys.Setting.ResAnchorJamp := ResAnchorCheckBox.Checked;
1002         // \83u\83\89\83E\83U\8dÅ\91å\89»
1003         GikoSys.Setting.BrowserAutoMaximize := TGikoBrowserAutoMaximize( BrowserMaxCombo.ItemIndex );
1004         //\83|\83b\83v\83A\83b\83v\88Ê\92u
1005         case PopupPositionRadioGroup.ItemIndex of
1006                 0: GikoSys.Setting.PopupPosition := gppRightTop;
1007                 1: GikoSys.Setting.PopupPosition := gppRight;
1008                 2: GikoSys.Setting.PopupPosition := gppRightBottom;
1009                 3: GikoSys.Setting.PopupPosition := gppTop;
1010                 4: GikoSys.Setting.PopupPosition := gppCenter;
1011                 5: GikoSys.Setting.PopupPosition := gppBottom;
1012                 6: GikoSys.Setting.PopupPosition := gppLeftTop;
1013                 7: GikoSys.Setting.PopupPosition := gppLeft;
1014                 8: GikoSys.Setting.PopupPosition := gppLeftBottom;
1015         end;
1016
1017         //\94ñ\83A\83N\83e\83B\83u\8e\9e\83|\83b\83v\83A\83b\83v\95\\8e¦
1018         GikoSys.Setting.UnActivePopup := UnActivePopupCheckBox.Checked;
1019         //\83\8c\83X\83|\83b\83v\83A\83b\83v\83{\81[\83\8b\83h\95\\8e¦
1020         GikoSys.Setting.ResPopupHeaderBold := ResPopupBoldCheckBox.Checked;
1021
1022         //\83A\83h\83\8c\83X\83o\81[
1023         GikoSys.Setting.URLDisplay := URLDisplayCheckBox.Checked;
1024         GikoSys.Setting.AddressBarTabStop := TabStopAddressBarCheckBox.Checked;
1025         GikoSys.Setting.LinkAddAddressBar := LinkAddCheckBox.Checked;
1026         if GikoSys.IsNumeric(AddressHistoryCountEdit.Text) then
1027                 GikoSys.Setting.AddressHistoryCount := StrToInt(AddressHistoryCountEdit.Text)
1028         else
1029                 GikoSys.Setting.AddressHistoryCount := 100;
1030
1031         //HTML\83v\83\8c\83r\83\85\81[
1032         GikoSys.Setting.PreviewVisible := PreviewVisibleCheckBox.Checked;
1033         if GikoSys.IsNumeric(PreviewWaitEdit.Text) then
1034                 GikoSys.Setting.PreviewWait := StrToInt(PreviewWaitEdit.Text)
1035         else
1036                 GikoSys.Setting.PreviewWait := 500;
1037         case PreviewSizeComboBox.ItemIndex of
1038                 0: GikoSys.Setting.PreviewSize := gpsXSmall;
1039                 1: GikoSys.Setting.PreviewSize := gpsSmall;
1040                 2: GikoSys.Setting.PreviewSize := gpsMedium;
1041                 3: GikoSys.Setting.PreviewSize := gpsLarge;
1042                 4: GikoSys.Setting.PreviewSize := gpsXLarge;
1043         end;
1044
1045         //\83X\83\8c\83b\83h\88ê\97\97\8dX\90V\83A\83C\83R\83\93
1046         GikoSys.Setting.ListIconVisible := ThreadListIconCheckBox.Checked;
1047
1048         GikoSys.Setting.CreationTimeLogs := CreationTimeLogsCheckBox.Checked;
1049         GikoSys.Setting.FutureThread := FutureThreadCheckBox.Checked;
1050         if StrToIntDef(SelectIntervalEdit.Text, 110) > 55 then
1051                 GikoSys.Setting.SelectInterval := StrToIntDef(SelectIntervalEdit.Text, 110)
1052         else
1053                 GikoSys.Setting.SelectInterval := 55;
1054
1055         //dat\97\8e\82¿\83X\83\8c\83\\81[\83g\8f\87
1056         case DatOchiSortCombo.ItemIndex of
1057                 0: GikoSys.Setting.DatOchiSortIndex := -1;      //\95À\82Ñ\91Ö\82¦\82µ\82È\82¢
1058                 1: begin        //\83X\83\8c\94Ô\8d\86(\8f¸\8f\87)
1059                         GikoSys.Setting.DatOchiSortOrder := true;
1060                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcTitle );
1061                    end;
1062                 2: begin        //\83X\83\8c\94Ô\8d\86(\8d~\8f\87)
1063                         GikoSys.Setting.DatOchiSortOrder := false;
1064                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcTitle );
1065                    end;
1066                 3: begin        //\8eæ\93¾\93ú\8e\9e(\8f¸\8f\87)
1067                         GikoSys.Setting.DatOchiSortOrder := true;
1068                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcRoundDate );{gbcLastModified}
1069                    end;
1070                 4: begin        //\8eæ\93¾\93ú\8e\9e(\8d~\8f\87)
1071                         GikoSys.Setting.DatOchiSortOrder := false;
1072                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcRoundDate );{gbcLastModified}
1073                    end;
1074                 5: begin        //\83X\83\8c\8dì\90¬\93ú\8e\9e(\8f¸\8f\87)
1075                         GikoSys.Setting.DatOchiSortOrder := true;
1076                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcCreated );
1077                    end;
1078                 6: begin        //\83X\83\8c\8dì\90¬\93ú\8e\9e(\8d~\8f\87)
1079                         GikoSys.Setting.DatOchiSortOrder := false;
1080                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcCreated );
1081                    end;
1082                 7:      begin  //\83X\83\8c\8dÅ\8fI\8dX\90V\93ú\8e\9e\81i\8f¸\8f\87\81j
1083                         GikoSys.Setting.DatOchiSortOrder := true;
1084                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcLastModified );{gbcLastModified}
1085                         end;
1086                 8:      begin  //\83X\83\8c\8dÅ\8fI\8dX\90V\93ú\8e\9e\81i\8d~\8f\87\81j
1087                         GikoSys.Setting.DatOchiSortOrder := false;
1088                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcLastModified );{gbcLastModified}
1089                         end;
1090         end;
1091
1092         GikoSys.Setting.WriteSystemSettingFile;
1093         GikoSys.Setting.WriteBoardURLSettingFile;
1094 //      GikoForm.SetBrowserTabState;
1095
1096         if LogFolderEdit.Text <> '' then begin
1097                 GikoSys.Setting.NewLogFolder := LogFolderEdit.Text;
1098                 GikoSys.Setting.WriteFolderSettingFile;
1099         end;
1100
1101         for i := 0 to SoundListView.Items.Count - 1 do begin
1102                 if FileExists(SoundListView.Items[i].SubItems[0]) then
1103                         GikoSys.Setting.SoundFileName[i] := SoundListView.Items[i].SubItems[0]
1104                 else
1105                         GikoSys.Setting.SoundFileName[i] := '';
1106         end;
1107
1108         //\82 \82Ú\81`\82ñ
1109         GikoSys.Setting.AbonDeleterlo := RloCheckBox.Checked;
1110         GikoSys.Setting.AbonReplaceul := ReplaceulCheckBox.Checked;
1111         GikoSys.Setting.PopUpAbon := PopUpAbonCheckBox.Checked;
1112         GikoSys.Setting.ShowNGLinesNum := ShowNGLineCheckBox.Checked;
1113         GikoSys.Setting.AddResAnchor := AddResAnchorCheckBox.Checked;
1114                                 GikoSys.Setting.DeleteSyria := DeleteSyriaCheckBox.Checked;
1115         // \8eg\97p\82·\82é\83X\83p\83\80\83t\83B\83\8b\83^
1116         if GikoSys.Setting.SpamFilterAlgorithm <> TGikoSpamFilterAlgorithm(
1117                 SpamFilterAlgorithmComboBox.ItemIndex ) then begin
1118                 GikoSys.Setting.SpamFilterAlgorithm := TGikoSpamFilterAlgorithm(
1119                         SpamFilterAlgorithmComboBox.ItemIndex );
1120                 FRepaintThread := True;
1121         end;
1122
1123         //Tab\8e©\93®\95Û\91
1124         GikoSys.Setting.TabAutoLoadSave := TabLoadSave.Checked;
1125         GikoSys.Setting.UseUndecided := UseUndecidedCheckBox.Checked;
1126         //Be2ch
1127         GikoSys.Setting.BeUserID := BeUserIDEdit.Text;
1128         GikoSys.Setting.BePassword := BePasswordEdit.Text;
1129         GikoSys.Setting.BeAutoLogin := BeAutoLoginCheckBox.Checked;
1130 end;
1131
1132 procedure TOptionDialog.SettingApply;
1133 var
1134         i: Integer;
1135 begin
1136         GikoForm.TreeView.Items.BeginUpdate;
1137         GikoForm.FavoriteTreeView.Items.BeginUpdate;
1138         GikoForm.ListView.Items.BeginUpdate;
1139         try
1140                 GikoForm.TreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1141                 GikoForm.TreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1142                 GikoForm.TreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1143                 GikoForm.TreeView.Color := GikoSys.Setting.CabinetBackColor;
1144
1145                 {GikoForm.TreeView.Font.Style := [];
1146                 if GikoSys.Setting.CabinetFontBold then
1147                         GikoForm.TreeView.Font.Style := [fsBold];
1148                 if GikoSys.Setting.CabinetFontItalic then
1149                         GikoForm.TreeView.Font.Style := GikoForm.TreeView.Font.Style + [fsItalic];
1150                 }
1151                 {GikoForm.FavoriteTreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1152                 GikoForm.FavoriteTreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1153                 GikoForm.FavoriteTreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1154                 }
1155                 GikoForm.FavoriteTreeView.Font.Assign(GikoForm.TreeView.Font);
1156                 GikoForm.FavoriteTreeView.Color := GikoSys.Setting.CabinetBackColor;
1157
1158                 GikoForm.ListView.Font.Name := GikoSys.Setting.ListFontName;
1159                 GikoForm.ListView.Font.Size := GikoSys.Setting.ListFontSize;
1160                 GikoForm.ListView.Font.Color := GikoSys.Setting.ListFontColor;
1161                 GikoForm.ListView.Font.Style := [];
1162                 if GikoSys.Setting.ListFontBold then
1163                         GikoForm.ListView.Font.Style := [fsbold];
1164                 if GikoSys.Setting.ListFontItalic then
1165                         GikoForm.ListView.Font.Style := GikoForm.ListView.Font.Style + [fsitalic];
1166
1167                 //GikoForm.ListView.Color := GikoSys.Setting.ListBackColor;
1168                 GikoForm.ListViewBackGroundColor := GikoSys.Setting.ListBackColor;
1169                 GikoForm.UseOddResOddColor := GikoSys.Setting.UseOddColorOddResNum;
1170                 GikoForm.OddColor := GikoSys.Setting.OddColor;
1171
1172                 GikoForm.BrowserTab.Font.Name := GikoSys.Setting.BrowserTabFontName;
1173                 GikoForm.BrowserTab.Font.Size := GikoSys.Setting.BrowserTabFontSize;
1174                 GikoForm.BrowserTab.Font.Style := [];
1175                 if GikoSys.Setting.BrowserTabFontBold then
1176                         GikoForm.BrowserTab.Font.Style := [fsBold];
1177                 if GikoSys.Setting.BrowserTabFontItalic then
1178                         GikoForm.BrowserTab.Font.Style := GikoForm.BrowserTab.Font.Style + [fsItalic];
1179 //              GikoForm.BrowserTab.Height := (GikoSys.Setting.BrowserTabFontSize * 2) + 1;
1180 //              GikoForm.BrowserBottomPanel.Height := GikoForm.BrowserTab.Height;
1181
1182                 for i := 0 to Screen.CustomFormCount - 1 do begin
1183                         if TObject(Screen.CustomForms[i]) is TEditorForm then begin
1184                                 TEditorForm(Screen.CustomForms[i]).SetFont;
1185                         end;
1186                 end;
1187
1188         finally
1189                 GikoForm.TreeView.Items.EndUpdate;
1190                 GikoForm.FavoriteTreeView.Items.EndUpdate;
1191                 GikoForm.ListView.Items.EndUpdate;
1192         end;
1193
1194         //\83A\83h\83\8c\83X\83o\81[
1195         for i := GikoForm.AddressComboBox.Items.Count - 1 downto 0 do begin
1196                 if GikoSys.Setting.AddressHistoryCount >= GikoForm.AddressComboBox.Items.Count then
1197                         Break;
1198                 GikoForm.AddressComboBox.Items.Delete(i);
1199         end;
1200         GikoForm.AddressComboBox.TabStop := GikoSys.Setting.AddressBarTabStop;
1201
1202         //\83X\83\8c\88ê\97\97\82Ì\83\8a\83t\83\8c\83b\83V\83\85
1203         if FRepaintList then begin
1204                 // SetActiveList\82ð\8eÀ\8ds
1205                 GikoForm.ActiveList := GikoForm.ActiveList;
1206         end;
1207
1208         // \83X\83\8c\83b\83h\82Ì\83\8a\83t\83\8c\83b\83V\83\85
1209         if FRepaintThread then begin
1210                 for i := GikoForm.BrowserTab.Tabs.Count - 1 downto 0 do begin
1211                         TBrowserRecord(GikoForm.BrowserTab.Tabs.Objects[i]).Repaint := true;
1212                 end;
1213                 GikoForm.BrowserTab.OnChange(nil);
1214         end;
1215 end;
1216
1217 procedure TOptionDialog.ReadProxyCheckClick(Sender: TObject);
1218 begin
1219         ReadProxyAddressEdit.Enabled := ReadProxyCheck.Checked;
1220         ReadPortEdit.Enabled := ReadProxyCheck.Checked;
1221         ReadProxyUserIDEdit.Enabled := ReadProxyCheck.Checked;
1222         ReadProxyPasswordEdit.Enabled := ReadProxyCheck.Checked;
1223
1224         ReadAddressLabel.Enabled := ReadProxyCheck.Checked;
1225         ReadPortLabel.Enabled := ReadProxyCheck.Checked;
1226         ReadUserIDLabel.Enabled := ReadProxyCheck.Checked;
1227         ReadPasswordLabel.Enabled := ReadProxyCheck.Checked;
1228 end;
1229
1230 procedure TOptionDialog.ReadPortEditExit(Sender: TObject);
1231 begin
1232         if not GikoSys.IsNumeric(ReadPortEdit.Text) then
1233                 ReadPortEdit.Text := '0';
1234 end;
1235
1236 procedure TOptionDialog.LogFolderButtonClick(Sender: TObject);
1237 var
1238         Root: WideString;
1239         Dir: string;
1240 begin
1241         Root := '';
1242         if SelectDirectory('\83\8d\83O\83t\83H\83\8b\83_\91I\91ð', Root, Dir) then begin
1243                 LogFolderEdit.Text := Dir;
1244         end;
1245 end;
1246
1247 function TOptionDialog.CheckFolder: Boolean;
1248 begin
1249         if Trim(LogFolderEdit.Text) = '' then
1250                 LogFolderEdit.Text := ExtractFilePath(Application.ExeName) + 'Log';
1251
1252         if DirectoryExists(LogFolderEdit.Text) then begin
1253                 Result := True;
1254         end else begin
1255                 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
1256                         //\83t\83H\83\8b\83_\82ð\8dì\90¬
1257                         try
1258                                 GikoSys.ForceDirectoriesEx(LogFolderEdit.Text);
1259                                 Result := True
1260                         except
1261                                 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);
1262                                 OptionTab.ActivePage := FolderSheet;
1263                                 LogFolderEdit.SetFocus;
1264                                 Result := False;
1265                         end;
1266                 end else
1267                         Result := False;
1268         end;
1269 end;
1270
1271 procedure TOptionDialog.FormClose(Sender: TObject; var Action: TCloseAction);
1272 begin
1273         if not FClose then
1274                 Action := caNone;
1275         FClose := True;
1276 end;
1277
1278 procedure TOptionDialog.SoundReferButtonClick(Sender: TObject);
1279 begin
1280         OpenDialog.Filter := '\83T\83E\83\93\83h (*.wav)|*.wav|\82·\82×\82Ä\82Ì\83t\83@\83C\83\8b (*.*)|*.*';
1281         sndPlaySound(nil, SND_ASYNC);
1282         if OpenDialog.Execute then begin
1283                 SoundFileEdit.Text := OpenDialog.FileName;
1284         end;
1285 end;
1286
1287 procedure TOptionDialog.SoundPlayButtonClick(Sender: TObject);
1288 begin
1289         if not FileExists(SoundFileEdit.Text) then begin
1290                 MsgBox(Handle, '\91\8dÝ\82µ\82È\82¢\83t\83@\83C\83\8b\82Å\82·', '\83G\83\89\81[', MB_ICONSTOP or MB_OK);
1291                 SoundFileEdit.Text := '';
1292                 Exit;
1293         end;
1294         if not sndPlaySound(PChar(SoundFileEdit.Text), SND_ASYNC or SND_NOSTOP) then begin
1295                 sndPlaySound(nil, SND_ASYNC);
1296         end;
1297 end;
1298
1299 procedure TOptionDialog.SoundListViewChanging(Sender: TObject;
1300         Item: TListItem; Change: TItemChange; var AllowChange: Boolean);
1301 begin
1302         if Item.SubItems.Count > 0 then
1303                 SoundFileEdit.Text := Item.SubItems[0];
1304 end;
1305
1306 procedure TOptionDialog.SoundFileEditChange(Sender: TObject);
1307 var
1308         Item: TListItem;
1309 begin
1310         sndPlaySound(nil, SND_ASYNC);
1311         Item := SoundListView.Selected;
1312         if Item = nil then Exit;
1313
1314         if FileExists(SoundFileEdit.Text) then
1315                 Item.SubItems[0] := SoundFileEdit.Text;
1316         if Trim(SoundFileEdit.Text) = '' then
1317                 Item.SubItems[0] := '';
1318 end;
1319
1320 procedure TOptionDialog.OptionTabChange(Sender: TObject);
1321 begin
1322         sndPlaySound(nil, SND_ASYNC);
1323
1324         if OptionTab.ActivePage = CSSTabSheet then
1325                 CSSPreview;
1326 end;
1327
1328 procedure TOptionDialog.AppFolderButtonClick(Sender: TObject);
1329 begin
1330         OpenDialog.Filter := '\8eÀ\8ds\83t\83@\83C\83\8b (*.exe)|*.exe|\82·\82×\82Ä\82Ì\83t\83@\83C\83\8b (*.*)|*.*';
1331         if OpenDialog.Execute then
1332                 AppFolderEdit.Text := OpenDialog.FileName;
1333 end;
1334
1335 procedure TOptionDialog.WriteProxyCheckClick(Sender: TObject);
1336 begin
1337         WriteProxyAddressEdit.Enabled := WriteProxyCheck.Checked;
1338         WritePortEdit.Enabled := WriteProxyCheck.Checked;
1339         WriteProxyUserIDEdit.Enabled := WriteProxyCheck.Checked;
1340         WriteProxyPasswordEdit.Enabled := WriteProxyCheck.Checked;
1341
1342         WriteAddressLabel.Enabled := WriteProxyCheck.Checked;
1343         WritePortLabel.Enabled := WriteProxyCheck.Checked;
1344         WriteUserIDLabel.Enabled := WriteProxyCheck.Checked;
1345         WritePasswordLabel.Enabled := WriteProxyCheck.Checked;
1346 end;
1347
1348 procedure TOptionDialog.WritePortEditExit(Sender: TObject);
1349 begin
1350         if not GikoSys.IsNumeric(WritePortEdit.Text) then
1351                 WritePortEdit.Text := '0';
1352 end;
1353
1354 procedure TOptionDialog.Tora3URLLabelClick(Sender: TObject);
1355 begin
1356         GikoSys.OpenBrowser(URL_TORA3, gbtAuto);
1357 end;
1358
1359 procedure TOptionDialog.HotKeyEnter(Sender: TObject);
1360 begin
1361         OkBotton.Default := False;
1362         CancelBotton.Cancel := False;
1363 end;
1364
1365 procedure TOptionDialog.HotKeyExit(Sender: TObject);
1366 begin
1367         OkBotton.Default := True;
1368         CancelBotton.Cancel := True;
1369 end;
1370
1371 procedure TOptionDialog.URLAppCheckBoxClick(Sender: TObject);
1372 begin
1373         AppFolderLabel.Enabled := URLAppCheckBox.Checked;
1374         AppFolderEdit.Enabled := URLAppCheckBox.Checked;
1375         AppFolderButton.Enabled := URLAppCheckBox.Checked;
1376 end;
1377
1378 procedure TOptionDialog.AddressHistoryCountEditExit(Sender: TObject);
1379 begin
1380         if not GikoSys.IsNumeric(AddressHistoryCountEdit.Text) then
1381                 AddressHistoryCountEdit.Text := '100';
1382 end;
1383
1384 procedure TOptionDialog.PreviewWaitEditExit(Sender: TObject);
1385 begin
1386         if not GikoSys.IsNumeric(PreviewWaitEdit.Text) then
1387                 PreviewWaitEdit.Text := '500';
1388         if StrToInt(PreviewWaitEdit.Text) < 500 then
1389                 PreviewWaitEdit.Text := '500';
1390         if StrToInt(PreviewWaitEdit.Text) > 9999 then
1391                 PreviewWaitEdit.Text := '9999';
1392 end;
1393
1394 procedure TOptionDialog.CSSCheckBoxClick(Sender: TObject);
1395 begin
1396         CSSListLabel.Enabled := CSSCheckBox.Checked;
1397         CSSListView.Enabled := CSSCheckBox.Checked;
1398 end;
1399
1400 procedure TOptionDialog.SetAbonpropertys;
1401 begin
1402         //\82 \82Ú\81`\82ñ
1403         GikoSys.FAbon.Deleterlo := RloCheckBox.Checked;
1404         GikoSys.FAbon.Replaceul := ReplaceulCheckBox.Checked;
1405         GikoSys.FAbon.AbonPopupRes := PopUpAbonCheckBox.Checked;
1406         GikoSys.FAbon.ReturnNGwordLineNum := ShowNGLineCheckBox.Checked;
1407         GikoSys.FAbon.SetNGResAnchor := AddResAnchorCheckBox.Checked;
1408         GikoSys.FAbon.DeleteSyria := DeleteSyriaCheckBox.Checked;
1409 end;
1410 procedure TOptionDialog.CSSFontButtonClick(Sender: TObject);
1411 begin
1412
1413         FontDialog.Options := [fdAnsiOnly, fdEffects];
1414         FontDialog.Font.Assign(FCSSFont);
1415         if FontDialog.Execute then begin
1416                 FontDialog.Font.Style := FontDialog.Font.Style - [fsUnderline] - [fsStrikeout];
1417                 FCSSFont.Assign(FontDialog.Font);
1418                 //FCSSFont := FontDialog.Font;
1419         end;
1420
1421         CSSPreview;
1422
1423 end;
1424
1425 procedure TOptionDialog.CSSBackColorButtonClick(Sender: TObject);
1426 begin
1427
1428         ColorDialog.Color := FCSSBackColor;
1429         if ColorDialog.Execute then begin
1430                 FCSSBackColor := ColorDialog.Color;
1431         end;
1432
1433         CSSPreview;
1434
1435 end;
1436
1437 procedure TOptionDialog.CSSFontCheckBoxClick(Sender: TObject);
1438 begin
1439
1440         CSSFontButton.Enabled := CSSFontCheckBox.Checked;
1441         CSSPreview;
1442
1443 end;
1444
1445 procedure TOptionDialog.CSSBackColorCheckBoxClick(Sender: TObject);
1446 begin
1447
1448         CSSBackColorButton.Enabled := CSSBackColorCheckBox.Checked;
1449         CSSPreview;
1450
1451 end;
1452
1453 procedure TOptionDialog.CSSSetContent(Content: string);
1454 var
1455         doc : Variant;
1456 begin
1457         if CSSBrowser.Document <> nil then begin
1458                 doc := CSSBrowser.Document;
1459                 doc.open;
1460                                 doc.Clear;
1461                 doc.charset := 'Shift_JIS';
1462                 doc.Write(Content);
1463                 doc.Close;
1464   end;
1465 end;
1466
1467 procedure TOptionDialog.CSSPreview;
1468 var
1469         Board: TBoard;
1470         ThreadItem: TThreadItem;
1471         html: string;
1472         Res: array [0..1] of TResRec;
1473         UserOptionalStyle: string;
1474         i: Integer;
1475         fileName: string;
1476 begin
1477
1478         fileName := GikoSys.Setting.CSSFileName;
1479
1480         GikoSys.Setting.CSSFileName := 'default.css';
1481         if CSSListView.Items.Count > 0 then begin
1482                 try
1483                         if CSSListView.ItemIndex >= 0 then begin
1484                                 if CSSListView.Items[CSSListView.ItemIndex].Data <> nil then
1485                                         GikoSys.Setting.CSSFileName := string( CSSListView.Items[CSSListView.ItemIndex].data )
1486                                 else
1487                                         GikoSys.Setting.CSSFileName := CSSListView.Items[CSSListView.ItemIndex].Caption + '.css';
1488                         end;
1489                 except
1490                 end;
1491         end;
1492
1493         Board := TBoard.Create( nil, 'about://sample/' );
1494         ThreadItem := TThreadItem.Create( nil, 'about://sample/test/read.cgi/sample/' );
1495
1496         try
1497                 Board.Title := '\83T\83\93\83v\83\8b\94Â';
1498                 ThreadItem.ParentBoard := Board;
1499                 ThreadItem.AllResCount := High( Res );
1500                 ThreadItem.NewResCount := 1;
1501                 ThreadItem.NewReceive := 2;
1502                 ThreadItem.Title := '\83T\83\93\83v\83\8b\83v\83\8c\83r\83\85\81[';
1503
1504                 Res[0].FName := '\96¼\96³\82µ\82³\82ñ';
1505                 Res[0].FMailTo := 'sage';
1506                 Res[0].FDateTime := 'ID:Sample';
1507                 Res[0].FBody := 'CSS \82Æ\83X\83L\83\93\82Ì\83T\83\93\83v\83\8b';
1508                 Res[1].FName := '\96¼\96³\82µ\82³\82ñ';
1509                 Res[1].FMailTo := 'age';
1510                 Res[1].FDateTime := 'ID:Sample';
1511                 Res[1].FBody := '\83I\83}\83G\83\82\83i\81[';
1512
1513                 // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
1514                 if CSSFontCheckBox.Checked then begin
1515                         i := ColorToRGB( FCSSFont.Color );
1516                         i := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
1517
1518                         UserOptionalStyle := UserOptionalStyle +
1519                                 'font-family:"' + FCSSFont.Name + '";' +
1520                                 'font-size:' + IntToStr( FCSSFont.Size ) + 'pt;' +
1521                                 'color:#' + IntToHex( i, 6 ) + ';';
1522                         if fsBold in FCSSFont.Style then
1523                                 UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;'
1524                         else
1525                                 UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1526                         if fsItalic in FCSSFont.Style then
1527                                 UserOptionalStyle := UserOptionalStyle + 'font-style:italic;'
1528                         else
1529                                 UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1530                 end;
1531                 if CSSBackColorCheckBox.Checked then begin
1532                         i := ColorToRGB( FCSSBackColor );
1533                         i := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
1534
1535                         UserOptionalStyle := UserOptionalStyle +
1536                                 'background-color:#' + IntToHex( i, 6 ) + ';';
1537                 end;
1538
1539                 if FileExists( GikoSys.GetSkinHeaderFileName ) then begin
1540                         html :=
1541                                 GikoSys.LoadFromSkin( GikoSys.GetSkinHeaderFileName, ThreadItem, 0 ) +
1542                                 '<a name="top"></a>' +
1543                                 GikoSys.SkinedRes( GikoSYs.LoadFromSkin( GikoSys.GetSkinResFileName, ThreadItem, 0 ), Res[0], '1' ) +
1544                                 GikoSys.SkinedRes( GikoSYs.LoadFromSkin( GikoSys.GetSkinNewResFileName, ThreadItem, 0 ), Res[1], '2' ) +
1545                                 '<a name="bottom"></a>' +
1546                                 GikoSys.LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, 0 );
1547
1548                         html := StringReplace( html, '</head>',
1549                                 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>', [rfReplaceAll] );
1550                 end else begin
1551                         html :=
1552                                 '<html><head>' +
1553                                 '<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">' +
1554                                 '<title>' + ThreadItem.Title + '</title>' +
1555                                 '<link rel="stylesheet" href="' + GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName + '" type="text/css">' +
1556                                 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' +
1557                                 '</head><body>' +
1558                                 '<div class="title">' + ThreadItem.Title + '</div>';
1559
1560                                 for i := 0 to High( Res ) do
1561                                 begin
1562                                         html := html +
1563                                                 '<div class="header"><span class="no">' + IntToStr( i + 1 ) + '</span>' +
1564                                                 '<span class="name_label"> \96¼\91O\81F </span>' +
1565                                                 '<a class="name_mail" href="mailto:' + Res[i].FMailTo + '">' +
1566                                                 '<b>' + Res[i].FName + '</b></a><span class="mail"> [' + Res[i].FMailTo + ']</span>' +
1567                                                 '<span class="date_label"> \93\8a\8de\93ú\81F</span>' +
1568                                                 '<span class="date"> ' + Res[i].FDateTime+ '</span></div>' +
1569                                                 '<div class="mes">' + Res[i].FBody + ' </div>';
1570                                 end;
1571
1572                                 html := html + '</body></html>';
1573                 end;
1574
1575                 try
1576                         CSSSetContent( html );
1577                 except
1578                 end;
1579
1580         finally
1581                 ThreadItem.Free;
1582                 Board.Free;
1583                 GikoSys.Setting.CSSFileName := fileName;
1584         end;
1585
1586 end;
1587
1588 procedure TOptionDialog.CSSListViewChange(Sender: TObject; Item: TListItem;
1589         Change: TItemChange);
1590 begin
1591
1592         if OptionTab.ActivePage = CSSTabSheet then
1593                 CSSPreview;
1594
1595 end;
1596
1597 procedure TOptionDialog.AddURLButtonClick(Sender: TObject);
1598 begin
1599         BoardURLComboBox.Items.Append(BoardURLComboBox.Text);
1600   BoardURLComboBox.ItemIndex := BoardURLComboBox.Items.Count - 1;
1601 end;
1602
1603 procedure TOptionDialog.RemoveURLButtonClick(Sender: TObject);
1604 begin
1605         BoardURLComboBox.DeleteSelected;
1606 end;
1607
1608 procedure TOptionDialog.OddResNumCheckBoxClick(Sender: TObject);
1609 begin
1610         OddResNumColorBox.Enabled := OddResNumCheckBox.Checked;
1611 end;
1612
1613 procedure TOptionDialog.ResRangeHoldCheckBoxClick(Sender: TObject);
1614 begin
1615         ResRangeHoldComboBox.Enabled := ResRangeHoldCheckBox.Checked;
1616 end;
1617
1618 procedure TOptionDialog.CroutOptionClick(Sender: TObject);
1619 var
1620         KuroutOption: TKuroutOption;
1621 begin
1622         KuroutOption := TKuroutOption.Create(Self);
1623         try
1624                 KuroutOption.ShowModal;
1625         finally
1626                 KuroutOption.Release;
1627         end;
1628 end;
1629
1630 end.
1631