OSDN Git Service

1245aa9e24344f3e65e3675a7f694962bfff6567
[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   SHDocVw_TLB;
10
11 type
12         TOptionDialog = class(TForm)
13                 OkBotton: TButton;
14                 CancelBotton: TButton;
15                 OptionTab: TPageControl;
16                 ConnectSheet: TTabSheet;
17                 Font1Sheet: TTabSheet;
18     ApplyButton: TButton;
19                 FontDialog: TFontDialog;
20                 ColorDialog: TColorDialog;
21     ReadProxyGroupBox: TGroupBox;
22     ReadAddressLabel: TLabel;
23                 ReadPortLabel: TLabel;
24     ReadProxyCheck: TCheckBox;
25     ReadProxyAddressEdit: TEdit;
26     ReadPortEdit: TEdit;
27     ReadProxyUserIDEdit: TEdit;
28     ReadProxyPasswordEdit: TEdit;
29                 ReadUserIDLabel: TLabel;
30                 ReadPasswordLabel: TLabel;
31                 FolderSheet: TTabSheet;
32     FolderGroupBox: TGroupBox;
33                 LogFolderEdit: TEdit;
34     LogFolderButton: TButton;
35     Label1: TLabel;
36                 Label2: TLabel;
37     ThreadSheet: TTabSheet;
38     SoundSheet: TTabSheet;
39     SoundEventGroupBox: TGroupBox;
40                 SoundListView: TListView;
41     SoundReferButton: TButton;
42     SoundFileEdit: TEdit;
43     OpenDialog: TOpenDialog;
44     WriteProxyGroupBox: TGroupBox;
45     WriteAddressLabel: TLabel;
46     WritePortLabel: TLabel;
47     WriteUserIDLabel: TLabel;
48     WritePasswordLabel: TLabel;
49     WriteProxyCheck: TCheckBox;
50     WriteProxyAddressEdit: TEdit;
51     WritePortEdit: TEdit;
52     WriteProxyUserIDEdit: TEdit;
53     WriteProxyPasswordEdit: TEdit;
54     BoardSheet: TTabSheet;
55     GroupBox4: TGroupBox;
56     BoardURL2chEdit: TEdit;
57     Label13: TLabel;
58     UserIDSheet: TTabSheet;
59                 GroupBox3: TGroupBox;
60     Label9: TLabel;
61                 Label10: TLabel;
62     UserIDEdit: TEdit;
63     PasswordEdit: TEdit;
64     SoundPlayButton: TBitBtn;
65                 AutoLoginCheckBox: TCheckBox;
66     Tora3URLLabel: TLabel;
67     Label12: TLabel;
68     Label5: TLabel;
69     GroupBox5: TGroupBox;
70     ComboBox1: TComboBox;
71     Label6: TLabel;
72     Label7: TLabel;
73     Label8: TLabel;
74     ComboBox2: TComboBox;
75     ComboBox3: TComboBox;
76     Label4: TLabel;
77     Edit1: TEdit;
78     Button1: TButton;
79     CabinetFontBotton: TButton;
80     CabinetColorBotton: TButton;
81     CabinetDefaultButton: TButton;
82     CabinetMemo: TMemo;
83     ListMemo: TMemo;
84     ListFontBotton: TButton;
85     ListColorBotton: TButton;
86     ListDefaultBotton: TButton;
87     HintFontButton: TButton;
88     HintBackButton: TButton;
89     HintDefaultButton: TButton;
90     HintMemo: TMemo;
91                 EditorMemo: TMemo;
92     EditorFontBotton: TButton;
93     EditorColorBotton: TButton;
94     EditorDefaultBotton: TButton;
95                 BrowserTabMemo: TMemo;
96     BruwserTabFontButton: TButton;
97     BrowserTabDefaultButton: TButton;
98     Bevel1: TBevel;
99     Bevel2: TBevel;
100     GroupBox1: TGroupBox;
101     GroupBox2: TGroupBox;
102     URLAppCheckBox: TCheckBox;
103     AppFolderLabel: TLabel;
104     AppFolderEdit: TEdit;
105     AppFolderButton: TButton;
106     OpenMailerCheckBox: TCheckBox;
107     TabSheet1: TTabSheet;
108     PopupPositionRadioGroup: TRadioGroup;
109     TabAddRadioGroup: TRadioGroup;
110     TabSheet2: TTabSheet;
111     GroupBox7: TGroupBox;
112     URLDisplayCheckBox: TCheckBox;
113     Label3: TLabel;
114     Label11: TLabel;
115     TabStopAddressBarCheckBox: TCheckBox;
116     AddressHistoryCountEdit: TEdit;
117     LinkAddCheckBox: TCheckBox;
118     GroupBox8: TGroupBox;
119     PreviewVisibleCheckBox: TCheckBox;
120     PreviewSizeComboBox: TComboBox;
121     Label14: TLabel;
122     Label15: TLabel;
123     PreviewWaitEdit: TEdit;
124     Label16: TLabel;
125     ShowMailCheckBox: TCheckBox;
126     TabSheet3: TTabSheet;
127     GroupBox9: TGroupBox;
128     ThreadListIconCheckBox: TCheckBox;
129     GroupBox6: TGroupBox;
130     LogDeleteMessageCheckBox: TCheckBox;
131     GroupBox10: TGroupBox;
132     UnActivePopupCheckBox: TCheckBox;
133     GroupBox11: TGroupBox;
134     RecvBufferSize: TEdit;
135     Label17: TLabel;
136     ProxyProtocolCheckBox: TCheckBox;
137     ProtocolCheckBox: TCheckBox;
138     Label18: TLabel;
139     Label19: TLabel;
140     Bevel5: TBevel;
141     Label20: TLabel;
142     Label21: TLabel;
143     Label22: TLabel;
144     Label23: TLabel;
145     TabSheet4: TTabSheet;
146     lblSFont: TLabel;
147     GroupBox12: TGroupBox;
148     CSSCheckBox: TCheckBox;
149     CSSListLabel: TLabel;
150     CSSListView: TListView;
151     GroupBox13: TGroupBox;
152     PostTimeCheckBox: TCheckBox;
153     Label24: TLabel;
154     Label25: TLabel;
155     PostTimeEdit: TEdit;
156     PostTimeLabel: TLabel;
157     Label27: TLabel;
158     PutPostTimeRadioButton: TRadioButton;
159     BackPostTimeRadioButton: TRadioButton;
160     ResPopupBoldCheckBox: TCheckBox;
161     NGwordSheet: TTabSheet;
162     GroupBox14: TGroupBox;
163     RloCheckBox: TCheckBox;
164     ReplaceulCheckBox: TCheckBox;
165     PopUpAbonCheckBox: TCheckBox;
166     CSSWebBrowser: TWebBrowser;
167     CSSFontCheckBox: TCheckBox;
168     CSSBackColorCheckBox: TCheckBox;
169     CSSFontButton: TButton;
170     CSSBackColorButton: TButton;
171                 procedure FormCreate(Sender: TObject);
172                 procedure FormDestroy(Sender: TObject);
173                 procedure ApplyButtonClick(Sender: TObject);
174                 procedure CabinetFontBottonClick(Sender: TObject);
175                 procedure CabinetColorBottonClick(Sender: TObject);
176                 procedure EditorFontBottonClick(Sender: TObject);
177                 procedure OkBottonClick(Sender: TObject);
178                 procedure ReadProxyCheckClick(Sender: TObject);
179                 procedure ListFontBottonClick(Sender: TObject);
180                 procedure ListColorBottonClick(Sender: TObject);
181                 procedure EditorColorBottonClick(Sender: TObject);
182                 procedure CabinetDefaultButtonClick(Sender: TObject);
183                 procedure ReadPortEditExit(Sender: TObject);
184                 procedure ListDefaultBottonClick(Sender: TObject);
185                 procedure EditorDefaultBottonClick(Sender: TObject);
186                 procedure HintFontButtonClick(Sender: TObject);
187                 procedure HintBackButtonClick(Sender: TObject);
188                 procedure HintDefaultButtonClick(Sender: TObject);
189                 procedure LogFolderButtonClick(Sender: TObject);
190                 procedure FormClose(Sender: TObject; var Action: TCloseAction);
191                 procedure SoundReferButtonClick(Sender: TObject);
192                 procedure SoundPlayButtonClick(Sender: TObject);
193                 procedure SoundListViewChanging(Sender: TObject; Item: TListItem;
194       Change: TItemChange; var AllowChange: Boolean);
195                 procedure SoundFileEditChange(Sender: TObject);
196                 procedure OptionTabChange(Sender: TObject);
197                 procedure AppFolderButtonClick(Sender: TObject);
198                 procedure WriteProxyCheckClick(Sender: TObject);
199                 procedure WritePortEditExit(Sender: TObject);
200                 procedure Tora3URLLabelClick(Sender: TObject);
201                 procedure HotKeyEnter(Sender: TObject);
202                 procedure HotKeyExit(Sender: TObject);
203                 procedure URLAppCheckBoxClick(Sender: TObject);
204                 procedure BruwserTabFontButtonClick(Sender: TObject);
205                 procedure BrowserTabDefaultButtonClick(Sender: TObject);
206     procedure AddressHistoryCountEditExit(Sender: TObject);
207     procedure PreviewWaitEditExit(Sender: TObject);
208                 procedure RecvBufferSizeExit(Sender: TObject);
209     procedure CSSCheckBoxClick(Sender: TObject);
210     procedure PostTimeEditExit(Sender: TObject);
211     procedure PostTimeCheckBoxClick(Sender: TObject);
212     procedure CSSFontButtonClick(Sender: TObject);
213     procedure CSSBackColorButtonClick(Sender: TObject);
214     procedure CSSFontCheckBoxClick(Sender: TObject);
215     procedure CSSBackColorCheckBoxClick(Sender: TObject);
216         private
217                 { Private \90é\8c¾ }
218                 FClose: Boolean;
219                 function GetMemoText(font: TFont; text: string): string;
220 //              function GetFontText(Font: TFont; Text: string): string;
221                 procedure SetValue;
222                 procedure SaveSetting;
223                 procedure SettingApply;
224                 function CheckFolder: Boolean;
225         procedure SetAbonpropertys;
226         public
227                 { Public \90é\8c¾ }
228         end;
229
230 var
231         OptionDialog: TOptionDialog;
232
233 implementation
234
235 uses
236         Giko, Editor, Setting, ActnList;
237
238 const
239         FONT_TEXT: string = '%s %d pt';
240         MEMO_CABINET: string = '\83L\83\83\83r\83l\83b\83g';
241         MEMO_THREAD: string = '\83X\83\8c\83b\83h\83\8a\83X\83g';
242         MEMO_BROWSERPOPUP: string = '\83u\83\89\83E\83U\83|\83b\83v\83A\83b\83v';
243         MEMO_BROWSERTAB: string = '\83u\83\89\83E\83U\83^\83u';
244         MEMO_EDITOR: string = '\83G\83f\83B\83^\83e\83L\83X\83g';
245         DEFAULT_FONT_NAME: string = '\82l\82\82o\83S\83V\83b\83N';
246         DEFAULT_FONT_SIZE: Integer = 9;
247         DEFAULT_TABFONT_NAME: string = '\82l\82\82o\83S\83V\83b\83N';
248         DEFAULT_TABFONT_SIZE: Integer = 9;
249         URL_TORA3: WideString = 'http://2ch.tora3.net/';
250
251 {$R *.DFM}
252
253 procedure TOptionDialog.FormCreate(Sender: TObject);
254 begin
255         FClose := True;
256
257         OptionTab.ActivePage := ConnectSheet;
258         SetValue;
259
260         CabinetMemo.Text := GetMemoText(CabinetMemo.Font, MEMO_CABINET);
261         ListMemo.Text := GetMemoText(ListMemo.Font, MEMO_THREAD);
262         HintMemo.Text := GetMemoText(HintMemo.Font, MEMO_BROWSERPOPUP);
263         BrowserTabMemo.Text := GetMemoText(BrowserTabMemo.Font, MEMO_BROWSERTAB);
264         EditorMemo.Text := GetMemoText(EditorMemo.Font, MEMO_EDITOR);
265
266         Tora3URLLabel.Cursor := 5;
267         lblSFont.Caption := '\81\9a\8fd\97v\81\9a'#13#10#13#10
268                                                                                 + '\83X\83\8c\83b\83h\95\\8e¦\83G\83\8a\83A\82Ì\83t\83H\83\93\83g\95Ï\8dX\82Í\81A'#13#10
269                                                                                 + '\81u\83X\83^\83C\83\8b\83V\81[\83g\81v\83^\83u\82Å\90Ý\92è\8fo\97\88\82Ü\82·';
270         CSSCheckBoxClick(Sender);
271         PostTimeCheckBoxClick(Sender);
272 end;
273
274 procedure TOptionDialog.FormDestroy(Sender: TObject);
275 begin
276         sndPlaySound(nil, SND_ASYNC);
277 end;
278
279 procedure TOptionDialog.OkBottonClick(Sender: TObject);
280 begin
281         FClose := True;
282         RecvBufferSizeExit(Sender);
283         ReadPortEditExit(Sender);
284         WritePortEditExit(Sender);
285         AddressHistoryCountEditExit(Sender);
286         PreviewWaitEditExit(Sender);
287         PostTimeEditExit(Sender);
288
289         if not CheckFolder then begin
290                 FClose := False;
291                 Exit;
292         end;
293         SaveSetting;
294         SettingApply;
295   SetAbonpropertys;
296 end;
297
298 procedure TOptionDialog.ApplyButtonClick(Sender: TObject);
299 begin
300         RecvBufferSizeExit(Sender);
301         ReadPortEditExit(Sender);
302         WritePortEditExit(Sender);
303         AddressHistoryCountEditExit(Sender);
304         PreviewWaitEditExit(Sender);
305         PostTimeEditExit(Sender);
306
307         if not CheckFolder then begin
308                 FClose := False;
309                 Exit;
310         end;
311         SaveSetting;
312         SettingApply;
313   SetAbonpropertys;
314         FClose := False;
315 end;
316
317 //function TOptionDialog.GetFontText(Font: TFont; Text: string): string;
318 //begin
319 //      result := Format(Text, [Font.Name, Font.Size]);
320 //end;
321
322 function TOptionDialog.GetMemoText(font: TFont; text: string): string;
323 var
324         s: string;
325 begin
326         s := '';
327         if font <> nil then
328                 s := Format(FONT_TEXT, [Font.Name, Font.Size]) + #13#10;
329         Result := s + text;
330 end;
331
332 //\83L\83\83\83r\83l\83b\83g\83t\83H\83\93\83g\83{\83^\83\93
333 procedure TOptionDialog.CabinetFontBottonClick(Sender: TObject);
334 begin
335         FontDialog.Options := [fdAnsiOnly, fdEffects];
336         FontDialog.Font.Assign(CabinetMemo.Font);
337         if FontDialog.Execute then begin
338                 FontDialog.Font.Style := FontDialog.Font.Style - [fsUnderline] - [fsStrikeout];
339                 CabinetMemo.Font.Assign(FontDialog.Font);
340                 CabinetMemo.Text := GetMemoText(CabinetMemo.Font, MEMO_CABINET);
341                 CabinetMemo.Font.Charset := SHIFTJIS_CHARSET;
342         end;
343 end;
344
345 //\83L\83\83\83r\83l\83b\83g\94w\8ci\90F\83{\83^\83\93
346 procedure TOptionDialog.CabinetColorBottonClick(Sender: TObject);
347 begin
348         ColorDialog.Color := CabinetMemo.Color;
349         if ColorDialog.Execute then begin
350                 CabinetMemo.Color := ColorDialog.Color;
351         end;
352 end;
353
354 //\83L\83\83\83r\83l\83b\83g\83f\83t\83H\83\8b\83g\83{\83^\83\93
355 procedure TOptionDialog.CabinetDefaultButtonClick(Sender: TObject);
356 begin
357         CabinetMemo.Font.Name := DEFAULT_FONT_NAME;
358         CabinetMemo.Font.Size := DEFAULT_FONT_SIZE;
359         CabinetMemo.Font.Color := clWindowText;
360         CabinetMemo.Font.Style := [];
361         CabinetMemo.Color := clWindow;
362         CabinetMemo.Text := GetMemoText(CabinetMemo.Font, MEMO_CABINET);
363 end;
364
365 //\83X\83\8c\83b\83h\83\8a\83X\83g\83t\83H\83\93\83g\83{\83^\83\93
366 procedure TOptionDialog.ListFontBottonClick(Sender: TObject);
367 begin
368         FontDialog.Options := [fdAnsiOnly, fdEffects];
369         FontDialog.Font.Assign(ListMemo.Font);
370         if FontDialog.Execute then begin
371                 ListMemo.Font.Assign(FontDialog.Font);
372                 ListMemo.Text := GetMemoText(ListMemo.Font, MEMO_THREAD);
373                 ListMemo.Font.Charset := SHIFTJIS_CHARSET;
374         end;
375 end;
376
377 //\83X\83\8c\83b\83h\83\8a\83X\83g\94w\8ci\90F\83{\83^\83\93
378 procedure TOptionDialog.ListColorBottonClick(Sender: TObject);
379 begin
380         ColorDialog.Color := ListMemo.Color;
381         if ColorDialog.Execute then begin
382                 ListMemo.Color := ColorDialog.Color;
383         end;
384 end;
385
386 //\83X\83\8c\83b\83h\83\8a\83X\83g\83f\83t\83H\83\8b\83g\83{\83^\83\93
387 procedure TOptionDialog.ListDefaultBottonClick(Sender: TObject);
388 begin
389         ListMemo.Font.Name := DEFAULT_FONT_NAME;
390         ListMemo.Font.Size := DEFAULT_FONT_SIZE;
391         ListMemo.Font.Color := clWindowText;
392         ListMemo.Font.Style := [];
393         ListMemo.Color := clWindow;
394         ListMemo.Text := GetMemoText(ListMemo.Font, MEMO_THREAD);
395 end;
396
397 //\83u\83\89\83E\83U\83|\83b\83v\83A\83b\83v\83t\83H\83\93\83g\83{\83^\83\93
398 procedure TOptionDialog.HintFontButtonClick(Sender: TObject);
399 begin
400         FontDialog.Options := [fdAnsiOnly, fdEffects];
401         FontDialog.Font.Assign(HintMemo.Font);
402         if FontDialog.Execute then begin
403                 HintMemo.Font.Assign(FontDialog.Font);
404                 HintMemo.Text := GetMemoText(HintMemo.Font, MEMO_BROWSERPOPUP);
405                 HintMemo.Font.Charset := SHIFTJIS_CHARSET;
406         end;
407 end;
408
409 //\83u\83\89\83E\83U\83|\83b\83v\83A\83b\83v\94w\8ci\90F\83{\83^\83\93
410 procedure TOptionDialog.HintBackButtonClick(Sender: TObject);
411 begin
412         ColorDialog.Color := HintMemo.Color;
413         if ColorDialog.Execute then begin
414                 HintMemo.Color := ColorDialog.Color;
415         end;
416 end;
417
418 //\83u\83\89\83E\83U\83|\83b\83v\83A\83b\83v\83f\83t\83H\83\8b\83g\83{\83^\83\93
419 procedure TOptionDialog.HintDefaultButtonClick(Sender: TObject);
420 begin
421         HintMemo.Font.Name := DEFAULT_FONT_NAME;
422         HintMemo.Font.Size := DEFAULT_FONT_SIZE;
423         HintMemo.Font.Color := clWindowText;
424         HintMemo.Font.Style := [];
425         HintMemo.Color := clInfoBk;
426         HintMemo.Text := GetMemoText(HintMemo.Font, MEMO_BROWSERPOPUP);
427 end;
428
429 //\83u\83\89\83E\83U\83^\83u\83t\83H\83\93\83g\83{\83^\83\93
430 procedure TOptionDialog.BruwserTabFontButtonClick(Sender: TObject);
431 begin
432         FontDialog.Options := [fdAnsiOnly];
433         FontDialog.Font.Assign(BrowserTabMemo.Font);
434         if FontDialog.Execute then begin
435                 BrowserTabMemo.Font.Assign(FontDialog.Font);
436                 BrowserTabMemo.Text := GetMemoText(FontDialog.Font, MEMO_BROWSERTAB);
437                 BrowserTabMemo.Font.Charset := SHIFTJIS_CHARSET;
438         end;
439 end;
440
441 //\83u\83\89\83E\83U\83^\83u\83f\83t\83H\83\8b\83g\83{\83^\83\93
442 procedure TOptionDialog.BrowserTabDefaultButtonClick(Sender: TObject);
443 begin
444         BrowserTabMemo.Font.Name := DEFAULT_TABFONT_NAME;
445         BrowserTabMemo.Font.Size := DEFAULT_TABFONT_SIZE;
446         BrowserTabMemo.Font.Color := clWindowText;
447         BrowserTabMemo.Font.Style := [];
448         BrowserTabMemo.Color := clBtnFace;
449         BrowserTabMemo.Text := GetMemoText(BrowserTabMemo.Font, MEMO_BROWSERTAB);
450 end;
451
452 //\83G\83f\83B\83^\83t\83H\83\93\83g\83{\83^\83\93
453 procedure TOptionDialog.EditorFontBottonClick(Sender: TObject);
454 begin
455         FontDialog.Options := [fdAnsiOnly, fdEffects];
456         FontDialog.Font.Assign(EditorMemo.Font);
457         if FontDialog.Execute then begin
458                 EditorMemo.Font.Assign(FontDialog.Font);
459                 EditorMemo.Text := GetMemoText(EditorMemo.Font, MEMO_EDITOR);
460                 EditorMemo.Font.Charset := SHIFTJIS_CHARSET;
461         end;
462 end;
463
464 //\83G\83f\83B\83^\94w\8ci\90F\83{\83^\83\93
465 procedure TOptionDialog.EditorColorBottonClick(Sender: TObject);
466 begin
467         ColorDialog.Color := EditorMemo.Font.Color;
468         if ColorDialog.Execute then begin
469                 EditorMemo.Color := ColorDialog.Color;
470         end;
471 end;
472
473 //\83G\83f\83B\83^\83f\83t\83H\83\8b\83g\83{\83^\83\93
474 procedure TOptionDialog.EditorDefaultBottonClick(Sender: TObject);
475 begin
476         EditorMemo.Font.Name := DEFAULT_FONT_NAME;
477         EditorMemo.Font.Size := DEFAULT_FONT_SIZE;
478         EditorMemo.Font.Color := clWindowText;
479         EditorMemo.Font.Style := [];
480         EditorMemo.Color := clWindow;
481         EditorMemo.Text := GetMemoText(EditorMemo.Font, MEMO_EDITOR);
482 end;
483
484 procedure TOptionDialog.SetValue;
485 var
486         i: Integer;
487         Item: TListItem;
488 //      s: string;
489         idx: Integer;
490         FileList: TStringList;
491 begin
492         //\8eó\90M\83o\83b\83t\83@\83T\83C\83Y
493         RecvBufferSize.Text := IntToStr(Gikosys.Setting.RecvBufferSize);
494         //HTTP1.1\8eg\97p
495         ProtocolCheckBox.Checked := GikoSys.Setting.Protocol;
496         //\83v\83\8d\83L\83V\90Ú\91±HTTP1.1\8eg\97p
497         ProxyProtocolCheckBox.Checked := Gikosys.Setting.ProxyProtocol;
498
499         //\93Ç\82Ý\8d\9e\82Ý\97p\83v\83\8d\83L\83V
500         ReadProxyCheck.Checked := GikoSys.Setting.ReadProxy;
501         ReadProxyCheckClick(nil);
502         ReadProxyAddressEdit.Text := GikoSys.Setting.ReadProxyAddress;
503         ReadPortEdit.Text := IntToStr(GikoSys.Setting.ReadProxyPort);
504         ReadProxyUserIDEdit.Text := GikoSys.Setting.ReadProxyUserID;
505         ReadProxyPasswordEdit.Text := GikoSys.Setting.ReadProxyPassword;
506         //\8f\91\82«\8d\9e\82Ý\97p\83v\83\8d\83L\83V
507         WriteProxyCheck.Checked := GikoSys.Setting.WriteProxy;
508         WriteProxyCheckClick(nil);
509         WriteProxyAddressEdit.Text := GikoSys.Setting.WriteProxyAddress;
510         WritePortEdit.Text := IntToStr(GikoSys.Setting.WriteProxyPort);
511         WriteProxyUserIDEdit.Text := GikoSys.Setting.WriteProxyUserID;
512         WriteProxyPasswordEdit.Text := GikoSys.Setting.WriteProxyPassword;
513         //\83L\83\83\83r\83l\83b\83g\83t\83H\83\93\83g
514         CabinetMemo.Font.Name := GikoSys.Setting.CabinetFontName;
515         CabinetMemo.Font.Size := GikoSys.Setting.CabinetFontSize;
516         CabinetMemo.Font.Color := GikoSys.Setting.CabinetFontColor;
517         CabinetMemo.Color := GikoSys.Setting.CabinetBackColor;
518         //\83X\83\8c\83b\83h\83\8a\83X\83g\83t\83H\83\93\83g
519         ListMemo.Font.Name := GikoSys.Setting.ListFontName;
520         ListMemo.Font.Size := GikoSys.Setting.ListFontSize;
521         ListMemo.Font.Color := GikoSys.Setting.ListFontColor;
522         ListMemo.Color := GikoSys.Setting.ListBackColor;
523         //\83u\83\89\83E\83U\83|\83b\83v\83A\83b\83v\83t\83H\83\93\83g
524         HintMemo.Font.Name := GikoSys.Setting.HintFontName;
525         HintMemo.Font.Size := GikoSys.Setting.HintFontSize;
526         HintMemo.Font.Color := GikoSys.Setting.HintFontColor;
527         HintMemo.Color := GikoSys.Setting.HintBackColor;
528         //\83u\83\89\83E\83U\83^\83u\83t\83H\83\93\83g
529         BrowserTabMemo.Font.Name := GikoSys.Setting.BrowserTabFontName;
530         BrowserTabMemo.Font.Size := GikoSys.Setting.BrowserTabFontSize;
531         BrowserTabMemo.Font.Style := [];
532         if GikoSys.Setting.BrowserTabFontBold then
533                 BrowserTabMemo.Font.Style := BrowserTabMemo.Font.Style + [fsBold];
534         if GikoSys.Setting.BrowserTabFontItalic then
535                 BrowserTabMemo.Font.Style := BrowserTabMemo.Font.Style + [fsItalic];
536         //\83G\83f\83B\83^\83\81\83\82\83t\83H\83\93\83g
537         EditorMemo.Font.Name := GikoSys.Setting.EditorFontName;
538         EditorMemo.Font.Size := GikoSys.Setting.EditorFontSize;
539         EditorMemo.Font.Color := GikoSys.Setting.EditorFontColor;
540         EditorMemo.Color := GikoSys.Setting.EditorBackColor;
541         //CSS\95\\8e¦
542         CSSCheckBox.Checked := GikoSys.Setting.UseCSS;
543         //
544         //\83X\83^\83C\83\8b\83V\81[\83g\83t\83@\83C\83\8b\96¼\88ê\97\97
545         FileList := TStringList.Create;
546         try
547                 GikoSys.GetFileList(GikoSys.GetStyleSheetDir, '*.css', FileList, True, True);
548
549                 Idx := Length(GikoSys.GetStyleSheetDir);
550                 for i := 0 to FileList.Count - 1 do
551                         FileList[i] := Copy(FileList[i], Idx + 1, Length(FileList[i]));
552                 FileList.Sort;
553                 for i := 0 to FileList.Count - 1 do begin
554                         //s := ExtractFileName(FileList[i]);
555                         if LowerCase(FileList[i]) = 'default.css' then
556                                 Item := CSSListView.Items.Insert(0)
557                         else
558                                 Item := CSSListView.Items.Add;
559                         Item.Caption := ChangeFileExt(FileList[i], '');
560                         if LowerCase(FileList[i]) = LowerCase(GikoSys.Setting.CSSFileName) then
561                                 Item.Selected := True;
562                 end;
563         finally
564                 FileList.Free;
565         end;
566         //\83X\83L\83\93\83t\83@\83C\83\8b\96¼\88ê\97\97
567         FileList := TStringList.Create;
568         try
569                 GikoSys.GetDirectoryList(GikoSys.GetSkinDir, '*', FileList, False);
570
571     Idx := Length(GikoSys.GetSkinDir);
572                 FileList.Sort;
573                 for i := 0 to FileList.Count - 1 do begin
574                         //s := ExtractFileName(FileList[i]);
575                         Item := CSSListView.Items.Add;
576       Item.Data := PChar( FileList[i] );
577                         Item.Caption := Copy( FileList[i], Idx + 1, Length(FileList[i]) );
578                         if LowerCase(FileList[i]) = LowerCase(GikoSys.Setting.CSSFileName) then
579                                 Item.Selected := True;
580                 end;
581         finally
582         // 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`
583                 //FileList.Free;
584         end;
585
586         if (CSSListView.ItemIndex = -1) and (CSSListView.Items.Count > 0) then
587                 CSSListView.Items[0].Selected := True;          
588
589         //Mail\97\93\95\\8e¦
590         ShowMailCheckBox.Checked := GikoSys.Setting.ShowMail;
591         //\83^\83u\92Ç\89Á\88Ê\92u
592         TabAddRadioGroup.ItemIndex := Ord(GikoSys.Setting.BrowserTabAppend);
593         //\94Â\8dX\90VURL
594         BoardURL2chEdit.Text := GikoSys.Setting.BoardURL2ch;
595         //\94F\8fØ
596         UserIDEdit.Text := GikoSys.Setting.UserID;
597         PasswordEdit.Text := GikoSys.Setting.Password;
598         AutoLoginCheckBox.Checked := GikoSys.Setting.AutoLogin;
599         //\83\8d\83O\83t\83H\83\8b\83_
600         if GikoSys.Setting.NewLogFolder = '' then
601                 LogFolderEdit.Text := GikoSys.Setting.LogFolder
602         else
603                 LogFolderEdit.Text := GikoSys.Setting.NewLogFolder;
604         //\83T\83E\83\93\83h
605         for i := 0 to GikoSys.Setting.GetSoundCount - 1 do begin
606                 Item := SoundListView.Items.Add;
607                 Item.Caption := GikoSys.Setting.SoundViewName[i];
608                 if FileExists(GikoSys.Setting.SoundFileName[i]) then
609                         Item.SubItems.Add(GikoSys.Setting.SoundFileName[i])
610                 else
611                         Item.SubItems.Add('');
612         end;
613         //URL\83N\83\8a\83b\83N\8e\9e\93®\8dì
614         URLAppCheckBox.Checked := GikoSys.Setting.URLApp;
615         URLAppCheckBoxClick(nil);
616         AppFolderEdit.Text := GikoSys.Setting.URLAppFile;
617
618         //mailto\83N\83\8a\83b\83N\8e\9e\93®\8dì
619         OpenMailerCheckBox.Checked := GikoSys.Setting.OpenMailer;
620
621         //\83\8d\83O\8dí\8f\9c\8e\9e\83\81\83b\83Z\81[\83W
622         LogDeleteMessageCheckBox.Checked := GikoSys.Setting.DeleteMsg;
623
624         //\83|\83b\83v\83A\83b\83v\88Ê\92u
625         case GikoSys.Setting.PopupPosition of
626                 gppRightTop:            PopupPositionRadioGroup.ItemIndex := 0;
627                 gppRight:                       PopupPositionRadioGroup.ItemIndex := 1;
628                 gppRightBottom: PopupPositionRadioGroup.ItemIndex := 2;
629                 gppTop:                                 PopupPositionRadioGroup.ItemIndex := 3;
630                 gppCenter:                      PopupPositionRadioGroup.ItemIndex := 4;
631                 gppBottom:                      PopupPositionRadioGroup.ItemIndex := 5;
632                 gppLeftTop:             PopupPositionRadioGroup.ItemIndex := 6;
633                 gppLeft:                                PopupPositionRadioGroup.ItemIndex := 7;
634                 gppLeftBottom:  PopupPositionRadioGroup.ItemIndex := 8;
635         end;
636
637         //\94ñ\83A\83N\83e\83B\83u\8e\9e\83|\83b\83v\83A\83b\83v\95\\8e¦
638         UnActivePopupCheckBox.Checked := GikoSys.Setting.UnActivePopup;
639         //\83\8c\83X\83|\83b\83v\83A\83b\83v\83{\81[\83\8b\83h\95\\8e¦
640         ResPopupBoldCheckBox.Checked := GikoSys.Setting.ResPopupHeaderBold;
641
642         //\83A\83h\83\8c\83X\83o\81[
643         URLDisplayCheckBox.Checked := GikoSys.Setting.URLDisplay;
644         TabStopAddressBarCheckBox.Checked := GikoSys.Setting.AddressBarTabStop;
645         LinkAddCheckBox.Checked := GikoSys.Setting.LinkAddAddressBar;
646         AddressHistoryCountEdit.Text := IntToStr(GikoSys.Setting.AddressHistoryCount);
647
648         //HTML\83v\83\8c\83r\83\85\81[
649         PreviewVisibleCheckBox.Checked := GikoSys.Setting.PreviewVisible;
650         PreviewWaitEdit.Text := IntToStr(GikoSys.Setting.PreviewWait);
651         PreviewSizeComboBox.ItemIndex := 2;
652         case GikoSys.Setting.PreviewSize of
653                 gpsXLarge: PreviewSizeComboBox.ItemIndex := 4;
654                 gpsLarge: PreviewSizeComboBox.ItemIndex := 3;
655                 gpsMedium: PreviewSizeComboBox.ItemIndex := 2;
656                 gpsSmall: PreviewSizeComboBox.ItemIndex := 1;
657                 gpsXSmall: PreviewSizeComboBox.ItemIndex := 0;
658         end;
659
660         //\83X\83\8c\83b\83h\88ê\97\97\8dX\90V\83A\83C\83R\83\93
661         ThreadListIconCheckBox.Checked := GikoSys.Setting.ListIconVisible;
662
663         //\8f\91\82«\8d\9e\82Ý\8e\9e\83}\83V\83\93\8e\9e\8aÔ\8eg\97p\90Ý\92è
664         PostTimeCheckBox.Checked := GikoSys.Setting.UseMachineTime;
665         PostTimeEdit.Text := IntToStr(GikoSys.Setting.TimeAdjustSec);
666         if GikoSys.Setting.TimeAdjust then
667                 PutPostTimeRadioButton.Checked := True
668         else
669                 BackPostTimeRadioButton.Checked := True;
670     //\82 \82Ú\81`\82ñ
671     RloCheckBox.Checked := GikoSys.Setting.AbonDeleterlo;
672     ReplaceulCheckBox.Checked := GikoSys.Setting.AbonReplaceul;
673     PopUpAbonCheckBox.Checked := GikoSys.Setting.PopUpAbon;
674
675 end;
676
677 procedure TOptionDialog.SaveSetting;
678 var
679         i: Integer;
680 //      Item: TListItem;
681 begin
682         //\8eó\90M\83o\83b\83t\83@\83T\83C\83Y
683         Gikosys.Setting.RecvBufferSize := StrToInt(RecvBufferSize.Text);
684         //HTTP1.1\8eg\97p
685         GikoSys.Setting.Protocol := ProtocolCheckBox.Checked;
686         //\83v\83\8d\83L\83V\90Ú\91±HTTP1.1\8eg\97p
687         Gikosys.Setting.ProxyProtocol := ProxyProtocolCheckBox.Checked;
688
689         GikoSys.Setting.ReadProxy := ReadProxyCheck.Checked;
690         GikoSys.Setting.ReadProxyAddress := ReadProxyAddressEdit.Text;
691         GikoSys.Setting.ReadProxyPort := StrToInt(ReadPortEdit.Text);
692         GikoSys.Setting.ReadProxyUserID := ReadProxyUserIDEdit.Text;
693         GikoSys.Setting.ReadProxyPassword := ReadProxyPasswordEdit.Text;
694
695         GikoSys.Setting.WriteProxy := WriteProxyCheck.Checked;
696         GikoSys.Setting.WriteProxyAddress := WriteProxyAddressEdit.Text;
697         GikoSys.Setting.WriteProxyPort := StrToInt(WritePortEdit.Text);
698         GikoSys.Setting.WriteProxyUserID := WriteProxyUserIDEdit.Text;
699         GikoSys.Setting.WriteProxyPassword := WriteProxyPasswordEdit.Text;
700
701         GikoSys.Setting.CabinetFontName := CabinetMemo.Font.Name;
702         GikoSys.Setting.CabinetFontSize := CabinetMemo.Font.Size;
703         GikoSys.Setting.CabinetFontColor := CabinetMemo.Font.Color;
704         GikoSys.Setting.CabinetBackColor := CabinetMemo.Color;
705
706         GikoSys.Setting.ListFontName := ListMemo.Font.Name;
707         GikoSys.Setting.ListFontSize := ListMemo.Font.Size;
708         GikoSys.Setting.ListFontColor := ListMemo.Font.Color;
709         GikoSys.Setting.ListBackColor := ListMemo.Color;
710
711         GikoSys.Setting.HintFontName := HintMemo.Font.Name;
712         GikoSys.Setting.HintFontSize := HintMemo.Font.Size;
713         GikoSys.Setting.HintFontColor := HintMemo.Font.Color;
714         GikoSys.Setting.HintBackColor := HintMemo.Color;
715
716         GikoSys.Setting.BrowserTabFontName := BrowserTabMemo.Font.Name;
717         GikoSys.Setting.BrowserTabFontSize := BrowserTabMemo.Font.Size;
718
719         GikoSys.Setting.EditorFontName := EditorMemo.Font.Name;
720         GikoSys.Setting.EditorFontSize := EditorMemo.Font.Size;
721         GikoSys.Setting.EditorFontColor := EditorMemo.Font.Color;
722         GikoSys.Setting.EditorBackColor := EditorMemo.Color;
723         //CSS\95\\8e¦
724         GikoSys.Setting.UseCSS := CSSCheckBox.Checked;
725         //CSS\83t\83@\83C\83\8b\96¼
726         GikoSys.Setting.CSSFileName := 'default.css';
727         if CSSListView.Items.Count > 0 then begin
728                 try
729         if CSSListView.Items[CSSListView.ItemIndex].Data <> nil then
730                                 GikoSys.Setting.CSSFileName := string( CSSListView.Items[CSSListView.ItemIndex].data )
731       else
732                                 GikoSys.Setting.CSSFileName := CSSListView.Items[CSSListView.ItemIndex].Caption + '.css';
733                 except
734                 end;
735         end;
736
737         //Mail\97\93\95\\8e¦
738         GikoSys.Setting.ShowMail := ShowMailCheckBox.Checked;
739
740         GikoSys.Setting.BrowserTabAppend := TGikoTabAppend(TabAddRadioGroup.ItemIndex);
741
742         GikoSys.Setting.BoardURL2ch := BoardURL2chEdit.Text;
743
744         GikoSys.Setting.UserID := UserIDEdit.Text;
745         GikoSys.Setting.Password := PasswordEdit.Text;
746         GikoSys.Setting.AutoLogin := AutoLoginCheckBox.Checked;
747
748         GikoSys.Setting.URLApp := URLAppCheckBox.Checked;
749         GikoSys.Setting.URLAppFile := AppFolderEdit.Text;
750
751         GikoSys.Setting.OpenMailer := OpenMailerCheckBox.Checked;
752         GikoSys.Setting.DeleteMsg := LogDeleteMessageCheckBox.Checked;
753
754         //\83|\83b\83v\83A\83b\83v\88Ê\92u
755         case PopupPositionRadioGroup.ItemIndex of
756                 0: GikoSys.Setting.PopupPosition := gppRightTop;
757                 1: GikoSys.Setting.PopupPosition := gppRight;
758                 2: GikoSys.Setting.PopupPosition := gppRightBottom;
759                 3: GikoSys.Setting.PopupPosition := gppTop;
760                 4: GikoSys.Setting.PopupPosition := gppCenter;
761                 5: GikoSys.Setting.PopupPosition := gppBottom;
762                 6: GikoSys.Setting.PopupPosition := gppLeftTop;
763                 7: GikoSys.Setting.PopupPosition := gppLeft;
764                 8: GikoSys.Setting.PopupPosition := gppLeftBottom;
765         end;
766
767         //\94ñ\83A\83N\83e\83B\83u\8e\9e\83|\83b\83v\83A\83b\83v\95\\8e¦
768         GikoSys.Setting.UnActivePopup := UnActivePopupCheckBox.Checked;
769         //\83\8c\83X\83|\83b\83v\83A\83b\83v\83{\81[\83\8b\83h\95\\8e¦
770         GikoSys.Setting.ResPopupHeaderBold := ResPopupBoldCheckBox.Checked;
771
772         //\83A\83h\83\8c\83X\83o\81[
773         GikoSys.Setting.URLDisplay := URLDisplayCheckBox.Checked;
774         GikoSys.Setting.AddressBarTabStop := TabStopAddressBarCheckBox.Checked;
775         GikoSys.Setting.LinkAddAddressBar := LinkAddCheckBox.Checked;
776         if GikoSys.IsNumeric(AddressHistoryCountEdit.Text) then
777                 GikoSys.Setting.AddressHistoryCount := StrToInt(AddressHistoryCountEdit.Text)
778         else
779                 GikoSys.Setting.AddressHistoryCount := 100;
780
781         //HTML\83v\83\8c\83r\83\85\81[
782         GikoSys.Setting.PreviewVisible := PreviewVisibleCheckBox.Checked;
783         if GikoSys.IsNumeric(PreviewWaitEdit.Text) then
784                 GikoSys.Setting.PreviewWait := StrToInt(PreviewWaitEdit.Text)
785         else
786                 GikoSys.Setting.PreviewWait := 500;
787         case PreviewSizeComboBox.ItemIndex of
788                 0: GikoSys.Setting.PreviewSize := gpsXSmall;
789                 1: GikoSys.Setting.PreviewSize := gpsSmall;
790                 2: GikoSys.Setting.PreviewSize := gpsMedium;
791                 3: GikoSys.Setting.PreviewSize := gpsLarge;
792                 4: GikoSys.Setting.PreviewSize := gpsXLarge;
793         end;
794
795         //\83X\83\8c\83b\83h\88ê\97\97\8dX\90V\83A\83C\83R\83\93
796         GikoSys.Setting.ListIconVisible := ThreadListIconCheckBox.Checked;
797
798         //\8f\91\82«\8d\9e\82Ý\8e\9e\83}\83V\83\93\8e\9e\8aÔ\8eg\97p\90Ý\92è
799         GikoSys.Setting.UseMachineTime := PostTimeCheckBox.Checked;
800         if GikoSys.IsNumeric(PostTimeEdit.Text) then
801                 GikoSys.Setting.TimeAdjustSec := StrToInt(PostTimeEdit.Text)
802         else
803                 GikoSys.Setting.TimeAdjustSec := 0;
804         GikoSys.Setting.TimeAdjust := PutPostTimeRadioButton.Checked;
805
806
807         GikoSys.Setting.WriteSystemSettingFile;
808 //      GikoForm.SetBrowserTabState;
809
810         if LogFolderEdit.Text <> '' then begin
811                 GikoSys.Setting.NewLogFolder := LogFolderEdit.Text;
812                 GikoSys.Setting.WriteFolderSettingFile;
813         end;
814
815         for i := 0 to SoundListView.Items.Count - 1 do begin
816                 if FileExists(SoundListView.Items[i].SubItems[0]) then
817                         GikoSys.Setting.SoundFileName[i] := SoundListView.Items[i].SubItems[0]
818                 else
819                         GikoSys.Setting.SoundFileName[i] := '';
820         end;
821
822   //\82 \82Ú\81`\82ñ
823   GikoSys.Setting.AbonDeleterlo := RloCheckBox.Checked;
824   GikoSys.Setting.AbonReplaceul := ReplaceulCheckBox.Checked;
825   GikoSys.Setting.PopUpAbon := PopUpAbonCheckBox.Checked;
826 end;
827
828 procedure TOptionDialog.SettingApply;
829 var
830         i: Integer;
831 begin
832         GikoForm.TreeView.Items.BeginUpdate;
833         GikoForm.ListView.Items.BeginUpdate;
834         try
835                 GikoForm.TreeView.Font.Name := GikoSys.Setting.CabinetFontName;
836                 GikoForm.TreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
837                 GikoForm.TreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
838                 GikoForm.TreeView.Color := GikoSys.Setting.CabinetBackColor;
839
840                 GikoForm.ListView.Font.Name := GikoSys.Setting.ListFontName;
841                 GikoForm.ListView.Font.Size := GikoSys.Setting.ListFontSize;
842                 GikoForm.ListView.Font.Color := GikoSys.Setting.ListFontColor;
843                 GikoForm.ListView.Color := GikoSys.Setting.ListBackColor;
844
845                 GikoForm.BrowserTab.Font.Name := GikoSys.Setting.BrowserTabFontName;
846                 GikoForm.BrowserTab.Font.Size := GikoSys.Setting.BrowserTabFontSize;
847 //              GikoForm.BrowserTab.Height := (GikoSys.Setting.BrowserTabFontSize * 2) + 1;
848 //              GikoForm.BrowserBottomPanel.Height := GikoForm.BrowserTab.Height;
849
850                 for i := 0 to Screen.CustomFormCount - 1 do begin
851                         if TObject(Screen.CustomForms[i]) is TEditorForm then begin
852                                 TEditorForm(Screen.CustomForms[i]).SetFont;
853                         end;
854                 end;
855
856         finally
857                 GikoForm.TreeView.Items.EndUpdate;
858                 GikoForm.ListView.Items.EndUpdate;
859         end;
860
861         //\83A\83h\83\8c\83X\83o\81[
862         for i := GikoForm.AddressComboBox.Items.Count - 1 downto 0 do begin
863                 if GikoSys.Setting.AddressHistoryCount >= GikoForm.AddressComboBox.Items.Count then
864                         Break;
865                 GikoForm.AddressComboBox.Items.Delete(i);
866         end;
867         GikoForm.AddressComboBox.TabStop := GikoSys.Setting.AddressBarTabStop;
868 end;
869
870 procedure TOptionDialog.ReadProxyCheckClick(Sender: TObject);
871 begin
872         ReadProxyAddressEdit.Enabled := ReadProxyCheck.Checked;
873         ReadPortEdit.Enabled := ReadProxyCheck.Checked;
874         ReadProxyUserIDEdit.Enabled := ReadProxyCheck.Checked;
875         ReadProxyPasswordEdit.Enabled := ReadProxyCheck.Checked;
876
877         ReadAddressLabel.Enabled := ReadProxyCheck.Checked;
878         ReadPortLabel.Enabled := ReadProxyCheck.Checked;
879         ReadUserIDLabel.Enabled := ReadProxyCheck.Checked;
880         ReadPasswordLabel.Enabled := ReadProxyCheck.Checked;
881 end;
882
883 procedure TOptionDialog.ReadPortEditExit(Sender: TObject);
884 begin
885         if not GikoSys.IsNumeric(ReadPortEdit.Text) then
886                 ReadPortEdit.Text := '0';
887 end;
888
889 procedure TOptionDialog.LogFolderButtonClick(Sender: TObject);
890 var
891         Root: WideString;
892         Dir: string;
893 begin
894         Root := '';
895         if SelectDirectory('\83\8d\83O\83t\83H\83\8b\83_\91I\91ð', Root, Dir) then begin
896                 LogFolderEdit.Text := Dir;
897         end;
898 end;
899
900 function TOptionDialog.CheckFolder: Boolean;
901 begin
902         if Trim(LogFolderEdit.Text) = '' then
903                 LogFolderEdit.Text := ExtractFilePath(Application.ExeName) + 'Log';
904
905         if DirectoryExists(LogFolderEdit.Text) then begin
906                 Result := True;
907         end else begin
908                 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
909                         //\83t\83H\83\8b\83_\82ð\8dì\90¬
910                         try
911                                 GikoSys.ForceDirectoriesEx(LogFolderEdit.Text);
912                                 Result := True
913                         except
914                                 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);
915                                 OptionTab.ActivePage := FolderSheet;
916                                 LogFolderEdit.SetFocus;
917                                 Result := False;
918                         end;
919                 end else
920                         Result := False;
921         end;
922 end;
923
924 procedure TOptionDialog.FormClose(Sender: TObject; var Action: TCloseAction);
925 begin
926         if not FClose then
927                 Action := caNone;
928         FClose := True;
929 end;
930
931 procedure TOptionDialog.SoundReferButtonClick(Sender: TObject);
932 begin
933         OpenDialog.Filter := '\83T\83E\83\93\83h (*.wav)|*.wav|\82·\82×\82Ä\82Ì\83t\83@\83C\83\8b (*.*)|*.*';
934         sndPlaySound(nil, SND_ASYNC);
935         if OpenDialog.Execute then begin
936                 SoundFileEdit.Text := OpenDialog.FileName;
937         end;
938 end;
939
940 procedure TOptionDialog.SoundPlayButtonClick(Sender: TObject);
941 begin
942         if not FileExists(SoundFileEdit.Text) then begin
943                 MsgBox(Handle, '\91\8dÝ\82µ\82È\82¢\83t\83@\83C\83\8b\82Å\82·', '\83G\83\89\81[', MB_ICONSTOP or MB_OK);
944                 SoundFileEdit.Text := '';
945                 Exit;
946         end;
947         if not sndPlaySound(PChar(SoundFileEdit.Text), SND_ASYNC or SND_NOSTOP) then begin
948                 sndPlaySound(nil, SND_ASYNC);
949         end;
950 end;
951
952 procedure TOptionDialog.SoundListViewChanging(Sender: TObject;
953   Item: TListItem; Change: TItemChange; var AllowChange: Boolean);
954 begin
955         if Item.SubItems.Count > 0 then
956                 SoundFileEdit.Text := Item.SubItems[0];
957 end;
958
959 procedure TOptionDialog.SoundFileEditChange(Sender: TObject);
960 var
961         Item: TListItem;
962 begin
963         sndPlaySound(nil, SND_ASYNC);
964         Item := SoundListView.Selected;
965         if Item = nil then Exit;
966
967         if FileExists(SoundFileEdit.Text) then
968                 Item.SubItems[0] := SoundFileEdit.Text;
969         if Trim(SoundFileEdit.Text) = '' then
970                 Item.SubItems[0] := '';
971 end;
972
973 procedure TOptionDialog.OptionTabChange(Sender: TObject);
974 begin
975         sndPlaySound(nil, SND_ASYNC);
976 end;
977
978 procedure TOptionDialog.AppFolderButtonClick(Sender: TObject);
979 begin
980         OpenDialog.Filter := '\8eÀ\8ds\83t\83@\83C\83\8b (*.exe)|*.exe|\82·\82×\82Ä\82Ì\83t\83@\83C\83\8b (*.*)|*.*';
981         if OpenDialog.Execute then
982                 AppFolderEdit.Text := OpenDialog.FileName;
983 end;
984
985 procedure TOptionDialog.WriteProxyCheckClick(Sender: TObject);
986 begin
987         WriteProxyAddressEdit.Enabled := WriteProxyCheck.Checked;
988         WritePortEdit.Enabled := WriteProxyCheck.Checked;
989         WriteProxyUserIDEdit.Enabled := WriteProxyCheck.Checked;
990         WriteProxyPasswordEdit.Enabled := WriteProxyCheck.Checked;
991
992         WriteAddressLabel.Enabled := WriteProxyCheck.Checked;
993         WritePortLabel.Enabled := WriteProxyCheck.Checked;
994         WriteUserIDLabel.Enabled := WriteProxyCheck.Checked;
995         WritePasswordLabel.Enabled := WriteProxyCheck.Checked;
996 end;
997
998 procedure TOptionDialog.WritePortEditExit(Sender: TObject);
999 begin
1000         if not GikoSys.IsNumeric(WritePortEdit.Text) then
1001                 WritePortEdit.Text := '0';
1002 end;
1003
1004 procedure TOptionDialog.Tora3URLLabelClick(Sender: TObject);
1005 begin
1006         GikoSys.OpenBrowser(URL_TORA3, gbtAuto);
1007 end;
1008
1009 procedure TOptionDialog.HotKeyEnter(Sender: TObject);
1010 begin
1011         OkBotton.Default := False;
1012         CancelBotton.Cancel := False;
1013 end;
1014
1015 procedure TOptionDialog.HotKeyExit(Sender: TObject);
1016 begin
1017         OkBotton.Default := True;
1018         CancelBotton.Cancel := True;
1019 end;
1020
1021 procedure TOptionDialog.URLAppCheckBoxClick(Sender: TObject);
1022 begin
1023         AppFolderLabel.Enabled := URLAppCheckBox.Checked;
1024         AppFolderEdit.Enabled := URLAppCheckBox.Checked;
1025         AppFolderButton.Enabled := URLAppCheckBox.Checked;
1026 end;
1027
1028 procedure TOptionDialog.AddressHistoryCountEditExit(Sender: TObject);
1029 begin
1030         if not GikoSys.IsNumeric(AddressHistoryCountEdit.Text) then
1031                 AddressHistoryCountEdit.Text := '100';
1032 end;
1033
1034 procedure TOptionDialog.PreviewWaitEditExit(Sender: TObject);
1035 begin
1036         if not GikoSys.IsNumeric(PreviewWaitEdit.Text) then
1037                 PreviewWaitEdit.Text := '500';
1038         if StrToInt(PreviewWaitEdit.Text) < 500 then
1039                 PreviewWaitEdit.Text := '500';
1040         if StrToInt(PreviewWaitEdit.Text) > 9999 then
1041                 PreviewWaitEdit.Text := '9999';
1042 end;
1043
1044 procedure TOptionDialog.RecvBufferSizeExit(Sender: TObject);
1045 begin
1046         if not GikoSys.IsNumeric(RecvBufferSize.Text) then
1047                 RecvBufferSize.Text := '4096';
1048         if StrToInt(RecvBufferSize.Text) < 256 then
1049                 RecvBufferSize.Text := '4096';
1050 end;
1051
1052 procedure TOptionDialog.CSSCheckBoxClick(Sender: TObject);
1053 begin
1054         CSSListLabel.Enabled := CSSCheckBox.Checked;
1055         CSSListView.Enabled := CSSCheckBox.Checked;
1056 end;
1057
1058 procedure TOptionDialog.PostTimeEditExit(Sender: TObject);
1059 begin
1060         if not GikoSys.IsNumeric(PostTimeEdit.Text) then
1061                 PostTimeEdit.Text := '0';
1062 end;
1063
1064 procedure TOptionDialog.PostTimeCheckBoxClick(Sender: TObject);
1065 begin
1066         PostTimeLabel.Enabled := PostTimeCheckBox.Checked;
1067         PostTimeEdit.Enabled := PostTimeCheckBox.Checked;
1068         PutPostTimeRadioButton.Enabled := PostTimeCheckBox.Checked;
1069         BackPostTimeRadioButton.Enabled := PostTimeCheckBox.Checked;
1070 end;
1071 procedure TOptionDialog.SetAbonpropertys;
1072 begin
1073     //\82 \82Ú\81`\82ñ
1074     GikoSys.FAbon.Deleterlo := RloCheckBox.Checked;
1075     GikoSys.FAbon.Replaceul := ReplaceulCheckBox.Checked;
1076     GikoSys.FAbon.AbonPopupRes := PopUpAbonCheckBox.Checked;
1077
1078 end;
1079 procedure TOptionDialog.CSSFontButtonClick(Sender: TObject);
1080 begin
1081
1082         FontDialog.Options := [fdAnsiOnly, fdEffects];
1083         FontDialog.Font.Assign(CabinetMemo.Font);
1084         if FontDialog.Execute then begin
1085                 FontDialog.Font.Style := FontDialog.Font.Style - [fsUnderline] - [fsStrikeout];
1086     {
1087                 CabinetMemo.Font.Assign(FontDialog.Font);
1088                 CabinetMemo.Text := GetMemoText(CabinetMemo.Font, MEMO_CABINET);
1089                 CabinetMemo.Font.Charset := SHIFTJIS_CHARSET;
1090     }
1091         end;
1092
1093 end;
1094
1095 procedure TOptionDialog.CSSBackColorButtonClick(Sender: TObject);
1096 begin
1097
1098         ColorDialog.Color := CabinetMemo.Color;
1099         if ColorDialog.Execute then begin
1100                 //CabinetMemo.Color := ColorDialog.Color;
1101         end;
1102
1103 end;
1104
1105 procedure TOptionDialog.CSSFontCheckBoxClick(Sender: TObject);
1106 begin
1107
1108         CSSFontButton.Enabled := CSSFontCheckBox.Checked;
1109
1110 end;
1111
1112 procedure TOptionDialog.CSSBackColorCheckBoxClick(Sender: TObject);
1113 begin
1114
1115         CSSBackColorButton.Enabled := CSSBackColorCheckBox.Checked;
1116
1117 end;
1118
1119 end.
1120