OSDN Git Service

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