OSDN Git Service

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