OSDN Git Service

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