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