OSDN Git Service

Mutexによる二重起動チェックの位置を、プロジェクトソース側に移動
[winbottle/winbottle.git] / bottleclient / BottleDef.pas
1 unit BottleDef;
2
3 (*
4   \83A\83v\83\8a\83P\81[\83V\83\87\83\93\91S\91Ì\82Å\8eg\82¤\82³\82Ü\82´\82Ü\82È\83f\81[\83^\82ð\92è\8b`
5 *)
6
7 interface
8
9 uses Windows, IniFiles, BRegExp, Graphics, SysUtils, Forms, Dialogs, Classes,
10   ComCtrls, Contnrs, SsPlayTime;
11
12 type
13   TReturnKeyFunction = (kfYenN, kfReturn, kfYenNReturn, kfConstText);
14   TSoundArrived = (saFalse, saTrue, saParent);
15   TLogWindowPreviewStyle = (psConversation, psImageConversation,
16     psScript, psScriptWithLineBreak);
17   TLogListPreviewStyle = (psNoColor, psNormal, psTagStripped);
18   TSurfacePreviewOnScriptPointPosition = (spspMainWindowLeft, spspMainWindowRight);
19
20   //SSTP Bottle\82Ì\90Ý\92è
21   TBottlePrefs = class(TObject)
22   private
23     FIni: TIniFile;
24     //
25     FIgnoreTimeCritical: boolean;
26     FStayOnTop: boolean;
27     FShowConstBar: boolean;
28     FNoConfirm: boolean;
29     FDblClkInsert: boolean;
30     FShowToolBar: boolean;
31     FDefaultScript: TStringList;
32     FTalkColorH: TColor;
33     FMetaWordColor: TColor;
34     FTalkColorU: TColor;
35     FMarkErrorColor: TColor;
36     FMarkUpColor: TColor;
37     FAutoStart: boolean;
38     FCgiName: string;
39     FHomePage: string;
40     FWhenCtrlReturn: TReturnKeyFunction;
41     FWhenShiftReturn: TReturnKeyFunction;
42     FWhenReturn: TReturnKeyFunction;
43     FNoTranslate: boolean;
44     FNoDescript: boolean;
45     FBgColor: TColor;
46     FTextColor: TColor;
47     FServerPort: integer;
48     FSilentWhenHidden: boolean;
49     FLUID: String;
50     FSenderWindowPosition: TRect;
51     FTabPosition: TTabPosition;
52     FLogWindowPosition: TRect;
53     FNoTransUrl: boolean;
54     FIgnoreFrequentYenS: boolean;
55     FWaitScriptEnd: integer;
56     FCgiNameGhost: String;
57     FGLogPage: String;
58     FVotePage: String;
59     FLogWindowDividerPos: integer;
60     FHelpPage: String;
61     FUseHttpProxy: boolean;
62     FProxyPort: integer;
63     FProxyAddress: String;
64     FConfirmOnExit: boolean;
65     FFixMessySurface: boolean;
66     FResetIfGhostAfterSend: boolean;
67     FGhostDropDownCount: integer;
68     FLogWindowPreviewStyle: TLogWindowPreviewStyle;
69     FCgiFetchLog: String;
70     FTalkColorS: TColor;
71     FLogWindowColumnWidth: String;
72     FClearAfterSend: boolean;
73     FAutoJoinChannels: TStrings;
74     FFMOName: TStrings;
75     FHUTagTo01Tag: boolean;
76     FWarnYenTNotExist: boolean;
77     FWarnScopeChangeInSynchronize: boolean;
78     FNeedConfirmBeforeSend: boolean;
79     FShowRuler: boolean;
80     FHideGhosts: boolean;
81     FVisibleGhostsList: TStringList;
82     FSurfacePreviewOnHint: boolean;
83     FSurfacePreviewOnScriptPoint: boolean;
84     FSurfacePreviewOnScriptPointPosition: TSurfacePreviewOnScriptPointPosition;
85     FNoExtraSSTPHeaders: boolean;
86     FLogListPreviewStyle: TLogListPreviewStyle;
87     FEditorPreviewWindowPosition: TRect;
88     FAutoClip: boolean;
89     FConfirmOnTabClose: boolean;
90     FReconnectWait: integer;
91     FPartialConfirmFormat: String;
92     FAutoPartialConfirm: boolean;
93     FPlayTimeParams: TSsPlayTimeParams;
94     FBottleServerPort: integer;
95     FBottleServer: String;
96     FTabWidth: integer;
97     FBrowserExeName: string;
98
99     procedure SetDblClkInsert(const Value: boolean);
100     procedure SetDefaultScript(const Value: String);
101     procedure SetIgnoreTimeCritical(const Value: boolean);
102     procedure SetMarkErrorColor(const Value: TColor);
103     procedure SetMarkUpColor(const Value: TColor);
104     procedure SetMetaWordColor(const Value: TColor);
105     procedure SetTextColor(const Value: TColor);
106     procedure SetNoConfirm(const Value: boolean);
107     procedure SetShowConstBar(const Value: boolean);
108     procedure SetShowToolBar(const Value: boolean);
109     procedure SetStayOnTop(const Value: boolean);
110     procedure SetTalkColorH(const Value: TColor);
111     procedure SetTalkColorU(const Value: TColor);
112     procedure SetAutoStart(const Value: boolean);
113     procedure SetWhenCtrlReturn(const Value: TReturnKeyFunction);
114     procedure SetWhenReturn(const Value: TReturnKeyFunction);
115     procedure SetWhenShiftReturn(const Value: TReturnKeyFunction);
116     procedure SetNoTranslate(const Value: boolean);
117     procedure SetNoDescript(const Value: boolean);
118     procedure SetBgColor(const Value: TColor);
119     procedure SetServerPort(const Value: integer);
120     procedure SetSilentWhenHidden(const Value: boolean);
121     procedure SetLUID(const Value: String);
122     procedure SetSenderWindowPosition(const Value: TRect);
123     procedure SetTabPosition(const Value: TTabPosition);
124     procedure SetLogWindowPosition(const Value: TRect);
125     procedure SetIgnoreFrequentYenS(const Value: boolean);
126     procedure SetNoTransUrl(const Value: boolean);
127     procedure SetWaitScriptEnd(const Value: integer);
128     procedure SetLogWindowDividerPos(const Value: integer);
129     procedure SetProxyAddress(const Value: String);
130     procedure SetProxyPort(const Value: integer);
131     procedure SetUseHttpProxy(const Value: boolean);
132     procedure SetConfirmOnExit(const Value: boolean);
133     procedure SetFixMessySurface(const Value: boolean);
134     procedure SetResetIfGhostAfterSend(const Value: boolean);
135     procedure SetGhostDropDownCount(const Value: integer);
136     procedure SetLogWindowPreviewStyle(const Value: TLogWindowPreviewStyle);
137     procedure SetTalkColorS(const Value: TColor);
138     procedure SetLogWindowColumnWidth(const Value: String);
139     procedure SetClearAfterSend(const Value: boolean);
140     procedure SetAutoJoinChannels(const Value: TStrings);
141     procedure SetFMOName(const Value: TStrings);
142     function GetDefaultScript: String;
143     procedure SetHUTagTo01Tag(const Value: boolean);
144     procedure SetWarnScopeChangeInSynchronize(const Value: boolean);
145     procedure SetWarnYenTNotExist(const Value: boolean);
146     procedure SetNeedConfirmBeforeSend(const Value: boolean);
147     procedure SetShowRuler(const Value: boolean);
148     procedure SetHideGhosts(const Value: boolean);
149     procedure SetVisibleGhostsList(const Value: TStringList);
150     procedure SetSurfacePreviewOnHint(const Value: boolean);
151     procedure SetSurfacePreviewOnScriptPoint(const Value: boolean);
152     procedure SetSurfacePreviewOnScriptPointPosition(
153       const Value: TSurfacePreviewOnScriptPointPosition);
154     procedure SetNoExtraSSTPHeaders(const Value: boolean);
155     procedure SetLogListPreviewStyle(const Value: TLogListPreviewStyle);
156     procedure SetEditorPreviewWindowPosition(const Value: TRect);
157     procedure SetAutoClip(const Value: boolean);
158     procedure SetConfirmOnTabClose(const Value: boolean);
159     procedure SetReconnectWait(const Value: integer);
160     procedure SetPartialConfirmFormat(const Value: String);
161     procedure SetAutoPartialConfirm(const Value: boolean);
162     procedure SetPlayTimeParams(const Value: TSsPlayTimeParams);
163     procedure SetTabWidth(const Value: integer);
164     procedure SetBrowserExeName(const Value: string);
165   protected
166     function InScreen(ARect: TRect): boolean;
167   public
168     property BottleServer: String read FBottleServer;
169     property BottleServerPort: integer read FBottleServerPort;
170     property PartialConfirmFormat: String read FPartialConfirmFormat write SetPartialConfirmFormat;
171     property AutoPartialConfirm: boolean read FAutoPartialConfirm write SetAutoPartialConfirm;
172     property ConfirmOnExit: boolean read FConfirmOnExit write SetConfirmOnExit;
173     property ConfirmOnTabClose: boolean read FConfirmOnTabClose write SetConfirmOnTabClose;
174     property AutoClip: boolean read FAutoClip write SetAutoClip;
175     property AutoStart: boolean read FAutoStart write SetAutoStart;
176     property TabPosition: TTabPosition read FTabPosition write SetTabPosition;
177     property TabWidth: integer read FTabWidth write SetTabWidth;
178     property GhostDropDownCount: integer read FGhostDropDownCount write SetGhostDropDownCount;
179     property NoTranslate: boolean read FNoTranslate write SetNoTranslate;
180     property NoDescript: boolean read FNoDescript write SetNoDescript;
181     property NoTransUrl: boolean read FNoTransUrl write SetNoTransUrl;
182     property SilentWhenHidden: boolean read FSilentWhenHidden write SetSilentWhenHidden;
183     property FixMessySurface: boolean read FFixMessySurface write SetFixMessySurface;
184     property HUTagTo01Tag: boolean read FHUTagTo01Tag write SetHUTagTo01Tag;
185     property ResetIfGhostAfterSend: boolean read FResetIfGhostAfterSend write SetResetIfGhostAfterSend;
186     property ClearAfterSend: boolean read FClearAfterSend write SetClearAfterSend;
187     property NeedConfirmBeforeSend: boolean read FNeedConfirmBeforeSend write SetNeedConfirmBeforeSend;
188     property IgnoreFrequentYenS: boolean read FIgnoreFrequentYenS write SetIgnoreFrequentYenS;
189     property WarnYenTNotExist: boolean read FWarnYenTNotExist write SetWarnYenTNotExist;
190     property WarnScopeChangeInSynchronize: boolean read FWarnScopeChangeInSynchronize write SetWarnScopeChangeInSynchronize;
191     property WaitScriptEnd: integer read FWaitScriptEnd write SetWaitScriptEnd;
192     property StayOnTop: boolean read FStayOnTop write SetStayOnTop;
193     property IgnoreTimeCritical: boolean read FIgnoreTimeCritical write SetIgnoreTimeCritical;
194     property TalkColorH: TColor read FTalkColorH write SetTalkColorH;
195     property TalkColorU: TColor read FTalkColorU write SetTalkColorU;
196     property TalkColorS: TColor read FTalkColorS write SetTalkColorS;
197     property MarkUpColor: TColor read FMarkUpColor write SetMarkUpColor;
198     property MetaWordColor: TColor read FMetaWordColor write SetMetaWordColor;
199     property MarkErrorColor: TColor read FMarkErrorColor write SetMarkErrorColor;
200     property BgColor: TColor read FBgColor write SetBgColor;
201     property TextColor: TColor read FTextColor write SetTextColor;
202     property DefaultScript: String read GetDefaultScript write SetDefaultScript;
203     property ShowRuler: boolean read FShowRuler write SetShowRuler;
204     property DblClkInsert: boolean read FDblClkInsert write SetDblClkInsert;
205     property ShowToolBar: boolean read FShowToolBar write SetShowToolBar;
206     property ShowConstBar: boolean read FShowConstBar write SetShowConstBar;
207     property NoConfirm: boolean read FNoConfirm write SetNoConfirm;
208     property HomePage: string read FHomePage;
209     property WhenReturn: TReturnKeyFunction read FWhenReturn write SetWhenReturn;
210     property WhenShiftReturn: TReturnKeyFunction read FWhenShiftReturn write SetWhenShiftReturn;
211     property WhenCtrlReturn: TReturnKeyFunction read FWhenCtrlReturn write SetWhenCtrlReturn;
212     property ServerPort: integer read FServerPort write SetServerPort;
213     //URL\8aÖ\8cW
214     property CgiName: string read FCgiName;
215     property CgiNameGhost: String read FCgiNameGhost;
216     property CgiFetchLog: String read FCgiFetchLog;
217     property GLogPage: String read FGLogPage;
218     property VotePage: String read FVotePage;
219     property HelpPage: String read FHelpPage;
220
221     //\83`\83\83\83\93\83l\83\8b\8aÖ\8cW
222     property AutoJoinChannels: TStrings read FAutoJoinChannels write SetAutoJoinChannels;
223
224     property LUID: String read FLUID write SetLUID;
225
226     //\83E\83B\83\93\83h\83E\88Ê\92u
227     property SenderWindowPosition: TRect
228       read FSenderWindowPosition write SetSenderWindowPosition;
229     property LogWindowPosition: TRect read FLogWindowPosition write SetLogWindowPosition;
230     property LogWindowDividerPos: integer
231       read FLogWindowDividerPos write SetLogWindowDividerPos;
232     property LogWindowColumnWidth: String
233       read FLogWindowColumnWidth write SetLogWindowColumnWidth;
234     property EditorPreviewWindowPosition: TRect read FEditorPreviewWindowPosition write SetEditorPreviewWindowPosition;
235     //\83v\83\8d\83L\83V\8aÖ\8cW
236     property UseHttpProxy: boolean read FUseHttpProxy write SetUseHttpProxy;
237     property ProxyAddress: String read FProxyAddress write SetProxyAddress;
238     property ProxyPort: integer read FProxyPort write SetProxyPort;
239     //\8dÄ\90Ú\91±
240     property ReconnectWait: integer read FReconnectWait write SetReconnectWait;
241     //\83\8d\83O\83E\83B\83\93\83h\83E\8aÖ\8cW
242     property LogWindowPreviewStyle: TLogWindowPreviewStyle
243       read FLogWindowPreviewStyle write SetLogWindowPreviewStyle;
244     property LogListPreviewStyle: TLogListPreviewStyle
245       read FLogListPreviewStyle write SetLogListPreviewStyle;
246     //\8fÚ\8d×\90Ý\92è
247     property FMOName: TStrings read FFMOName write SetFMOName;
248     property HideGhosts: boolean read FHideGhosts write SetHideGhosts;
249     property VisibleGhostsList: TStringList read FVisibleGhostsList write SetVisibleGhostsList;
250     property NoExtraSSTPHeaders: boolean read FNoExtraSSTPHeaders write SetNoExtraSSTPHeaders;
251     //\83T\81[\83t\83B\83X\83v\83\8c\83r\83\85\81[
252     property SurfacePreviewOnHint: boolean
253       read FSurfacePreviewOnHint write SetSurfacePreviewOnHint;
254     property SurfacePreviewOnScriptPoint: boolean
255       read FSurfacePreviewOnScriptPoint write SetSurfacePreviewOnScriptPoint;
256     property SurfacePreviewOnScriptPointPosition: TSurfacePreviewOnScriptPointPosition
257       read FSurfacePreviewOnScriptPointPosition write SetSurfacePreviewOnScriptPointPosition;
258     //\8dÄ\90\8e\9e\8aÔ\97\\91ª
259     property PlayTimeParams: TSsPlayTimeParams read FPlayTimeParams write SetPlayTimeParams;
260     //URL\83I\81[\83v\83\93\8e\9e\82É\8eg\82¤\83u\83\89\83E\83U\82Ì\8eÀ\8ds\83t\83@\83C\83\8b\96¼
261     property BrowserExeName: string read FBrowserExeName write SetBrowserExeName;
262
263     //\83R\83\93\83X\83g\83\89\83N\83^\81E\83f\83X\83g\83\89\83N\83^\81E\95Û\91
264     constructor Create;
265     destructor Destroy; override;
266     procedure SaveSettings;
267   end;
268
269   TChannelListItem = class(TObject)
270   private
271     FMembers: integer;
272     FGhost: String;
273     FInfo: String;
274     FName: String;
275     FNoPost: boolean;
276     FWarnPost: boolean;
277     procedure SetGhost(const Value: String);
278     procedure SetInfo(const Value: String);
279     procedure SetMembers(const Value: integer);
280     procedure SetName(const Value: String);
281     procedure SetNoPost(const Value: boolean);
282     procedure SetWarnPost(const Value: boolean);
283   public
284     property Name: String read FName write SetName;
285     property Info: String read FInfo write SetInfo;
286     property Ghost: String read FGhost write SetGhost;
287     property Members: integer read FMembers write SetMembers;
288     property NoPost: boolean read FNoPost write SetNoPost;
289     property WarnPost: boolean read FWarnPost write SetWarnPost;
290   end;
291
292   TChannelList = class(TList)
293   private
294     function GetChannel(Name: String): TChannelListItem;
295     function GetChannelItem(Index: integer): TChannelListItem;
296   public
297     procedure Clear; override;
298     property Channel[Name: String]: TChannelListItem read GetChannel;
299     property ChannelItem[Index: integer]: TChannelListItem read GetChannelItem;
300   end;
301
302   TScriptTransOption = (
303     toIgnoreTimeCritical,
304     toConvertURL,
305     toNoChoice,
306     toIgnoreFrequentYenS,
307     toWaitScriptEnd,
308     toFixMessySurface,
309     toWarnMessySurface,
310     toHUTagTo01Tag,
311     toWarnCheck
312   );
313
314   TScriptTransOptions = set of TScriptTransOption;
315
316 var
317   Pref: TBottlePrefs;
318   ChannelList: TChannelList; //\83`\83\83\83\93\83l\83\8b\83\8a\83X\83g\82ð\95Û\8e\9d\82·\82é
319   JoinChannels: TStringList; // \8c»\8dÝ\8eQ\89Á\82µ\82Ä\82¢\82é\83`\83\83\83\93\83l\83\8b
320
321 const
322   DefaultBottleServer    = 'bottle.mikage.to';
323   DefaultBottleServerPort = 9871;
324   DefaultCGI      = '/bottle2.cgi';
325   DefaultCGIGhost = '/glog/bottleglog.cgi';
326   DefaultCGIFetchLog = '/fetchlog.cgi';
327
328
329   DefaultHomePage = 'http://bottle.mikage.to/';
330   DefaultGLogPage = 'http://bottle.mikage.to/glog/glogview.cgi';
331   DefaultVotePage = 'http://bottle.mikage.to/viewvotes.cgi';
332   DefaultHelpPage = 'http://bottle.mikage.to/clihelp/index.html';
333
334   Version = '2.69';
335
336   {$IFDEF NOMUTEX}
337   VersionString = 'SSTP Bottle Client ver ' + Version + 'a NO MUTEX VERSION';
338   {$ELSE}
339   VersionString = 'SSTP Bottle Client ver ' + Version;
340   {$ENDIF}
341
342   SentLogFile     = 'sent.log';
343
344   BottleDisclaimer = '(C)2001-2004 WinBottle Project'#13#10 +
345     'naru, C.Ponapalt, Yune Kotomi, yese, Mikage Sawatari'#13#10 +
346     DefaultHomePage;
347
348   ChannelDefault = '(CH\90\84\8f§)';
349   ClipChannel    = '(\83N\83\8a\83b\83v)'; 
350
351 function ParamsEncode(const ASrc: string): string;
352 function XMLEntity(From: String): String;
353 function SafeFileName(From: String; ChangePathDelimiters: boolean = true): String;
354 function ComponentToString(Component: TComponent): string;
355 function StringToComponent(Value: string): TComponent;
356
357 implementation
358
359 function ParamsEncode(const ASrc: string): string;
360 var
361   i: Integer;
362 const
363   UnsafeChars = ['*', '#', '%', '<', '>', ' ', '[', ']', '+'];
364 begin
365   Result := '';    {Do not Localize}
366   for i := 1 to Length(ASrc) do
367   begin
368     if (ASrc[i] in UnsafeChars) or (not (ord(ASrc[i])in [33..128])) then
369     begin {do not localize}
370       Result := Result + '%' + IntToHex(Ord(ASrc[i]), 2);  {do not localize}
371     end
372     else
373     begin
374       Result := Result + ASrc[i];
375     end;
376   end;
377 end;
378
379 // XML\8eÀ\91Ì\8eQ\8fÆ\82É\92u\82«\8a·\82¦\82é
380 function XMLEntity(From: String): String;
381 var
382   i: integer;
383   InLead: boolean;
384 begin
385   InLead := false;
386   Result := '';
387   for i := 1 to Length(From) do
388   begin
389     if InLead then
390     begin
391       InLead := false;
392       Result := Result + From[i];
393     end else if From[i] in LeadBytes then
394     begin
395       InLead := true;
396       Result := Result + From[i];
397     end else
398     begin
399       case Ord(From[i]) of
400         60: Result := Result + '&lt;'; // Less than
401         62: Result := Result + '&gt;'; // Greater than
402         38: Result := Result + '&amp;'; // Ampersand
403         39: Result := Result + '&#39;'; // Single quote
404         34: Result := Result + '&quot;'; // Double quote
405         else
406           Result := Result + From[i];
407       end;
408     end;
409   end;
410 end;
411
412 // Escape characters which can not be used as a filename
413 function SafeFileName(From: String; ChangePathDelimiters: boolean = true): String;
414 begin
415   Result := StringReplace(From, '*', '\81\96', [rfReplaceAll]);
416   Result := StringReplace(Result, '|', '\81b', [rfReplaceAll]);
417   Result := StringReplace(Result, '"', '''''', [rfReplaceAll]);
418   Result := StringReplace(Result, '<', '\81\83', [rfReplaceAll]);
419   Result := StringReplace(Result, '>', '\81\84', [rfReplaceAll]);
420   Result := StringReplace(Result, '?', '\81H', [rfReplaceAll]);
421   if ChangePathDelimiters then
422   begin
423     Result := StringReplace(Result, '\', '\81\8f', [rfReplaceAll]);
424     Result := StringReplace(Result, ':', '\81F', [rfReplaceAll]);
425     Result := StringReplace(Result, '/', '\81^', [rfReplaceAll]);
426   end;
427 end;
428
429 function ComponentToString(Component: TComponent): string;
430 var
431   BinStream:TMemoryStream;
432   StrStream: TStringStream;
433   s: string;
434 begin
435   BinStream := TMemoryStream.Create;
436   try
437     StrStream := TStringStream.Create(s);
438     try
439       BinStream.WriteComponent(Component);
440       BinStream.Seek(0, soFromBeginning);
441       ObjectBinaryToText(BinStream, StrStream);
442       StrStream.Seek(0, soFromBeginning);
443       Result:= StrStream.DataString;
444     finally
445       StrStream.Free;
446     end;
447   finally
448     BinStream.Free
449   end;
450 end;
451
452 function StringToComponent(Value: string): TComponent;
453 var
454   StrStream:TStringStream;
455   BinStream: TMemoryStream;
456 begin
457   StrStream := TStringStream.Create(Value);
458   try
459     BinStream := TMemoryStream.Create;
460     try
461       ObjectTextToBinary(StrStream, BinStream);
462       BinStream.Seek(0, soFromBeginning);
463       Result := BinStream.ReadComponent(nil);
464     finally
465       BinStream.Free;
466     end;
467   finally
468     StrStream.Free;
469   end;
470 end;
471
472 { TBottlePrefs }
473
474 constructor TBottlePrefs.Create;
475 var ARect: TRect;
476     Strs: TStringList;
477 begin
478   FAutoJoinChannels := TStringList.Create;
479   FDefaultScript := TStringList.Create;
480   FFMOName := TStringList.Create;
481   FVisibleGhostsList := TStringList.Create;
482   try
483     FIni := TIniFile.Create(ChangeFileExt(Application.ExeName, '.ini'));
484     //
485     PartialConfirmFormat := FIni.ReadString('System', 'PartialConfirmFormat', '\t|\e');
486     AutoPartialConfirm := FIni.ReadBool('System', 'AutoPartialConfirm', false);
487     ConfirmOnExit := FIni.ReadBool('System', 'ConfirmOnExit', false);
488     ConfirmOnExit := FIni.ReadBool('System', 'ConfirmOnExit', false);
489     ConfirmOnTabClose := FIni.ReadBool('System', 'ConfirmOnTabClose', false);
490     AutoClip := FIni.ReadBool('System', 'AutoClip', false);
491     AutoStart := FIni.ReadBool('System', 'AutoStart', false);
492     TabPosition := TTabPosition(FIni.ReadInteger('System', 'TabPosition', 0));
493     TabWidth := FIni.ReadInteger('System', 'TabWidth', 0);
494     GhostDropDownCount := FIni.ReadInteger('System', 'GhostDropDownCount', 30);
495
496     NoTranslate := FIni.ReadBool('System', 'NoTranslate', true);
497     NoDescript := FIni.ReadBool('System', 'NoDescript', false);
498     NoTransUrl := FIni.ReadBool('System', 'NoTransUrl', false);
499     SilentWhenHidden:= FIni.ReadBool('System', 'SilentWhenHidden', true);
500     FixMessySurface := FIni.ReadBool('System', 'FixMessySurface', false);
501     HUTagTo01Tag := FIni.ReadBool('System', 'HUTagTo01Tag', false);
502     ResetIfGhostAfterSend := FIni.ReadBool('System', 'ResetIfGhostAfterSend', false);
503     ClearAfterSend := FIni.ReadBool('System', 'ClearAfterSend', true);
504     NeedConfirmBeforeSend := FIni.ReadBool('System', 'NeedConfirmBeforeSend', true);
505     WarnYenTNotExist := FIni.ReadBool('System', 'WarnYenTNotExist', false);
506     WarnScopeChangeInSynchronize := FIni.ReadBool('System', 'WarnScopeChangeInSynchronize', false);
507
508     IgnoreFrequentYenS := FIni.ReadBool('System', 'IgnoreFrequentYenS', false);
509     WaitScriptEnd := FIni.ReadInteger('System', 'WaitScriptEnd', 0);
510     StayOnTop := FIni.ReadBool('System', 'StayOnTop', false);
511     ShowConstBar := FIni.ReadBool('System', 'ShowConstBar', true);
512     ShowToolBar := FIni.ReadBool('System', 'ShowToolBar', true);
513     NoConfirm := FIni.ReadBool('System', 'NoConfirm', false);
514     IgnoreTimeCritical := FIni.ReadBool('System', 'IgnoreTimeCritical', false);
515     FDefaultScript.CommaText := FIni.ReadString('System', 'DefaultScript', '\t\u\s[10]\h\s[0]|\e');
516     ShowRuler := FIni.ReadBool('System', 'ShowRuler', false);
517     //
518     try
519       TalkColorH := StringToColor(FIni.ReadString('System', 'TalkColorH', 'clBlack'));
520       TalkColorU := StringToColor(FIni.ReadString('System', 'TalkColorU', 'clMaroon'));
521       TalkColorS := StringToColor(FIni.ReadString('System', 'TalkColorS', 'clPurple'));
522       MarkUpColor := StringToColor(FIni.ReadString('System', 'MarkUpColor', 'clGreen'));
523       MetaWordColor := StringToColor(FIni.ReadString('System', 'MetaWordColor', 'clBlue'));
524       MarkErrorColor := StringToColor(FIni.ReadString('System', 'MarkErrorColor', 'clRed'));
525       TextColor := StringToColor(FIni.ReadString('System', 'TextColor', ColorToString(TalkColorH)));
526       BgColor := StringToColor(FIni.ReadString('System', 'BgColor', 'clWhite'));
527     except
528       on EConvertError do begin
529         ShowMessage('\83J\83\89\81[\82Ì\90Ý\92è\93Ç\82Ý\8d\9e\82Ý\83G\83\89\81[');
530         FTalkColorH := clBlack;
531         FTalkColorU := clMaroon;
532         FMarkUpColor := clGreen;
533         FMetaWordColor := clBlue;
534         FMarkErrorColor := clRed;
535         FTextColor := clBlack;
536       end;
537     end;
538
539     try
540       if FIni.ReadString('System', 'PlayTimeParams', '') = '' then
541       begin
542         FPlayTimeParams := TSsPlayTimeParams.Create(nil);
543         FPlayTimeParams.ProfileName := '\83f\83t\83H\83\8b\83g';
544       end else
545       begin
546         Strs := TStringList.Create;
547         try
548           Strs.CommaText := FIni.ReadString('System', 'PlayTimeParams', '');
549           FPlayTimeParams := StringToComponent(Strs.Text) as TSsPlayTimeParams;
550         finally
551           Strs.Free;
552         end;
553       end;
554     except
555       on E: Exception do
556       begin
557         ShowMessage('\8dÄ\90\8e\9e\8aÔ\97\\91ª\90Ý\92è\82Ì\93Ç\82Ý\8d\9e\82Ý\83G\83\89\81[' + E.Message);
558         if FPlayTimeParams = nil then
559           FPlayTimeParams := TSsPlayTimeParams.Create(nil);
560       end;
561     end;
562
563     WhenReturn      := TReturnKeyFunction(FIni.ReadInteger('System', 'WhenReturn', 0));
564     WhenShiftReturn := TReturnKeyFunction(FIni.ReadInteger('System', 'WhenShiftReturn', 0));
565     WhenCtrlReturn  := TReturnKeyFunction(FIni.ReadInteger('System', 'WhenCtrlReturn', 0));
566     //\83\\83P\83b\83g\82ð\83{\83g\83\8b\94z\91\97\82ÌSSTP\92Ê\90M\82É\8eg\97p\82·\82é\8fê\8d\87\82Ì\90Ý\92è
567     ServerPort      := FIni.ReadInteger('System', 'ServerPort', 11000);
568
569     FBottleServer := FIni.ReadString('System', 'BottleServer', DefaultBottleServer);
570     FBottleServerPort := FIni.ReadInteger('System', 'BottleServerPort', DefaultBottleServerPort);
571     FCgiName  := FIni.ReadString('System', 'CgiName', DefaultCGI);
572     FCgiFetchLog := FIni.ReadString('System', 'CgiFetchLog', DefaultCGIFetchLog);
573     FHomePage := FIni.ReadString('System', 'HomePage', DefaultHomePage);
574     FGLogPage := FIni.ReadString('System', 'GLogPage', DefaultGLogPage);
575     FVotePage := FIni.ReadString('System', 'VotePage', DefaultVotePage);
576     FHelpPage := FIni.ReadString('System', 'HelpPage', DefaultHelpPage);
577     FCgiNameGhost := FIni.ReadString('System', 'GHOST', DefaultCGIGhost);
578     FLUID     := FIni.ReadString('System', 'LUID', '');
579     FAutoJoinChannels.CommaText := FIni.ReadString('System', 'AutoJoinChannels', '');
580     //
581     ARect.Top    := FIni.ReadInteger('System', 'SenderWindowPositionTop', 100);
582     ARect.Left   := FIni.ReadInteger('System', 'SenderWindowPositionLeft', 100);
583     ARect.Bottom := FIni.ReadInteger('System', 'SenderWindowPositionBottom', 500);
584     ARect.Right  := FIni.ReadInteger('System', 'SenderWindowPositionRight', 500);
585     if not InScreen(ARect) then
586       ARect := Rect(100, 100, 500, 500);
587     SenderWindowPosition := ARect;
588     ARect.Top    := FIni.ReadInteger('System', 'LogWindowPositionTop', 200);
589     ARect.Left   := FIni.ReadInteger('System', 'LogWindowPositionLeft', 200);
590     ARect.Bottom := FIni.ReadInteger('System', 'LogWindowPositionBottom', 600);
591     ARect.Right  := FIni.ReadInteger('System', 'LogWindowPositionRight', 400);
592     LogWindowDividerPos := FIni.ReadInteger('System', 'LogWindowDividerPos', 150);
593     LogWindowColumnWidth := FIni.ReadString('System', 'LogWindowColumnWidth', '');
594     if not InScreen(ARect) then begin
595       ARect := Rect(200, 200, 600, 400);
596       LogWindowDividerPos := 150;
597     end;
598     LogWindowPosition := ARect;
599     Strs := TStringList.Create;
600     try
601       Strs.CommaText := FIni.ReadString('System', 'EditorPreviewWindowPosition', '500,100,800,500');
602       try
603         ARect.Left   := StrToInt(Strs[0]);
604         ARect.Top    := StrToInt(Strs[1]);
605         ARect.Right  := StrToInt(Strs[2]);
606         ARect.Bottom := StrToInt(Strs[3]);
607       except
608         ARect := Rect(500, 100, 800, 500);
609       end;
610       EditorPreviewWindowPosition := ARect;
611     finally
612       Strs.Free;
613     end;
614     //
615     UseHttpProxy := FIni.ReadBool('System', 'UseHttpProxy', false);
616     ProxyAddress := FIni.ReadString('System', 'ProxyAddress', '');
617     ProxyPort    := FIni.ReadInteger('System', 'ProxyPort', 0);
618     //
619     ReconnectWait := FIni.ReadInteger('System', 'ReconnectWait', 6);
620     //\83\8d\83O\83E\83B\83\93\83h\83E\8aÖ\8cW
621     LogWindowPreviewStyle := TLogWindowPreviewStyle(
622       FIni.ReadInteger('System', 'LogWindowPreviewStyle', 0));
623     LogListPreviewStyle := TLogListPreviewStyle(
624       FIni.ReadInteger('System', 'LogListPreviewStyle', 0));
625     //\8fÚ\8d×
626     FMOName.CommaText := FIni.ReadString('System', 'FMOName', 'Sakura');
627     HideGhosts := FIni.ReadBool('System', 'HideGhosts', false);
628     VisibleGhostsList.CommaText := FIni.ReadString('System', 'VisibleGhostsList', '');
629     NoExtraSSTPHeaders := FIni.ReadBool('System', 'NoExtraSSTPHeaders', false);
630     //\83T\81[\83t\83B\83X\83v\83\8c\83r\83\85\81[
631     SurfacePreviewOnHint := FIni.ReadBool('System', 'SurfacePreviewOnHint', false);
632     SurfacePreviewOnScriptPoint := FIni.ReadBool('System', 'SurfacePreviewOnScriptPoint', false);
633     SurfacePreviewOnScriptPointPosition :=
634       TSurfacePreviewOnScriptPointPosition(FIni.ReadInteger('System', 'SurfacePreviewOnScriptPointPosition', 0));
635
636     //URL\82ð\8aJ\82­\83u\83\89\83E\83U
637     FBrowserExeName:= FIni.ReadString('System', 'BrowserExeName', '');
638
639   except
640     ShowMessage('INI\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý\83G\83\89\81[');
641     Application.Terminate;
642   end;
643 end;
644
645 destructor TBottlePrefs.Destroy;
646 begin
647   inherited;
648   SaveSettings;
649   if FIni <> nil then
650     FIni.Free;
651   if FAutoJoinChannels <> nil then
652     FAutoJoinChannels.Free;
653   if FDefaultScript <> nil then
654     FDefaultScript.Free;
655   if FFMOName <> nil then
656     FFMOName.Free;
657   if FVisibleGhostsList <> nil then
658     FVisibleGhostsList.Free;
659   if FPlayTimeParams <> nil then
660     FPlayTimeParams.Free;
661 end;
662
663 procedure TBottlePrefs.SetAutoStart(const Value: boolean);
664 begin
665   FAutoStart := Value;
666 end;
667
668 procedure TBottlePrefs.SetBgColor(const Value: TColor);
669 begin
670   FBgColor := Value;
671 end;
672
673 procedure TBottlePrefs.SetConfirmOnExit(const Value: boolean);
674 begin
675   FConfirmOnExit := Value;
676 end;
677
678 procedure TBottlePrefs.SetDblClkInsert(const Value: boolean);
679 begin
680   FDblClkInsert := Value;
681 end;
682
683 procedure TBottlePrefs.SetDefaultScript(const Value: String);
684 begin
685   FDefaultScript.Text := Value;
686 end;
687
688 procedure TBottlePrefs.SetFixMessySurface(const Value: boolean);
689 begin
690   FFixMessySurface := Value;
691 end;
692
693 procedure TBottlePrefs.SetGhostDropDownCount(const Value: integer);
694 begin
695   FGhostDropDownCount := Value;
696 end;
697
698 procedure TBottlePrefs.SetIgnoreFrequentYenS(const Value: boolean);
699 begin
700   FIgnoreFrequentYenS := Value;
701 end;
702
703 procedure TBottlePrefs.SetIgnoreTimeCritical(const Value: boolean);
704 begin
705   FIgnoreTimeCritical := Value;
706 end;
707
708 procedure TBottlePrefs.SetLogWindowDividerPos(const Value: integer);
709 begin
710   FLogWindowDividerPos := Value;
711 end;
712
713 procedure TBottlePrefs.SetLogWindowPosition(const Value: TRect);
714 begin
715   FLogWindowPosition := Value;
716 end;
717
718 procedure TBottlePrefs.SetLUID(const Value: String);
719 begin
720   FLUID := Value;
721 end;
722
723 procedure TBottlePrefs.SetMarkErrorColor(const Value: TColor);
724 begin
725   FMarkErrorColor := Value;
726 end;
727
728 procedure TBottlePrefs.SetTextColor(const Value: TColor);
729 begin
730   FTextColor := Value;
731 end;
732
733 procedure TBottlePrefs.SetMarkUpColor(const Value: TColor);
734 begin
735   FMarkUpColor := Value;
736 end;
737
738 procedure TBottlePrefs.SetMetaWordColor(const Value: TColor);
739 begin
740   FMetaWordColor := Value;
741 end;
742
743 procedure TBottlePrefs.SetNoConfirm(const Value: boolean);
744 begin
745   FNoConfirm := Value;
746 end;
747
748 procedure TBottlePrefs.SetNoDescript(const Value: boolean);
749 begin
750   FNoDescript := Value;
751 end;
752
753 procedure TBottlePrefs.SetNoTranslate(const Value: boolean);
754 begin
755   FNoTranslate := Value;
756 end;
757
758 procedure TBottlePrefs.SetNoTransUrl(const Value: boolean);
759 begin
760   FNoTransUrl := Value;
761 end;
762
763 procedure TBottlePrefs.SetLogWindowPreviewStyle(
764   const Value: TLogWindowPreviewStyle);
765 begin
766   FLogWindowPreviewStyle := Value;
767 end;
768
769 procedure TBottlePrefs.SetProxyAddress(const Value: String);
770 begin
771   FProxyAddress := Value;
772 end;
773
774 procedure TBottlePrefs.SetProxyPort(const Value: integer);
775 begin
776   FProxyPort := Value;
777 end;
778
779 procedure TBottlePrefs.SetResetIfGhostAfterSend(const Value: boolean);
780 begin
781   FResetIfGhostAfterSend := Value;
782 end;
783
784 procedure TBottlePrefs.SetSenderWindowPosition(const Value: TRect);
785 begin
786   FSenderWindowPosition := Value;
787 end;
788
789 procedure TBottlePrefs.SetServerPort(const Value: integer);
790 begin
791   if Value > 0 then FServerPort := Value;
792 end;
793
794 procedure TBottlePrefs.SetShowConstBar(const Value: boolean);
795 begin
796   FShowConstBar := Value;
797 end;
798
799 procedure TBottlePrefs.SetShowToolBar(const Value: boolean);
800 begin
801   FShowToolBar := Value;
802 end;
803
804 procedure TBottlePrefs.SetSilentWhenHidden(const Value: boolean);
805 begin
806   FSilentWhenHidden := Value;
807 end;
808
809 procedure TBottlePrefs.SetStayOnTop(const Value: boolean);
810 begin
811   FStayOnTop := Value;
812 end;
813
814 procedure TBottlePrefs.SetTabPosition(const Value: TTabPosition);
815 begin
816   FTabPosition := Value;
817 end;
818
819 procedure TBottlePrefs.SetTalkColorH(const Value: TColor);
820 begin
821   FTalkColorH := Value;
822 end;
823
824 procedure TBottlePrefs.SetTalkColorU(const Value: TColor);
825 begin
826   FTalkColorU := Value;
827 end;
828
829 procedure TBottlePrefs.SetUseHttpProxy(const Value: boolean);
830 begin
831   FUseHttpProxy := Value;
832 end;
833
834 procedure TBottlePrefs.SetWaitScriptEnd(const Value: integer);
835 begin
836   if Value > 0 then FWaitScriptEnd := Value;
837 end;
838
839 procedure TBottlePrefs.SetWhenCtrlReturn(const Value: TReturnKeyFunction);
840 begin
841   FWhenCtrlReturn := Value;
842 end;
843
844 procedure TBottlePrefs.SetWhenReturn(const Value: TReturnKeyFunction);
845 begin
846   FWhenReturn := Value;
847 end;
848
849 procedure TBottlePrefs.SetWhenShiftReturn(const Value: TReturnKeyFunction);
850 begin
851   FWhenShiftReturn := Value;
852 end;
853
854 procedure TBottlePrefs.SetTalkColorS(const Value: TColor);
855 begin
856   FTalkColorS := Value;
857 end;
858
859 procedure TBottlePrefs.SetLogWindowColumnWidth(const Value: String);
860 begin
861   FLogWindowColumnWidth := Value;
862 end;
863
864 procedure TBottlePrefs.SetClearAfterSend(const Value: boolean);
865 begin
866   FClearAfterSend := Value;
867 end;
868
869 procedure TBottlePrefs.SetAutoJoinChannels(const Value: TStrings);
870 begin
871   FAutoJoinChannels.Assign(Value);
872 end;
873
874 procedure TBottlePrefs.SetFMOName(const Value: TStrings);
875 begin
876   FFMOName.Assign(Value);
877 end;
878
879 procedure TBottlePrefs.SaveSettings;
880 var
881   Strs: TStringList;
882 begin
883   FIni.WriteString('System', 'PartialConfirmFormat', PartialConfirmFormat);
884   FIni.WriteBool('System', 'AutoPartialConfirm', AutoPartialConfirm);
885   FIni.WriteBool('System', 'ConfirmOnExit', ConfirmOnExit);
886   FIni.WriteBool('System', 'ConfirmOnTabClose', ConfirmOnTabClose);
887   FIni.WriteBool('System', 'AutoClip', AutoClip);
888   FIni.WriteBool('System', 'AutoStart', AutoStart);
889   FIni.WriteInteger('System', 'TabPosition', Ord(TabPosition));
890   FIni.WriteInteger('System', 'TabWidth', TabWidth);
891   FIni.WriteInteger('System', 'GhostDropDownCount', GhostDropDownCount);
892
893   FIni.WriteBool('System', 'NoTranslate', NoTranslate);
894   FIni.WriteBool('System', 'NoDescript', NoDescript);
895   FIni.WriteBool('System', 'NoTransUrl', NoTransUrl);
896   FIni.WriteBool('System', 'SilentWhenHidden', SilentWhenHidden);
897   FIni.WriteBool('System', 'FixMessySurface', FixMessySurface);
898   FIni.WriteBool('System', 'HUTagTo01Tag', HUTagTo01Tag);
899   FIni.WriteBool('System', 'ResetIfGhostAfterSend', ResetIfGhostAfterSend);
900   FIni.WriteBool('System', 'ClearAfterSend', ClearAfterSend);
901   FIni.WriteBool('System', 'NeedConfirmBeforeSend', NeedConfirmBeforeSend);
902   FIni.WriteBool('System', 'WarnYenTNotExist', WarnYenTNotExist);
903   FIni.WriteBool('System', 'WarnScopeChangeInSynchronize', WarnScopeChangeInSynchronize);
904
905   FIni.WriteBool('System', 'IgnoreFrequentYenS', IgnoreFrequentYenS);
906   FIni.WriteInteger('System', 'WaitScriptEnd', WaitScriptEnd);
907   FIni.WriteBool('System', 'StayOnTop', StayOnTop);
908   FIni.WriteBool('System', 'NoConfirm', NoConfirm);
909   FIni.WriteBool('System', 'IgnoreTimeCritical', IgnoreTimeCritical);
910   FIni.WriteString('System', 'TalkColorH',     ColorToString(TalkColorH));
911   FIni.WriteString('System', 'TalkColorU',     ColorToString(TalkColorU));
912   FIni.WriteString('System', 'TalkColorS',     ColorToString(TalkColorS));
913   FIni.WriteString('System', 'MarkUpColor',    ColorToString(MarkUpColor));
914   FIni.WriteString('System', 'MetaWordColor',  ColorToString(MetaWordColor));
915   FIni.WriteString('System', 'MarkErrorColor', ColorToString(MarkErrorColor));
916   FIni.WriteString('System', 'TextColor', ColorToString(TextColor));
917
918   Strs := TStringList.Create;
919   try
920     Strs.Text := ComponentToString(FPlayTimeParams);
921     FIni.WriteString('System', 'PlayTimeParams', Strs.CommaText);
922   finally
923     Strs.Free;
924   end;
925
926   FIni.WriteString('System', 'BgColor', ColorToString(BgColor));
927   FIni.WriteBool('System', 'ShowToolBar', ShowToolBar);
928   FIni.WriteBool('System', 'ShowConstBar', ShowConstBar);
929   FIni.WriteString('System', 'DefaultScript', FDefaultScript.CommaText);
930   FIni.WriteBool('System', 'ShowRuler', ShowRuler);
931   FIni.WriteInteger('System', 'WhenReturn', Ord(WhenReturn));
932   FIni.WriteInteger('System', 'WhenShiftReturn', Ord(WhenShiftReturn));
933   FIni.WriteInteger('System', 'WhenCtrlReturn', Ord(WhenCtrlReturn));
934   FIni.WriteInteger('System', 'ServerPort', ServerPort);
935   FIni.WriteString('System', 'LUID', LUID);
936   FIni.WriteString('System', 'AutoJoinChannels', FAutoJoinChannels.CommaText);
937   //
938   FIni.WriteInteger('System', 'SenderWindowPositionLeft', SenderWindowPosition.Left);
939   FIni.WriteInteger('System', 'SenderWindowPositionTop', SenderWindowPosition.Top);
940   FIni.WriteInteger('System', 'SenderWindowPositionRight', SenderWindowPosition.Right);
941   FIni.WriteInteger('System', 'SenderWindowPositionBottom', SenderWindowPosition.Bottom);
942   FIni.WriteInteger('System', 'LogWindowPositionLeft', LogWindowPosition.Left);
943   FIni.WriteInteger('System', 'LogWindowPositionTop', LogWindowPosition.Top);
944   FIni.WriteInteger('System', 'LogWindowPositionRight', LogWindowPosition.Right);
945   FIni.WriteInteger('System', 'LogWindowPositionBottom', LogWindowPosition.Bottom);
946   FIni.WriteInteger('System', 'LogWindowDividerPos', LogWindowDividerPos);
947   FIni.WriteString('System', 'LogWindowColumnWidth', LogWindowColumnWidth);
948   with EditorPreviewWindowPosition do
949     FIni.WriteString('System', 'EditorPreviewWindowPosition',
950       Format('%d,%d,%d,%d', [Left, Top, Right, Bottom]));
951   //
952   FIni.WriteBool('System', 'UseHttpProxy', UseHttpProxy);
953   FIni.WriteString('System', 'ProxyAddress', ProxyAddress);
954   FIni.WriteInteger('System', 'ProxyPort', ProxyPort);
955   //
956   FIni.WriteInteger('System', 'ReconnectWait', ReconnectWait);
957   //
958   FIni.WriteInteger('System', 'LogWindowPreviewStyle', Ord(LogWindowPreviewStyle));
959   FIni.WriteInteger('System', 'LogListPreviewStyle', Ord(LogListPreviewStyle));
960   FIni.WriteString('System', 'FMOName', FFMOName.CommaText);
961   FIni.WriteBool('System', 'HideGhosts', HideGhosts);
962   FIni.WriteString('System', 'VisibleGhostsList', VisibleGhostsList.CommaText);
963   FIni.WriteBool('System', 'NoExtraSSTPHeaders', NoExtraSSTPHeaders);
964   //
965   FIni.WriteBool('System', 'SurfacePreviewOnHint', SurfacePreviewOnHint);
966   FIni.WriteBool('System', 'SurfacePreviewOnScriptPoint', SurfacePreviewOnScriptPoint);
967   FIni.WriteInteger('System', 'SurfacePreviewOnScriptPointPosition', Ord(SurfacePreviewOnScriptPointPosition));
968
969   FIni.WriteString('System', 'BrowserExeName', FBrowserExeName);
970 end;
971
972 function TBottlePrefs.GetDefaultScript: String;
973 begin
974   Result := FDefaultScript.Text;
975 end;
976
977 procedure TBottlePrefs.SetHUTagTo01Tag(const Value: boolean);
978 begin
979   FHUTagTo01Tag := Value;
980 end;
981
982 procedure TBottlePrefs.SetWarnScopeChangeInSynchronize(
983   const Value: boolean);
984 begin
985   FWarnScopeChangeInSynchronize := Value;
986 end;
987
988 procedure TBottlePrefs.SetWarnYenTNotExist(const Value: boolean);
989 begin
990   FWarnYenTNotExist := Value;
991 end;
992
993 procedure TBottlePrefs.SetNeedConfirmBeforeSend(const Value: boolean);
994 begin
995   FNeedConfirmBeforeSend := Value;
996 end;
997
998 procedure TBottlePrefs.SetShowRuler(const Value: boolean);
999 begin
1000   FShowRuler := Value;
1001 end;
1002
1003 procedure TBottlePrefs.SetHideGhosts(const Value: boolean);
1004 begin
1005   FHideGhosts := Value;
1006 end;
1007
1008 procedure TBottlePrefs.SetVisibleGhostsList(const Value: TStringList);
1009 begin
1010   FVisibleGhostsList.Assign(Value);
1011 end;
1012
1013 procedure TBottlePrefs.SetSurfacePreviewOnHint(const Value: boolean);
1014 begin
1015   FSurfacePreviewOnHint := Value;
1016 end;
1017
1018 procedure TBottlePrefs.SetSurfacePreviewOnScriptPoint(
1019   const Value: boolean);
1020 begin
1021   FSurfacePreviewOnScriptPoint := Value;
1022 end;
1023
1024 procedure TBottlePrefs.SetSurfacePreviewOnScriptPointPosition(
1025   const Value: TSurfacePreviewOnScriptPointPosition);
1026 begin
1027   FSurfacePreviewOnScriptPointPosition := Value;
1028 end;
1029
1030 procedure TBottlePrefs.SetNoExtraSSTPHeaders(const Value: boolean);
1031 begin
1032   FNoExtraSSTPHeaders := Value;
1033 end;
1034
1035 procedure TBottlePrefs.SetLogListPreviewStyle(
1036   const Value: TLogListPreviewStyle);
1037 begin
1038   FLogListPreviewStyle := Value;
1039 end;
1040
1041 procedure TBottlePrefs.SetEditorPreviewWindowPosition(const Value: TRect);
1042 begin
1043   FEditorPreviewWindowPosition := Value;
1044 end;
1045
1046 function TBottlePrefs.InScreen(ARect: TRect): boolean;
1047 var i: integer;
1048     dum: TRect;
1049 begin
1050   Result := false;
1051   for i := 0 to Screen.MonitorCount-1 do
1052   begin
1053     if IntersectRect(dum, ARect, Screen.Monitors[i].WorkareaRect) then
1054     begin
1055       Result := true;
1056       Exit;
1057     end;
1058   end;
1059 end;
1060
1061 procedure TBottlePrefs.SetAutoClip(const Value: boolean);
1062 begin
1063   FAutoClip := Value;
1064 end;
1065
1066 procedure TBottlePrefs.SetConfirmOnTabClose(const Value: boolean);
1067 begin
1068   FConfirmOnTabClose := Value;
1069 end;
1070
1071 procedure TBottlePrefs.SetReconnectWait(const Value: integer);
1072 begin
1073   FReconnectWait := Value;
1074   if Value < 6 then
1075     raise Exception.Create('Reconnect wait must be >=6');
1076 end;
1077
1078 procedure TBottlePrefs.SetPartialConfirmFormat(const Value: String);
1079 begin
1080   FPartialConfirmFormat := Value;
1081 end;
1082
1083 procedure TBottlePrefs.SetAutoPartialConfirm(const Value: boolean);
1084 begin
1085   FAutoPartialConfirm := Value;
1086 end;
1087
1088 procedure TBottlePrefs.SetPlayTimeParams(const Value: TSsPlayTimeParams);
1089 begin
1090   FPlayTimeParams.Assign(Value);
1091 end;
1092
1093 procedure TBottlePrefs.SetTabWidth(const Value: integer);
1094 begin
1095   FTabWidth := Value;
1096 end;
1097
1098 procedure TBottlePrefs.SetBrowserExeName(const Value: string);
1099 begin
1100   FBrowserExeName := Value;
1101 end;
1102
1103 { TChannelListItem }
1104
1105 procedure TChannelListItem.SetGhost(const Value: String);
1106 begin
1107   FGhost := Value;
1108 end;
1109
1110 procedure TChannelListItem.SetInfo(const Value: String);
1111 begin
1112   FInfo := Value;
1113 end;
1114
1115 procedure TChannelListItem.SetMembers(const Value: integer);
1116 begin
1117   FMembers := Value;
1118 end;
1119
1120 procedure TChannelListItem.SetName(const Value: String);
1121 begin
1122   FName := Value;
1123 end;
1124
1125 procedure TChannelListItem.SetNoPost(const Value: boolean);
1126 begin
1127   FNoPost := Value;
1128 end;
1129
1130 procedure TChannelListItem.SetWarnPost(const Value: boolean);
1131 begin
1132   FWarnPost := Value;
1133 end;
1134
1135 { TChannelList }
1136
1137 procedure TChannelList.Clear;
1138 var i: integer;
1139 begin
1140   for i := Self.Count-1 downto 0 do begin
1141     TChannelListItem(Self[i]).Free;
1142   end;
1143   inherited;
1144 end;
1145
1146 function TChannelList.GetChannel(Name: String): TChannelListItem;
1147 var i: integer;
1148 begin
1149   Result := nil;
1150   for i := 0 to Count-1 do
1151     if TChannelListItem(Self[i]).Name = Name then begin
1152       Result := TChannelListItem(Self[i]);
1153       Exit;
1154     end;
1155 end;
1156
1157 function TChannelList.GetChannelItem(Index: integer): TChannelListItem;
1158 begin
1159   Result := TChannelListItem(Self[Index]);
1160 end;
1161
1162 initialization
1163
1164 Classes.RegisterClass(TSsPlayTimeParams);
1165
1166 Pref := TBottlePrefs.Create;
1167 ChannelList := TChannelList.Create;
1168 JoinChannels := TStringList.Create;
1169
1170 finalization
1171
1172 Pref.Free;
1173 ChannelList.Clear;
1174 JoinChannels.Free;
1175 ChannelList.Free;
1176
1177 end.