OSDN Git Service

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