OSDN Git Service

ハ゛タ55以前からアップデートすると、レスポップアップ位置の左右が逆転する不具合の修正
[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                 TabAddRadioGroup: TRadioGroup;
123                 GroupBox8: TGroupBox;
124                 Label14: TLabel;
125                 Label15: TLabel;
126                 Label16: TLabel;
127                 PreviewVisibleCheckBox: TCheckBox;
128                 PreviewSizeComboBox: TComboBox;
129                 PreviewWaitEdit: TEdit;
130                 GroupBox10: TGroupBox;
131                 UnActivePopupCheckBox: TCheckBox;
132                 ResPopupBoldCheckBox: TCheckBox;
133                 TabSheet2: TTabSheet;
134                 GroupBox7: TGroupBox;
135                 Label3: TLabel;
136                 Label11: TLabel;
137                 URLDisplayCheckBox: TCheckBox;
138                 AddressHistoryCountEdit: TEdit;
139                 TabStopAddressBarCheckBox: TCheckBox;
140                 LinkAddCheckBox: TCheckBox;
141                 GroupBox15: TGroupBox;
142                 ShowDialogForEndCheckBox: TCheckBox;
143                 AllTabCloseCheckBox: TCheckBox;
144                 SambaGroupBox: TGroupBox;
145                 UseSambaCheckBox: TCheckBox;
146                 TabAutoSaveLoad: TGroupBox;
147                 TabLoadSave: TCheckBox;
148                 SoundSheet: TTabSheet;
149                 SoundEventGroupBox: TGroupBox;
150                 SoundListView: TListView;
151                 SoundReferButton: TButton;
152                 SoundFileEdit: TEdit;
153                 SoundPlayButton: TBitBtn;
154                 FolderSheet: TTabSheet;
155                 FolderGroupBox: TGroupBox;
156                 Label1: TLabel;
157                 Label2: TLabel;
158                 Label5: TLabel;
159                 LogFolderEdit: TEdit;
160                 LogFolderButton: TButton;
161                 NGwordSheet: TTabSheet;
162                 GroupBox14: TGroupBox;
163                 RloCheckBox: TCheckBox;
164                 ReplaceulCheckBox: TCheckBox;
165                 PopUpAbonCheckBox: TCheckBox;
166                 ShowNGLineCheckBox: TCheckBox;
167                 AddResAnchorCheckBox: TCheckBox;
168                 DeleteSyriaCheckBox: TCheckBox;
169                 UserIDSheet: TTabSheet;
170                 GroupBox3: TGroupBox;
171                 Label9: TLabel;
172                 Label10: TLabel;
173                 ForcedLoginLabel: TLabel;
174                 UserIDEdit: TEdit;
175                 PasswordEdit: TEdit;
176                 AutoLoginCheckBox: TCheckBox;
177                 ForcedLoginCheckBox: TCheckBox;
178                 GroupBox4: TGroupBox;
179                 Label13: TLabel;
180                 BoardURLComboBox: TComboBox;
181                 AddURLButton: TButton;
182                 RemoveURLButton: TButton;
183                 OkBotton: TButton;
184                 SpamFilterGroupBox: TGroupBox;
185                 SpamFilterAlgorithmComboBox: TComboBox;
186                 TabSheet4: TTabSheet;
187                 GroupBox13: TGroupBox;
188                 UseUndecidedCheckBox: TCheckBox;
189                 Tora3URLLabel: TLabel;
190                 Label12: TLabel;
191                 GroupBox11: TGroupBox;
192                 Label7: TLabel;
193                 BeUserIDEdit: TEdit;
194                 Label8: TLabel;
195     BeCodeEdit: TEdit;
196                 BeAutoLoginCheckBox: TCheckBox;
197     GroupBox19: TGroupBox;
198     Label17: TLabel;
199     MaxRecordCountEdit: TEdit;
200     Label18: TLabel;
201     UnFocusedBoldCheckBox: TCheckBox;
202     IgnoreKanaCheckBox: TCheckBox;
203     UseKatjuTypeSkinCheckBox: TCheckBox;
204     GroupBox20: TGroupBox;
205     AutoSortCheckBox: TCheckBox;
206     Label24: TLabel;
207     GroupBox21: TGroupBox;
208     StoredTaskTrayCB: TCheckBox;
209     GroupBox22: TGroupBox;
210     LoopBrowserTabsCB: TCheckBox;
211     GroupBox23: TGroupBox;
212     IgnoreContextCheckBox: TCheckBox;
213     GroupBox24: TGroupBox;
214     gppRightTopRB: TRadioButton;
215     gppTopRB: TRadioButton;
216     gppLeftTopRB: TRadioButton;
217     gppLeftRB: TRadioButton;
218     gppRightRB: TRadioButton;
219     gppLeftBottomRB: TRadioButton;
220     gppBottomRB: TRadioButton;
221     gppRighBottomRB: TRadioButton;
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
770         //\8fI\97¹\8e\9e\8am\94F\83_\83C\83A\83\8d\83O
771         ShowDialogForEndCheckBox.Checked := GikoSys.Setting.ShowDialogForEnd;
772         //AllTabClose
773         AllTabCloseCheckBox.Checked := GikoSys.Setting.ShowDialogForAllTabClose;
774         //Samba
775         UseSambaCheckBox.Checked := GikoSys.Setting.UseSamba;
776         ResAnchorCheckBox.Checked := GikoSys.Setting.ResAnchorJamp;
777         // \83u\83\89\83E\83U\8dÅ\91å\89»
778         BrowserMaxCombo.ItemIndex := Ord( GikoSys.Setting.BrowserAutoMaximize );
779         //\83|\83b\83v\83A\83b\83v\88Ê\92u
780         case GikoSys.Setting.PopupPosition of
781                 gppRightTop:            gppRightTopRB.Checked := True;
782                 gppRight:                       gppRightRB.Checked := True;
783                 gppRightBottom:     gppRighBottomRB.Checked := True;
784                 gppTop:                         gppTopRB.Checked := True;
785                 gppCenter:                      gppTopRB.Checked := True; // \93Ç\82Ý\8d\9e\82Ý\82Å\95Ï\8a·\82µ\82Ä\82é\82Í\82¸
786                 gppBottom:                      gppBottomRB.Checked := True;
787                 gppLeftTop:             gppLeftTopRB.Checked := True;
788                 gppLeft:                        gppLeftRB.Checked := True;
789                 gppLeftBottom:      gppLeftBottomRB.Checked := True;
790         end;
791
792         //\94ñ\83A\83N\83e\83B\83u\8e\9e\83|\83b\83v\83A\83b\83v\95\\8e¦
793         UnActivePopupCheckBox.Checked := GikoSys.Setting.UnActivePopup;
794         //\83\8c\83X\83|\83b\83v\83A\83b\83v\83{\81[\83\8b\83h\95\\8e¦
795         ResPopupBoldCheckBox.Checked := GikoSys.Setting.ResPopupHeaderBold;
796
797         //\83A\83h\83\8c\83X\83o\81[
798         URLDisplayCheckBox.Checked := GikoSys.Setting.URLDisplay;
799         TabStopAddressBarCheckBox.Checked := GikoSys.Setting.AddressBarTabStop;
800         LinkAddCheckBox.Checked := GikoSys.Setting.LinkAddAddressBar;
801         AddressHistoryCountEdit.Text := IntToStr(GikoSys.Setting.AddressHistoryCount);
802
803         //HTML\83v\83\8c\83r\83\85\81[
804         PreviewVisibleCheckBox.Checked := GikoSys.Setting.PreviewVisible;
805         PreviewWaitEdit.Text := IntToStr(GikoSys.Setting.PreviewWait);
806         PreviewSizeComboBox.ItemIndex := 2;
807         case GikoSys.Setting.PreviewSize of
808                 gpsXLarge: PreviewSizeComboBox.ItemIndex := 4;
809                 gpsLarge: PreviewSizeComboBox.ItemIndex := 3;
810                 gpsMedium: PreviewSizeComboBox.ItemIndex := 2;
811                 gpsSmall: PreviewSizeComboBox.ItemIndex := 1;
812                 gpsXSmall: PreviewSizeComboBox.ItemIndex := 0;
813         end;
814
815         //\83X\83\8c\83b\83h\88ê\97\97\8dX\90V\83A\83C\83R\83\93
816         ThreadListIconCheckBox.Checked := GikoSys.Setting.ListIconVisible;
817         CreationTimeLogsCheckBox.Checked := GikoSys.Setting.CreationTimeLogs;
818         FutureThreadCheckBox.Checked := GikoSys.Setting.FutureThread;
819         SelectIntervalEdit.Text := IntToStr(GikoSys.Setting.SelectInterval);
820
821         //dat\97\8e\82¿\83X\83\8c\83\\81[\83g\8f\87
822         case TGikoBoardColumnID( GikoSys.Setting.DatOchiSortIndex ) of
823                 gbcTitle:
824                         if GikoSys.Setting.DatOchiSortOrder then
825                                 DatOchiSortCombo.ItemIndex := 1
826                         else
827                                 DatOchiSortCombo.ItemIndex := 2;
828                 gbcRoundDate://gbcLastModified:
829                         if GikoSys.Setting.DatOchiSortOrder then
830                                 DatOchiSortCombo.ItemIndex := 3
831                         else
832                                 DatOchiSortCombo.ItemIndex := 4;
833                 gbcCreated:
834                         if GikoSys.Setting.DatOchiSortOrder then
835                                 DatOchiSortCombo.ItemIndex := 5
836                         else
837                                 DatOchiSortCombo.ItemIndex := 6;
838                 gbcLastModified:
839                         if GikoSys.Setting.DatOchiSortOrder then
840                                 DatOchiSortCombo.ItemIndex := 7
841                         else
842                                 DatOchiSortCombo.ItemIndex := 8;
843         else
844                 DatOchiSortCombo.ItemIndex := 0;
845         end;
846         AutoSortCheckBox.Checked := GikoSys.Setting.AutoSortThreadList;
847         
848         //\82 \82Ú\81`\82ñ
849         RloCheckBox.Checked := GikoSys.Setting.AbonDeleterlo;
850         ReplaceulCheckBox.Checked := GikoSys.Setting.AbonReplaceul;
851         PopUpAbonCheckBox.Checked := GikoSys.Setting.PopUpAbon;
852         ShowNGLineCheckBox.Checked := GikoSys.Setting.ShowNGLinesNum;
853         AddResAnchorCheckBox.Checked := GikoSys.Setting.AddResAnchor;
854         DeleteSyriaCheckBox.Checked := GikoSys.Setting.DeleteSyria;
855         IgnoreKanaCheckBox.Checked := GikoSys.Setting.IgnoreKana;
856 {$IFDEF SPAM_FILTER_ENABLED}
857         // \83X\83p\83\80\83t\83B\83\8b\83^\82Ì\90Ý\92è\82ð\95\\8e¦\82·\82é
858         SpamFilterGroupBox.Visible := True;
859 {$ENDIF}
860         // \8eg\97p\82·\82é\83X\83p\83\80\83t\83B\83\8b\83^
861 {$IFDEF DEBUG}
862         SpamFilterAlgorithmComboBox.Clear;
863         SpamFilterAlgorithmComboBox.AddItem( '\8eg\97p\82µ\82È\82¢', nil );
864         SpamFilterAlgorithmComboBox.AddItem( 'Paul Graham \96@', nil );
865         SpamFilterAlgorithmComboBox.AddItem( 'Gary Robinson \96@', nil );
866         SpamFilterAlgorithmComboBox.AddItem( 'Gary Robinson-Fisher \96@', nil );
867 {$ENDIF}
868         SpamFilterAlgorithmComboBox.ItemIndex :=
869                 Ord( GikoSys.Setting.SpamFilterAlgorithm );
870
871         //TabAutoLoad
872         TabLoadSave.Checked := Gikosys.Setting.TabAutoLoadSave;
873         UseUndecidedCheckBox.Checked := GikoSys.Setting.UseUndecided;
874
875         //Be2ch\94F\8fØ
876         BeUserIDEdit.Text := GikoSys.Setting.BeUserID;
877         BeCodeEdit.Text := GikoSys.Setting.BeCode;
878         BeAutoLoginCheckBox.Checked := GikoSys.Setting.BeAutoLogin;
879         //\97\9a\97ð\82Ì\8dÅ\91å\95Û\91\90\94
880         MaxRecordCountEdit.Text := IntToStr(GikoSys.Setting.MaxRecordCount);
881     // \8dÅ\8f¬\89»\8e\9e\82É\83^\83X\83N\83g\83\8c\83C\82É\8ai\94[\82·\82é\82©
882     StoredTaskTrayCB.Checked := GikoSys.Setting.StoredTaskTray;
883     // \83u\83\89\83E\83U\83^\83u\82Ì\88Ú\93®\82Å\83\8b\81[\83v\82ð\8b\96\89Â\82·\82é\82©
884     LoopBrowserTabsCB.Checked := GikoSys.Setting.LoopBrowserTabs;
885     //
886     IgnoreContextCheckBox.Checked := GikoSys.Setting.GestureIgnoreContext;
887 end;
888
889 procedure TOptionDialog.SaveSetting;
890 var
891         i: Integer;
892         tmp: string;
893 //      Item: TListItem;
894 begin
895         GikoSys.Setting.OptionDialogTabIndex := OptionTab.TabIndex;
896
897         GikoSys.Setting.ReadProxy := ReadProxyCheck.Checked;
898         GikoSys.Setting.ReadProxyAddress := ReadProxyAddressEdit.Text;
899         GikoSys.Setting.ReadProxyPort := StrToInt(ReadPortEdit.Text);
900         GikoSys.Setting.ReadProxyUserID := ReadProxyUserIDEdit.Text;
901         GikoSys.Setting.ReadProxyPassword := ReadProxyPasswordEdit.Text;
902
903         GikoSys.Setting.WriteProxy := WriteProxyCheck.Checked;
904         GikoSys.Setting.WriteProxyAddress := WriteProxyAddressEdit.Text;
905         GikoSys.Setting.WriteProxyPort := StrToInt(WritePortEdit.Text);
906         GikoSys.Setting.WriteProxyUserID := WriteProxyUserIDEdit.Text;
907         GikoSys.Setting.WriteProxyPassword := WriteProxyPasswordEdit.Text;
908
909         GikoSys.Setting.CabinetFontName := CabinetMemo.Font.Name;
910         GikoSys.Setting.CabinetFontSize := CabinetMemo.Font.Size;
911         GikoSys.Setting.CabinetFontColor := CabinetMemo.Font.Color;
912         GikoSys.Setting.CabinetFontBold  := fsBold in CabinetMemo.Font.Style;
913         GikoSys.Setting.CabinetFontItalic:= fsItalic in CabinetMemo.Font.Style;
914         GikoSys.Setting.CabinetBackColor := CabinetMemo.Color;
915
916         GikoSys.Setting.ListFontName    := ListMemo.Font.Name;
917         GikoSys.Setting.ListFontSize    := ListMemo.Font.Size;
918         GikoSys.Setting.ListFontColor   := ListMemo.Font.Color;
919         GikoSys.Setting.ListFontBold    := fsBold in ListMemo.Font.Style;
920         GikoSys.Setting.ListFontItalic  := fsItalic in ListMemo.Font.Style;
921         GikoSys.Setting.ListBackColor := ListMemo.Color;
922         GikoSys.Setting.UseOddColorOddResNum := OddResNumCheckBox.Checked;
923         GikoSys.Setting.OddColor := OddResNumColorBox.Selected;
924         GikoSys.Setting.UnFocusedBold := (UnFocusedBoldCheckBox.Enabled) and
925                                                                                 (UnFocusedBoldCheckBox.Checked);
926
927         GikoSys.Setting.HintFontName := HintMemo.Font.Name;
928         GikoSys.Setting.HintFontSize := HintMemo.Font.Size;
929         GikoSys.Setting.HintFontColor := HintMemo.Font.Color;
930         GikoSys.Setting.HintBackColor := HintMemo.Color;
931
932         GikoSys.Setting.BrowserTabFontName := BrowserTabMemo.Font.Name;
933         GikoSys.Setting.BrowserTabFontSize := BrowserTabMemo.Font.Size;
934         GikoSys.Setting.BrowserTabFontBold := fsBold in BrowserTabMemo.Font.Style;
935         GikoSys.Setting.BrowserTabFontItalic := fsItalic in BrowserTabMemo.Font.Style;
936         GikoSys.Setting.EditorFontName := EditorMemo.Font.Name;
937         GikoSys.Setting.EditorFontSize := EditorMemo.Font.Size;
938         GikoSys.Setting.EditorFontColor := EditorMemo.Font.Color;
939         GikoSys.Setting.EditorBackColor := EditorMemo.Color;
940         {FRepaintThread : \95\\8e¦\8dÏ\82Ý\83X\83\8c\83b\83h\82Ì\8dÄ\95`\89æ\82ª\95K\97v\82©\82Ç\82¤\82©
941         \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Ì
942         \83X\83\8c\83b\83h\82ÌRepaint\82ðtrue\82É\82·\82é
943         }
944         //CSS\95\\8e¦
945         if GikoSys.Setting.UseCSS <> CSSCheckBox.Checked then FRepaintThread := true;
946         GikoSys.Setting.UseCSS := CSSCheckBox.Checked;
947         GikoSys.Setting.UseKatjushaType := UseKatjuTypeSkinCheckBox.Checked;
948         //CSS\83t\83@\83C\83\8b\96¼
949         tmp := GikoSys.Setting.CSSFileName;
950         GikoSys.Setting.CSSFileName := DEFAULT_CSS_FILENAME;
951         if CSSListView.Items.Count > 0 then begin
952                 try
953                         if CSSListView.Items[CSSListView.ItemIndex].Data <> nil then
954                                 GikoSys.Setting.CSSFileName := string( CSSListView.Items[CSSListView.ItemIndex].data )
955                         else
956                                 GikoSys.Setting.CSSFileName := CSSListView.Items[CSSListView.ItemIndex].Caption + '.css';
957                 except
958                 end;
959         end;
960         if tmp <> GikoSys.Setting.CSSFileName then FRepaintThread := true;
961         // CSS \82Ì\83t\83H\83\93\83g\8ew\92è
962         if CSSFontCheckBox.Checked then begin
963                 if GikoSys.Setting.BrowserFontName <> FCSSFont.Name then FRepaintThread := true;
964                 GikoSys.Setting.BrowserFontName := FCSSFont.Name;
965                 if GikoSys.Setting.BrowserFontSize <> FCSSFont.Size then FRepaintThread := true;
966                 GikoSys.Setting.BrowserFontSize := FCSSFont.Size;
967                 if fsBold in FCSSFont.Style then begin
968                         if GikoSys.Setting.BrowserFontBold <> 1 then FRepaintThread := true;
969                         GikoSys.Setting.BrowserFontBold := 1;
970                 end else begin
971                         if GikoSys.Setting.BrowserFontBold <> -1 then FRepaintThread := true;
972                         GikoSys.Setting.BrowserFontBold := -1;
973                 end;
974                 if fsItalic in FCSSFont.Style then begin
975                         if GikoSys.Setting.BrowserFontItalic <> 1 then FRepaintThread := true;
976                         GikoSys.Setting.BrowserFontItalic := 1;
977                 end else begin
978                         if GikoSys.Setting.BrowserFontItalic <> -1 then FRepaintThread := true;
979                         GikoSys.Setting.BrowserFontItalic := -1;
980                 end;
981                 i := ColorToRGB( FCSSFont.Color );
982                 if (GikoSys.Setting.BrowserFontColor <> (i shr 16) or (i and $ff00) or ((i and $ff) shl 16)) then
983                         FRepaintThread := true;
984                 GikoSys.Setting.BrowserFontColor := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
985         end else begin
986                 if GikoSys.Setting.BrowserFontName <> '' then FRepaintThread := true;
987                 GikoSys.Setting.BrowserFontName := '';
988                 if GikoSys.Setting.BrowserFontSize <> 0 then FRepaintThread := true;
989                 GikoSys.Setting.BrowserFontSize := 0;
990                 if GikoSys.Setting.BrowserFontBold <> 0 then FRepaintThread := true;
991                 GikoSys.Setting.BrowserFontBold := 0;
992                 if GikoSys.Setting.BrowserFontItalic <> 0 then FRepaintThread := true;
993                 GikoSys.Setting.BrowserFontItalic := 0;
994                 if GikoSys.Setting.BrowserFontColor <> -1 then FRepaintThread := true;
995                 GikoSys.Setting.BrowserFontColor := -1;
996         end;
997         if CSSBackColorCheckBox.Checked then begin
998                 i := ColorToRGB( FCSSBackColor );
999                 if(GikoSys.Setting.BrowserBackColor <> (i shr 16) or (i and $ff00) or ((i and $ff) shl 16)) then
1000                         FRepaintThread := true;
1001                 GikoSys.Setting.BrowserBackColor := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
1002         end else begin
1003                 if GikoSys.Setting.BrowserBackColor <> -1 then FRepaintThread := true;
1004                 GikoSys.Setting.BrowserBackColor := -1;
1005         end;
1006
1007         //Mail\97\93\95\\8e¦
1008         if GikoSys.Setting.ShowMail <> ShowMailCheckBox.Checked then FRepaintThread := true;
1009         GikoSys.Setting.ShowMail := ShowMailCheckBox.Checked;
1010         // \8bN\93®\8e\9e\83\8c\83X\95\\8e¦\94Í\88Í\82Ì\8cÅ\92è
1011         GikoSys.Setting.ResRangeHold := ResRangeHoldCheckBox.Checked;
1012         case ResRangeHoldComboBox.ItemIndex of
1013                 0: GikoSys.Setting.ResRange := Ord( grrAll );
1014                 1: GikoSys.Setting.ResRange := 100;
1015                 2: GikoSys.Setting.ResRange := Ord( grrKoko );
1016                 3: GikoSys.Setting.ResRange := Ord( grrNew );
1017         end;
1018
1019         GikoSys.Setting.BrowserTabAppend := TGikoTabAppend(TabAddRadioGroup.ItemIndex);
1020
1021 //      GikoSys.Setting.BoardURL2ch := BoardURL2chEdit.Text;
1022         GikoSys.Setting.BoardURLs.Clear;
1023         GikoSys.Setting.BoardURLs.AddStrings(BoardURLComboBox.Items);
1024         GikoSys.Setting.BoardURLSelected := BoardURLComboBox.ItemIndex + 1;
1025         GikoSys.Setting.UserID := UserIDEdit.Text;
1026         GikoSys.Setting.Password := PasswordEdit.Text;
1027         GikoSys.Setting.AutoLogin := AutoLoginCheckBox.Checked;
1028         GikoSys.Setting.ForcedLogin := ForcedLoginCheckBox.Checked;
1029         GikoSys.Setting.URLApp := URLAppCheckBox.Checked;
1030         GikoSys.Setting.URLAppFile := AppFolderEdit.Text;
1031
1032         GikoSys.Setting.OpenMailer := OpenMailerCheckBox.Checked;
1033         GikoSys.Setting.DeleteMsg := LogDeleteMessageCheckBox.Checked;
1034         //\8fI\97¹\8e\9e\8am\94F\83_\83C\83A\83\8d\83O
1035         GikoSys.Setting.ShowDialogForEnd := ShowDialogForEndCheckBox.Checked;
1036         //AllTabClose
1037         GikoSys.Setting.ShowDialogForAllTabClose := AllTabCloseCheckBox.Checked;
1038         //Samba
1039         GikoSys.Setting.UseSamba := UseSambaCheckBox.Checked;
1040         GikoSys.Setting.ResAnchorJamp := ResAnchorCheckBox.Checked;
1041         // \83u\83\89\83E\83U\8dÅ\91å\89»
1042         GikoSys.Setting.BrowserAutoMaximize := TGikoBrowserAutoMaximize( BrowserMaxCombo.ItemIndex );
1043         //\83|\83b\83v\83A\83b\83v\88Ê\92u
1044     if (gppRightTopRB.Checked) then GikoSys.Setting.PopupPosition := gppRightTop;
1045     if (gppRightRB.Checked) then GikoSys.Setting.PopupPosition := gppRight;
1046     if (gppRighBottomRB.Checked) then GikoSys.Setting.PopupPosition := gppRightBottom;
1047     if (gppTopRB.Checked) then GikoSys.Setting.PopupPosition := gppTop;
1048     if (gppBottomRB.Checked) then GikoSys.Setting.PopupPosition := gppBottom;
1049     if (gppLeftTopRB.Checked) then GikoSys.Setting.PopupPosition := gppLeftTop;
1050     if (gppLeftRB.Checked) then GikoSys.Setting.PopupPosition := gppLeft;
1051     if (gppLeftBottomRB.Checked) then GikoSys.Setting.PopupPosition := gppLeftBottom;
1052         //\94ñ\83A\83N\83e\83B\83u\8e\9e\83|\83b\83v\83A\83b\83v\95\\8e¦
1053         GikoSys.Setting.UnActivePopup := UnActivePopupCheckBox.Checked;
1054         //\83\8c\83X\83|\83b\83v\83A\83b\83v\83{\81[\83\8b\83h\95\\8e¦
1055         GikoSys.Setting.ResPopupHeaderBold := ResPopupBoldCheckBox.Checked;
1056
1057         //\83A\83h\83\8c\83X\83o\81[
1058         GikoSys.Setting.URLDisplay := URLDisplayCheckBox.Checked;
1059         GikoSys.Setting.AddressBarTabStop := TabStopAddressBarCheckBox.Checked;
1060         GikoSys.Setting.LinkAddAddressBar := LinkAddCheckBox.Checked;
1061         if GikoSys.IsNumeric(AddressHistoryCountEdit.Text) then
1062                 GikoSys.Setting.AddressHistoryCount := StrToInt(AddressHistoryCountEdit.Text)
1063         else
1064                 GikoSys.Setting.AddressHistoryCount := 100;
1065
1066         //HTML\83v\83\8c\83r\83\85\81[
1067         GikoSys.Setting.PreviewVisible := PreviewVisibleCheckBox.Checked;
1068         if GikoSys.IsNumeric(PreviewWaitEdit.Text) then
1069                 GikoSys.Setting.PreviewWait := StrToInt(PreviewWaitEdit.Text)
1070         else
1071                 GikoSys.Setting.PreviewWait := 500;
1072         case PreviewSizeComboBox.ItemIndex of
1073                 0: GikoSys.Setting.PreviewSize := gpsXSmall;
1074                 1: GikoSys.Setting.PreviewSize := gpsSmall;
1075                 2: GikoSys.Setting.PreviewSize := gpsMedium;
1076                 3: GikoSys.Setting.PreviewSize := gpsLarge;
1077                 4: GikoSys.Setting.PreviewSize := gpsXLarge;
1078         end;
1079
1080         //\83X\83\8c\83b\83h\88ê\97\97\8dX\90V\83A\83C\83R\83\93
1081         GikoSys.Setting.ListIconVisible := ThreadListIconCheckBox.Checked;
1082
1083         GikoSys.Setting.CreationTimeLogs := CreationTimeLogsCheckBox.Checked;
1084         GikoSys.Setting.FutureThread := FutureThreadCheckBox.Checked;
1085         if StrToIntDef(SelectIntervalEdit.Text, 110) > 55 then
1086                 GikoSys.Setting.SelectInterval := StrToIntDef(SelectIntervalEdit.Text, 110)
1087         else
1088                 GikoSys.Setting.SelectInterval := 55;
1089
1090         //dat\97\8e\82¿\83X\83\8c\83\\81[\83g\8f\87
1091         case DatOchiSortCombo.ItemIndex of
1092                 0: GikoSys.Setting.DatOchiSortIndex := -1;      //\95À\82Ñ\91Ö\82¦\82µ\82È\82¢
1093                 1: begin        //\83X\83\8c\94Ô\8d\86(\8f¸\8f\87)
1094                         GikoSys.Setting.DatOchiSortOrder := true;
1095                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcTitle );
1096                    end;
1097                 2: begin        //\83X\83\8c\94Ô\8d\86(\8d~\8f\87)
1098                         GikoSys.Setting.DatOchiSortOrder := false;
1099                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcTitle );
1100                    end;
1101                 3: begin        //\8eæ\93¾\93ú\8e\9e(\8f¸\8f\87)
1102                         GikoSys.Setting.DatOchiSortOrder := true;
1103                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcRoundDate );{gbcLastModified}
1104                    end;
1105                 4: begin        //\8eæ\93¾\93ú\8e\9e(\8d~\8f\87)
1106                         GikoSys.Setting.DatOchiSortOrder := false;
1107                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcRoundDate );{gbcLastModified}
1108                    end;
1109                 5: begin        //\83X\83\8c\8dì\90¬\93ú\8e\9e(\8f¸\8f\87)
1110                         GikoSys.Setting.DatOchiSortOrder := true;
1111                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcCreated );
1112                    end;
1113                 6: begin        //\83X\83\8c\8dì\90¬\93ú\8e\9e(\8d~\8f\87)
1114                         GikoSys.Setting.DatOchiSortOrder := false;
1115                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcCreated );
1116                    end;
1117                 7:      begin  //\83X\83\8c\8dÅ\8fI\8dX\90V\93ú\8e\9e\81i\8f¸\8f\87\81j
1118                         GikoSys.Setting.DatOchiSortOrder := true;
1119                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcLastModified );{gbcLastModified}
1120                         end;
1121                 8:      begin  //\83X\83\8c\8dÅ\8fI\8dX\90V\93ú\8e\9e\81i\8d~\8f\87\81j
1122                         GikoSys.Setting.DatOchiSortOrder := false;
1123                         GikoSys.Setting.DatOchiSortIndex := Ord( gbcLastModified );{gbcLastModified}
1124                         end;
1125         end;
1126         GikoSys.Setting.AutoSortThreadList := AutoSortCheckBox.Checked;
1127
1128         GikoSys.Setting.WriteSystemSettingFile;
1129         GikoSys.Setting.WriteBoardURLSettingFile;
1130 //      GikoForm.SetBrowserTabState;
1131
1132         if LogFolderEdit.Text <> '' then begin
1133                 GikoSys.Setting.NewLogFolder := LogFolderEdit.Text;
1134                 GikoSys.Setting.WriteFolderSettingFile;
1135         end;
1136
1137         for i := 0 to SoundListView.Items.Count - 1 do begin
1138                 if FileExists(SoundListView.Items[i].SubItems[0]) then
1139                         GikoSys.Setting.SoundFileName[i] := SoundListView.Items[i].SubItems[0]
1140                 else
1141                         GikoSys.Setting.SoundFileName[i] := '';
1142         end;
1143
1144         //\82 \82Ú\81`\82ñ
1145         GikoSys.Setting.AbonDeleterlo := RloCheckBox.Checked;
1146         GikoSys.Setting.AbonReplaceul := ReplaceulCheckBox.Checked;
1147         GikoSys.Setting.PopUpAbon := PopUpAbonCheckBox.Checked;
1148         GikoSys.Setting.ShowNGLinesNum := ShowNGLineCheckBox.Checked;
1149         GikoSys.Setting.AddResAnchor := AddResAnchorCheckBox.Checked;
1150         GikoSys.Setting.DeleteSyria := DeleteSyriaCheckBox.Checked;
1151         GikoSys.Setting.IgnoreKana := IgnoreKanaCheckBox.Checked;
1152         GikoSys.FAbon.IgnoreKana := GikoSys.Setting.IgnoreKana;
1153         // \8eg\97p\82·\82é\83X\83p\83\80\83t\83B\83\8b\83^
1154         if GikoSys.Setting.SpamFilterAlgorithm <> TGikoSpamFilterAlgorithm(
1155                 SpamFilterAlgorithmComboBox.ItemIndex ) then begin
1156                 GikoSys.Setting.SpamFilterAlgorithm := TGikoSpamFilterAlgorithm(
1157                         SpamFilterAlgorithmComboBox.ItemIndex );
1158                 FRepaintThread := True;
1159         end;
1160
1161         //Tab\8e©\93®\95Û\91
1162         GikoSys.Setting.TabAutoLoadSave := TabLoadSave.Checked;
1163         GikoSys.Setting.UseUndecided := UseUndecidedCheckBox.Checked;
1164         //Be2ch
1165         GikoSys.Setting.BeUserID := BeUserIDEdit.Text;
1166         GikoSys.Setting.BeCode := BeCodeEdit.Text;
1167                 GikoSys.Setting.BeAutoLogin := BeAutoLoginCheckBox.Checked;
1168         //\97\9a\97ð\82Ì\8dÅ\91å\95Û\91\90\94
1169         GikoSys.Setting.MaxRecordCount := Max(StrToInt64Def(MaxRecordCountEdit.Text,100),1);
1170     GikoSys.Setting.StoredTaskTray := StoredTaskTrayCB.Checked;
1171     GikoSys.Setting.LoopBrowserTabs := LoopBrowserTabsCB.Checked;
1172
1173     GikoSys.Setting.GestureIgnoreContext := IgnoreContextCheckBox.Checked;
1174 end;
1175
1176 procedure TOptionDialog.SettingApply;
1177 var
1178         i: Integer;
1179 begin
1180         GikoForm.TreeView.Items.BeginUpdate;
1181         GikoForm.FavoriteTreeView.Items.BeginUpdate;
1182         GikoForm.ListView.Items.BeginUpdate;
1183         try
1184                 GikoForm.TreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1185                 GikoForm.TreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1186                 GikoForm.TreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1187                 GikoForm.TreeView.Color := GikoSys.Setting.CabinetBackColor;
1188
1189                 GikoForm.FavoriteTreeView.Font.Assign(GikoForm.TreeView.Font);
1190                 GikoForm.FavoriteTreeView.Color := GikoSys.Setting.CabinetBackColor;
1191
1192                 GikoForm.ListView.Font.Name := GikoSys.Setting.ListFontName;
1193                 GikoForm.ListView.Font.Size := GikoSys.Setting.ListFontSize;
1194                 GikoForm.ListView.Font.Color := GikoSys.Setting.ListFontColor;
1195                 GikoForm.ListView.Font.Style := [];
1196                 if GikoSys.Setting.ListFontBold then
1197                         GikoForm.ListView.Font.Style := [fsbold];
1198                 if GikoSys.Setting.ListFontItalic then
1199                         GikoForm.ListView.Font.Style := GikoForm.ListView.Font.Style + [fsitalic];
1200
1201                 //GikoForm.ListView.Color := GikoSys.Setting.ListBackColor;
1202                 GikoForm.ListViewBackGroundColor := GikoSys.Setting.ListBackColor;
1203                 GikoForm.UseOddResOddColor := GikoSys.Setting.UseOddColorOddResNum;
1204                 GikoForm.OddColor := GikoSys.Setting.OddColor;
1205                 GikoSys.Setting.UnFocusedBold := (UnFocusedBoldCheckBox.Enabled) and
1206                                                                                         (UnFocusedBoldCheckBox.Checked);
1207
1208                 GikoForm.BrowserTab.Font.Name := GikoSys.Setting.BrowserTabFontName;
1209                 GikoForm.BrowserTab.Font.Size := GikoSys.Setting.BrowserTabFontSize;
1210                 GikoForm.BrowserTab.Font.Style := [];
1211                 if GikoSys.Setting.BrowserTabFontBold then
1212                         GikoForm.BrowserTab.Font.Style := [fsBold];
1213                 if GikoSys.Setting.BrowserTabFontItalic then
1214                         GikoForm.BrowserTab.Font.Style := GikoForm.BrowserTab.Font.Style + [fsItalic];
1215 //              GikoForm.BrowserTab.Height := (GikoSys.Setting.BrowserTabFontSize * 2) + 1;
1216 //              GikoForm.BrowserBottomPanel.Height := GikoForm.BrowserTab.Height;
1217
1218                 for i := 0 to Screen.CustomFormCount - 1 do begin
1219                         if TObject(Screen.CustomForms[i]) is TEditorForm then begin
1220                                 TEditorForm(Screen.CustomForms[i]).SetFont;
1221                         end;
1222                 end;
1223
1224         finally
1225                 GikoForm.TreeView.Items.EndUpdate;
1226                 GikoForm.FavoriteTreeView.Items.EndUpdate;
1227                 GikoForm.ListView.Items.EndUpdate;
1228         end;
1229
1230         //\83A\83h\83\8c\83X\83o\81[
1231         for i := GikoForm.AddressComboBox.Items.Count - 1 downto 0 do begin
1232                 if GikoSys.Setting.AddressHistoryCount >= GikoForm.AddressComboBox.Items.Count then
1233                         Break;
1234                 GikoForm.AddressComboBox.Items.Delete(i);
1235         end;
1236         GikoForm.AddressComboBox.TabStop := GikoSys.Setting.AddressBarTabStop;
1237
1238         //\83X\83\8c\88ê\97\97\82Ì\83\8a\83t\83\8c\83b\83V\83\85
1239         if FRepaintList then begin
1240                 // SetActiveList\82ð\8eÀ\8ds
1241                 GikoForm.ActiveList := GikoForm.ActiveList;
1242         end;
1243
1244         // \83X\83\8c\83b\83h\82Ì\83\8a\83t\83\8c\83b\83V\83\85
1245         if FRepaintThread then begin
1246                 for i := GikoForm.BrowserTab.Tabs.Count - 1 downto 0 do begin
1247                         TBrowserRecord(GikoForm.BrowserTab.Tabs.Objects[i]).Repaint := true;
1248                 end;
1249                 GikoForm.BrowserTab.OnChange(nil);
1250         end;
1251 end;
1252
1253 procedure TOptionDialog.ReadProxyCheckClick(Sender: TObject);
1254 begin
1255         ReadProxyAddressEdit.Enabled := ReadProxyCheck.Checked;
1256         ReadPortEdit.Enabled := ReadProxyCheck.Checked;
1257         ReadProxyUserIDEdit.Enabled := ReadProxyCheck.Checked;
1258         ReadProxyPasswordEdit.Enabled := ReadProxyCheck.Checked;
1259
1260         ReadAddressLabel.Enabled := ReadProxyCheck.Checked;
1261         ReadPortLabel.Enabled := ReadProxyCheck.Checked;
1262         ReadUserIDLabel.Enabled := ReadProxyCheck.Checked;
1263         ReadPasswordLabel.Enabled := ReadProxyCheck.Checked;
1264 end;
1265
1266 procedure TOptionDialog.ReadPortEditExit(Sender: TObject);
1267 begin
1268         if not GikoSys.IsNumeric(ReadPortEdit.Text) then
1269                 ReadPortEdit.Text := '0';
1270 end;
1271
1272 procedure TOptionDialog.LogFolderButtonClick(Sender: TObject);
1273 var
1274         Root: WideString;
1275         Dir: string;
1276 begin
1277         Root := '';
1278         if SelectDirectory('\83\8d\83O\83t\83H\83\8b\83_\91I\91ð', Root, Dir) then begin
1279                 LogFolderEdit.Text := Dir;
1280         end;
1281 end;
1282
1283 function TOptionDialog.CheckFolder: Boolean;
1284 begin
1285         if Trim(LogFolderEdit.Text) = '' then
1286                 LogFolderEdit.Text := GikoSys.GetAppDir + 'Log';
1287
1288         if DirectoryExists(LogFolderEdit.Text) then begin
1289                 Result := True;
1290         end else begin
1291                 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
1292                         //\83t\83H\83\8b\83_\82ð\8dì\90¬
1293                         try
1294                                 GikoSys.ForceDirectoriesEx(LogFolderEdit.Text);
1295                                 Result := True
1296                         except
1297                                 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);
1298                                 OptionTab.ActivePage := FolderSheet;
1299                                 LogFolderEdit.SetFocus;
1300                                 Result := False;
1301                         end;
1302                 end else
1303                         Result := False;
1304         end;
1305 end;
1306
1307 procedure TOptionDialog.FormClose(Sender: TObject; var Action: TCloseAction);
1308 begin
1309         if not FClose then
1310                 Action := caNone;
1311         FClose := True;
1312 end;
1313
1314 procedure TOptionDialog.SoundReferButtonClick(Sender: TObject);
1315 begin
1316         OpenDialog.Filter := '\83T\83E\83\93\83h (*.wav)|*.wav|\82·\82×\82Ä\82Ì\83t\83@\83C\83\8b (*.*)|*.*';
1317         sndPlaySound(nil, SND_ASYNC);
1318         if OpenDialog.Execute then begin
1319                 SoundFileEdit.Text := OpenDialog.FileName;
1320         end;
1321 end;
1322
1323 procedure TOptionDialog.SoundPlayButtonClick(Sender: TObject);
1324 begin
1325         if not FileExists(SoundFileEdit.Text) then begin
1326                 MsgBox(Handle, '\91\8dÝ\82µ\82È\82¢\83t\83@\83C\83\8b\82Å\82·', '\83G\83\89\81[', MB_ICONSTOP or MB_OK);
1327                 SoundFileEdit.Text := '';
1328                 Exit;
1329         end;
1330         if not sndPlaySound(PChar(SoundFileEdit.Text), SND_ASYNC or SND_NOSTOP) then begin
1331                 sndPlaySound(nil, SND_ASYNC);
1332         end;
1333 end;
1334
1335 procedure TOptionDialog.SoundListViewChanging(Sender: TObject;
1336         Item: TListItem; Change: TItemChange; var AllowChange: Boolean);
1337 begin
1338         if Item.SubItems.Count > 0 then
1339                 SoundFileEdit.Text := Item.SubItems[0];
1340 end;
1341
1342 procedure TOptionDialog.SoundFileEditChange(Sender: TObject);
1343 var
1344         Item: TListItem;
1345 begin
1346         sndPlaySound(nil, SND_ASYNC);
1347         Item := SoundListView.Selected;
1348         if Item = nil then Exit;
1349
1350         if FileExists(SoundFileEdit.Text) then
1351                 Item.SubItems[0] := SoundFileEdit.Text;
1352         if Trim(SoundFileEdit.Text) = '' then
1353                 Item.SubItems[0] := '';
1354 end;
1355
1356 procedure TOptionDialog.OptionTabChange(Sender: TObject);
1357 begin
1358         sndPlaySound(nil, SND_ASYNC);
1359
1360         if OptionTab.ActivePage = CSSTabSheet then
1361                 CSSPreview;
1362 end;
1363
1364 procedure TOptionDialog.AppFolderButtonClick(Sender: TObject);
1365 begin
1366         OpenDialog.Filter := '\8eÀ\8ds\83t\83@\83C\83\8b (*.exe)|*.exe|\82·\82×\82Ä\82Ì\83t\83@\83C\83\8b (*.*)|*.*';
1367         if OpenDialog.Execute then
1368                 AppFolderEdit.Text := OpenDialog.FileName;
1369 end;
1370
1371 procedure TOptionDialog.WriteProxyCheckClick(Sender: TObject);
1372 begin
1373         WriteProxyAddressEdit.Enabled := WriteProxyCheck.Checked;
1374         WritePortEdit.Enabled := WriteProxyCheck.Checked;
1375         WriteProxyUserIDEdit.Enabled := WriteProxyCheck.Checked;
1376         WriteProxyPasswordEdit.Enabled := WriteProxyCheck.Checked;
1377
1378         WriteAddressLabel.Enabled := WriteProxyCheck.Checked;
1379         WritePortLabel.Enabled := WriteProxyCheck.Checked;
1380         WriteUserIDLabel.Enabled := WriteProxyCheck.Checked;
1381         WritePasswordLabel.Enabled := WriteProxyCheck.Checked;
1382 end;
1383
1384 procedure TOptionDialog.WritePortEditExit(Sender: TObject);
1385 begin
1386         if not GikoSys.IsNumeric(WritePortEdit.Text) then
1387                 WritePortEdit.Text := '0';
1388 end;
1389
1390 procedure TOptionDialog.Tora3URLLabelClick(Sender: TObject);
1391 begin
1392         GikoSys.OpenBrowser(URL_TORA3, gbtAuto);
1393 end;
1394
1395 procedure TOptionDialog.HotKeyEnter(Sender: TObject);
1396 begin
1397         OkBotton.Default := False;
1398         CancelBotton.Cancel := False;
1399 end;
1400
1401 procedure TOptionDialog.HotKeyExit(Sender: TObject);
1402 begin
1403         OkBotton.Default := True;
1404         CancelBotton.Cancel := True;
1405 end;
1406
1407 procedure TOptionDialog.URLAppCheckBoxClick(Sender: TObject);
1408 begin
1409         AppFolderLabel.Enabled := URLAppCheckBox.Checked;
1410         AppFolderEdit.Enabled := URLAppCheckBox.Checked;
1411         AppFolderButton.Enabled := URLAppCheckBox.Checked;
1412 end;
1413
1414 procedure TOptionDialog.AddressHistoryCountEditExit(Sender: TObject);
1415 begin
1416         if not GikoSys.IsNumeric(AddressHistoryCountEdit.Text) then
1417                 AddressHistoryCountEdit.Text := '100';
1418 end;
1419
1420 procedure TOptionDialog.PreviewWaitEditExit(Sender: TObject);
1421 begin
1422         if not GikoSys.IsNumeric(PreviewWaitEdit.Text) then
1423                 PreviewWaitEdit.Text := '500';
1424         if StrToInt(PreviewWaitEdit.Text) < 500 then
1425                 PreviewWaitEdit.Text := '500';
1426         if StrToInt(PreviewWaitEdit.Text) > 9999 then
1427                 PreviewWaitEdit.Text := '9999';
1428 end;
1429
1430 procedure TOptionDialog.CSSCheckBoxClick(Sender: TObject);
1431 begin
1432         CSSListLabel.Enabled := CSSCheckBox.Checked;
1433         CSSListView.Enabled := CSSCheckBox.Checked;
1434 end;
1435
1436 procedure TOptionDialog.SetAbonpropertys;
1437 begin
1438         //\82 \82Ú\81`\82ñ
1439         GikoSys.FAbon.Deleterlo := RloCheckBox.Checked;
1440         GikoSys.FAbon.Replaceul := ReplaceulCheckBox.Checked;
1441         GikoSys.FAbon.AbonPopupRes := PopUpAbonCheckBox.Checked;
1442         GikoSys.FAbon.ReturnNGwordLineNum := ShowNGLineCheckBox.Checked;
1443         GikoSys.FAbon.SetNGResAnchor := AddResAnchorCheckBox.Checked;
1444                 GikoSys.FAbon.DeleteSyria := DeleteSyriaCheckBox.Checked;
1445 end;
1446 procedure TOptionDialog.CSSFontButtonClick(Sender: TObject);
1447 begin
1448
1449         FontDialog.Options := [fdAnsiOnly, fdEffects];
1450         FontDialog.Font.Assign(FCSSFont);
1451         if FontDialog.Execute then begin
1452                 FontDialog.Font.Style := FontDialog.Font.Style - [fsUnderline] - [fsStrikeout];
1453                 FCSSFont.Assign(FontDialog.Font);
1454                 //FCSSFont := FontDialog.Font;
1455         end;
1456
1457         CSSPreview;
1458
1459 end;
1460
1461 procedure TOptionDialog.CSSBackColorButtonClick(Sender: TObject);
1462 begin
1463
1464         ColorDialog.Color := FCSSBackColor;
1465         if ColorDialog.Execute then begin
1466                 FCSSBackColor := ColorDialog.Color;
1467         end;
1468
1469         CSSPreview;
1470
1471 end;
1472
1473 procedure TOptionDialog.CSSFontCheckBoxClick(Sender: TObject);
1474 begin
1475
1476         CSSFontButton.Enabled := CSSFontCheckBox.Checked;
1477         CSSPreview;
1478
1479 end;
1480
1481 procedure TOptionDialog.CSSBackColorCheckBoxClick(Sender: TObject);
1482 begin
1483
1484         CSSBackColorButton.Enabled := CSSBackColorCheckBox.Checked;
1485         CSSPreview;
1486
1487 end;
1488
1489 procedure TOptionDialog.CSSSetContent(Content: string);
1490 var
1491         doc : Variant;
1492 begin
1493         if CSSBrowser.Document <> nil then begin
1494                 doc := CSSBrowser.Document;
1495                 doc.open;
1496                                 doc.Clear;
1497                 doc.charset := 'Shift_JIS';
1498                 doc.Write(Content);
1499                 doc.Close;
1500   end;
1501 end;
1502
1503 procedure TOptionDialog.CSSPreview;
1504 var
1505         Board: TBoard;
1506         ThreadItem: TThreadItem;
1507         html: string;
1508         Res: array [0..1] of TResRec;
1509         fileName: string;
1510 begin
1511
1512         fileName := GikoSys.Setting.CSSFileName;
1513
1514         GikoSys.Setting.CSSFileName := DEFAULT_CSS_FILENAME;
1515         if CSSListView.Items.Count > 0 then begin
1516                 try
1517                         if CSSListView.ItemIndex >= 0 then begin
1518                                 if CSSListView.Items[CSSListView.ItemIndex].Data <> nil then
1519                                         GikoSys.Setting.CSSFileName := string( CSSListView.Items[CSSListView.ItemIndex].data )
1520                                 else
1521                                         GikoSys.Setting.CSSFileName := CSSListView.Items[CSSListView.ItemIndex].Caption + '.css';
1522                                                 end;
1523                 except
1524                 end;
1525         end;
1526
1527         Board := TBoard.Create( nil, 'about://sample/' );
1528         ThreadItem := TThreadItem.Create( nil, Board, 'about://sample/test/read.cgi/sample/' );
1529
1530         try
1531                 Board.Title := '\83T\83\93\83v\83\8b\94Â';
1532                 ThreadItem.ParentBoard := Board;
1533                 ThreadItem.AllResCount := High( Res );
1534                 ThreadItem.NewResCount := 1;
1535                 ThreadItem.NewReceive := 2;
1536                 ThreadItem.Title := '\83T\83\93\83v\83\8b\83v\83\8c\83r\83\85\81[';
1537
1538                 Res[0].FName := '\96¼\96³\82µ\82³\82ñ';
1539                 Res[0].FMailTo := 'sage';
1540                 Res[0].FDateTime := 'ID:Sample';
1541                 Res[0].FBody := 'CSS \82Æ\83X\83L\83\93\82Ì\83T\83\93\83v\83\8b';
1542                 Res[1].FName := '\96¼\96³\82µ\82³\82ñ';
1543                 Res[1].FMailTo := 'age';
1544                 Res[1].FDateTime := 'ID:Sample';
1545                 Res[1].FBody := '\83I\83}\83G\83\82\83i\81[';
1546
1547
1548                 if FileExists( GikoSys.GetSkinHeaderFileName ) then begin
1549                         html :=
1550                                 HTMLCreater.LoadFromSkin( GikoSys.GetSkinHeaderFileName, ThreadItem, 0 ) +
1551                                 '<a name="top"></a>' +
1552                                 HTMLCreater.SkinedRes( HTMLCreater.LoadFromSkin( GikoSys.GetSkinResFileName, ThreadItem, 0 ), @Res[0], '1' ) +
1553                                 HTMLCreater.SkinedRes( HTMLCreater.LoadFromSkin( GikoSys.GetSkinNewResFileName, ThreadItem, 0 ), @Res[1], '2' ) +
1554                                 '<a name="bottom"></a>' +
1555                                 HTMLCreater.LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, 0 );
1556
1557                         html := StringReplace( html, '</head>',
1558                                 '<style type="text/css">body {' + GetPreviewUserStyle + '}</style></head>', [rfReplaceAll] );
1559                 end else begin
1560                         html :=
1561                                 '<html><head><meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">' +
1562                                 '<title>' + ThreadItem.Title + '</title>' +
1563                                 '<link rel="stylesheet" href="' + GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName + '" type="text/css">' +
1564                                 '<style type="text/css">body {' + GetPreviewUserStyle + '}</style>' +
1565                                 '</head><body><div class="title">' + ThreadItem.Title + '</div>';
1566
1567                         html := html + CreatePreviewBody(Res) + '</body></html>';
1568                 end;
1569
1570                 try
1571                         CSSSetContent( html );
1572                 except
1573                 end;
1574
1575         finally
1576                 ThreadItem.Free;
1577                 Board.Free;
1578                 GikoSys.Setting.CSSFileName := fileName;
1579         end;
1580
1581 end;
1582 function TOptionDialog.CreatePreviewBody(Res: array of TResRec): string;
1583 var
1584         i : Integer;
1585 begin
1586         Result := '';
1587         for i := 0 to High( Res ) do
1588         begin
1589                 Result := Result +
1590                         '<div class="header"><span class="no">' + IntToStr( i + 1 ) + '</span>' +
1591                         '<span class="name_label"> \96¼\91O\81F </span>' +
1592                         '<a class="name_mail" href="mailto:' + Res[i].FMailTo + '">' +
1593                         '<b>' + Res[i].FName + '</b></a><span class="mail"> [' + Res[i].FMailTo + ']</span>' +
1594                         '<span class="date_label"> \93\8a\8de\93ú\81F</span>' +
1595                         '<span class="date"> ' + Res[i].FDateTime+ '</span></div>' +
1596                         '<div class="mes">' + Res[i].FBody + ' </div>';
1597         end;
1598 end;
1599
1600 function TOptionDialog.GetPreviewUserStyle(): string;
1601 var
1602         i : Integer;
1603
1604 begin
1605         Result := '';
1606         // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
1607         if CSSFontCheckBox.Checked then begin
1608                 i := ColorToRGB( FCSSFont.Color );
1609                 i := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
1610
1611                 Result := Result +
1612                         'font-family:"' + FCSSFont.Name + '";' +
1613                         'font-size:' + IntToStr( FCSSFont.Size ) + 'pt;' +
1614                         'color:#' + IntToHex( i, 6 ) + ';';
1615                 if fsBold in FCSSFont.Style then
1616                         Result := Result + 'font-weight:bold;'
1617                 else
1618                         Result := Result + 'font-weight:normal;';
1619                 if fsItalic in FCSSFont.Style then
1620                         Result := Result + 'font-style:italic;'
1621                 else
1622                         Result := Result + 'font-style:normal;';
1623         end;
1624         if CSSBackColorCheckBox.Checked then begin
1625                 i := ColorToRGB( FCSSBackColor );
1626                 i := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
1627
1628                 Result := Result +
1629                         'background-color:#' + IntToHex( i, 6 ) + ';';
1630         end;
1631
1632 end;
1633 procedure TOptionDialog.CSSListViewChange(Sender: TObject; Item: TListItem;
1634         Change: TItemChange);
1635 begin
1636
1637         if OptionTab.ActivePage = CSSTabSheet then
1638                 CSSPreview;
1639
1640 end;
1641
1642 procedure TOptionDialog.AddURLButtonClick(Sender: TObject);
1643 begin
1644         BoardURLComboBox.Items.Append(BoardURLComboBox.Text);
1645   BoardURLComboBox.ItemIndex := BoardURLComboBox.Items.Count - 1;
1646 end;
1647
1648 procedure TOptionDialog.RemoveURLButtonClick(Sender: TObject);
1649 begin
1650         BoardURLComboBox.DeleteSelected;
1651 end;
1652
1653 procedure TOptionDialog.OddResNumCheckBoxClick(Sender: TObject);
1654 begin
1655         OddResNumColorBox.Enabled := OddResNumCheckBox.Checked;
1656         UnFocusedBoldCheckBox.Enabled := OddResNumCheckBox.Checked;
1657 end;
1658
1659 procedure TOptionDialog.ResRangeHoldCheckBoxClick(Sender: TObject);
1660 begin
1661         ResRangeHoldComboBox.Enabled := ResRangeHoldCheckBox.Checked;
1662 end;
1663
1664 procedure TOptionDialog.CroutOptionClick(Sender: TObject);
1665 var
1666         KuroutOption: TKuroutOption;
1667 begin
1668         KuroutOption := TKuroutOption.Create(Self);
1669         try
1670                 KuroutOption.ShowModal;
1671         finally
1672                 KuroutOption.Release;
1673         end;
1674 end;
1675
1676 procedure TOptionDialog.MaxRecordCountEditExit(Sender: TObject);
1677 begin
1678         if not GikoSys.IsNumeric(MaxRecordCountEdit.Text) then
1679                 MaxRecordCountEdit.Text := '100'
1680         else if StrToIntDef(MaxRecordCountEdit.Text, 100) <= 0 then
1681         MaxRecordCountEdit.Text := '1';
1682 end;
1683
1684 end.
1685