OSDN Git Service

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