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 procedure SetDblClkInsert(const Value: boolean);
98 procedure SetDefaultScript(const Value: String);
99 procedure SetIgnoreTimeCritical(const Value: boolean);
100 procedure SetMarkErrorColor(const Value: TColor);
101 procedure SetMarkUpColor(const Value: TColor);
102 procedure SetMetaWordColor(const Value: TColor);
103 procedure SetTextColor(const Value: TColor);
104 procedure SetNoConfirm(const Value: boolean);
105 procedure SetShowConstBar(const Value: boolean);
106 procedure SetShowToolBar(const Value: boolean);
107 procedure SetStayOnTop(const Value: boolean);
108 procedure SetTalkColorH(const Value: TColor);
109 procedure SetTalkColorU(const Value: TColor);
110 procedure SetAutoStart(const Value: boolean);
111 procedure SetWhenCtrlReturn(const Value: TReturnKeyFunction);
112 procedure SetWhenReturn(const Value: TReturnKeyFunction);
113 procedure SetWhenShiftReturn(const Value: TReturnKeyFunction);
114 procedure SetNoTranslate(const Value: boolean);
115 procedure SetNoDescript(const Value: boolean);
116 procedure SetBgColor(const Value: TColor);
117 procedure SetServerPort(const Value: integer);
118 procedure SetSilentWhenHidden(const Value: boolean);
119 procedure SetLUID(const Value: String);
120 procedure SetSenderWindowPosition(const Value: TRect);
121 procedure SetTabPosition(const Value: TTabPosition);
122 procedure SetLogWindowPosition(const Value: TRect);
123 procedure SetIgnoreFrequentYenS(const Value: boolean);
124 procedure SetNoTransUrl(const Value: boolean);
125 procedure SetWaitScriptEnd(const Value: integer);
126 procedure SetLogWindowDividerPos(const Value: integer);
127 procedure SetProxyAddress(const Value: String);
128 procedure SetProxyPort(const Value: integer);
129 procedure SetUseHttpProxy(const Value: boolean);
130 procedure SetConfirmOnExit(const Value: boolean);
131 procedure SetFixMessySurface(const Value: boolean);
132 procedure SetResetIfGhostAfterSend(const Value: boolean);
133 procedure SetGhostDropDownCount(const Value: integer);
134 procedure SetLogWindowPreviewStyle(const Value: TLogWindowPreviewStyle);
135 procedure SetTalkColorS(const Value: TColor);
136 procedure SetLogWindowColumnWidth(const Value: String);
137 procedure SetClearAfterSend(const Value: boolean);
138 procedure SetAutoJoinChannels(const Value: TStrings);
139 procedure SetFMOName(const Value: TStrings);
140 function GetDefaultScript: String;
141 procedure SetHUTagTo01Tag(const Value: boolean);
142 procedure SetWarnScopeChangeInSynchronize(const Value: boolean);
143 procedure SetWarnYenTNotExist(const Value: boolean);
144 procedure SetNeedConfirmBeforeSend(const Value: boolean);
145 procedure SetShowRuler(const Value: boolean);
146 procedure SetHideGhosts(const Value: boolean);
147 procedure SetVisibleGhostsList(const Value: TStringList);
148 procedure SetSurfacePreviewOnHint(const Value: boolean);
149 procedure SetSurfacePreviewOnScriptPoint(const Value: boolean);
150 procedure SetSurfacePreviewOnScriptPointPosition(
151 const Value: TSurfacePreviewOnScriptPointPosition);
152 procedure SetNoExtraSSTPHeaders(const Value: boolean);
153 procedure SetLogListPreviewStyle(const Value: TLogListPreviewStyle);
154 procedure SetEditorPreviewWindowPosition(const Value: TRect);
155 procedure SetAutoClip(const Value: boolean);
156 procedure SetConfirmOnTabClose(const Value: boolean);
157 procedure SetReconnectWait(const Value: integer);
158 procedure SetPartialConfirmFormat(const Value: String);
159 procedure SetAutoPartialConfirm(const Value: boolean);
160 procedure SetPlayTimeParams(const Value: TSsPlayTimeParams);
161 procedure SetTabWidth(const Value: integer);
163 function InScreen(ARect: TRect): boolean;
165 property BottleServer: String read FBottleServer;
166 property BottleServerPort: integer read FBottleServerPort;
167 property PartialConfirmFormat: String read FPartialConfirmFormat write SetPartialConfirmFormat;
168 property AutoPartialConfirm: boolean read FAutoPartialConfirm write SetAutoPartialConfirm;
169 property ConfirmOnExit: boolean read FConfirmOnExit write SetConfirmOnExit;
170 property ConfirmOnTabClose: boolean read FConfirmOnTabClose write SetConfirmOnTabClose;
171 property AutoClip: boolean read FAutoClip write SetAutoClip;
172 property AutoStart: boolean read FAutoStart write SetAutoStart;
173 property TabPosition: TTabPosition read FTabPosition write SetTabPosition;
174 property TabWidth: integer read FTabWidth write SetTabWidth;
175 property GhostDropDownCount: integer read FGhostDropDownCount write SetGhostDropDownCount;
176 property NoTranslate: boolean read FNoTranslate write SetNoTranslate;
177 property NoDescript: boolean read FNoDescript write SetNoDescript;
178 property NoTransUrl: boolean read FNoTransUrl write SetNoTransUrl;
179 property SilentWhenHidden: boolean read FSilentWhenHidden write SetSilentWhenHidden;
180 property FixMessySurface: boolean read FFixMessySurface write SetFixMessySurface;
181 property HUTagTo01Tag: boolean read FHUTagTo01Tag write SetHUTagTo01Tag;
182 property ResetIfGhostAfterSend: boolean read FResetIfGhostAfterSend write SetResetIfGhostAfterSend;
183 property ClearAfterSend: boolean read FClearAfterSend write SetClearAfterSend;
184 property NeedConfirmBeforeSend: boolean read FNeedConfirmBeforeSend write SetNeedConfirmBeforeSend;
185 property IgnoreFrequentYenS: boolean read FIgnoreFrequentYenS write SetIgnoreFrequentYenS;
186 property WarnYenTNotExist: boolean read FWarnYenTNotExist write SetWarnYenTNotExist;
187 property WarnScopeChangeInSynchronize: boolean read FWarnScopeChangeInSynchronize write SetWarnScopeChangeInSynchronize;
188 property WaitScriptEnd: integer read FWaitScriptEnd write SetWaitScriptEnd;
189 property StayOnTop: boolean read FStayOnTop write SetStayOnTop;
190 property IgnoreTimeCritical: boolean read FIgnoreTimeCritical write SetIgnoreTimeCritical;
191 property TalkColorH: TColor read FTalkColorH write SetTalkColorH;
192 property TalkColorU: TColor read FTalkColorU write SetTalkColorU;
193 property TalkColorS: TColor read FTalkColorS write SetTalkColorS;
194 property MarkUpColor: TColor read FMarkUpColor write SetMarkUpColor;
195 property MetaWordColor: TColor read FMetaWordColor write SetMetaWordColor;
196 property MarkErrorColor: TColor read FMarkErrorColor write SetMarkErrorColor;
197 property BgColor: TColor read FBgColor write SetBgColor;
198 property TextColor: TColor read FTextColor write SetTextColor;
199 property DefaultScript: String read GetDefaultScript write SetDefaultScript;
200 property ShowRuler: boolean read FShowRuler write SetShowRuler;
201 property DblClkInsert: boolean read FDblClkInsert write SetDblClkInsert;
202 property ShowToolBar: boolean read FShowToolBar write SetShowToolBar;
203 property ShowConstBar: boolean read FShowConstBar write SetShowConstBar;
204 property NoConfirm: boolean read FNoConfirm write SetNoConfirm;
205 property HomePage: string read FHomePage;
206 property WhenReturn: TReturnKeyFunction read FWhenReturn write SetWhenReturn;
207 property WhenShiftReturn: TReturnKeyFunction read FWhenShiftReturn write SetWhenShiftReturn;
208 property WhenCtrlReturn: TReturnKeyFunction read FWhenCtrlReturn write SetWhenCtrlReturn;
209 property ServerPort: integer read FServerPort write SetServerPort;
211 property CgiName: string read FCgiName;
212 property CgiNameGhost: String read FCgiNameGhost;
213 property CgiFetchLog: String read FCgiFetchLog;
214 property GLogPage: String read FGLogPage;
215 property VotePage: String read FVotePage;
216 property HelpPage: String read FHelpPage;
218 //
\83`
\83\83\83\93\83l
\83\8b\8aÖ
\8cW
219 property AutoJoinChannels: TStrings read FAutoJoinChannels write SetAutoJoinChannels;
221 property LUID: String read FLUID write SetLUID;
223 //
\83E
\83B
\83\93\83h
\83E
\88Ê
\92u
224 property SenderWindowPosition: TRect
225 read FSenderWindowPosition write SetSenderWindowPosition;
226 property LogWindowPosition: TRect read FLogWindowPosition write SetLogWindowPosition;
227 property LogWindowDividerPos: integer
228 read FLogWindowDividerPos write SetLogWindowDividerPos;
229 property LogWindowColumnWidth: String
230 read FLogWindowColumnWidth write SetLogWindowColumnWidth;
231 property EditorPreviewWindowPosition: TRect read FEditorPreviewWindowPosition write SetEditorPreviewWindowPosition;
232 //
\83v
\83\8d\83L
\83V
\8aÖ
\8cW
233 property UseHttpProxy: boolean read FUseHttpProxy write SetUseHttpProxy;
234 property ProxyAddress: String read FProxyAddress write SetProxyAddress;
235 property ProxyPort: integer read FProxyPort write SetProxyPort;
237 property ReconnectWait: integer read FReconnectWait write SetReconnectWait;
238 //
\83\8d\83O
\83E
\83B
\83\93\83h
\83E
\8aÖ
\8cW
239 property LogWindowPreviewStyle: TLogWindowPreviewStyle
240 read FLogWindowPreviewStyle write SetLogWindowPreviewStyle;
241 property LogListPreviewStyle: TLogListPreviewStyle
242 read FLogListPreviewStyle write SetLogListPreviewStyle;
244 property FMOName: TStrings read FFMOName write SetFMOName;
245 property HideGhosts: boolean read FHideGhosts write SetHideGhosts;
246 property VisibleGhostsList: TStringList read FVisibleGhostsList write SetVisibleGhostsList;
247 property NoExtraSSTPHeaders: boolean read FNoExtraSSTPHeaders write SetNoExtraSSTPHeaders;
248 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
249 property SurfacePreviewOnHint: boolean
250 read FSurfacePreviewOnHint write SetSurfacePreviewOnHint;
251 property SurfacePreviewOnScriptPoint: boolean
252 read FSurfacePreviewOnScriptPoint write SetSurfacePreviewOnScriptPoint;
253 property SurfacePreviewOnScriptPointPosition: TSurfacePreviewOnScriptPointPosition
254 read FSurfacePreviewOnScriptPointPosition write SetSurfacePreviewOnScriptPointPosition;
255 //
\8dÄ
\90¶
\8e\9e\8aÔ
\97\
\91ª
256 property PlayTimeParams: TSsPlayTimeParams read FPlayTimeParams write SetPlayTimeParams;
257 //
\83R
\83\93\83X
\83g
\83\89\83N
\83^
\81E
\83f
\83X
\83g
\83\89\83N
\83^
\81E
\95Û
\91¶
259 destructor Destroy; override;
260 procedure SaveSettings;
263 TChannelListItem = class(TObject)
271 procedure SetGhost(const Value: String);
272 procedure SetInfo(const Value: String);
273 procedure SetMembers(const Value: integer);
274 procedure SetName(const Value: String);
275 procedure SetNoPost(const Value: boolean);
276 procedure SetWarnPost(const Value: boolean);
278 property Name: String read FName write SetName;
279 property Info: String read FInfo write SetInfo;
280 property Ghost: String read FGhost write SetGhost;
281 property Members: integer read FMembers write SetMembers;
282 property NoPost: boolean read FNoPost write SetNoPost;
283 property WarnPost: boolean read FWarnPost write SetWarnPost;
286 TChannelList = class(TList)
288 function GetChannel(Name: String): TChannelListItem;
289 function GetChannelItem(Index: integer): TChannelListItem;
291 procedure Clear; override;
292 property Channel[Name: String]: TChannelListItem read GetChannel;
293 property ChannelItem[Index: integer]: TChannelListItem read GetChannelItem;
296 TScriptTransOption = (
297 toIgnoreTimeCritical,
300 toIgnoreFrequentYenS,
308 TScriptTransOptions = set of TScriptTransOption;
313 ChannelList: TChannelList; //
\83`
\83\83\83\93\83l
\83\8b\83\8a\83X
\83g
\82ð
\95Û
\8e\9d\82·
\82é
314 JoinChannels: TStringList; //
\8c»
\8dÝ
\8eQ
\89Á
\82µ
\82Ä
\82¢
\82é
\83`
\83\83\83\93\83l
\83\8b
317 DefaultBottleServer = 'bottle.mikage.to';
318 DefaultBottleServerPort = 9871;
319 DefaultCGI = '/bottle2.cgi';
320 DefaultCGIGhost = '/glog/bottleglog.cgi';
321 DefaultCGIFetchLog = '/fetchlog.cgi';
324 DefaultHomePage = 'http://bottle.mikage.to/';
325 DefaultGLogPage = 'http://bottle.mikage.to/glog/glogview.cgi';
326 DefaultVotePage = 'http://bottle.mikage.to/viewvotes.cgi';
327 DefaultHelpPage = 'http://bottle.mikage.to/clihelp/index.html';
332 VersionString = 'SSTP Bottle Client ver ' + Version + 'a NO MUTEX VERSION';
334 VersionString = 'SSTP Bottle Client ver ' + Version;
337 SentLogFile = 'sent.log';
339 BottleDisclaimer = '(C)2001-2004 WinBottle Project'#13#10 +
340 'naru, C.Ponapalt, Yune Kotomi, yese, Mikage Sawatari'#13#10 +
343 ChannelDefault = '(CH
\90\84\8f§)';
344 ClipChannel = '(
\83N
\83\8a\83b
\83v)';
346 function ParamsEncode(const ASrc: string): string;
347 function XMLEntity(From: String): String;
348 function SafeFileName(From: String; ChangePathDelimiters: boolean = true): String;
349 function ComponentToString(Component: TComponent): string;
350 function StringToComponent(Value: string): TComponent;
352 // m//k
\82È
\82Ç
\82Å
\88Í
\82Ü
\82ê
\82Ä
\82¢
\82È
\82¢
\90³
\8bK
\95\
\8c»
\82ð
\90³
\82µ
\82
\88Í
\82ñ
\82Å
353 // BRegExp
\83G
\83\89\81[
\82Ì
\94
\90¶
\82ð
\96h
\82®
354 function SafeRegExp(const Expression: String): String;
356 //
\90³
\8bK
\95\
\8c»
\83G
\83\89\81[
\82ð
\83`
\83F
\83b
\83N
357 function CheckRegExp(const Expression: String): boolean;
361 function ParamsEncode(const ASrc: string): string;
365 UnsafeChars = ['*', '#', '%', '<', '>', ' ', '[', ']', '+'];
367 Result := ''; {Do not Localize}
368 for i := 1 to Length(ASrc) do
370 if (ASrc[i] in UnsafeChars) or (not (ord(ASrc[i])in [33..128])) then
371 begin {do not localize}
372 Result := Result + '%' + IntToHex(Ord(ASrc[i]), 2); {do not localize}
376 Result := Result + ASrc[i];
381 // XML
\8eÀ
\91Ì
\8eQ
\8fÆ
\82É
\92u
\82«
\8a·
\82¦
\82é
382 function XMLEntity(From: String): String;
389 for i := 1 to Length(From) do
394 Result := Result + From[i];
395 end else if From[i] in LeadBytes then
398 Result := Result + From[i];
402 60: Result := Result + '<'; // Less than
403 62: Result := Result + '>'; // Greater than
404 38: Result := Result + '&'; // Ampersand
405 39: Result := Result + '''; // Single quote
406 34: Result := Result + '"'; // Double quote
408 Result := Result + From[i];
414 // Escape characters which can not be used as a filename
415 function SafeFileName(From: String; ChangePathDelimiters: boolean = true): String;
417 Result := StringReplace(From, '*', '
\81\96', [rfReplaceAll]);
418 Result := StringReplace(Result, '|', '
\81b', [rfReplaceAll]);
419 Result := StringReplace(Result, '"', '''''', [rfReplaceAll]);
420 Result := StringReplace(Result, '<', '
\81\83', [rfReplaceAll]);
421 Result := StringReplace(Result, '>', '
\81\84', [rfReplaceAll]);
422 Result := StringReplace(Result, '?', '
\81H', [rfReplaceAll]);
423 if ChangePathDelimiters then
425 Result := StringReplace(Result, '\', '
\81\8f', [rfReplaceAll]);
426 Result := StringReplace(Result, ':', '
\81F', [rfReplaceAll]);
427 Result := StringReplace(Result, '/', '
\81^', [rfReplaceAll]);
431 function ComponentToString(Component: TComponent): string;
433 BinStream:TMemoryStream;
434 StrStream: TStringStream;
437 BinStream := TMemoryStream.Create;
439 StrStream := TStringStream.Create(s);
441 BinStream.WriteComponent(Component);
442 BinStream.Seek(0, soFromBeginning);
443 ObjectBinaryToText(BinStream, StrStream);
444 StrStream.Seek(0, soFromBeginning);
445 Result:= StrStream.DataString;
454 function StringToComponent(Value: string): TComponent;
456 StrStream:TStringStream;
457 BinStream: TMemoryStream;
459 StrStream := TStringStream.Create(Value);
461 BinStream := TMemoryStream.Create;
463 ObjectTextToBinary(StrStream, BinStream);
464 BinStream.Seek(0, soFromBeginning);
465 Result := BinStream.ReadComponent(nil);
474 function SafeRegExp(const Expression: String): String;
476 Result := Expression;
478 //Perl
\82Ì
\90³
\8bK
\95\
\8c»
\8d\
\95¶
\82É
\83}
\83b
\83`
\82·
\82é
\90³
\8bK
\95\
\8c»
\82Å
\83`
\83F
\83b
\83N
479 //k
\83I
\83v
\83V
\83\87\83\93\82Í
\8a¿
\8e\9a\91Î
\89\9e
480 //#255(0xFF)
\82Í
\82 \82è
\82¦
\82È
\82¢
\82Ì
\82Å
\82±
\82±
\82Å
\97\98\97p
481 if not RegExp.Match('m'#255'^(/|m[/#({\[]).+[/#)}\]][ikms]{1,4}$'#255'k', Result) then
482 Result := 'm'#255 + Result + #255'k';
489 function CheckRegExp(const Expression: String): boolean;
493 RegExp.Match(Expression,' ');
495 on E: EBRegExpError do begin
496 ShowMessage('
\97L
\8cø
\82È
\90³
\8bK
\95\
\8c»
\82Å
\82Í
\82 \82è
\82Ü
\82¹
\82ñ
\81B'#13#10 + E.Message);
504 constructor TBottlePrefs.Create;
508 FAutoJoinChannels := TStringList.Create;
509 FDefaultScript := TStringList.Create;
510 FFMOName := TStringList.Create;
511 FVisibleGhostsList := TStringList.Create;
513 FIni := TIniFile.Create(ChangeFileExt(Application.ExeName, '.ini'));
515 PartialConfirmFormat := FIni.ReadString('System', 'PartialConfirmFormat', '\t|\e');
516 AutoPartialConfirm := FIni.ReadBool('System', 'AutoPartialConfirm', false);
517 ConfirmOnExit := FIni.ReadBool('System', 'ConfirmOnExit', false);
518 ConfirmOnExit := FIni.ReadBool('System', 'ConfirmOnExit', false);
519 ConfirmOnTabClose := FIni.ReadBool('System', 'ConfirmOnTabClose', false);
520 AutoClip := FIni.ReadBool('System', 'AutoClip', false);
521 AutoStart := FIni.ReadBool('System', 'AutoStart', false);
522 TabPosition := TTabPosition(FIni.ReadInteger('System', 'TabPosition', 0));
523 TabWidth := FIni.ReadInteger('System', 'TabWidth', 0);
524 GhostDropDownCount := FIni.ReadInteger('System', 'GhostDropDownCount', 30);
526 NoTranslate := FIni.ReadBool('System', 'NoTranslate', true);
527 NoDescript := FIni.ReadBool('System', 'NoDescript', false);
528 NoTransUrl := FIni.ReadBool('System', 'NoTransUrl', false);
529 SilentWhenHidden:= FIni.ReadBool('System', 'SilentWhenHidden', true);
530 FixMessySurface := FIni.ReadBool('System', 'FixMessySurface', false);
531 HUTagTo01Tag := FIni.ReadBool('System', 'HUTagTo01Tag', false);
532 ResetIfGhostAfterSend := FIni.ReadBool('System', 'ResetIfGhostAfterSend', false);
533 ClearAfterSend := FIni.ReadBool('System', 'ClearAfterSend', false);
534 NeedConfirmBeforeSend := FIni.ReadBool('System', 'NeedConfirmBeforeSend', false);
535 WarnYenTNotExist := FIni.ReadBool('System', 'WarnYenTNotExist', false);
536 WarnScopeChangeInSynchronize := FIni.ReadBool('System', 'WarnScopeChangeInSynchronize', false);
538 IgnoreFrequentYenS := FIni.ReadBool('System', 'IgnoreFrequentYenS', false);
539 WaitScriptEnd := FIni.ReadInteger('System', 'WaitScriptEnd', 0);
540 StayOnTop := FIni.ReadBool('System', 'StayOnTop', false);
541 ShowConstBar := FIni.ReadBool('System', 'ShowConstBar', true);
542 ShowToolBar := FIni.ReadBool('System', 'ShowToolBar', true);
543 NoConfirm := FIni.ReadBool('System', 'NoConfirm', false);
544 IgnoreTimeCritical := FIni.ReadBool('System', 'IgnoreTimeCritical', false);
545 FDefaultScript.CommaText := FIni.ReadString('System', 'DefaultScript', '\t\u\s[10]\h\s[0]|\e');
546 ShowRuler := FIni.ReadBool('System', 'ShowRuler', false);
549 TalkColorH := StringToColor(FIni.ReadString('System', 'TalkColorH', 'clBlack'));
550 TalkColorU := StringToColor(FIni.ReadString('System', 'TalkColorU', 'clMaroon'));
551 TalkColorS := StringToColor(FIni.ReadString('System', 'TalkColorS', 'clPurple'));
552 MarkUpColor := StringToColor(FIni.ReadString('System', 'MarkUpColor', 'clGreen'));
553 MetaWordColor := StringToColor(FIni.ReadString('System', 'MetaWordColor', 'clBlue'));
554 MarkErrorColor := StringToColor(FIni.ReadString('System', 'MarkErrorColor', 'clRed'));
555 TextColor := StringToColor(FIni.ReadString('System', 'TextColor', ColorToString(TalkColorH)));
556 BgColor := StringToColor(FIni.ReadString('System', 'BgColor', 'clWhite'));
558 on EConvertError do begin
559 ShowMessage('
\83J
\83\89\81[
\82Ì
\90Ý
\92è
\93Ç
\82Ý
\8d\9e\82Ý
\83G
\83\89\81[');
560 FTalkColorH := clBlack;
561 FTalkColorU := clMaroon;
562 FMarkUpColor := clGreen;
563 FMetaWordColor := clBlue;
564 FMarkErrorColor := clRed;
565 FTextColor := clBlack;
570 if FIni.ReadString('System', 'PlayTimeParams', '') = '' then
572 FPlayTimeParams := TSsPlayTimeParams.Create(nil);
573 FPlayTimeParams.ProfileName := '
\83f
\83t
\83H
\83\8b\83g';
576 Strs := TStringList.Create;
578 Strs.CommaText := FIni.ReadString('System', 'PlayTimeParams', '');
579 FPlayTimeParams := StringToComponent(Strs.Text) as TSsPlayTimeParams;
587 ShowMessage('
\8dÄ
\90¶
\8e\9e\8aÔ
\97\
\91ª
\90Ý
\92è
\82Ì
\93Ç
\82Ý
\8d\9e\82Ý
\83G
\83\89\81[' + E.Message);
588 if FPlayTimeParams = nil then
589 FPlayTimeParams := TSsPlayTimeParams.Create(nil);
593 WhenReturn := TReturnKeyFunction(FIni.ReadInteger('System', 'WhenReturn', 0));
594 WhenShiftReturn := TReturnKeyFunction(FIni.ReadInteger('System', 'WhenShiftReturn', 0));
595 WhenCtrlReturn := TReturnKeyFunction(FIni.ReadInteger('System', 'WhenCtrlReturn', 0));
596 //
\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è
597 ServerPort := FIni.ReadInteger('System', 'ServerPort', 11000);
599 FBottleServer := FIni.ReadString('System', 'BottleServer', DefaultBottleServer);
600 FBottleServerPort := FIni.ReadInteger('System', 'BottleServerPort', DefaultBottleServerPort);
601 FCgiName := FIni.ReadString('System', 'CgiName', DefaultCGI);
602 FCgiFetchLog := FIni.ReadString('System', 'CgiFetchLog', DefaultCGIFetchLog);
603 FHomePage := FIni.ReadString('System', 'HomePage', DefaultHomePage);
604 FGLogPage := FIni.ReadString('System', 'GLogPage', DefaultGLogPage);
605 FVotePage := FIni.ReadString('System', 'VotePage', DefaultVotePage);
606 FHelpPage := FIni.ReadString('System', 'HelpPage', DefaultHelpPage);
607 FCgiNameGhost := FIni.ReadString('System', 'GHOST', DefaultCGIGhost);
608 FLUID := FIni.ReadString('System', 'LUID', '');
609 FAutoJoinChannels.CommaText := FIni.ReadString('System', 'AutoJoinChannels', '');
611 ARect.Top := FIni.ReadInteger('System', 'SenderWindowPositionTop', 100);
612 ARect.Left := FIni.ReadInteger('System', 'SenderWindowPositionLeft', 100);
613 ARect.Bottom := FIni.ReadInteger('System', 'SenderWindowPositionBottom', 500);
614 ARect.Right := FIni.ReadInteger('System', 'SenderWindowPositionRight', 500);
615 if not InScreen(ARect) then
616 ARect := Rect(100, 100, 500, 500);
617 SenderWindowPosition := ARect;
618 ARect.Top := FIni.ReadInteger('System', 'LogWindowPositionTop', 200);
619 ARect.Left := FIni.ReadInteger('System', 'LogWindowPositionLeft', 200);
620 ARect.Bottom := FIni.ReadInteger('System', 'LogWindowPositionBottom', 600);
621 ARect.Right := FIni.ReadInteger('System', 'LogWindowPositionRight', 400);
622 LogWindowDividerPos := FIni.ReadInteger('System', 'LogWindowDividerPos', 150);
623 LogWindowColumnWidth := FIni.ReadString('System', 'LogWindowColumnWidth', '');
624 if not InScreen(ARect) then begin
625 ARect := Rect(200, 200, 600, 400);
626 LogWindowDividerPos := 150;
628 LogWindowPosition := ARect;
629 Strs := TStringList.Create;
631 Strs.CommaText := FIni.ReadString('System', 'EditorPreviewWindowPosition', '500,100,800,500');
633 ARect.Left := StrToInt(Strs[0]);
634 ARect.Top := StrToInt(Strs[1]);
635 ARect.Right := StrToInt(Strs[2]);
636 ARect.Bottom := StrToInt(Strs[3]);
638 ARect := Rect(500, 100, 800, 500);
640 EditorPreviewWindowPosition := ARect;
645 UseHttpProxy := FIni.ReadBool('System', 'UseHttpProxy', false);
646 ProxyAddress := FIni.ReadString('System', 'ProxyAddress', '');
647 ProxyPort := FIni.ReadInteger('System', 'ProxyPort', 0);
649 ReconnectWait := FIni.ReadInteger('System', 'ReconnectWait', 6);
650 //
\83\8d\83O
\83E
\83B
\83\93\83h
\83E
\8aÖ
\8cW
651 LogWindowPreviewStyle := TLogWindowPreviewStyle(
652 FIni.ReadInteger('System', 'LogWindowPreviewStyle', 0));
653 LogListPreviewStyle := TLogListPreviewStyle(
654 FIni.ReadInteger('System', 'LogListPreviewStyle', 0));
656 FMOName.CommaText := FIni.ReadString('System', 'FMOName', 'Sakura');
657 HideGhosts := FIni.ReadBool('System', 'HideGhosts', false);
658 VisibleGhostsList.CommaText := FIni.ReadString('System', 'VisibleGhostsList', '');
659 NoExtraSSTPHeaders := FIni.ReadBool('System', 'NoExtraSSTPHeaders', false);
660 //
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
661 SurfacePreviewOnHint := FIni.ReadBool('System', 'SurfacePreviewOnHint', false);
662 SurfacePreviewOnScriptPoint := FIni.ReadBool('System', 'SurfacePreviewOnScriptPoint', false);
663 SurfacePreviewOnScriptPointPosition :=
664 TSurfacePreviewOnScriptPointPosition(FIni.ReadInteger('System', 'SurfacePreviewOnScriptPointPosition', 0));
666 ShowMessage('INI
\83t
\83@
\83C
\83\8b\93Ç
\82Ý
\8d\9e\82Ý
\83G
\83\89\81[');
667 Application.Terminate;
671 destructor TBottlePrefs.Destroy;
677 if FAutoJoinChannels <> nil then
678 FAutoJoinChannels.Free;
679 if FDefaultScript <> nil then
681 if FFMOName <> nil then
683 if FVisibleGhostsList <> nil then
684 FVisibleGhostsList.Free;
685 if FPlayTimeParams <> nil then
686 FPlayTimeParams.Free;
689 procedure TBottlePrefs.SetAutoStart(const Value: boolean);
694 procedure TBottlePrefs.SetBgColor(const Value: TColor);
699 procedure TBottlePrefs.SetConfirmOnExit(const Value: boolean);
701 FConfirmOnExit := Value;
704 procedure TBottlePrefs.SetDblClkInsert(const Value: boolean);
706 FDblClkInsert := Value;
709 procedure TBottlePrefs.SetDefaultScript(const Value: String);
711 FDefaultScript.Text := Value;
714 procedure TBottlePrefs.SetFixMessySurface(const Value: boolean);
716 FFixMessySurface := Value;
719 procedure TBottlePrefs.SetGhostDropDownCount(const Value: integer);
721 FGhostDropDownCount := Value;
724 procedure TBottlePrefs.SetIgnoreFrequentYenS(const Value: boolean);
726 FIgnoreFrequentYenS := Value;
729 procedure TBottlePrefs.SetIgnoreTimeCritical(const Value: boolean);
731 FIgnoreTimeCritical := Value;
734 procedure TBottlePrefs.SetLogWindowDividerPos(const Value: integer);
736 FLogWindowDividerPos := Value;
739 procedure TBottlePrefs.SetLogWindowPosition(const Value: TRect);
741 FLogWindowPosition := Value;
744 procedure TBottlePrefs.SetLUID(const Value: String);
749 procedure TBottlePrefs.SetMarkErrorColor(const Value: TColor);
751 FMarkErrorColor := Value;
754 procedure TBottlePrefs.SetTextColor(const Value: TColor);
759 procedure TBottlePrefs.SetMarkUpColor(const Value: TColor);
761 FMarkUpColor := Value;
764 procedure TBottlePrefs.SetMetaWordColor(const Value: TColor);
766 FMetaWordColor := Value;
769 procedure TBottlePrefs.SetNoConfirm(const Value: boolean);
774 procedure TBottlePrefs.SetNoDescript(const Value: boolean);
776 FNoDescript := Value;
779 procedure TBottlePrefs.SetNoTranslate(const Value: boolean);
781 FNoTranslate := Value;
784 procedure TBottlePrefs.SetNoTransUrl(const Value: boolean);
786 FNoTransUrl := Value;
789 procedure TBottlePrefs.SetLogWindowPreviewStyle(
790 const Value: TLogWindowPreviewStyle);
792 FLogWindowPreviewStyle := Value;
795 procedure TBottlePrefs.SetProxyAddress(const Value: String);
797 FProxyAddress := Value;
800 procedure TBottlePrefs.SetProxyPort(const Value: integer);
805 procedure TBottlePrefs.SetResetIfGhostAfterSend(const Value: boolean);
807 FResetIfGhostAfterSend := Value;
810 procedure TBottlePrefs.SetSenderWindowPosition(const Value: TRect);
812 FSenderWindowPosition := Value;
815 procedure TBottlePrefs.SetServerPort(const Value: integer);
817 if Value > 0 then FServerPort := Value;
820 procedure TBottlePrefs.SetShowConstBar(const Value: boolean);
822 FShowConstBar := Value;
825 procedure TBottlePrefs.SetShowToolBar(const Value: boolean);
827 FShowToolBar := Value;
830 procedure TBottlePrefs.SetSilentWhenHidden(const Value: boolean);
832 FSilentWhenHidden := Value;
835 procedure TBottlePrefs.SetStayOnTop(const Value: boolean);
840 procedure TBottlePrefs.SetTabPosition(const Value: TTabPosition);
842 FTabPosition := Value;
845 procedure TBottlePrefs.SetTalkColorH(const Value: TColor);
847 FTalkColorH := Value;
850 procedure TBottlePrefs.SetTalkColorU(const Value: TColor);
852 FTalkColorU := Value;
855 procedure TBottlePrefs.SetUseHttpProxy(const Value: boolean);
857 FUseHttpProxy := Value;
860 procedure TBottlePrefs.SetWaitScriptEnd(const Value: integer);
862 if Value > 0 then FWaitScriptEnd := Value;
865 procedure TBottlePrefs.SetWhenCtrlReturn(const Value: TReturnKeyFunction);
867 FWhenCtrlReturn := Value;
870 procedure TBottlePrefs.SetWhenReturn(const Value: TReturnKeyFunction);
872 FWhenReturn := Value;
875 procedure TBottlePrefs.SetWhenShiftReturn(const Value: TReturnKeyFunction);
877 FWhenShiftReturn := Value;
880 procedure TBottlePrefs.SetTalkColorS(const Value: TColor);
882 FTalkColorS := Value;
885 procedure TBottlePrefs.SetLogWindowColumnWidth(const Value: String);
887 FLogWindowColumnWidth := Value;
890 procedure TBottlePrefs.SetClearAfterSend(const Value: boolean);
892 FClearAfterSend := Value;
895 procedure TBottlePrefs.SetAutoJoinChannels(const Value: TStrings);
897 FAutoJoinChannels.Assign(Value);
900 procedure TBottlePrefs.SetFMOName(const Value: TStrings);
902 FFMOName.Assign(Value);
905 procedure TBottlePrefs.SaveSettings;
909 FIni.WriteString('System', 'PartialConfirmFormat', PartialConfirmFormat);
910 FIni.WriteBool('System', 'AutoPartialConfirm', AutoPartialConfirm);
911 FIni.WriteBool('System', 'ConfirmOnExit', ConfirmOnExit);
912 FIni.WriteBool('System', 'ConfirmOnTabClose', ConfirmOnTabClose);
913 FIni.WriteBool('System', 'AutoClip', AutoClip);
914 FIni.WriteBool('System', 'AutoStart', AutoStart);
915 FIni.WriteInteger('System', 'TabPosition', Ord(TabPosition));
916 FIni.WriteInteger('System', 'TabWidth', TabWidth);
917 FIni.WriteInteger('System', 'GhostDropDownCount', GhostDropDownCount);
919 FIni.WriteBool('System', 'NoTranslate', NoTranslate);
920 FIni.WriteBool('System', 'NoDescript', NoDescript);
921 FIni.WriteBool('System', 'NoTransUrl', NoTransUrl);
922 FIni.WriteBool('System', 'SilentWhenHidden', SilentWhenHidden);
923 FIni.WriteBool('System', 'FixMessySurface', FixMessySurface);
924 FIni.WriteBool('System', 'HUTagTo01Tag', HUTagTo01Tag);
925 FIni.WriteBool('System', 'ResetIfGhostAfterSend', ResetIfGhostAfterSend);
926 FIni.WriteBool('System', 'ClearAfterSend', ClearAfterSend);
927 FIni.WriteBool('System', 'NeedConfirmBeforeSend', NeedConfirmBeforeSend);
928 FIni.WriteBool('System', 'WarnYenTNotExist', WarnYenTNotExist);
929 FIni.WriteBool('System', 'WarnScopeChangeInSynchronize', WarnScopeChangeInSynchronize);
931 FIni.WriteBool('System', 'IgnoreFrequentYenS', IgnoreFrequentYenS);
932 FIni.WriteInteger('System', 'WaitScriptEnd', WaitScriptEnd);
933 FIni.WriteBool('System', 'StayOnTop', StayOnTop);
934 FIni.WriteBool('System', 'NoConfirm', NoConfirm);
935 FIni.WriteBool('System', 'IgnoreTimeCritical', IgnoreTimeCritical);
936 FIni.WriteString('System', 'TalkColorH', ColorToString(TalkColorH));
937 FIni.WriteString('System', 'TalkColorU', ColorToString(TalkColorU));
938 FIni.WriteString('System', 'TalkColorS', ColorToString(TalkColorS));
939 FIni.WriteString('System', 'MarkUpColor', ColorToString(MarkUpColor));
940 FIni.WriteString('System', 'MetaWordColor', ColorToString(MetaWordColor));
941 FIni.WriteString('System', 'MarkErrorColor', ColorToString(MarkErrorColor));
942 FIni.WriteString('System', 'TextColor', ColorToString(TextColor));
944 Strs := TStringList.Create;
946 Strs.Text := ComponentToString(FPlayTimeParams);
947 FIni.WriteString('System', 'PlayTimeParams', Strs.CommaText);
952 FIni.WriteString('System', 'BgColor', ColorToString(BgColor));
953 FIni.WriteBool('System', 'ShowToolBar', ShowToolBar);
954 FIni.WriteBool('System', 'ShowConstBar', ShowConstBar);
955 FIni.WriteString('System', 'DefaultScript', FDefaultScript.CommaText);
956 FIni.WriteBool('System', 'ShowRuler', ShowRuler);
957 FIni.WriteInteger('System', 'WhenReturn', Ord(WhenReturn));
958 FIni.WriteInteger('System', 'WhenShiftReturn', Ord(WhenShiftReturn));
959 FIni.WriteInteger('System', 'WhenCtrlReturn', Ord(WhenCtrlReturn));
960 FIni.WriteInteger('System', 'ServerPort', ServerPort);
961 FIni.WriteString('System', 'LUID', LUID);
962 FIni.WriteString('System', 'AutoJoinChannels', FAutoJoinChannels.CommaText);
964 FIni.WriteInteger('System', 'SenderWindowPositionLeft', SenderWindowPosition.Left);
965 FIni.WriteInteger('System', 'SenderWindowPositionTop', SenderWindowPosition.Top);
966 FIni.WriteInteger('System', 'SenderWindowPositionRight', SenderWindowPosition.Right);
967 FIni.WriteInteger('System', 'SenderWindowPositionBottom', SenderWindowPosition.Bottom);
968 FIni.WriteInteger('System', 'LogWindowPositionLeft', LogWindowPosition.Left);
969 FIni.WriteInteger('System', 'LogWindowPositionTop', LogWindowPosition.Top);
970 FIni.WriteInteger('System', 'LogWindowPositionRight', LogWindowPosition.Right);
971 FIni.WriteInteger('System', 'LogWindowPositionBottom', LogWindowPosition.Bottom);
972 FIni.WriteInteger('System', 'LogWindowDividerPos', LogWindowDividerPos);
973 FIni.WriteString('System', 'LogWindowColumnWidth', LogWindowColumnWidth);
974 with EditorPreviewWindowPosition do
975 FIni.WriteString('System', 'EditorPreviewWindowPosition',
976 Format('%d,%d,%d,%d', [Left, Top, Right, Bottom]));
978 FIni.WriteBool('System', 'UseHttpProxy', UseHttpProxy);
979 FIni.WriteString('System', 'ProxyAddress', ProxyAddress);
980 FIni.WriteInteger('System', 'ProxyPort', ProxyPort);
982 FIni.WriteInteger('System', 'ReconnectWait', ReconnectWait);
984 FIni.WriteInteger('System', 'LogWindowPreviewStyle', Ord(LogWindowPreviewStyle));
985 FIni.WriteInteger('System', 'LogListPreviewStyle', Ord(LogListPreviewStyle));
986 FIni.WriteString('System', 'FMOName', FFMOName.CommaText);
987 FIni.WriteBool('System', 'HideGhosts', HideGhosts);
988 FIni.WriteString('System', 'VisibleGhostsList', VisibleGhostsList.CommaText);
989 FIni.WriteBool('System', 'NoExtraSSTPHeaders', NoExtraSSTPHeaders);
991 FIni.WriteBool('System', 'SurfacePreviewOnHint', SurfacePreviewOnHint);
992 FIni.WriteBool('System', 'SurfacePreviewOnScriptPoint', SurfacePreviewOnScriptPoint);
993 FIni.WriteInteger('System', 'SurfacePreviewOnScriptPointPosition', Ord(SurfacePreviewOnScriptPointPosition));
996 function TBottlePrefs.GetDefaultScript: String;
998 Result := FDefaultScript.Text;
1001 procedure TBottlePrefs.SetHUTagTo01Tag(const Value: boolean);
1003 FHUTagTo01Tag := Value;
1006 procedure TBottlePrefs.SetWarnScopeChangeInSynchronize(
1007 const Value: boolean);
1009 FWarnScopeChangeInSynchronize := Value;
1012 procedure TBottlePrefs.SetWarnYenTNotExist(const Value: boolean);
1014 FWarnYenTNotExist := Value;
1017 procedure TBottlePrefs.SetNeedConfirmBeforeSend(const Value: boolean);
1019 FNeedConfirmBeforeSend := Value;
1022 procedure TBottlePrefs.SetShowRuler(const Value: boolean);
1024 FShowRuler := Value;
1027 procedure TBottlePrefs.SetHideGhosts(const Value: boolean);
1029 FHideGhosts := Value;
1032 procedure TBottlePrefs.SetVisibleGhostsList(const Value: TStringList);
1034 FVisibleGhostsList.Assign(Value);
1037 procedure TBottlePrefs.SetSurfacePreviewOnHint(const Value: boolean);
1039 FSurfacePreviewOnHint := Value;
1042 procedure TBottlePrefs.SetSurfacePreviewOnScriptPoint(
1043 const Value: boolean);
1045 FSurfacePreviewOnScriptPoint := Value;
1048 procedure TBottlePrefs.SetSurfacePreviewOnScriptPointPosition(
1049 const Value: TSurfacePreviewOnScriptPointPosition);
1051 FSurfacePreviewOnScriptPointPosition := Value;
1054 procedure TBottlePrefs.SetNoExtraSSTPHeaders(const Value: boolean);
1056 FNoExtraSSTPHeaders := Value;
1059 procedure TBottlePrefs.SetLogListPreviewStyle(
1060 const Value: TLogListPreviewStyle);
1062 FLogListPreviewStyle := Value;
1065 procedure TBottlePrefs.SetEditorPreviewWindowPosition(const Value: TRect);
1067 FEditorPreviewWindowPosition := Value;
1070 function TBottlePrefs.InScreen(ARect: TRect): boolean;
1075 for i := 0 to Screen.MonitorCount-1 do
1077 if IntersectRect(dum, ARect, Screen.Monitors[i].WorkareaRect) then
1085 procedure TBottlePrefs.SetAutoClip(const Value: boolean);
1090 procedure TBottlePrefs.SetConfirmOnTabClose(const Value: boolean);
1092 FConfirmOnTabClose := Value;
1095 procedure TBottlePrefs.SetReconnectWait(const Value: integer);
1097 FReconnectWait := Value;
1099 raise Exception.Create('Reconnect wait must be >=6');
1102 procedure TBottlePrefs.SetPartialConfirmFormat(const Value: String);
1104 FPartialConfirmFormat := Value;
1107 procedure TBottlePrefs.SetAutoPartialConfirm(const Value: boolean);
1109 FAutoPartialConfirm := Value;
1112 procedure TBottlePrefs.SetPlayTimeParams(const Value: TSsPlayTimeParams);
1114 FPlayTimeParams.Assign(Value);
1117 procedure TBottlePrefs.SetTabWidth(const Value: integer);
1122 { TChannelListItem }
1124 procedure TChannelListItem.SetGhost(const Value: String);
1129 procedure TChannelListItem.SetInfo(const Value: String);
1134 procedure TChannelListItem.SetMembers(const Value: integer);
1139 procedure TChannelListItem.SetName(const Value: String);
1144 procedure TChannelListItem.SetNoPost(const Value: boolean);
1149 procedure TChannelListItem.SetWarnPost(const Value: boolean);
1156 procedure TChannelList.Clear;
1159 for i := Self.Count-1 downto 0 do begin
1160 TChannelListItem(Self[i]).Free;
1165 function TChannelList.GetChannel(Name: String): TChannelListItem;
1169 for i := 0 to Count-1 do
1170 if TChannelListItem(Self[i]).Name = Name then begin
1171 Result := TChannelListItem(Self[i]);
1176 function TChannelList.GetChannelItem(Index: integer): TChannelListItem;
1178 Result := TChannelListItem(Self[Index]);
1184 RegExp := TBRegExp.Create;
1186 ShowMessage('RegExp
\8aJ
\8en
\83G
\83\89\81[');
1187 Application.Terminate;
1190 Classes.RegisterClass(TSsPlayTimeParams);
1192 Pref := TBottlePrefs.Create;
1193 ChannelList := TChannelList.Create;
1194 JoinChannels := TStringList.Create;