OSDN Git Service

・Windows 95 でもお気に入りが使えるようになった。
[gikonavigoeson/gikonavi.git] / Setting.pas
1 unit Setting;
2
3 interface
4
5 uses
6         SysUtils, Classes, Graphics, Forms, Math, IniFiles, UCryptAuto, UBase64,
7         ComCtrls;
8
9 const
10         MAIN_COOLBAND_COUNT = 4;                //\83\81\83C\83\93CoolBand\82Ì\90\94
11         LIST_COOLBAND_COUNT = 2;                //\94ÂCoolBand\82Ì\90\94
12         BROWSER_COOLBAND_COUNT = 3;     //\83u\83\89\83E\83UCoolBand\82Ì\90\94
13
14 type
15         TGikoTabPosition = (gtpTop, gtpBottom);                                                         // \83^\83u\88Ê\92u
16         TGikoTabAppend = (gtaFirst, gtpLast);                                                                   // \83^\83u\92Ç\89Á\88Ê\92u
17         TGikoTabStyle = (gtsTab, gtsButton, gtsFlat);                                   // \83^\83u\83X\83^\83C\83\8b
18         TGikoListOrientation = (gloHorizontal, gloVertical);    // \83\8a\83X\83g\90\82\92¼\81E\90\85\95½
19         TGikoListState = (glsMax, glsNormal, glsMin);                                   // \83\8a\83X\83g\83T\83C\83Y\8fó\91Ô
20                                                                                                                                                                                                                                 // \83|\83b\83v\83A\83b\83v\95\\8e¦\88Ê\92u
21         TGikoPopupPosition = (gppRightTop, gppTop, gppLeftTop,
22                                                                                                 gppRight, gppCenter, gppLeft,
23                                                                                                 gppRightBottom, gppBottom, gppLeftBottom);
24                                                                                                                                                                                                                                 //\83v\83\8c\83r\83\85\81[\83T\83C\83Y
25         TGikoPreviewSize = (gpsXLarge, gpsLarge, gpsMedium, gpsSmall, gpsXSmall);
26
27         //CoolBar\90Ý\92è\83\8c\83R\81[\83h
28         TCoolSet = record
29                 FCoolID: Integer;
30                 FCoolWidth: Integer;
31                 FCoolBreak: Boolean;
32         end;
33
34         TSetting = class(TObject)
35         private
36                 //\8eó\90M\83o\83b\83t\83@\83T\83C\83Y
37                 FRecvBufferSize: Integer;
38                 //HTTP1.1\8eg\97p
39                 FProtocol: Boolean;
40                 //\83v\83\8d\83L\83V\90Ú\91±HTTP1.1\8eg\97p
41                 FProxyProtocol: Boolean;
42
43                 //\83v\83\8d\83L\83V\81i\93Ç\8d\9e\97p\81j
44                 FReadProxy: Boolean;
45                 FReadProxyAddress: string;
46                 FReadProxyPort: Integer;
47                 FReadProxyUserID: string;
48                 FReadProxyPassword: string;
49
50                 //\83v\83\8d\83L\83V\81i\8f\91\8d\9e\97p\81j
51                 FWriteProxy: Boolean;
52                 FWriteProxyAddress: string;
53                 FWriteProxyPort: Integer;
54                 FWriteProxyUserID: string;
55                 FWriteProxyPassword: string;
56
57                 //\83L\83\83\83r\83l\83b\83g
58                 FCabinetFontName: string;
59                 FCabinetFontSize: Integer;
60                 FCabinetFontBold: Boolean;
61                 FCabinetFontItalic: Boolean;
62                 FCabinetFontColor: TColor;
63                 FCabinetBackColor: TColor;
64
65                 //\83\8a\83X\83g
66                 FListFontName: string;
67                 FListFontSize: Integer;
68                 FListFontBold: Boolean;
69                 FListFontItalic: Boolean;
70                 FListFontColor: TColor;
71                 FListBackColor: TColor;
72
73                 //\83u\83\89\83E\83U
74                 //FBrowserFontColor: TColor;
75                 //FBrowserBackColor: TColor;
76                 //FBrowserFontSize: Integer;
77
78                 //\83G\83f\83B\83^
79                 FEditorFontName: string;
80                 FEditorFontSize: Integer;
81                 FEditorFontBold: Boolean;
82                 FEditorFontItalic: Boolean;
83                 FEditorFontColor: TColor;
84                 FEditorBackColor: TColor;
85
86                 //\83^\83u\83t\83H\83\93\83g
87                 FBrowserTabFontName: string;
88                 FBrowserTabFontSize: Integer;
89                 FBrowserTabFontBold: Boolean;
90                 FBrowserTabFontItalic: Boolean;
91
92                 //\83q\83\93\83g\83E\83B\83\93\83h\83E
93                 FHintFontName: string;
94                 FHintFontSize: Integer;
95                 //FHintFontBold: Boolean;
96                 //FHintFontItalic: Boolean;
97                 FHintFontColor: TColor;
98                 FHintBackColor: TColor;
99
100                 //\83E\83B\83\93\83h\83E\83T\83C\83Y
101                 FWindowTop: Integer;
102                 FWindowLeft: Integer;
103                 FWindowHeight: Integer;
104                 FWindowWidth: Integer;
105                 FWindowMax: Boolean;
106                 //\83\8a\83X\83g\83r\83\85\81[\83X\83^\83C\83\8b
107                 FListStyle: TViewStyle;
108
109                 //\83c\81[\83\8b\83o\81[\95\\8e¦
110                 FStdToolBarVisible: Boolean;
111                 FAddressBarVisible: Boolean;
112                 FLinkBarVisible: Boolean;
113                 FListToolBarVisible: Boolean;
114                 FListNameBarVisible: Boolean;
115                 FBrowserToolBarVisible: Boolean;
116                 FBrowserNameBarVisible: Boolean;
117
118                 //\83u\83\89\83E\83U\83^\83u
119                 FBrowserTabVisible: Boolean;
120                 FBrowserTabPosition: TGikoTabPosition;
121                 FBrowserTabAppend: TGikoTabAppend;
122                 FBrowserTabStyle: TGikoTabStyle;
123
124                 //\83\81\83b\83Z\81[\83W\83o\81[
125                 FMessageBarVisible: Boolean;
126                 FMessegeBarHeight: Integer;
127
128                 //\83X\83e\81[\83^\83X\83o\81[
129                 FStatusBarVisible: Boolean;
130
131                 //\83L\83\83\83r\83l\83b\83g\89Â\8e\8b\81E\83T\83C\83Y
132                 FCabinetVisible: Boolean;
133                 FCabinetWidth: Integer;
134
135                 //\83\8a\83X\83g\81E\83u\83\89\83E\83U\83T\83C\83Y
136                 FListOrientation: TGikoListOrientation;
137                 FListHeight: Integer;
138                 FListHeightState: TGikoListState;
139                 FListWidth: Integer;
140                 FListWidthState: TGikoListState;
141 //              FListHeightMax: Boolean;
142 //              FListWidthMax: Boolean;
143
144                 //\91\97\90M\97p\96¼\91O\81E\83\81\81[\83\8b
145                 FNameList: TStringList;
146                 FMailList: TStringList;
147
148                 //\83G\83f\83B\83^\81[\83E\83B\83\93\83h\83E\83T\83C\83Y
149                 FEditWindowTop: Integer;
150                 FEditWindowLeft: Integer;
151                 FEditWindowHeight: Integer;
152                 FEditWindowWidth: Integer;
153                 FEditWindowMax: Boolean;
154
155                 //\83\8a\83X\83g\94Ô\8d\86\95\\8e¦
156                 FListViewNo: Boolean;
157                 //CSS\95\\8e¦
158                 FUseCSS: Boolean;
159                 //CSS\83t\83@\83C\83\8b\96¼
160                 FCSSFileName: string;
161                 //mail\97\93\95\\8e¦
162                 FShowMail: Boolean;
163                 //\94ñ\83A\83N\83e\83B\83u\8e\9e\83\8c\83X\83|\83b\83v\83A\83b\83v\95\\8e¦
164                 FUnActivePopup: Boolean;
165                 //\83\8c\83X\83|\83b\83v\83A\83b\83v\83w\83b\83_\81[\83{\81[\83\8b\83h
166                 FResPopupHeaderBold: Boolean;
167
168                 //\83\8d\83O\83t\83H\83\8b\83_
169                 FLogFolder: string;
170                 FNewLogFolder: string;
171
172                 //\83\8a\83X\83g\83J\83\89\83\80\83w\83b\83_\81[\83T\83C\83Y
173                 FBBSColumnWidth: array[0..0] of Integer;
174                 FCategoryColumnWidth: array[0..3] of Integer;
175                 FBoardColumnWidth: array[0..6] of Integer;
176
177                 //\8di\8d\9e\82Ý\95\8e\9a\97ñ
178                 FSelectTextList: TStringList;
179
180                 //\94Â\88ê\97\97URL
181                 FBoardURL2ch: string;
182
183                 //\83\86\81[\83UID\81E\83p\83X\83\8f\81[\83h
184                 FUserID: string;
185                 FPassword: string;
186                 FAutoLogin: Boolean;
187
188                 //URL\83N\83\8a\83b\83N\8e\9e\8bN\93®\83A\83v\83\8a
189                 FURLApp: Boolean;
190                 FURLAppFile: string;
191
192                 //mailto\83N\83\8a\83b\83N\8e\9e\93®\8dì
193                 FOpenMailer: Boolean;
194
195                 //\8dí\8f\9c\8am\94F
196                 FDeleteMsg: Boolean;
197
198                 //CoolBar\81i\83\81\83C\83\93\81E\94Â\81E\83u\83\89\83E\83U\81j
199                 FMainCoolBar: array[0..MAIN_COOLBAND_COUNT - 1] of TCoolSet;
200                 FListCoolBar: array[0..LIST_COOLBAND_COUNT - 1] of TCoolSet;
201                 FBrowserCoolBar: array[0..BROWSER_COOLBAND_COUNT - 1] of TCoolSet;
202
203                 //ToolBar Wrapable
204                 FListToolBarWrapable: Boolean;
205                 FBrowserToolBarWrapable: Boolean;
206
207                 //\83|\83b\83v\83A\83b\83v\88Ê\92u
208                 FPopupPosition: TGikoPopupPosition;
209
210                 //\83A\83h\83\8c\83X\83o\81[
211                 FURLDisplay: Boolean;
212                 FAddressBarTabStop: Boolean;
213                 FLinkAddAddressBar: Boolean;
214                 FAddressHistoryCount: Integer;
215
216                 //\89æ\91\9c\83v\83\8c\83r\83\85\81[
217                 FPreviewVisible: Boolean;
218                 FPreviewSize: TGikoPreviewSize;
219                 FPreviewWait: Integer;
220
221                 //\83X\83\8c\83b\83h\88ê\97\97\8dX\90V\83A\83C\83R\83\93\95\\8e¦
222                 FListIconVisible: Boolean;
223
224                 //\8f\91\82«\8d\9e\82Ý\8e\9e\83}\83V\83\93\8e\9e\8aÔ\8eg\97p\90Ý\92è
225                 FUseMachineTime: Boolean;
226                 FTimeAdjustSec: Integer;
227                 FTimeAdjust: Boolean;
228
229                 function GetMainCoolSet(Index: Integer): TCoolSet;
230                 function GetBoardCoolSet(Index: Integer): TCoolSet;
231                 function GetBrowserCoolSet(Index: Integer): TCoolSet;
232                 procedure SetMainCoolSet(Index: Integer; CoolSet: TCoolSet);
233                 procedure SetBoardCoolSet(Index: Integer; CoolSet: TCoolSet);
234                 procedure SetBrowserCoolSet(Index: Integer; CoolSet: TCoolSet);
235
236                 function GetBBSColumnWidth(index: Integer): Integer;
237                 function GetCategoryColumnWidth(index: Integer): Integer;
238                 function GetBoardColumnWidth(index: Integer): Integer;
239                 procedure SetBBSColumnWidth(index: Integer; value: Integer);
240                 procedure SetCategoryColumnWidth(index: Integer; value: Integer);
241                 procedure SetBoardColumnWidth(index: Integer; value: Integer);
242
243                 function GetSoundName(Index: Integer): string;
244                 function GetSoundViewName(Index: Integer): string;
245                 function GetSoundFileName(Index: Integer): string;
246                 procedure SetSoundFileName(Index: Integer; value: string);
247                 function Encrypt(s: string): string;
248                 function Decrypt(s: string): string;
249         protected
250
251         public
252                 constructor Create;
253                 destructor Destroy; override;
254                 function GetFileName: string;
255                 procedure ReadSettingFile;
256                 procedure WriteSystemSettingFile;
257                 procedure WriteWindowSettingFile;
258                 procedure WriteNameMailSettingFile;
259                 procedure WriteFolderSettingFile();
260                 function GetSoundCount: Integer;
261                 function FindSoundFileName(Name: string): string;
262
263                 //\8eó\90M\83o\83b\83t\83@\83T\83C\83Y
264                 property RecvBufferSize: Integer read FRecvBufferSize write FRecvBufferSize;
265                 //HTTP1.1\8eg\97p
266                 property Protocol: Boolean read FProtocol write FProtocol;
267                 //\83v\83\8d\83L\83V\90Ú\91±HTTP1.1\8eg\97p
268                 property ProxyProtocol: Boolean read FProxyProtocol write FProxyProtocol;
269
270                 property ReadProxy: Boolean read FReadProxy write FReadProxy;
271                 property ReadProxyAddress: string read FReadProxyAddress write FReadProxyAddress;
272                 property ReadProxyPort: Integer read FReadProxyPort write FReadProxyPort;
273                 property ReadProxyUserID: string read FReadProxyUserID write FReadProxyUserID;
274                 property ReadProxyPassword: string read FReadProxyPassword write FReadProxyPassword;
275
276                 property WriteProxy: Boolean read FWriteProxy write FWriteProxy;
277                 property WriteProxyAddress: string read FWriteProxyAddress write FWriteProxyAddress;
278                 property WriteProxyPort: Integer read FWriteProxyPort write FWriteProxyPort;
279                 property WriteProxyUserID: string read FWriteProxyUserID write FWriteProxyUserID;
280                 property WriteProxyPassword: string read FWriteProxyPassword write FWriteProxyPassword;
281
282                 property CabinetFontName: string read FCabinetFontName write FCabinetFontName;
283                 property CabinetFontSize: Integer read FCabinetFontSize write FCabinetFontSize;
284                 property CabinetFontBold: Boolean read FCabinetFontBold write FCabinetFontBold;
285                 property CabinetFontItalic: Boolean read FCabinetFontItalic write FCabinetFontItalic;
286                 property CabinetFontColor: TColor read FCabinetFontColor write FCabinetFontColor;
287                 property CabinetBackColor: TColor read FCabinetBackColor write FCabinetBackColor;
288
289                 property ListFontName: string read FListFontName write FListFontName;
290                 property ListFontSize: Integer read FListFontSize write FListFontSize;
291                 property ListFontBold: Boolean read FListFontBold write FListFontBold;
292                 property ListFontItalic: Boolean read FListFontItalic write FListFontItalic;
293                 property ListFontColor: TColor read FListFontColor write FListFontColor;
294                 property ListBackColor: TColor read FListBackColor write FListBackColor;
295
296 //              property BrowserFontColor: TColor read FBrowserFontColor write FBrowserFontColor;
297 //              property BrowserBackColor: TColor read FBrowserBackColor write FBrowserBackColor;
298 //              property BrowserFontSize: Integer read FBrowserFontSize write FBrowserFontSize;
299
300                 property EditorFontName: string read FEditorFontName write FEditorFontName;
301                 property EditorFontSize: Integer read FEditorFontSize write FEditorFontSize;
302                 property EditorFontBold: Boolean read FEditorFontBold write FEditorFontBold;
303                 property EditorFontItalic: Boolean read FEditorFontItalic write FEditorFontItalic;
304                 property EditorFontColor: TColor read FEditorFontColor write FEditorFontColor;
305                 property EditorBackColor: TColor read FEditorBackColor write FEditorBackColor;
306
307                 property BrowserTabFontName: string read FBrowserTabFontName write FBrowserTabFontName;
308                 property BrowserTabFontSize: Integer read FBrowserTabFontSize write FBrowserTabFontSize;
309                 property BrowserTabFontBold: Boolean read FBrowserTabFontBold write FBrowserTabFontBold;
310                 property BrowserTabFontItalic: Boolean read FBrowserTabFontItalic write FBrowserTabFontItalic;
311
312                 property HintFontName: string read FHintFontName write FHintFontName;
313                 property HintFontSize: Integer read FHintFontSize write FHintFontSize;
314                 //property HintFontBold: Boolean read FHintFontBold write FHintFontBold;
315                 //property HintFontItalic: Boolean read FHintFontItalic write FHintFontItalic;
316                 property HintFontColor: TColor read FHintFontColor write FHintFontColor;
317                 property HintBackColor: TColor read FHintBackColor write FHintBackColor;
318
319                 property WindowTop: Integer read FWindowTop write FWindowTop;
320                 property WindowLeft: Integer read FWindowLeft write FWindowLeft;
321                 property WindowHeight: Integer read FWindowHeight write FWindowHeight;
322                 property WindowWidth: Integer read FWindowWidth write FWindowWidth;
323                 property WindowMax: Boolean read FWindowMax write FWindowMax;
324                 property ListStyle: TViewStyle read FListStyle write FListStyle;
325
326                 property StdToolBarVisible: Boolean read FStdToolBarVisible write FStdToolBarVisible;
327                 property AddressBarVisible: Boolean read FAddressBarVisible write FAddressBarVisible;
328                 property LinkBarVisible: Boolean read FLinkBarVisible write FLinkBarVisible;
329                 property ListToolBarVisible: Boolean read FListToolBarVisible write FListToolBarVisible;
330                 property ListNameBarVisible: Boolean read FListNameBarVisible write FListNameBarVisible;
331                 property BrowserToolBarVisible: Boolean read FBrowserToolBarVisible write FBrowserToolBarVisible;
332                 property BrowserNameBarVisible: Boolean read FBrowserNameBarVisible write FBrowserNameBarVisible;
333
334                 property BrowserTabVisible: Boolean read FBrowserTabVisible write FBrowserTabVisible;
335                 property BrowserTabPosition: TGikoTabPosition read FBrowserTabPosition write FBrowserTabPosition;
336                 property BrowserTabAppend: TGikoTabAppend read FBrowserTabAppend write FBrowserTabAppend;
337                 property BrowserTabStyle: TGikoTabStyle read FBrowserTabStyle write FBrowserTabStyle;
338
339                 property MessageBarVisible: Boolean read FMessageBarVisible write FMessageBarVisible;
340                 property MessegeBarHeight: Integer read FMessegeBarHeight write FMessegeBarHeight;
341
342                 property StatusBarVisible: Boolean read FStatusBarVisible write FStatusBarVisible;
343
344                 property CabinetVisible: Boolean read FCabinetVisible write FCabinetVisible;
345                 property CabinetWidth: Integer read FCabinetWidth write FCabinetWidth;
346
347                 property ListOrientation: TGikoListOrientation read FListOrientation write FListOrientation;
348                 property ListHeight: Integer read FListHeight write FListHeight;
349                 property ListHeightState: TGikoListState read FListHeightState write FListHeightState;
350                 property ListWidth: Integer read FListWidth write FListWidth;
351                 property ListWidthState: TGikoListState read FListWidthState write FListWidthState;
352 //              property ListHeightMax: Boolean read FListHeightMax write FListHeightMax;
353 //              property ListWidthMax: Boolean read FListWidthMax write FListWidthMax;
354
355                 property NameList: TStringList read FNameList write FNameList;
356                 property MailList: TStringList read FMailList write FMailList;
357                 property SelectTextList: TStringList read FSelectTextList write FSelectTextList;
358
359                 property EditWindowTop: Integer read FEditWindowTop write FEditWindowTop;
360                 property EditWindowLeft: Integer read FEditWindowLeft write FEditWindowLeft;
361                 property EditWindowHeight: Integer read FEditWindowHeight write FEditWindowHeight;
362                 property EditWindowWidth: Integer read FEditWindowWidth write FEditWindowWidth;
363                 property EditWindowMax: Boolean read FEditWindowMax write FEditWindowMax;
364
365                 property ListViewNo: Boolean read FListViewNo write FListViewNo;
366                 property UseCSS: Boolean read FUseCSS write FUseCSS;
367                 property CSSFileName: string read FCSSFileName write FCSSFileName;
368
369                 property ShowMail: Boolean read FShowMail write FShowMail;
370                 property UnActivePopup: Boolean read FUnActivePopup write FUnActivePopup;
371                 property ResPopupHeaderBold: Boolean read FResPopupHeaderBold write FResPopupHeaderBold;
372
373                 property LogFolder: string read FLogFolder write FLogFolder;
374                 property NewLogFolder: string read FNewLogFolder write FNewLogFolder;
375
376                 property BBSColumnWidth[index: Integer]: Integer read GetBBSColumnWidth write SetBBSColumnWidth;
377                 property CategoryColumnWidth[index: Integer]: Integer read GetCategoryColumnWidth write SetCategoryColumnWidth;
378                 property BoardColumnWidth[index: Integer]: Integer read GetBoardColumnWidth write SetBoardColumnWidth;
379
380                 property SoundName[index: Integer]: string read GetSoundName;
381                 property SoundViewName[index: Integer]: string read GetSoundViewName;
382                 property SoundFileName[index: Integer]: string read GetSoundFileName write SetSoundFileName;
383
384                 property BoardURL2ch: string read FBoardURL2ch write FBoardURL2ch;
385
386                 property UserID: string read FUserID write FUserID;
387                 property Password: string read FPassword write FPassword;
388                 property AutoLogin: Boolean read FAutoLogin write FAutoLogin;
389
390                 property URLApp: Boolean read FURLApp write FURLApp;
391                 property URLAppFile: string read FURLAppFile write FURLAppFile;
392
393                 property OpenMailer: Boolean read FOpenMailer write FOpenMailer;
394
395                 property DeleteMsg: Boolean read FDeleteMsg write FDeleteMsg;
396
397                 property MainCoolSet[Index: Integer]: TCoolSet read GetMainCoolSet write SetMainCoolSet;
398                 property ListCoolSet[Index: Integer]: TCoolSet read GetBoardCoolSet write SetBoardCoolSet;
399                 property BrowserCoolSet[Index: Integer]: TCoolSet read GetBrowserCoolSet write SetBrowserCoolSet;
400
401                 property ListToolBarWrapable: Boolean read FListToolBarWrapable write FListToolBarWrapable;
402                 property BrowserToolBarWrapable: Boolean read FBrowserToolBarWrapable write FBrowserToolBarWrapable;
403
404                 property PopupPosition: TGikoPopupPosition read FPopupPosition write FPopupPosition;
405
406                 property URLDisplay: Boolean read FURLDisplay write FURLDisplay;
407                 property AddressBarTabStop: Boolean read FAddressBarTabStop write FAddressBarTabStop;
408                 property LinkAddAddressBar: Boolean read FLinkAddAddressBar write FLinkAddAddressBar;
409                 property AddressHistoryCount: Integer read FAddressHistoryCount write FAddressHistoryCount;
410
411                 property PreviewVisible: Boolean read FPreviewVisible write FPreviewVisible;
412                 property PreviewSize: TGikoPreviewSize read FPreviewSize write FPreviewSize;
413                 property PreviewWait: Integer read FPreviewWait write FPreviewWait;
414
415                 property ListIconVisible: Boolean read FListIconVisible write FListIconVisible;
416
417                 property UseMachineTime: Boolean read FUseMachineTime write FUseMachineTime;
418                 property TimeAdjustSec: Integer read FTimeAdjustSec write FTimeAdjustSec;
419                 property TimeAdjust: Boolean read FTimeAdjust write FTimeAdjust;
420         end;
421
422
423 implementation
424
425 type
426         TSoundName = record
427                 Name: string;
428                 ViewName: string;
429                 FileName: string;
430         end;
431
432 const
433         INI_FILE_NAME: string         = 'gikoNavi.ini';
434         DEFAULT_FONT_NAME: string     = '\82l\82\82o\83S\83V\83b\83N';
435         DEFAULT_FONT_SIZE: Integer    = 9;
436         DEFAULT_FONT_COLOR: string    = 'clWindowText';
437         DEFAULT_WINDOW_COLOR: string  = 'clWindow';
438         DEFAULT_TAB_FONT_NAME: string     = '\82l\82\82o\83S\83V\83b\83N';
439         DEFAULT_TAB_FONT_SIZE: Integer    = 9;
440         DEFAULT_2CH_BOARD_URL: string = 'http://www6.ocn.ne.jp/~mirv/2chmenu.html';
441                                                                                                                                 //'http://www.2ch.net/newbbsmenu.html';
442         GIKO_ENCRYPT_TEXT: string     = 'gikoNaviEncryptText';
443
444 var
445         SOUND_NAME: array[0..4] of TSoundName = (
446                 (Name: 'New';        ViewName: '\8eæ\93¾\90¬\8c÷';           FileName: ''),
447                 (Name: 'NewDiff';    ViewName: '\8eæ\93¾\90¬\8c÷(\8d·\95ª)';     FileName: ''),
448                 (Name: 'NoChange';   ViewName: '\96¢\8dX\90V';             FileName: ''),
449 //              (Name: 'RoundEnd';   ViewName: '\8f\84\89ñ\8fI\97¹(\8eæ\93¾\82 \82è)'; FileName: ''),
450 //              (Name: 'RoundNone';  ViewName: '\8f\84\89ñ\8fI\97¹(\8eæ\93¾\82È\82µ)'; FileName: ''),
451                 (Name: 'ResEnd';     ViewName: '\83\8c\83X\91\97\90M\8a®\97¹';       FileName: ''),
452                 (Name: 'Error';      ViewName: '\83G\83\89\81[';             FileName: ''));
453
454 //\83R\83\93\83X\83g\83\89\83N\83^
455 constructor TSetting.Create();
456 begin
457         FNameList := TStringList.Create;
458         FMailList := TStringList.Create;
459         FSelectTextList := TStringList.Create;
460
461         FNameList.Duplicates := dupIgnore;
462         FMailList.Duplicates := dupIgnore;
463         FSelectTextList.Duplicates := dupIgnore;
464         ReadSettingFile();
465 end;
466
467 //\83f\83X\83g\83\89\83N\83^
468 destructor TSetting.Destroy();
469 begin
470         inherited;
471         FSelectTextList.Free;
472         FMailList.Free;
473         FNameList.Free;
474 end;
475
476 //\8f\89\8aú\89»\83t\83@\83C\83\8b\96¼\8eæ\93¾\81i\83p\83X\81{\83t\83@\83C\83\8b\96¼\81j
477 function TSetting.GetFileName(): string;
478 begin
479         Result := ExtractFilePath(Application.ExeName) + INI_FILE_NAME;
480 end;
481
482 //\90Ý\92è\83t\83@\83C\83\8b\93Ç\8d\9e
483 procedure TSetting.ReadSettingFile();
484 const
485         DEFAULT_BBS_WIDTH: array[0..0] of Integer = (140);
486         DEFAULT_CATEGORY_WIDTH: array[0..2] of Integer = (150, 80, 130);
487         DEFAULT_BOARD_WIDTH: array[0..6] of Integer = (350, 60, 60, 60, 60, 80, 130);
488 var
489         ini: TMemIniFile;
490         i: Integer;
491         wkList: TStringList;
492         wkStr: string;
493         Exists: Boolean;
494         s: string;
495 //      id: Integer;
496         CoolSet: TCoolSet;
497 begin
498         Exists := FileExists(GetFileName);
499         ini := TMemIniFile.Create(GetFileName);
500         try
501                 //\8eó\90M\83o\83b\83t\83@\83T\83C\83Y
502                 FRecvBufferSize := ini.ReadInteger('HTTP', 'RecvBufferSize', 4096);
503                 //HTTP1.1\8eg\97p
504                 FProtocol := ini.ReadBool('HTTP', 'Protocol', True);
505                 //\83v\83\8d\83L\83V\90Ú\91±HTTP1.1\8eg\97p
506                 FProxyProtocol := ini.ReadBool('HTTP', 'ProxyProtocol', False);
507
508                 FReadProxy := ini.ReadBool('ReadProxy', 'Proxy', false);
509                 FReadProxyAddress := ini.ReadString('ReadProxy', 'Address', '');
510                 FReadProxyPort := ini.ReadInteger('ReadProxy', 'Port', 0);
511                 FReadProxyUserID := ini.ReadString('ReadProxy', 'UserID', '');
512                 FReadProxyPassword := ini.ReadString('ReadProxy', 'Password', '');
513
514                 FWriteProxy := ini.ReadBool('WriteProxy', 'Proxy', false);
515                 FWriteProxyAddress := ini.ReadString('WriteProxy', 'Address', '');
516                 FWriteProxyPort := ini.ReadInteger('WriteProxy', 'Port', 0);
517                 FWriteProxyUserID := ini.ReadString('WriteProxy', 'UserID', '');
518                 FWriteProxyPassword := ini.ReadString('WriteProxy', 'Password', '');
519
520                 FCabinetFontName := ini.ReadString('Window', 'CabinetFontName', DEFAULT_FONT_NAME);
521                 FCabinetFontSize := ini.ReadInteger('Window', 'CabinetFontSize', DEFAULT_FONT_SIZE);
522                 FCabinetFontBold := ini.ReadBool('Window', 'CabinetFontBold', False);
523                 FCabinetFontItalic := ini.ReadBool('Window', 'CabinetFontItalic', False);
524                 FCabinetFontColor := StringToColor(ini.ReadString('Window', 'CabinetFontColor', DEFAULT_FONT_COLOR));
525                 FCabinetBackColor := StringToColor(ini.ReadString('Window', 'CabinetBackColor', DEFAULT_WINDOW_COLOR));
526
527                 FListFontName := ini.ReadString('Window', 'ListFontName', DEFAULT_FONT_NAME);
528                 FListFontSize := ini.ReadInteger('Window', 'ListFontSize', DEFAULT_FONT_SIZE);
529                 FListFontBold := ini.ReadBool('Window', 'ListFontBold', False);
530                 FListFontItalic := ini.ReadBool('Window', 'ListFontItalic', False);
531                 FListFontColor := StringToColor(ini.ReadString('Window', 'ListFontColor', DEFAULT_FONT_COLOR));
532                 FListBackColor := StringToColor(ini.ReadString('Window', 'ListBackColor', DEFAULT_WINDOW_COLOR));
533
534                 FEditorFontName := ini.ReadString('Window', 'EditorFontName', DEFAULT_FONT_NAME);
535                 FEditorFontSize := ini.ReadInteger('Window', 'EditorFontSize', DEFAULT_FONT_SIZE);
536                 FEditorFontBold := ini.ReadBool('Window', 'EditorFontBold', False);
537                 FEditorFontItalic := ini.ReadBool('Window', 'EditorFontItalic', False);
538                 FEditorFontColor := StringToColor(ini.ReadString('Window', 'EditorFontColor', DEFAULT_FONT_COLOR));
539                 FEditorBackColor := StringToColor(ini.ReadString('Window', 'EditorBackColor', DEFAULT_WINDOW_COLOR));
540
541                 FBrowserTabFontName := ini.ReadString('Window', 'BrowserTabFontName', DEFAULT_TAB_FONT_NAME);
542                 FBrowserTabFontSize := ini.ReadInteger('Window', 'BrowserTabFontSize', DEFAULT_TAB_FONT_SIZE);
543                 FBrowserTabFontBold := ini.ReadBool('Window', 'BrowserTabFontBold', False);
544                 FBrowserTabFontItalic := ini.ReadBool('Window', 'BrowserTabFontItalic', False);
545
546                 FHintFontName := ini.ReadString('Window', 'HintFontName', Screen.HintFont.Name);
547                 FHintFontSize := ini.ReadInteger('Window', 'HintFontSize', Screen.HintFont.Size);
548                 //FHintFontBold := ini.ReadBool('Window', 'HintFontBold', False);
549                 //FHintFontItalic := ini.ReadBool('Window', 'HintFontItalic', False);
550                 FHintFontColor := StringToColor(ini.ReadString('Window', 'HintFontColor', DEFAULT_FONT_COLOR));
551                 FHintBackColor := StringToColor(ini.ReadString('Window', 'HintBackColor', 'clInfoBk'));
552
553                 FWindowTop := ini.ReadInteger('WindowSize', 'Top', -1);
554                 FWindowLeft := ini.ReadInteger('WindowSize', 'Left', -1);
555                 FWindowHeight := ini.ReadInteger('WindowSize', 'Height', -1);
556                 FWindowWidth := ini.ReadInteger('WindowSize', 'Width', -1);
557                 FWindowMax := ini.ReadBool('WindowSize', 'Max', false);
558
559                 if FWindowHeight <= 0 then      FWindowHeight := 400;
560                 if FWindowWidth <= 0 then FWindowWidth := 600;
561
562                 FListStyle := TViewStyle(ini.ReadInteger('ViewStyle', 'ListView', Ord(vsReport)));
563
564                 FEditWindowTop := ini.ReadInteger('EditorWindowSize', 'Top', -1);
565                 FEditWindowLeft := ini.ReadInteger('EditorWindowSize', 'Left', -1);
566                 FEditWindowHeight := ini.ReadInteger('EditorWindowSize', 'Height', -1);
567                 FEditWindowWidth := ini.ReadInteger('EditorWindowSize', 'Width', -1);
568                 FEditWindowMax := ini.ReadBool('EditorWindowSize', 'Max', False);
569
570                 //\83c\81[\83\8b\83o\81[
571                 FStdToolBarVisible := ini.ReadBool('ToolBar', 'StdVisible', True);
572                 FAddressBarVisible := ini.ReadBool('ToolBar', 'AddressVisible', True);
573                 FLinkBarVisible := ini.ReadBool('ToolBar', 'LinkVisible', True);
574                 FListToolBarVisible := ini.ReadBool('ToolBar', 'ListVisible', True);
575                 FListNameBarVisible := ini.ReadBool('ToolBar', 'ListNameVisible', True);
576                 FBrowserToolBarVisible := ini.ReadBool('ToolBar', 'BrowserVisible', True);
577                 FBrowserNameBarVisible := ini.ReadBool('ToolBar', 'BrowserNameVisible', True);
578                 //\83c\81[\83\8b\83o\81[Wrapable
579                 FListToolBarWrapable := ini.ReadBool('ToolBar', 'ListWrapable', False);
580                 FBrowserToolBarWrapable := ini.ReadBool('ToolBar', 'BrowserWrapable', False);
581
582                 FBrowserTabVisible := ini.ReadBool('Tab', 'BrowserTabVisible', True);
583                 FBrowserTabPosition := TGikoTabPosition(ini.ReadInteger('Tab', 'BrowserTabPosition', Ord(gtpTop)));
584                 FBrowserTabAppend := TGikoTabAppend(ini.ReadInteger('Tab', 'BrowserTabAppend', Ord(gtaFirst)));
585                 FBrowserTabStyle := TGikoTabStyle(ini.ReadInteger('Tab', 'BrowserTabStyle', Ord(gtsFlat)));
586
587                 FMessageBarVisible := ini.ReadBool('MessageBar', 'Visible', True);
588                 FMessegeBarHeight := ini.ReadInteger('MessageBar', 'Height', 30);
589
590                 FStatusBarVisible := ini.ReadBool('StatusBar', 'Visible', True);
591
592                 FCabinetVisible := ini.ReadBool('Cabinet', 'Visible', True);
593                 FCabinetWidth := ini.ReadInteger('Cabinet', 'Width', 200);
594
595                 FListOrientation := TGikoListOrientation(ini.ReadInteger('List', 'Orientation', Ord(gloHorizontal)));
596                 FListHeight := ini.ReadInteger('List', 'Height', 180);
597                 FListHeightState := TGikoListState(ini.ReadInteger('List', 'HeightState', Ord(glsNormal)));
598                 FListWidth := ini.ReadInteger('List', 'Width', 180);
599                 FListWidthState := TGikoListState(ini.ReadInteger('List', 'WidthState', Ord(glsNormal)));
600 //              FListHeightMax := ini.ReadBool('List', 'HeightMax', False);
601 //              FListWidthMax := ini.ReadBool('List', 'WidthMax', False);
602
603                 wkList := TStringList.Create;
604                 try
605                         ini.ReadSection('Name', wkList);
606                         for i := 0 to wkList.Count - 1 do begin
607                                 wkStr := ini.ReadString('Name', wkList[i], '');
608                                 if (wkStr <> '') and (FNameList.IndexOf(wkStr) = -1) then
609                                         FNameList.Add(wkStr);
610                         end;
611                         ini.ReadSection('Mail', wkList);
612                         for i := 0 to wkList.Count - 1 do begin
613                                 wkStr := ini.ReadString('Mail', wkList[i], '');
614                                 if (wkStr <> '') and (FMailList.IndexOf(wkStr) = -1) then
615                                         FMailList.Add(wkStr);
616                         end;
617                         ini.ReadSection('SelectText', wkList);
618                         for i := 0 to wkList.Count - 1 do begin
619                                 wkStr := ini.ReadString('SelectText', wkList[i], '');
620                                 if (wkStr <> '') and (FSelectTextList.IndexOf(wkStr) = -1) then
621                                         FSelectTextList.Add(wkStr);
622                         end;
623                 finally
624                         wkList.Free;
625                 end;
626
627                 //\83\8a\83X\83g\83J\83\89\83\80
628                 wkList := TStringList.Create;
629                 try
630                         ini.ReadSection('BBSColumnWidth', wkList);
631                         if Length(FBBSColumnWidth) <> wkList.Count then begin
632                                 ini.EraseSection('BBSColumnWidth');
633                         end;
634                         for i := 0 to Length(FBBSColumnWidth) - 1 do begin
635                                 BBSColumnWidth[i] := ini.ReadInteger('BBSColumnWidth', 'ID' + IntToStr(i), DEFAULT_BBS_WIDTH[i]);
636                         end;
637                         ini.ReadSection('CategoryColumnWidth', wkList);
638                         if Length(FCategoryColumnWidth) <> wkList.Count then begin
639                                 ini.EraseSection('CategoryColumnWidth');
640                         end;
641                         for i := 0 to Length(FCategoryColumnWidth) - 1 do begin
642                                 CategoryColumnWidth[i] := ini.ReadInteger('CategoryColumnWidth', 'ID' + IntToStr(i), DEFAULT_CATEGORY_WIDTH[i]);
643                         end;
644                         ini.ReadSection('BoardColumnWidth', wkList);
645                         if Length(FBoardColumnWidth) <> wkList.Count then begin
646                                 ini.EraseSection('BoardColumnWidth');
647                         end;
648                         for i := 0 to Length(FBoardColumnWidth) - 1 do begin
649                                 BoardColumnWidth[i] := ini.ReadInteger('BoardColumnWidth', 'ID' + IntToStr(i), DEFAULT_BOARD_WIDTH[i]);
650                         end;
651                 finally
652                         wkList.Free;
653                 end;
654
655
656                 //\83\8a\83X\83g\94Ô\8d\86
657                 FListViewNo := ini.ReadBool('Function', 'ListViewNo', True);
658                 //CSS
659                 FUseCSS := ini.ReadBool('CSS', 'UseCSS', True);
660                 //CSS\83t\83@\83C\83\8b\96¼
661                 FCSSFileName := ini.ReadString('CSS', 'FileName', 'default.css');
662
663                 //Mail\97\93\95\\8e¦
664                 FShowMail := ini.ReadBool('Thread', 'ShowMail', True);
665                 //\94ñ\83A\83N\83e\83B\83u\8e\9e\83\8c\83X\83|\83b\83v\83A\83b\83v\95\\8e¦
666                 FUnActivePopup := ini.ReadBool('Thread', 'UnActivePopup', False);
667                 //\83\8c\83X\83|\83b\83v\83A\83b\83v\83w\83b\83_\81[\83{\81[\83\8b\83h
668                 FResPopupHeaderBold := ini.ReadBool('Thread', 'ResPopupHeaderBold', True);
669
670                 //\8dí\8f\9c\8am\94F
671                 FDeleteMsg := ini.ReadBool('Function', 'LogDeleteMessage', True);
672
673                 //\83\8d\83O\83t\83H\83\8b\83_
674                 FLogFolder := ini.ReadString('Folder', 'LogFolder', ExtractFilePath(Application.ExeName) + 'Log');
675                 NewLogFolder := '';
676
677                 //\94ÂURL
678                 FBoardURL2ch := ini.ReadString('BoardURL', '2ch', DEFAULT_2CH_BOARD_URL);
679
680                 //\94F\8fØ\97p\83\86\81[\83UID\81E\83p\83X\83\8f\81[\83h
681                 FUserID := ini.ReadString('Attestation', 'UserID', '');
682                 FPassword := Decrypt(ini.ReadString('Attestation', 'Password', ''));
683                 FAutoLogin := ini.ReadBool('Attestation', 'AutoLogin', False);
684
685                 //URL\83N\83\8a\83b\83N\8e\9e\8bN\93®\83A\83v\83\8a
686                 FURLApp := ini.ReadBool('URLApp', 'Select', False);
687                 FURLAppFile := ini.ReadString('URLApp', 'File', '');
688
689                 //mailto\83N\83\8a\83b\83N\8e\9e\93®\8dì
690                 FOpenMailer := ini.ReadBool('Mailto', 'Open', True);
691
692                 //\83|\83b\83v\83A\83b\83v\88Ê\92u
693                 FPopupPosition := TGikoPopupPosition(ini.ReadInteger('Browser', 'PopupPosition', Ord(gppLeftBottom)));
694
695                 //\83A\83h\83\8c\83X\83o\81[
696                 FURLDisplay := ini.ReadBool('AddressBar', 'URLDisplay', False);
697                 FAddressBarTabStop := ini.ReadBool('AddressBar', 'TabStop', True);
698                 FLinkAddAddressBar := ini.ReadBool('AddressBar', 'LinkAdd', False);
699                 FAddressHistoryCount := ini.ReadInteger('AddressBar', 'HistoryCount', 100);
700
701                 //\89æ\91\9c\83v\83\8c\83r\83\85\81[
702                 FPreviewVisible := ini.ReadBool('Browser', 'PreviewVisible', True);
703                 FPreviewSize := TGikoPreviewSize(ini.ReadInteger('Browser', 'PreviewSize', Ord(gpsMedium)));
704                 FPreviewWait := ini.ReadInteger('Browser', 'PreviewWait', 500);
705
706                 //\83X\83\8c\83b\83h\88ê\97\97\8dX\90V\83A\83C\83R\83\93
707                 FListIconVisible := ini.ReadBool('ThreadList', 'StateIconVisible', True);
708
709                 //\8f\91\82«\8d\9e\82Ý\8e\9e\83}\83V\83\93\8e\9e\8d\8f\8eg\97p\90Ý\92è
710                 FUseMachineTime := ini.ReadBool('PostTime', 'UseMachineTime', False);
711                 FTimeAdjustSec := ini.ReadInteger('PostTime', 'TimeAdjustSec', 0);
712                 FTimeAdjust := ini.ReadBool('PostTime', 'TimeAdjust', True);
713
714                 //\83T\83E\83\93\83h
715                 if Exists then begin
716                         for i := 0 to GetSoundCount - 1 do begin
717                                 SoundFileName[i] := ini.ReadString('Sound', SoundName[i], '');
718                                 if not FileExists(SoundFileName[i]) then
719                                         SoundFileName[i] := '';
720                         end;
721                 end else begin
722                         s := ExtractFileDir(Application.ExeName) + '\sound\';
723                         SoundFileName[0] := s + '\8eæ\93¾\90¬\8c÷.wav';
724                         SoundFileName[1] := s + '\8eæ\93¾\90¬\8c÷(\8d·\95ª).wav';
725                         SoundFileName[2] := s + '\96¢\8dX\90V.wav';
726                         SoundFileName[3] := '';
727                         SoundFileName[4] := s + '\83G\83\89\81[.wav';
728                 end;
729
730                 //\83N\81[\83\8b\83o\81[
731                 for i := 0 to MAIN_COOLBAND_COUNT - 1 do begin
732                         CoolSet.FCoolID := ini.ReadInteger('MainCoolBar', 'ID' + IntToStr(i), -1);
733                         CoolSet.FCoolWidth := ini.ReadInteger('MainCoolBar', 'Width' + IntToStr(i), -1);
734                         CoolSet.FCoolBreak := ini.ReadBool('MainCoolBar', 'Break' + IntToStr(i), False);
735                         MainCoolSet[i] := CoolSet;
736                 end;
737                 for i := 0 to LIST_COOLBAND_COUNT - 1 do begin
738                         CoolSet.FCoolID := ini.ReadInteger('ListCoolBar', 'ID' + IntToStr(i), -1);
739                         CoolSet.FCoolWidth := ini.ReadInteger('ListCoolBar', 'Width' + IntToStr(i), -1);
740                         CoolSet.FCoolBreak := ini.ReadBool('ListCoolBar', 'Break' + IntToStr(i), False);
741                         ListCoolSet[i] := CoolSet;
742                 end;
743                 for i := 0 to BROWSER_COOLBAND_COUNT - 1 do begin
744                         CoolSet.FCoolID := ini.ReadInteger('BrowserCoolBar', 'ID' + IntToStr(i), -1);
745                         CoolSet.FCoolWidth := ini.ReadInteger('BrowserCoolBar', 'Width' + IntToStr(i), -1);
746                         CoolSet.FCoolBreak := ini.ReadBool('BrowserCoolBar', 'Break' + IntToStr(i), False);
747                         BrowserCoolSet[i] := CoolSet;
748                 end;
749         finally
750                 ini.Free;
751         end;
752 end;
753
754 //\90Ý\92è\83t\83@\83C\83\8b\95Û\91¶(system)
755 procedure TSetting.WriteSystemSettingFile();
756 var
757         ini: TMemIniFile;
758 begin
759         ini := TMemIniFile.Create(GetFileName());
760         try
761                 //\8eó\90M\83o\83b\83t\83@\83T\83C\83Y
762                 ini.WriteInteger('HTTP', 'RecvBufferSize', FRecvBufferSize);
763                 //HTTP1.1\8eg\97p
764                 ini.WriteBool('HTTP', 'Protocol', FProtocol);
765                 //\83v\83\8d\83L\83V\90Ú\91±HTTP1.1\8eg\97p
766                 ini.WriteBool('HTTP', 'ProxyProtocol', FProxyProtocol);
767
768                 ini.WriteBool('ReadProxy', 'Proxy', FReadProxy);
769                 ini.WriteString('ReadProxy', 'Address', FReadProxyAddress);
770                 ini.WriteInteger('ReadProxy', 'Port', FReadProxyPort);
771                 ini.WriteString('ReadProxy', 'UserID', FReadProxyUserID);
772                 ini.WriteString('ReadProxy', 'Password', FReadProxyPassword);
773
774                 ini.WriteBool('WriteProxy', 'Proxy', FWriteProxy);
775                 ini.WriteString('WriteProxy', 'Address', FWriteProxyAddress);
776                 ini.WriteInteger('WriteProxy', 'Port', FWriteProxyPort);
777                 ini.WriteString('WriteProxy', 'UserID', FWriteProxyUserID);
778                 ini.WriteString('WriteProxy', 'Password', FWriteProxyPassword);
779
780                 ini.WriteString('Window', 'CabinetFontName', FCabinetFontName);
781                 ini.WriteInteger('Window', 'CabinetFontSize', FCabinetFontSize);
782                 ini.WriteString('Window', 'CabinetFontColor', ColorToString(FCabinetFontColor));
783                 ini.WriteString('Window', 'CabinetBackColor', ColorToString(FCabinetBackColor));
784
785                 ini.WriteString('Window', 'ListFontName', FListFontName);
786                 ini.WriteInteger('Window', 'ListFontSize', FListFontSize);
787                 ini.WriteString('Window', 'ListFontColor', ColorToString(FListFontColor));
788                 ini.WriteString('Window', 'ListBackColor', ColorToString(FListBackColor));
789
790                 ini.WriteString('Window', 'EditorFontName', FEditorFontName);
791                 ini.WriteInteger('Window', 'EditorFontSize', FEditorFontSize);
792                 ini.WriteString('Window', 'EditorFontColor', ColorToString(FEditorFontColor));
793                 ini.WriteString('Window', 'EditorBackColor', ColorToString(FEditorBackColor));
794
795                 ini.WriteString('Window', 'BrowserTabFontName', FBrowserTabFontName);
796                 ini.WriteInteger('Window', 'BrowserTabFontSize', FBrowserTabFontSize);
797                 ini.WriteBool('Window', 'BrowserTabFontBold', FBrowserTabFontBold);
798                 ini.WriteBool('Window', 'BrowserTabFontItalic', FBrowserTabFontItalic);
799
800                 ini.WriteString('Window', 'HintFontName', FHintFontName);
801                 ini.WriteInteger('Window', 'HintFontSize', FHintFontSize);
802                 ini.WriteString('Window', 'HintFontColor', ColorToString(FHintFontColor));
803                 ini.WriteString('Window', 'HintBackColor', ColorToString(FHintBackColor));
804
805                 ini.UpdateFile;
806         finally
807                 ini.Free;
808         end;
809 end;
810
811 //\90Ý\92è\83t\83@\83C\83\8b\95Û\91¶(window)
812 procedure TSetting.WriteWindowSettingFile();
813 var
814         i: Integer;
815         ini: TMemIniFile;
816         CoolSet: TCoolSet;
817 begin
818         ini := TMemIniFile.Create(GetFileName());
819         try
820                 ini.WriteInteger('WindowSize', 'Top', WindowTop);
821                 ini.WriteInteger('WindowSize', 'Left', WindowLeft);
822                 ini.WriteInteger('WindowSize', 'Height', WindowHeight);
823                 ini.WriteInteger('WindowSize', 'Width', WindowWidth);
824                 ini.WriteBool('WindowSize', 'Max', WindowMax);
825
826                 ini.WriteInteger('ViewStyle', 'ListView', Ord(ListStyle));
827
828                 ini.WriteInteger('EditorWindowSize', 'Top', EditWindowTop);
829                 ini.WriteInteger('EditorWindowSize', 'Left', EditWindowLeft);
830                 ini.WriteInteger('EditorWindowSize', 'Height', EditWindowHeight);
831                 ini.WriteInteger('EditorWindowSize', 'Width', EditWindowWidth);
832                 ini.WriteBool('EditorWindowSize', 'Max', EditWindowMax);
833
834                 //\83c\81[\83\8b\83o\81[
835                 ini.WriteBool('ToolBar', 'StdVisible', FStdToolBarVisible);
836                 ini.WriteBool('ToolBar', 'AddressVisible', FAddressBarVisible);
837                 ini.WriteBool('ToolBar', 'LinkVisible', FLinkBarVisible);
838                 ini.WriteBool('ToolBar', 'ListVisible', FListToolBarVisible);
839                 ini.WriteBool('ToolBar', 'ListNameVisible', FListNameBarVisible);
840                 ini.WriteBool('ToolBar', 'BrowserVisible', FBrowserToolBarVisible);
841                 ini.WriteBool('ToolBar', 'BrowserNameVisible', FBrowserNameBarVisible);
842                 //\83c\81[\83\8b\83o\81[Wrapable
843                 ini.WriteBool('ToolBar', 'ListWrapable', FListToolBarWrapable);
844                 ini.WriteBool('ToolBar', 'BrowserWrapable', FBrowserToolBarWrapable);
845
846                 //\83^\83u
847                 ini.WriteBool('Tab', 'BrowserTabVisible', FBrowserTabVisible);
848                 ini.WriteInteger('Tab', 'BrowserTabPosition', Ord(FBrowserTabPosition));
849                 ini.WriteInteger('Tab', 'BrowserTabAppend', Ord(FBrowserTabAppend));
850                 ini.WriteInteger('Tab', 'BrowserTabStyle', Ord(FBrowserTabStyle));
851
852                 //\83\81\83b\83Z\81[\83W\83o\81[
853                 ini.WriteBool('MessageBar', 'Visible', FMessageBarVisible);
854                 ini.WriteInteger('MessageBar', 'Height', FMessegeBarHeight);
855
856                 //\83X\83e\81[\83^\83X\83o\81[
857                 ini.WriteBool('StatusBar', 'Visible', FStatusBarVisible);
858
859                 //\83L\83\83\83r\83l\83b\83g
860                 ini.WriteBool('Cabinet', 'Visible', FCabinetVisible);
861                 ini.WriteInteger('Cabinet', 'Width', FCabinetWidth);
862
863                 //\83\8a\83X\83g\82Ì\83T\83C\83Y\82Æ\90\82\92¼\90\85\95½
864                 ini.WriteInteger('List', 'Orientation', Ord(FListOrientation));
865                 ini.WriteInteger('List', 'Height', FListHeight);
866                 ini.WriteInteger('List', 'HeightState', Ord(FListHeightState));
867                 ini.WriteInteger('List', 'Width', FListWidth);
868                 ini.WriteInteger('List', 'WidthState', Ord(FListWidthState));
869 //              ini.WriteBool('List', 'HeightMax', FListHeightMax);
870 //              ini.WriteBool('List', 'WidthMax', FListWidthMax);
871
872
873 //              ini.WriteInteger('Window', 'BrowserFontSize', BrowserFontSize);
874
875                 //\83\8a\83X\83g\94Ô\8d\86\95\\8e¦
876                 ini.WriteBool('Function', 'ListViewNo', FListViewNo);
877                 //CSS\8eg\97p
878                 ini.WriteBool('CSS', 'UseCSS', FUseCSS);
879                 //CSS\83t\83@\83C\83\8b\96¼
880                 ini.WriteString('CSS', 'FileName', FCSSFileName);
881                 //Mail\97\93\95\\8e¦
882                 ini.WriteBool('Thread', 'ShowMail', FShowMail);
883                 //\83\8d\83O\8dí\8f\9c\8am\94F
884                 ini.WriteBool('Function', 'LogDeleteMessage', FDeleteMsg);
885                 //\94ñ\83A\83N\83e\83B\83u\8e\9e\83|\83b\83v\83A\83b\83v\95\\8e¦
886                 ini.WriteBool('Thread', 'UnActivePopup', FUnActivePopup);
887                 //\83\8c\83X\83|\83b\83v\83A\83b\83v\83w\83b\83_\81[\83{\81[\83\8b\83h
888                 ini.WriteBool('Thread', 'ResPopupHeaderBold', FResPopupHeaderBold);
889
890                 ini.WriteString('BoardURL', '2ch', FBoardURL2ch);
891
892                 //\94F\8fØ\97p\83\86\81[\83UID\81E\83p\83X\83\8f\81[\83h
893                 ini.WriteString('Attestation', 'UserID', FUserID);
894                 ini.WriteString('Attestation', 'Password', Encrypt(FPassword));
895                 ini.WriteBool('Attestation', 'AutoLogin', FAutoLogin);
896
897                 //URL\83N\83\8a\83b\83N\8e\9e\8bN\93®\83A\83v\83\8a
898                 ini.WriteBool('URLApp', 'Select', FURLApp);
899                 ini.WriteString('URLApp', 'File', FURLAppFile);
900
901                 //mailto\83N\83\8a\83b\83N\8e\9e\93®\8dì
902                 ini.WriteBool('Mailto', 'Open', FOpenMailer);
903
904                 //\83|\83b\83v\83A\83b\83v\88Ê\92u
905                 ini.WriteInteger('Browser', 'PopupPosition', Ord(FPopupPosition));
906
907                 //\83A\83h\83\8c\83X\83o\81[
908                 ini.WriteBool('AddressBar', 'URLDisplay', FURLDisplay);
909                 ini.WriteBool('AddressBar', 'TabStop', FAddressBarTabStop);
910                 ini.WriteBool('AddressBar', 'LinkAdd', FLinkAddAddressBar);
911                 ini.WriteInteger('AddressBar', 'HistoryCount', FAddressHistoryCount);
912
913                 //\89æ\91\9c\83v\83\8c\83r\83\85\81[
914                 ini.WriteBool('Browser', 'PreviewVisible', FPreviewVisible);
915                 ini.WriteInteger('Browser', 'PreviewSize', Ord(FPreviewSize));
916                 ini.WriteInteger('Browser', 'PreviewWait', FPreviewWait);
917
918                 //\83X\83\8c\83b\83h\88ê\97\97\8dX\90V\83A\83C\83R\83\93
919                 ini.WriteBool('ThreadList', 'StateIconVisible', FListIconVisible);
920
921                 //\8f\91\82«\8d\9e\82Ý\8e\9e\83}\83V\83\93\8e\9e\8d\8f\8eg\97p\90Ý\92è
922                 ini.WriteBool('PostTime', 'UseMachineTime', FUseMachineTime);
923                 ini.WriteInteger('PostTime', 'TimeAdjustSec', FTimeAdjustSec);
924                 ini.WriteBool('PostTime', 'TimeAdjust', FTimeAdjust);
925
926                 //\83\8a\83X\83g\83J\83\89\83\80
927                 for i := 0 to Length(FBBSColumnWidth) - 1 do begin
928                         ini.WriteInteger('BBSColumnWidth', 'ID' + IntToStr(i), FBBSColumnWidth[i]);
929                 end;
930                 for i := 0 to Length(FCategoryColumnWidth) - 1 do begin
931                         ini.WriteInteger('CategoryColumnWidth', 'ID' + IntToStr(i), FCategoryColumnWidth[i]);
932                 end;
933                 for i := 0 to Length(FBoardColumnWidth) - 1 do begin
934                         ini.WriteInteger('BoardColumnWidth', 'ID' + IntToStr(i), FBoardColumnWidth[i]);
935                 end;
936
937                 //\83T\83E\83\93\83h
938                 for i := 0 to GetSoundCount - 1 do begin
939                         if not FileExists(SoundFileName[i]) then
940                                 SoundFileName[i] := '';
941                         ini.WriteString('Sound', SoundName[i], SoundFileName[i]);
942                 end;
943
944                 //CoolBar
945                 ini.EraseSection('MainCoolBar');
946                 for i := 0 to MAIN_COOLBAND_COUNT - 1 do begin
947                         CoolSet := MainCoolSet[i];
948                         ini.WriteInteger('MainCoolBar', 'ID' + IntToStr(i), CoolSet.FCoolID);
949                         ini.WriteInteger('MainCoolBar', 'Width' + IntToStr(i), CoolSet.FCoolWidth);
950                         ini.WriteBool('MainCoolBar', 'Break' + IntToStr(i), CoolSet.FCoolBreak);
951                 end;
952                 ini.EraseSection('ListCoolBar');
953                 for i := 0 to LIST_COOLBAND_COUNT - 1 do begin
954                         CoolSet := ListCoolSet[i];
955                         ini.WriteInteger('ListCoolBar', 'ID' + IntToStr(i), CoolSet.FCoolID);
956                         ini.WriteInteger('ListCoolBar', 'Width' + IntToStr(i), CoolSet.FCoolWidth);
957                         ini.WriteBool('ListCoolBar', 'Break' + IntToStr(i), CoolSet.FCoolBreak);
958                 end;
959                 ini.EraseSection('BrowserCoolBar');
960                 for i := 0 to BROWSER_COOLBAND_COUNT - 1 do begin
961                         CoolSet := BrowserCoolSet[i];
962                         ini.WriteInteger('BrowserCoolBar', 'ID' + IntToStr(i), CoolSet.FCoolID);
963                         ini.WriteInteger('BrowserCoolBar', 'Width' + IntToStr(i), CoolSet.FCoolWidth);
964                         ini.WriteBool('BrowserCoolBar', 'Break' + IntToStr(i), CoolSet.FCoolBreak);
965                 end;
966
967                 ini.UpdateFile;
968         finally
969                 ini.Free;
970         end;
971 end;
972
973 //\90Ý\92è\83t\83@\83C\83\8b\95Û\91¶(name & mail)
974 procedure TSetting.WriteNameMailSettingFile();
975 var
976         i: Integer;
977         ini: TMemIniFile;
978 begin
979         ini := TMemIniFile.Create(GetFileName());
980         try
981                 ini.EraseSection('Name');
982                 ini.EraseSection('Mail');
983                 ini.EraseSection('SelectText');
984                 for i := 0 to FNameList.Count - 1 do begin
985                         ini.WriteString('Name', Format('%.2d', [i + 1]), FNameList[i]);
986                         if i >= 39 then
987                                 Break;
988                 end;
989                 for i := 0 to FMailList.Count - 1 do begin
990                         ini.WriteString('Mail', Format('%.2d', [i + 1]), FMailList[i]);
991                         if i >= 39 then
992                                 Break;
993                 end;
994                 for i := 0 to FSelectTextList.Count - 1 do begin
995                         ini.WriteString('SelectText', Format('%.2d', [i + 1]), FSelectTextList[i]);
996                         if i >= 39 then
997                                 Break;
998                 end;
999                 ini.UpdateFile;
1000         finally
1001                 ini.Free;
1002         end;
1003 end;
1004
1005 procedure TSetting.WriteFolderSettingFile();
1006 var
1007         ini: TMemIniFile;
1008 begin
1009         ini := TMemIniFile.Create(GetFileName());
1010         try
1011                 if ExtractFilePath(Application.ExeName) + 'Log' = NewLogFolder then
1012                         ini.DeleteKey('Folder', 'LogFolder')
1013                 else
1014                         ini.WriteString('Folder', 'LogFolder', NewLogFolder);
1015                 ini.UpdateFile;
1016         finally
1017                 ini.Free;
1018         end;
1019 end;
1020
1021 //\83\8a\83X\83g\83J\83\89\83\80\83w\83b\83_\81[
1022 function TSetting.GetBBSColumnWidth(index: Integer): Integer;
1023 begin
1024         Result := IfThen(index in [0..Length(FBBSColumnWidth) - 1], FBBSColumnWidth[index], 0);
1025 end;
1026
1027 function TSetting.GetCategoryColumnWidth(index: Integer): Integer;
1028 begin
1029         Result := IfThen(index in [0..Length(FCategoryColumnWidth) - 1], FCategoryColumnWidth[index], 0);
1030 end;
1031
1032 function TSetting.GetBoardColumnWidth(index: Integer): Integer;
1033 begin
1034         Result := IfThen(index in [0..Length(FBoardColumnWidth) - 1], FBoardColumnWidth[index], 0);
1035 end;
1036
1037 procedure TSetting.SetBBSColumnWidth(index: Integer; value: Integer);
1038 begin
1039         if index in [0..Length(FBBSColumnWidth) - 1] then
1040                 FBBSColumnWidth[index] := value;
1041 end;
1042
1043 procedure TSetting.SetCategoryColumnWidth(index: Integer; value: Integer);
1044 begin
1045         if index in [0..Length(FCategoryColumnWidth) - 1] then
1046                 FCategoryColumnWidth[index] := value;
1047 end;
1048
1049 procedure TSetting.SetBoardColumnWidth(index: Integer; value: Integer);
1050 begin
1051         if index in [0..Length(FBoardColumnWidth) - 1] then
1052                 FBoardColumnWidth[index] := value;
1053 end;
1054
1055 function TSetting.GetSoundCount: Integer;
1056 begin
1057         Result := Length(SOUND_NAME);
1058 end;
1059
1060 function TSetting.GetSoundName(Index: Integer): string;
1061 begin
1062         if (Index < GetSoundCount) and (Index >= 0) then
1063                 Result := SOUND_NAME[Index].Name
1064         else
1065                 Result := '';
1066 end;
1067
1068 function TSetting.GetSoundViewName(Index: Integer): string;
1069 begin
1070         if (Index < GetSoundCount) and (Index >= 0) then
1071                 Result := SOUND_NAME[Index].ViewName
1072         else
1073                 Result := '';
1074 end;
1075
1076 function TSetting.GetSoundFileName(Index: Integer): string;
1077 begin
1078         if (Index < GetSoundCount) and (Index >= 0) then
1079                 Result := SOUND_NAME[Index].FileName
1080         else
1081                 Result := '';
1082 end;
1083
1084 procedure TSetting.SetSoundFileName(Index: Integer; value: string);
1085 begin
1086         if (Index < GetSoundCount) and (Index >= 0) then
1087                 SOUND_NAME[Index].FileName := value;
1088 end;
1089
1090 function TSetting.FindSoundFileName(Name: string): string;
1091 var
1092         i: Integer;
1093 begin
1094         for i := 0 to GetSoundCount - 1 do begin
1095                 if SoundName[i] = Name then begin
1096                         Result := SoundFileName[i];
1097                         Exit;
1098                 end;
1099         end;
1100         Result := '';
1101 end;
1102
1103 function TSetting.Encrypt(s: string): string;
1104 var
1105         cryptObj: THogeCryptAuto;
1106         inputStream, outputStream: TStringStream;
1107 begin
1108         inputStream := TStringStream.Create(s);
1109         outputStream := TStringStream.Create('');
1110         cryptObj := THogeCryptAuto.Create;
1111         try
1112                 // \88Ã\8d\86\89»
1113                 cryptObj.Encrypt(inputStream, GIKO_ENCRYPT_TEXT, outputStream);
1114
1115                 // \83o\83C\83i\83\8a\82È\82Ì\82Å\95K\97v\82É\89\9e\82\82Ä\83e\83L\83X\83g\82É\95Ï\8a·
1116                 Result := HogeBase64Encode(outputStream.DataString);
1117         finally
1118                 cryptObj.Free;
1119                 outputStream.Free;
1120                 inputStream.Free;
1121         end;
1122 end;
1123
1124 function TSetting.Decrypt(s: string): string;
1125 var
1126         cryptObj: THogeCryptAuto;
1127         inputStream, outputStream: TStringStream;
1128 begin
1129         try
1130                 inputStream := TStringStream.Create(HogeBase64Decode(s));
1131         except
1132                 Result := '';
1133                 Exit;
1134         end;
1135         outputStream := TStringStream.Create('');
1136         cryptObj := THogeCryptAuto.Create;
1137         try
1138                 // \95\9c\8d\86
1139                 cryptObj.Decrypt(inputStream, GIKO_ENCRYPT_TEXT, outputStream);
1140                 Result := outputStream.DataString;
1141         finally
1142                 cryptObj.Free;
1143                 outputStream.Free;
1144                 inputStream.Free;
1145         end;
1146 end;
1147
1148 function TSetting.GetMainCoolSet(Index: Integer): TCoolSet;
1149 begin
1150         if Index in [0..MAIN_COOLBAND_COUNT - 1] then
1151                 Result := FMainCoolBar[Index]
1152         else begin
1153                 Result.FCoolID := -1;
1154                 Result.FCoolWidth := -1;
1155                 Result.FCoolBreak := False;
1156         end;
1157 end;
1158
1159 function TSetting.GetBoardCoolSet(Index: Integer): TCoolSet;
1160 begin
1161         if Index in [0..LIST_COOLBAND_COUNT - 1] then
1162                 Result := FListCoolBar[Index]
1163         else begin
1164                 Result.FCoolID := -1;
1165                 Result.FCoolWidth := -1;
1166                 Result.FCoolBreak := False;
1167         end;
1168 end;
1169
1170 function TSetting.GetBrowserCoolSet(Index: Integer): TCoolSet;
1171 begin
1172         if Index in [0..BROWSER_COOLBAND_COUNT - 1] then
1173                 Result := FBrowserCoolBar[Index]
1174         else begin
1175                 Result.FCoolID := -1;
1176                 Result.FCoolWidth := -1;
1177                 Result.FCoolBreak := False;
1178         end;
1179 end;
1180
1181 procedure TSetting.SetMainCoolSet(Index: Integer; CoolSet: TCoolSet);
1182 begin
1183         if Index in [0..MAIN_COOLBAND_COUNT - 1] then
1184                 FMainCoolBar[Index] := CoolSet;
1185 end;
1186
1187 procedure TSetting.SetBoardCoolSet(Index: Integer; CoolSet: TCoolSet);
1188 begin
1189         if Index in [0..LIST_COOLBAND_COUNT - 1] then
1190                 FListCoolBar[Index] := CoolSet;
1191 end;
1192
1193 procedure TSetting.SetBrowserCoolSet(Index: Integer; CoolSet: TCoolSet);
1194 begin
1195         if Index in [0..BROWSER_COOLBAND_COUNT - 1] then
1196                 FBrowserCoolBar[Index] := CoolSet;
1197 end;
1198
1199
1200 end.
1201