OSDN Git Service

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