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`
9 uses Windows, IniFiles, BRegExp, Graphics, SysUtils, Forms, Dialogs, Classes,
10 ComCtrls, Contnrs, SsPlayTime;
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);
20 //SSTP Bottle
\82Ì
\90Ý
\92è
21 TBottlePrefs = class(TObject)
25 FIgnoreTimeCritical: boolean;
27 FShowConstBar: boolean;
29 FDblClkInsert: boolean;
30 FShowToolBar: boolean;
31 FDefaultScript: TStringList;
33 FMetaWordColor: TColor;
35 FMarkErrorColor: TColor;
40 FWhenCtrlReturn: TReturnKeyFunction;
41 FWhenShiftReturn: TReturnKeyFunction;
42 FWhenReturn: TReturnKeyFunction;
43 FNoTranslate: boolean;
48 FSilentWhenHidden: boolean;
50 FSenderWindowPosition: TRect;
51 FTabPosition: TTabPosition;
52 FLogWindowPosition: TRect;
54 FIgnoreFrequentYenS: boolean;
55 FWaitScriptEnd: integer;
56 FCgiNameGhost: String;
59 FLogWindowDividerPos: integer;
61 FUseHttpProxy: boolean;
63 FProxyAddress: String;
64 FConfirmOnExit: boolean;
65 FFixMessySurface: boolean;
66 FResetIfGhostAfterSend: boolean;
67 FGhostDropDownCount: integer;
68 FLogWindowPreviewStyle: TLogWindowPreviewStyle;
71 FLogWindowColumnWidth: String;
72 FClearAfterSend: boolean;
73 FAutoJoinChannels: TStrings;
75 FHUTagTo01Tag: boolean;
76 FWarnYenTNotExist: boolean;
77 FWarnScopeChangeInSynchronize: boolean;
78 FNeedConfirmBeforeSend: boolean;
81 FVisibleGhostsList: TStringList;
82 FSurfacePreviewOnHint: boolean;
83 FSurfacePreviewOnScriptPoint: boolean;
84 FSurfacePreviewOnScriptPointPosition: TSurfacePreviewOnScriptPointPosition;
85 FNoExtraSSTPHeaders: boolean;
86 FLogListPreviewStyle: TLogListPreviewStyle;
87 FEditorPreviewWindowPosition: TRect;
89 FConfirmOnTabClose: boolean;
90 FReconnectWait: integer;
91 FPartialConfirmFormat: String;
92 FAutoPartialConfirm: boolean;
93 FPlayTimeParams: TSsPlayTimeParams;
94 FBottleServerPort: integer;
95 FBottleServer: String;
97 FBrowserExeName: string;
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);
166 function InScreen(ARect: TRect): boolean;
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;
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;
221 //
\83`
\83\83\83\93\83l
\83\8b\8aÖ
\8cW
222 property AutoJoinChannels: TStrings read FAutoJoinChannels write SetAutoJoinChannels;
224 property LUID: String read FLUID write SetLUID;
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;
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;
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;
263 //
\83R
\83\93\83X
\83g
\83\89\83N
\83^
\81E
\83f
\83X
\83g
\83\89\83N
\83^
\81E
\95Û
\91¶
265 destructor Destroy; override;
266 procedure SaveSettings;
269 TChannelListItem = class(TObject)
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);
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;
292 TChannelList = class(TList)
294 function GetChannel(Name: String): TChannelListItem;
295 function GetChannelItem(Index: integer): TChannelListItem;
297 procedure Clear; override;
298 property Channel[Name: String]: TChannelListItem read GetChannel;
299 property ChannelItem[Index: integer]: TChannelListItem read GetChannelItem;
302 TScriptTransOption = (
303 toIgnoreTimeCritical,
306 toIgnoreFrequentYenS,
314 TScriptTransOptions = set of TScriptTransOption;
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
322 DefaultBottleServer = 'bottle.mikage.to';
323 DefaultBottleServerPort = 9871;
324 DefaultCGI = '/bottle2.cgi';
325 DefaultCGIGhost = '/glog/bottleglog.cgi';
326 DefaultCGIFetchLog = '/fetchlog.cgi';
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';
337 VersionString = 'SSTP Bottle Client ver ' + Version + 'a NO MUTEX VERSION';
339 VersionString = 'SSTP Bottle Client ver ' + Version;
342 SentLogFile = 'sent.log';
344 BottleDisclaimer = '(C)2001-2004 WinBottle Project'#13#10 +
345 'naru, C.Ponapalt, Yune Kotomi, yese, Mikage Sawatari'#13#10 +
348 ChannelDefault = '(CH
\90\84\8f§)';
349 ClipChannel = '(
\83N
\83\8a\83b
\83v)';
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;
359 function ParamsEncode(const ASrc: string): string;
363 UnsafeChars = ['*', '#', '%', '<', '>', ' ', '[', ']', '+'];
365 Result := ''; {Do not Localize}
366 for i := 1 to Length(ASrc) do
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}
374 Result := Result + ASrc[i];
379 // XML
\8eÀ
\91Ì
\8eQ
\8fÆ
\82É
\92u
\82«
\8a·
\82¦
\82é
380 function XMLEntity(From: String): String;
387 for i := 1 to Length(From) do
392 Result := Result + From[i];
393 end else if From[i] in LeadBytes then
396 Result := Result + From[i];
400 60: Result := Result + '<'; // Less than
401 62: Result := Result + '>'; // Greater than
402 38: Result := Result + '&'; // Ampersand
403 39: Result := Result + '''; // Single quote
404 34: Result := Result + '"'; // Double quote
406 Result := Result + From[i];
412 // Escape characters which can not be used as a filename
413 function SafeFileName(From: String; ChangePathDelimiters: boolean = true): String;
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
423 Result := StringReplace(Result, '\', '
\81\8f', [rfReplaceAll]);
424 Result := StringReplace(Result, ':', '
\81F', [rfReplaceAll]);
425 Result := StringReplace(Result, '/', '
\81^', [rfReplaceAll]);
429 function ComponentToString(Component: TComponent): string;
431 BinStream:TMemoryStream;
432 StrStream: TStringStream;
435 BinStream := TMemoryStream.Create;
437 StrStream := TStringStream.Create(s);
439 BinStream.WriteComponent(Component);
440 BinStream.Seek(0, soFromBeginning);
441 ObjectBinaryToText(BinStream, StrStream);
442 StrStream.Seek(0, soFromBeginning);
443 Result:= StrStream.DataString;
452 function StringToComponent(Value: string): TComponent;
454 StrStream:TStringStream;
455 BinStream: TMemoryStream;
457 StrStream := TStringStream.Create(Value);
459 BinStream := TMemoryStream.Create;
461 ObjectTextToBinary(StrStream, BinStream);
462 BinStream.Seek(0, soFromBeginning);
463 Result := BinStream.ReadComponent(nil);
474 constructor TBottlePrefs.Create;
478 FAutoJoinChannels := TStringList.Create;
479 FDefaultScript := TStringList.Create;
480 FFMOName := TStringList.Create;
481 FVisibleGhostsList := TStringList.Create;
483 FIni := TIniFile.Create(ChangeFileExt(Application.ExeName, '.ini'));
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);
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);
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);
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'));
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;
540 if FIni.ReadString('System', 'PlayTimeParams', '') = '' then
542 FPlayTimeParams := TSsPlayTimeParams.Create(nil);
543 FPlayTimeParams.ProfileName := '
\83f
\83t
\83H
\83\8b\83g';
546 Strs := TStringList.Create;
548 Strs.CommaText := FIni.ReadString('System', 'PlayTimeParams', '');
549 FPlayTimeParams := StringToComponent(Strs.Text) as TSsPlayTimeParams;
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);
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);
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', '');
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;
598 LogWindowPosition := ARect;
599 Strs := TStringList.Create;
601 Strs.CommaText := FIni.ReadString('System', 'EditorPreviewWindowPosition', '500,100,800,500');
603 ARect.Left := StrToInt(Strs[0]);
604 ARect.Top := StrToInt(Strs[1]);
605 ARect.Right := StrToInt(Strs[2]);
606 ARect.Bottom := StrToInt(Strs[3]);
608 ARect := Rect(500, 100, 800, 500);
610 EditorPreviewWindowPosition := ARect;
615 UseHttpProxy := FIni.ReadBool('System', 'UseHttpProxy', false);
616 ProxyAddress := FIni.ReadString('System', 'ProxyAddress', '');
617 ProxyPort := FIni.ReadInteger('System', 'ProxyPort', 0);
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));
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));
636 //URL
\82ð
\8aJ
\82
\83u
\83\89\83E
\83U
637 FBrowserExeName:= FIni.ReadString('System', 'BrowserExeName', '');
640 ShowMessage('INI
\83t
\83@
\83C
\83\8b\93Ç
\82Ý
\8d\9e\82Ý
\83G
\83\89\81[');
641 Application.Terminate;
645 destructor TBottlePrefs.Destroy;
651 if FAutoJoinChannels <> nil then
652 FAutoJoinChannels.Free;
653 if FDefaultScript <> nil then
655 if FFMOName <> nil then
657 if FVisibleGhostsList <> nil then
658 FVisibleGhostsList.Free;
659 if FPlayTimeParams <> nil then
660 FPlayTimeParams.Free;
663 procedure TBottlePrefs.SetAutoStart(const Value: boolean);
668 procedure TBottlePrefs.SetBgColor(const Value: TColor);
673 procedure TBottlePrefs.SetConfirmOnExit(const Value: boolean);
675 FConfirmOnExit := Value;
678 procedure TBottlePrefs.SetDblClkInsert(const Value: boolean);
680 FDblClkInsert := Value;
683 procedure TBottlePrefs.SetDefaultScript(const Value: String);
685 FDefaultScript.Text := Value;
688 procedure TBottlePrefs.SetFixMessySurface(const Value: boolean);
690 FFixMessySurface := Value;
693 procedure TBottlePrefs.SetGhostDropDownCount(const Value: integer);
695 FGhostDropDownCount := Value;
698 procedure TBottlePrefs.SetIgnoreFrequentYenS(const Value: boolean);
700 FIgnoreFrequentYenS := Value;
703 procedure TBottlePrefs.SetIgnoreTimeCritical(const Value: boolean);
705 FIgnoreTimeCritical := Value;
708 procedure TBottlePrefs.SetLogWindowDividerPos(const Value: integer);
710 FLogWindowDividerPos := Value;
713 procedure TBottlePrefs.SetLogWindowPosition(const Value: TRect);
715 FLogWindowPosition := Value;
718 procedure TBottlePrefs.SetLUID(const Value: String);
723 procedure TBottlePrefs.SetMarkErrorColor(const Value: TColor);
725 FMarkErrorColor := Value;
728 procedure TBottlePrefs.SetTextColor(const Value: TColor);
733 procedure TBottlePrefs.SetMarkUpColor(const Value: TColor);
735 FMarkUpColor := Value;
738 procedure TBottlePrefs.SetMetaWordColor(const Value: TColor);
740 FMetaWordColor := Value;
743 procedure TBottlePrefs.SetNoConfirm(const Value: boolean);
748 procedure TBottlePrefs.SetNoDescript(const Value: boolean);
750 FNoDescript := Value;
753 procedure TBottlePrefs.SetNoTranslate(const Value: boolean);
755 FNoTranslate := Value;
758 procedure TBottlePrefs.SetNoTransUrl(const Value: boolean);
760 FNoTransUrl := Value;
763 procedure TBottlePrefs.SetLogWindowPreviewStyle(
764 const Value: TLogWindowPreviewStyle);
766 FLogWindowPreviewStyle := Value;
769 procedure TBottlePrefs.SetProxyAddress(const Value: String);
771 FProxyAddress := Value;
774 procedure TBottlePrefs.SetProxyPort(const Value: integer);
779 procedure TBottlePrefs.SetResetIfGhostAfterSend(const Value: boolean);
781 FResetIfGhostAfterSend := Value;
784 procedure TBottlePrefs.SetSenderWindowPosition(const Value: TRect);
786 FSenderWindowPosition := Value;
789 procedure TBottlePrefs.SetServerPort(const Value: integer);
791 if Value > 0 then FServerPort := Value;
794 procedure TBottlePrefs.SetShowConstBar(const Value: boolean);
796 FShowConstBar := Value;
799 procedure TBottlePrefs.SetShowToolBar(const Value: boolean);
801 FShowToolBar := Value;
804 procedure TBottlePrefs.SetSilentWhenHidden(const Value: boolean);
806 FSilentWhenHidden := Value;
809 procedure TBottlePrefs.SetStayOnTop(const Value: boolean);
814 procedure TBottlePrefs.SetTabPosition(const Value: TTabPosition);
816 FTabPosition := Value;
819 procedure TBottlePrefs.SetTalkColorH(const Value: TColor);
821 FTalkColorH := Value;
824 procedure TBottlePrefs.SetTalkColorU(const Value: TColor);
826 FTalkColorU := Value;
829 procedure TBottlePrefs.SetUseHttpProxy(const Value: boolean);
831 FUseHttpProxy := Value;
834 procedure TBottlePrefs.SetWaitScriptEnd(const Value: integer);
836 if Value > 0 then FWaitScriptEnd := Value;
839 procedure TBottlePrefs.SetWhenCtrlReturn(const Value: TReturnKeyFunction);
841 FWhenCtrlReturn := Value;
844 procedure TBottlePrefs.SetWhenReturn(const Value: TReturnKeyFunction);
846 FWhenReturn := Value;
849 procedure TBottlePrefs.SetWhenShiftReturn(const Value: TReturnKeyFunction);
851 FWhenShiftReturn := Value;
854 procedure TBottlePrefs.SetTalkColorS(const Value: TColor);
856 FTalkColorS := Value;
859 procedure TBottlePrefs.SetLogWindowColumnWidth(const Value: String);
861 FLogWindowColumnWidth := Value;
864 procedure TBottlePrefs.SetClearAfterSend(const Value: boolean);
866 FClearAfterSend := Value;
869 procedure TBottlePrefs.SetAutoJoinChannels(const Value: TStrings);
871 FAutoJoinChannels.Assign(Value);
874 procedure TBottlePrefs.SetFMOName(const Value: TStrings);
876 FFMOName.Assign(Value);
879 procedure TBottlePrefs.SaveSettings;
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);
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);
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));
918 Strs := TStringList.Create;
920 Strs.Text := ComponentToString(FPlayTimeParams);
921 FIni.WriteString('System', 'PlayTimeParams', Strs.CommaText);
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);
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]));
952 FIni.WriteBool('System', 'UseHttpProxy', UseHttpProxy);
953 FIni.WriteString('System', 'ProxyAddress', ProxyAddress);
954 FIni.WriteInteger('System', 'ProxyPort', ProxyPort);
956 FIni.WriteInteger('System', 'ReconnectWait', ReconnectWait);
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);
965 FIni.WriteBool('System', 'SurfacePreviewOnHint', SurfacePreviewOnHint);
966 FIni.WriteBool('System', 'SurfacePreviewOnScriptPoint', SurfacePreviewOnScriptPoint);
967 FIni.WriteInteger('System', 'SurfacePreviewOnScriptPointPosition', Ord(SurfacePreviewOnScriptPointPosition));
969 FIni.WriteString('System', 'BrowserExeName', FBrowserExeName);
972 function TBottlePrefs.GetDefaultScript: String;
974 Result := FDefaultScript.Text;
977 procedure TBottlePrefs.SetHUTagTo01Tag(const Value: boolean);
979 FHUTagTo01Tag := Value;
982 procedure TBottlePrefs.SetWarnScopeChangeInSynchronize(
983 const Value: boolean);
985 FWarnScopeChangeInSynchronize := Value;
988 procedure TBottlePrefs.SetWarnYenTNotExist(const Value: boolean);
990 FWarnYenTNotExist := Value;
993 procedure TBottlePrefs.SetNeedConfirmBeforeSend(const Value: boolean);
995 FNeedConfirmBeforeSend := Value;
998 procedure TBottlePrefs.SetShowRuler(const Value: boolean);
1000 FShowRuler := Value;
1003 procedure TBottlePrefs.SetHideGhosts(const Value: boolean);
1005 FHideGhosts := Value;
1008 procedure TBottlePrefs.SetVisibleGhostsList(const Value: TStringList);
1010 FVisibleGhostsList.Assign(Value);
1013 procedure TBottlePrefs.SetSurfacePreviewOnHint(const Value: boolean);
1015 FSurfacePreviewOnHint := Value;
1018 procedure TBottlePrefs.SetSurfacePreviewOnScriptPoint(
1019 const Value: boolean);
1021 FSurfacePreviewOnScriptPoint := Value;
1024 procedure TBottlePrefs.SetSurfacePreviewOnScriptPointPosition(
1025 const Value: TSurfacePreviewOnScriptPointPosition);
1027 FSurfacePreviewOnScriptPointPosition := Value;
1030 procedure TBottlePrefs.SetNoExtraSSTPHeaders(const Value: boolean);
1032 FNoExtraSSTPHeaders := Value;
1035 procedure TBottlePrefs.SetLogListPreviewStyle(
1036 const Value: TLogListPreviewStyle);
1038 FLogListPreviewStyle := Value;
1041 procedure TBottlePrefs.SetEditorPreviewWindowPosition(const Value: TRect);
1043 FEditorPreviewWindowPosition := Value;
1046 function TBottlePrefs.InScreen(ARect: TRect): boolean;
1051 for i := 0 to Screen.MonitorCount-1 do
1053 if IntersectRect(dum, ARect, Screen.Monitors[i].WorkareaRect) then
1061 procedure TBottlePrefs.SetAutoClip(const Value: boolean);
1066 procedure TBottlePrefs.SetConfirmOnTabClose(const Value: boolean);
1068 FConfirmOnTabClose := Value;
1071 procedure TBottlePrefs.SetReconnectWait(const Value: integer);
1073 FReconnectWait := Value;
1075 raise Exception.Create('Reconnect wait must be >=6');
1078 procedure TBottlePrefs.SetPartialConfirmFormat(const Value: String);
1080 FPartialConfirmFormat := Value;
1083 procedure TBottlePrefs.SetAutoPartialConfirm(const Value: boolean);
1085 FAutoPartialConfirm := Value;
1088 procedure TBottlePrefs.SetPlayTimeParams(const Value: TSsPlayTimeParams);
1090 FPlayTimeParams.Assign(Value);
1093 procedure TBottlePrefs.SetTabWidth(const Value: integer);
1098 procedure TBottlePrefs.SetBrowserExeName(const Value: string);
1100 FBrowserExeName := Value;
1103 { TChannelListItem }
1105 procedure TChannelListItem.SetGhost(const Value: String);
1110 procedure TChannelListItem.SetInfo(const Value: String);
1115 procedure TChannelListItem.SetMembers(const Value: integer);
1120 procedure TChannelListItem.SetName(const Value: String);
1125 procedure TChannelListItem.SetNoPost(const Value: boolean);
1130 procedure TChannelListItem.SetWarnPost(const Value: boolean);
1137 procedure TChannelList.Clear;
1140 for i := Self.Count-1 downto 0 do begin
1141 TChannelListItem(Self[i]).Free;
1146 function TChannelList.GetChannel(Name: String): TChannelListItem;
1150 for i := 0 to Count-1 do
1151 if TChannelListItem(Self[i]).Name = Name then begin
1152 Result := TChannelListItem(Self[i]);
1157 function TChannelList.GetChannelItem(Index: integer): TChannelListItem;
1159 Result := TChannelListItem(Self[Index]);
1164 Classes.RegisterClass(TSsPlayTimeParams);
1166 Pref := TBottlePrefs.Create;
1167 ChannelList := TChannelList.Create;
1168 JoinChannels := TStringList.Create;