6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 ComCtrls, ToolWin, StdCtrls, ExtCtrls, SsParser, BottleDef, Menus,
8 Clipbrd, Logs, ShellAPI, Commctrl, DirectSstp, Contnrs, StrUtils,
9 TalkShowFrame, SppList, HtmlOutputConfig, HtmlOutputProgress,
10 SearchLog, IniFiles, BRegExp, RegexUtils,
11 DateUtils, SAXComps, SAX, BSAX, SAXMS;
14 //
\83\8d\83O
\82Ì
\95Û
\91¶
\95û
\96@
15 TSaveLogType = (stLog, stLogWithChannels, stText, stXML);
17 //
\83\8a\83X
\83g
\83r
\83\85\81[
\82Ì
\83X
\83N
\83\8d\81[
\83\8b\95û
\8cü
18 TLVScrollDir = (lvScrollUp, lvScrollDown);
20 TfrmLog = class(TForm)
22 tbtnClear: TToolButton;
25 StatusBar: TStatusBar;
26 tbtnSaveLog: TToolButton;
27 PopupMenuPreview: TPopupMenu;
29 tbtnVoteMessage: TToolButton;
30 PopupMenuListView: TPopupMenu;
31 mnPopUpVoteMessage: TMenuItem;
32 SaveDialog: TSaveDialog;
35 mnPopUpCopyScript: TMenuItem;
36 PopupMenuSaveLog: TPopupMenu;
38 mnSaveLogChannel: TMenuItem;
39 mnSaveLogScript: TMenuItem;
40 mnSaveLogXML: TMenuItem;
41 ToolButton1: TToolButton;
43 mnPopUpAgreeMessage: TMenuItem;
44 tbtnAgreeMessage: TToolButton;
45 ToolButton2: TToolButton;
46 tbtnPreviewStyle: TToolButton;
47 PopupMenuPreviewStyle: TPopupMenu;
48 mnPreviewStyleConversation: TMenuItem;
49 mnPreviewStyleScript: TMenuItem;
50 mnPreviewStyleScriptWithLineBreak: TMenuItem;
52 tabBottleLog: TTabControl;
54 tbtnDownloadLog: TToolButton;
55 PopupMenuTab: TPopupMenu;
56 mnCloseTab: TMenuItem;
57 tbtnFindBottle: TToolButton;
58 tbtnOpenLog: TToolButton;
59 OpenDialog: TOpenDialog;
60 tbtnInsertCue: TToolButton;
61 mnInsertCue: TMenuItem;
62 PopupMenuListPreviewStyle: TPopupMenu;
63 mnListPreviewStyleNormal: TMenuItem;
64 mnListPreviewStyleTagStripped: TMenuItem;
65 tbtnListPreviewStyle: TToolButton;
66 mnListPreviewStyleNoColor: TMenuItem;
67 SsParserForTalkShow: TSsParser;
68 mnPreviewStyleConversationImage: TMenuItem;
69 pnlPreviewArea: TPanel;
70 TalkShowFrame: TfrmTalkShow;
72 tbtnSendEditor: TToolButton;
73 mnSendEditor: TMenuItem;
74 timScrollTimer: TTimer;
75 mnChangeTabName: TMenuItem;
78 mnDeleteLogItem: TMenuItem;
79 mnTabSaveXMLLog: TMenuItem;
80 mnSaveHTML: TMenuItem;
81 mnPopupCopyGhost: TMenuItem;
82 PopupMenuAction: TPopupMenu;
83 mnTestAction: TMenuItem;
84 mnSelAction: TMenuItem;
85 mnAllAction: TMenuItem;
86 SAXContentHandler1: TSAXContentHandler;
87 SAXErrorHandler1: TSAXErrorHandler;
88 tbtOpenSAXLog: TToolButton;
89 procedure tbtnClearClick(Sender: TObject);
90 procedure FormCreate(Sender: TObject);
91 procedure lvwLogChange(Sender: TObject; Item: TListItem;
93 procedure lvwLogDblClick(Sender: TObject);
94 procedure lvwLogKeyPress(Sender: TObject; var Key: Char);
95 procedure FormDestroy(Sender: TObject);
96 procedure lvwLogClick(Sender: TObject);
97 procedure mnSaveLogClick(Sender: TObject);
98 procedure lvwLogColumnClick(Sender: TObject; Column: TListColumn);
99 procedure mnPopUpCopyScriptClick(Sender: TObject);
100 procedure mnSaveLogChannelClick(Sender: TObject);
101 procedure mnSaveLogScriptClick(Sender: TObject);
102 procedure mnSaveLogXMLClick(Sender: TObject);
103 procedure lvwLogData(Sender: TObject; Item: TListItem);
104 procedure PopupMenuListViewPopup(Sender: TObject);
105 procedure lvwLogCustomDrawItem(Sender: TCustomListView;
106 Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
107 procedure PopupMenuPreviewStylePopup(Sender: TObject);
108 procedure mnPreviewStyleClick(Sender: TObject);
109 procedure tbtnPreviewStyleClick(Sender: TObject);
110 procedure tabBottleLogChange(Sender: TObject);
111 procedure tabBottleLogChanging(Sender: TObject;
112 var AllowChange: Boolean);
113 procedure tabBottleLogContextPopup(Sender: TObject; MousePos: TPoint;
114 var Handled: Boolean);
115 procedure mnCloseTabClick(Sender: TObject);
116 procedure tbtnFindBottleClick(Sender: TObject);
117 procedure tbtnOpenLogClick(Sender: TObject);
118 procedure tabBottleLogMouseDown(Sender: TObject; Button: TMouseButton;
119 Shift: TShiftState; X, Y: Integer);
120 procedure tabBottleLogDragOver(Sender, Source: TObject; X, Y: Integer;
121 State: TDragState; var Accept: Boolean);
122 procedure tabBottleLogDragDrop(Sender, Source: TObject; X, Y: Integer);
123 procedure tabBottleLogEndDrag(Sender, Target: TObject; X, Y: Integer);
124 procedure lvwLogDrawItem(Sender: TCustomListView; Item: TListItem;
125 Rect: TRect; State: TOwnerDrawState);
126 procedure mnListPreviewStyleClick(Sender: TObject);
127 procedure tbtnListPreviewStyleClick(Sender: TObject);
128 procedure PopupMenuListPreviewStylePopup(Sender: TObject);
129 procedure lvwLogDragOver(Sender, Source: TObject; X, Y: Integer;
130 State: TDragState; var Accept: Boolean);
131 procedure lvwLogDragDrop(Sender, Source: TObject; X, Y: Integer);
132 procedure timScrollTimerTimer(Sender: TObject);
133 procedure mnChangeTabNameClick(Sender: TObject);
134 procedure lvwLogStartDrag(Sender: TObject;
135 var DragObject: TDragObject);
136 procedure lvwLogEndDrag(Sender, Target: TObject; X, Y: Integer);
137 procedure mnTabSaveXMLLogClick(Sender: TObject);
138 procedure mnSaveHTMLClick(Sender: TObject);
139 procedure mnPopupCopyGhostClick(Sender: TObject);
140 procedure mnTestActionClick(Sender: TObject);
141 procedure mnSelActionClick(Sender: TObject);
142 procedure mnAllActionClick(Sender: TObject);
143 procedure SAXErrorHandler1Error(Sender: TObject;
144 const Error: ISAXParseError);
145 procedure SAXErrorHandler1FatalError(Sender: TObject;
146 const Error: ISAXParseError);
147 procedure SAXErrorHandler1Warning(Sender: TObject;
148 const Error: ISAXParseError);
149 procedure SAXContentHandler1Characters(Sender: TObject;
150 const PCh: WideString);
151 procedure SAXContentHandler1EndElement(Sender: TObject;
152 const NamespaceURI, LocalName, QName: WideString);
153 procedure SAXContentHandler1SetDocumentLocator(Sender: TObject;
154 const Locator: ILocator);
155 procedure SAXContentHandler1StartElement(Sender: TObject;
156 const NamespaceURI, LocalName, QName: WideString;
157 const Atts: IAttributes);
158 procedure tbtOpenSAXLogClick(Sender: TObject);
161 FLastScript: String; //
\83X
\83N
\83\8a\83v
\83g
\8dÄ
\95`
\89æ
\97}
\90§
\97p
162 FBottleLogList: TObjectList;
164 FDragTabIndex: integer; //
\83^
\83u
\83h
\83\89\83b
\83O
\83h
\83\8d\83b
\83v
\8aÖ
\98A
165 FDragTabDest: integer; //
\83h
\83\8d\83b
\83v
\82·
\82é
\88Ê
\92u(
\82·
\82®
\89E
\82É
\82
\82é
\83^
\83u
\82Ì
\83C
\83\93\83f
\83b
\83N
\83X)
167 //
\83\8a\83X
\83g
\83r
\83\85\81[
\83h
\83\89\83b
\83O
\83h
\83\8d\83b
\83v
\8aÖ
\98A
168 FLVScrollDir: TLVScrollDir; //
\83X
\83N
\83\8d\81[
\83\8b\95û
\8cü
169 FLVDragDest: integer; //
\83h
\83\8d\83b
\83v
\82·
\82é
\88Ê
\92u(
\82·
\82®
\89º
\82É
\82
\82é
\83A
\83C
\83e
\83\80\82ÌIndex)
172 FCurrLocator : ILocator;
173 FReadMess, FReadElm: boolean;
175 FsDate, FsChannel, FsScript, FsVotes, FsAgrees, FsGhost, FsMid: string;
176 FNowNode, FNowOpenFileName: string;
178 procedure UpdateScript(const Script: String);
179 procedure UpdateScriptConversationColor(const Script: String);
180 procedure UpdateScriptScript(const Script: String);
181 procedure mnURLClick(Sender: TObject);
182 function ExtractURLs(Script: String; Urls: TStrings; Labels: TStrings): Boolean;
183 function GetDefaultFileName(const Name: String; const Ext: String): String;
184 function BottleLogTitled(const LogName: String): TBottleLogList;
185 procedure DrawSingleLineScript(LogItem: TLogItem; Rect: TRect;
187 procedure PreviewStyleChange;
188 procedure DrawListViewDragBorder(const Rect: TRect);
189 function DoSaveLogXML(Log: TBottleLogList): integer;
190 procedure DoCloseTab(const Index: integer; FCheck: boolean);
191 function DoSearchLog(Condition: TSearchCond): TBottleLogList;
192 procedure SearchLogIndivisual(Condition: TSearchCond;
193 LogList, Result: TBottleLogList; UntilIndex: integer = -1);
194 function CheckLogSave(const Index: integer): integer;
195 procedure actLvwLog(FAction: boolean);
196 procedure LoadSAXItemReset;
197 procedure LoadSAXLoader(FileName: String);
199 procedure CreateParams(var Params: TCreateParams); override;
202 function SelectedBottleLog: TBottleLogList;
203 property BottleLogList: TObjectList read FBottleLogList;
204 procedure AddCurrentScriptLog(const LogName, Script, Channel, MID, Ghost: String;
205 const LogTime: TDateTime; const Vote, Agree: integer);
206 procedure AddCurrentSystemLog(const LogName, MessageString: String);
207 procedure VoteLog(const MID: String; const Vote: integer);
208 procedure AgreeLog(const MID: String; const Agree: integer);
209 procedure SetBottleState(const MID: String; State: TLogState);
210 procedure AllBottleOpened;
211 procedure LogLoaded(Sender: TObject);
212 procedure LogLoadFailure(Sender: TObject; const Message: String);
213 procedure LogLoadWork(Sender: TObject);
214 procedure HTMLOutputWork(Sender: TObject; const Count: integer;
215 var Canceled: boolean);
217 procedure UpdateWindow;
218 procedure SelAndFocusMessage(const MID: String);
219 function CheckLog(Sender: TObject): integer;
222 TBottleLogDragObject = class(TDragControlObjectEx)
224 FBottleLogList: TBottleLogList;
226 procedure SetBottleLogList(const Value: TBottleLogList);
227 procedure SetLogItem(const Value: TLogItem);
229 function GetDragImages: TDragImageList; override;
231 property BottleLogList: TBottleLogList read FBottleLogList write SetBottleLogList;
232 property LogItem: TLogItem read FLogItem write SetLogItem;
252 uses MainForm, SAXAdapters;
258 procedure TfrmLog.AddCurrentScriptLog(const LogName, Script, Channel, MID, Ghost: String;
259 const LogTime: TDateTime; const Vote, Agree: integer);
262 BottleLogTitled(LogName).AddScriptLog(Script, Channel, MID, Ghost, LogTime, Vote, Agree);
263 BottleLogTitled(LogName).LogModified := true; //
\82±
\82Ì
\83\8a\83X
\83g
\82Í
\95Ï
\8dX
\82³
\82ê
\82½
264 if SelectedBottleLog <> BottleLogTitled(LogName) then Exit;
265 lvwLog.OnChange := nil; //
\83C
\83x
\83\93\83g
\94
\90¶(
\82¢
\82ë
\82¢
\82ë
\8dÄ
\95`
\89æ
\82ª
\8bN
\82«
\82é)
\82Ì
\97}
\90§
266 if lvwLog.Selected <> nil then Sel := lvwLog.Selected.Index else Sel := -1;
267 lvwLog.Items.Count := SelectedBottleLog.Count;
269 if Sel >= 0 then begin
270 lvwLog.Selected := lvwLog.Items[Sel + 1];
271 lvwLog.Selected.Focused := true;
273 if not lvwLog.Focused then
274 ListView_Scroll(lvwLog.Handle, 0, High(integer));
275 lvwLog.OnChange := lvwLogChange;
278 procedure TfrmLog.AddCurrentSystemLog(const LogName, MessageString: String);
281 BottleLogTitled(LogName).AddSystemLog(MessageString);
282 if SelectedBottleLog <> BottleLogTitled(LogName) then Exit;
283 lvwLog.OnChange := nil;
284 if lvwLog.Selected <> nil then Sel := lvwLog.Selected.Index else Sel := -1;
285 lvwLog.Items.Count := SelectedBottleLog.Count;
287 if Sel >= 0 then begin
288 lvwLog.Selected := lvwLog.Items[Sel + 1];
289 lvwLog.Selected.Focused := true;
291 if not lvwLog.Focused then
292 ListView_Scroll(lvwLog.Handle, 0, High(integer));
293 lvwLog.OnChange := lvwLogChange;
298 procedure TfrmLog.tbtnClearClick(Sender: TObject);
300 if SelectedBottleLog = nil then Exit;
301 DoCloseTab(tabBottleLog.TabIndex, true);
304 procedure TfrmLog.FormCreate(Sender: TObject);
307 FLVDragDest := -1; //
\83\8a\83X
\83g
\83r
\83\85\81[
\82Ì
\83h
\83\89\83b
\83O
\92\86\82Å
\82Í
\82È
\82¢
308 FBottleLogList := TObjectList.Create;
310 SsParser.TagPattern.Assign(frmSender.SsParser.TagPattern);
311 SsParser.MetaPattern.Assign(frmSender.SsParser.MetaPattern);
313 with Pref.LogWindowPosition do begin
316 Self.Width := Right - Left + 1;
317 Self.Height := Bottom - Top + 1;
319 lvwLog.DoubleBuffered := true;
320 pnlPreviewArea.Height := Pref.LogWindowDividerPos;
323 while Token(Pref.LogWindowColumnWidth, ',', i) <> '' do begin
324 lvwLog.Columns[i].Width := StrToIntDef(Token(Pref.LogWindowColumnWidth, ',', i), 100);
328 SsParserForTalkShow.TagPattern.Assign(SsParser.TagPattern);
329 SsParserForTalkShow.MetaPattern.Assign(SsParser.MetaPattern);
330 SsParserForTalkShow.EscapeInvalidMeta := false;
331 SsParserForTalkShow.LeaveEscape := false;
332 TalkShowFrame.SsParser := self.SsParserForTalkShow;
334 TalkShowFrame.SetPreviewFont(edtScript.Font);
335 TalkShowFrame.PrevControl := lvwLog;
338 UpdateWindow; // Reset window color and enabled status of some buttons
341 procedure TfrmLog.FormDestroy(Sender: TObject);
346 for i := 0 to lvwLog.Columns.Count-1 do begin
347 if i > 0 then WidthStr := WidthStr + ',';
348 WidthStr := WidthStr + IntToStr(lvwLog.Column[i].Width);
350 Pref.LogWindowColumnWidth := WidthStr;
352 with Pref.LogWindowPosition do begin
355 Right := Self.Left + Self.Width - 1;
356 Bottom := Self.Top + Self.Height - 1;
358 Pref.LogWindowDividerPos := pnlPreviewArea.Height;
360 FreeAndNil(FBottleLogList);
363 procedure TfrmLog.lvwLogChange(Sender: TObject; Item: TListItem;
364 Change: TItemChange);
365 var Script, Text: String;
367 Selected, IsNormalBottle: boolean;
370 IsNormalBottle := false;
371 if SelectedBottleLog <> nil then begin
372 if Change = ctState then begin
374 if lvwLog.Selected <> nil then begin
376 StatusBar.Panels[0].Text := Format('%d/%d
\8c\8f', [lvwLog.Selected.Index+1,
377 SelectedBottleLog.Count]);
378 Log := SelectedBottleLog.Bottles[lvwLog.Selected.Index];
379 // if (Log.LogType = ltBottle) and not frmSender.Connecting then begin
380 if Log.LogType = ltBottle then begin
381 IsNormalBottle := true;
382 Script := Log.Script;
383 Text := Format('%d
\83o
\83C
\83g/%d
\95b -
\83_
\83u
\83\8b\83N
\83\8a\83b
\83N
\82Å
\8dÄ
\90¶',
384 [Length(Log.Script), frmSender.SsPlayTime.PlayTime(Log.Script) div 1000]);
385 StatusBar.Panels[1].Text := Text;
386 if Pref.LogWindowPreviewStyle = psImageConversation then
387 TalkShowFrame.View(Log)
389 UpdateScript(Script);
391 StatusBar.Panels[1].Text := '';
392 UpdateScript(''); //
\83\8d\83O
\83v
\83\8c\83r
\83\85\81[
\95\94\82ð
\83N
\83\8a\83A
395 StatusBar.Panels[0].Text := IntToStr(SelectedBottleLog.Count) + '
\8c\8f';
396 StatusBar.Panels[1].Text := '';
397 UpdateScript(Script); //
\83\8d\83O
\83v
\83\8c\83r
\83\85\81[
\95\94\83N
\83\8a\83A
400 tbtnSaveLog.Enabled := lvwLog.Items.Count > 0;
402 StatusBar.Panels[0].Text := '';
403 UpdateScript(''); //
\83\8d\83O
\83v
\83\8c\83r
\83\85\81[
\95\94\83N
\83\8a\83A
405 frmSender.actVoteMessage.Enabled := Selected and IsNormalBottle;
406 frmSender.actAgreeMessage.Enabled := Selected and IsNormalBottle;
407 frmSender.actSendToEditor.Enabled := Selected and IsNormalBottle;
408 frmSender.actInsertCue.Enabled := Selected;
409 frmSender.actDeleteLogItem.Enabled := Selected;
410 mnPopUpCopyScript.Enabled := Selected and IsNormalBottle;
411 mnPopupCopyGhost.Enabled := Selected and IsNormalBottle;
412 mnSelAction.Enabled := Selected and IsNormalBottle;
415 procedure TfrmLog.actLvwLog(FAction: boolean);
416 var Script, ErrorMes: String;
417 Log, CueItem: TLogItem;
420 if lvwLog.Selected = nil then
422 Log := SelectedBottleLog.Bottles[lvwLog.Selected.Index];
423 if Log = nil then Exit;
424 if Log.LogType <> ltBottle then
426 //
\92P
\91Ì
\83A
\83N
\83V
\83\87\83\93\82ª
\97L
\8cø
\82Å
\82 \82ê
\82Î
\83X
\83N
\83\8a\83v
\83g
\82Ì
\95Ï
\8a·
\82µ
\82È
\82¢
429 Script := Log.Script;
432 Script := frmSender.ScriptTransForSSTP(Log.Script, ErrorMes);
434 if ErrorMes <> '' then
436 Res := MessageDlg('
\96â
\91è
\82Ì
\82 \82é
\83X
\83N
\83\8a\83v
\83g
\82Å
\82·
\81B
\8dÄ
\90¶
\82Å
\82«
\82Ü
\82¹
\82ñ
\81B'#13#10+
438 '
\8b
\90§
\93I
\82É
\8dÄ
\90¶
\82µ
\82Ü
\82·
\82©?'#13#10,
439 mtWarning, mbOkCancel, 0
441 if Res = mrCancel then
445 CueItem := TLogItem.Create(Log);
447 //
\83A
\83N
\83V
\83\87\83\93\82ª
\97L
\8cø
\82Å
\82 \82ê
\82Î
\92Ê
\8fí
\8f\88\97\9d\8fÈ
\97ª
450 //
\8c^
\95Ï
\8a·
\82Æ
\8eó
\90M
451 frmSender.BottleCnv(CueItem);
452 CueItem.FreeInstance;
455 //
\83`
\83\83\83\93\83l
\83\8b\83S
\81[
\83X
\83g
\91Î
\8dô
456 if CueItem.Ghost = '' then
457 if ChannelList.Channel[CueItem.Channel] <> nil then
458 CueItem.Ghost := ChannelList.Channel[CueItem.Channel].Ghost;
459 CueItem.Script := Script;
460 frmSender.BottleSstp.Unshift(CueItem);
467 procedure TfrmLog.lvwLogDblClick(Sender: TObject);
472 procedure TfrmLog.UpdateScriptConversationColor(const Script: String);
475 UnyuTalking, Talked, InSynchronized: boolean;
478 frmSender.DoTrans(scr, [toConvertURL]);
479 SsParser.LeaveEscape := false;
480 SsParser.InputString := scr;
481 UnyuTalking := false;
482 Talked := false; //'\h\u\h\u'
\82Ì
\82æ
\82¤
\82È
\83X
\83N
\83\8a\83v
\83g
\82Å
\8bó
\82«
\8ds
\82ð
\8dì
\82ç
\82È
\82¢
\82½
\82ß
\82Ì
\91[
\92u
483 InSynchronized := false;
484 edtScript.Text := '';
485 edtScript.Color := Pref.BgColor;
486 for i := 0 to SsParser.Count-1 do begin
487 if (SsParser[i] = '\_s') and not InSynchronized then begin
488 InSynchronized := true;
490 edtScript.SelText := #13#10;
493 end else if (SsParser[i] = '\_s') and InSynchronized then begin
494 InSynchronized := false;
496 edtScript.SelText := #13#10;
500 if (SsParser[i] = '\u') and not UnyuTalking then begin
503 edtScript.SelText := #13#10;
507 if (SsParser[i] = '\h') and UnyuTalking then begin
508 UnyuTalking := false;
510 edtScript.SelText := #13#10;
514 if SsParser.MarkUpType[i] = mtStr then begin
515 if InSynchronized then
516 edtScript.SelAttributes.Color := Pref.TalkColorS
517 else if UnyuTalking then
518 edtScript.SelAttributes.Color := Pref.TalkColorU
520 edtScript.SelAttributes.Color := Pref.TalkColorH;
521 edtScript.SelText := SsParser[i];
524 if SsParser.MarkUpType[i] = mtMeta then begin
525 edtScript.SelAttributes.Color := Pref.MetaWordColor;
526 edtScript.SelText := SsParser[i];
532 procedure TfrmLog.lvwLogKeyPress(Sender: TObject; var Key: Char);
534 if Key = #13 then lvwLogDblClick(Sender);
537 procedure TfrmLog.CreateParams(var Params: TCreateParams);
540 Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
543 procedure TfrmLog.lvwLogClick(Sender: TObject);
545 //
\89E
\83N
\83\8a\83b
\83N
\82Å
\83\81\83j
\83\85\81[
\8fo
\82·
\82Æ
\82«
\82É
\94
\90¶
\82·
\82é
\95s
\8bï
\8d\87\91Î
\8dô
547 Selected := Selected;
550 procedure TfrmLog.lvwLogColumnClick(Sender: TObject; Column: TListColumn);
551 var SortType: TBottleLogSortType;
555 if SelectedBottleLog = nil then
557 if lvwLog.Selected <> nil then
558 SelectedMID := SelectedBottleLog.Bottles[lvwLog.Selected.Index].MID
562 SortColumn := Column.Index;
564 -1: SortType := stLogTime;
565 subChannel: SortType := stChannel;
566 subGhost: SortType := stGhost;
567 subVotes: SortType := stVote;
568 subAgrees: SortType := stAgree;
569 subScript: SortType := stScript;
571 SortType := stLogTime;
574 SelectedBottleLog.SortBottles(SortType);
576 if Length(SelectedMID) > 0 then
577 SelAndFocusMessage(SelectedMID);
581 procedure TfrmLog.mnPopUpCopyScriptClick(Sender: TObject);
586 Log := SelectedBottleLog.Bottles[frmLog.lvwLog.Selected.Index];
587 if Log = nil then Exit;
589 Clip.SetTextBuf(PChar(Log.Script));
592 procedure TfrmLog.SetBottleState(const MID: String; State: TLogState);
596 for i := 0 to FBottleLogList.Count-1 do begin
597 Bottle := (FBottleLogList[i] as TBottleLogList).Bottle(MID);
598 if Bottle <> nil then begin
599 Bottle.State := State;
600 lvwLog.OnChange := nil;
602 lvwLog.OnChange := lvwLogChange;
607 procedure TfrmLog.mnSaveLogClick(Sender: TObject);
609 if SelectedBottleLog = nil then Exit;
610 SaveDialog.FileName := GetDefaultFileName(SelectedBottleLog.Title, '.log');
611 SaveDialog.InitialDir := Pref.LogDir;
612 SaveDialog.DefaultExt := 'log';
613 SaveDialog.FilterIndex := 1;
614 if SaveDialog.Execute then
615 SelectedBottleLog.SaveToSstpLog(SaveDialog.FileName, false);
618 procedure TfrmLog.mnSaveLogChannelClick(Sender: TObject);
620 if SelectedBottleLog = nil then Exit;
621 SaveDialog.FileName := GetDefaultFileName(SelectedBottleLog.Title, '.log');
622 SaveDialog.InitialDir := Pref.LogDir;
623 SaveDialog.DefaultExt := 'log';
624 SaveDialog.FilterIndex := 1;
625 if SaveDialog.Execute then
626 SelectedBottleLog.SaveToSstpLog(SaveDialog.FileName, true);
629 procedure TfrmLog.mnSaveLogScriptClick(Sender: TObject);
631 if SelectedBottleLog = nil then Exit;
632 SaveDialog.FileName := GetDefaultFileName(SelectedBottleLog.Title, '.txt');
633 SaveDialog.InitialDir := Pref.LogDir;
634 SaveDialog.DefaultExt := 'txt';
635 SaveDialog.FilterIndex := 2;
636 if SaveDialog.Execute then
637 SelectedBottleLog.SaveToText(SaveDialog.FileName);
640 procedure TfrmLog.mnSaveLogXMLClick(Sender: TObject);
642 if SelectedBottleLog = nil then Exit;
643 DoSaveLogXML(SelectedBottleLog);
646 procedure TfrmLog.lvwLogData(Sender: TObject; Item: TListItem);
650 if Item = nil then Exit;
652 Log := SelectedBottleLog.Bottles[i];
654 Caption := FormatDateTime('yy/mm/dd hh:nn:ss', Log.LogTime);
656 SubItems.Add(Log.Channel);
657 SubItems.Add(Log.Ghost);
658 if Log.LogType = ltBottle then begin
659 if Log.Votes > 0 then
660 SubItems.Add(IntToStr(Log.Votes))
663 if Log.Agrees > 0 then
664 SubItems.Add(IntToStr(Log.Agrees))
668 //
\83V
\83X
\83e
\83\80\83\8d\83O
\82È
\82Ç
\82Í
\93\8a\95[
\81E
\93¯
\88Ó
\82ð
\95\
\8e¦
\82µ
\82È
\82¢
672 SubItems.Add(Log.Script);
674 if Log.LogType = ltBottle then begin
676 lsUnopened: ImageIndex := IconBottle;
677 lsPlaying: ImageIndex := IconPlaying;
678 lsOpened: ImageIndex := IconOpened;
681 ImageIndex := IconSystemLog;
685 procedure TfrmLog.UpdateWindow;
686 var EnabledFlag: boolean;
688 lvwLog.Color := Pref.BgColor;
689 lvwLog.Font.Color := Pref.TextColor;
690 if SelectedBottleLog <> nil then begin
691 Caption := '
\83\8d\83O - ' + SelectedBottleLog.Title;
692 StatusBar.Panels[0].Text := IntToStr(SelectedBottleLog.Count) + '
\8c\8f';
693 lvwLog.Items.Count := SelectedBottleLog.Count;
695 Caption := '
\83\8d\83O';
696 StatusBar.Panels[0].Text := '';
697 StatusBar.Panels[1].Text := '';
698 lvwLog.Items.Count := 0;
701 EnabledFlag := SelectedBottleLog <> nil;
702 tbtnClear.Enabled := EnabledFlag;
703 tbtnSaveLog.Enabled := EnabledFlag;
704 tbtnFindBottle.Enabled := EnabledFlag;
709 procedure TfrmLog.PopupMenuListViewPopup(Sender: TObject);
714 ProcessedUrl: String;
715 ProcessedLabel: String;
718 for i := mnJumpURL.Count-1 downto 0 do begin
719 mnJumpURL.Items[i].Free;
721 mnJumpURL.Enabled := false;
722 if lvwLog.Selected = nil then Exit;
723 Log := SelectedBottleLog.Bottles[lvwLog.Selected.Index];
724 if Log = nil then Exit;
725 Urls := TStringList.Create;
726 Labels := TStringList.Create;
728 ExtractURLs(Log.Script, Urls, Labels);
729 for i := 0 to Urls.Count-1 do begin
730 Child := TMenuItem.Create(Self);
732 ProcessedUrl := StringReplace(Urls[i], '&', '&&', [rfReplaceAll]);
733 ProcessedLabel := StringReplace(Labels[i], '&', '&&', [rfReplaceAll]);
734 if Length(ProcessedLabel) > 0 then begin
735 Caption := Format('[%s] %s (&%d)', [ProcessedLabel, ProcessedUrl, i+1]);
737 Caption := Format('%s (&%d)', [ProcessedUrl, i+1]);
740 OnClick := mnURLClick;
741 AutoHotkeys := maManual;
742 mnJumpURL.Add(Child);
745 mnJumpURL.Enabled := Urls.Count > 0;
752 procedure TfrmLog.mnURLClick(Sender: TObject);
753 var LogItem: TLogItem;
758 if (lvwLog.Selected = nil) or (SelectedBottleLog = nil) then Exit;
759 LogItem := SelectedBottleLog[lvwLog.Selected.Index] as TLogItem;
760 Urls := TStringList.Create;
762 ExtractURLs(LogItem.Script, Urls, nil);
763 URL := Urls[(Sender as TMenuItem).Tag];
770 function TfrmLog.ExtractURLs(Script: String; Urls: TStrings; Labels: TStrings): Boolean;
771 var i, u, j, count: integer;
775 SsParser.InputString := Script;
776 SsParser.LeaveEscape := true;
777 for i := 0 to SsParser.Count-1 do begin
778 if (SsParser.Match(SsParser[i], '\URL%b') > 0)
779 and (SsParser.MarkUpType[i] = mtTag) then
781 for u := 7 downto 1 do begin
782 if (SsParser.Match(SsParser[i],
783 '\URL%b'+StringReplace(StringOfChar('-', u*2),
784 '-', '%b', [rfReplaceAll]))) > 0 then begin
785 for j := 1 to u do begin
786 s := SsParser.GetParam(SsParser[i], j*2);
787 if Pos('http://', s) > 0 then begin
788 if Urls <> nil then Urls.Add(s);
791 if Labels <> nil then begin
792 s := SsParser.GetParam(SsParser[i], j*2+1);
799 if SsParser.Match(SsParser[i], '\URL%b%b') = 0 then begin
800 //
\8aÈ
\88Õ
\8c`
\8e®\URL
\83^
\83O
\95Ï
\8a·
801 s := SsParser.GetParam(SsParser[i], 1);
802 if Pos('http://', s) > 0 then begin
803 if Urls <> nil then Urls.Add(s);
810 //
\83\89\83x
\83\8b\82Ì
\90\94\82ðURL
\82Ì
\90\94\82É
\82 \82í
\82¹
\82é -
\82¢
\82¿
\82¢
\82¿
\94»
\92è
\82µ
\82È
\82
\82Ä
\82à
\82¢
\82¢
\82æ
\82¤
\82É
811 if Urls <> nil then begin
812 if Labels <> nil then begin
813 while Urls.Count > Labels.Count do Labels.Add('');
819 procedure TfrmLog.SelAndFocusMessage(const MID: String);
823 for i := 0 to SelectedBottleLog.Count-1 do begin
824 Log := SelectedBottleLog.Items[i] as TLogItem;
825 if Log.MID = MID then begin
826 lvwLog.Items[i].Selected := true;
827 lvwLog.Items[i].Focused := true;
832 procedure TfrmLog.lvwLogCustomDrawItem(Sender: TCustomListView;
833 Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
838 procedure TfrmLog.UpdateScript(const Script: String);
840 if Script <> FLastScript then begin
841 if Pref.LogWindowPreviewStyle = psConversation then begin
842 UpdateScriptConversationColor(Script);
844 UpdateScriptScript(Script);
846 SendMessage(edtScript.Handle, EM_LINESCROLL, Low(integer), Low(integer)); //
\83X
\83N
\83\8d\81[
\83\8b\96ß
\82µ
847 FLastScript := Script;
851 procedure TfrmLog.PopupMenuPreviewStylePopup(Sender: TObject);
854 with PopupMenuPreviewStyle do
855 for i := 0 to Items.Count-1 do
856 Items[i].Checked := Items[i].Tag = Ord(Pref.LogWindowPreviewStyle)
859 procedure TfrmLog.mnPreviewStyleClick(Sender: TObject);
862 with PopupMenuPreviewStyle do
863 for i := 0 to Items.Count-1 do
864 Items[i].Checked := (Sender as TMenuItem).Tag = Items[i].Tag;
865 Pref.LogWindowPreviewStyle := TLogWindowPreviewStyle((Sender as TMenuItem).Tag);
868 lvwLogChange(self, lvwLog.Selected, ctState);
871 procedure TfrmLog.UpdateScriptScript(const Script: String);
873 UnyuTalking, InSynchronized: boolean;
876 edtScript.Color := Pref.BgColor;
877 SsParser.LeaveEscape := true;
878 SsParser.InputString := Script;
879 edtScript.Text := '';
880 edtScript.SelAttributes.Color := clWindowText;
881 UnyuTalking := false;
882 InSynchronized := false;
883 for i := 0 to SsParser.Count-1 do begin
884 case SsParser.MarkUpType[i] of
886 if InSynchronized then
887 edtScript.SelAttributes.Color := Pref.TalkColorS
888 else if UnyuTalking then
889 edtScript.SelAttributes.Color := Pref.TalkColorU
891 edtScript.SelAttributes.Color := Pref.TalkColorH;
894 edtScript.SelAttributes.Color := Pref.MarkUpColor;
895 if SsParser[i] = '\h' then
897 else if SsParser[i] = '\u' then
899 else if SsParser[i] = '\_s' then
900 InSynchronized := not InSynchronized;
902 mtMeta: edtScript.SelAttributes.Color := Pref.MetaWordColor;
903 mtTagErr: edtScript.SelAttributes.Color := Pref.MarkErrorColor;
905 edtScript.SelText := SsParser[i];
906 if (SsParser[i] = '\n') and (Pref.LogWindowPreviewStyle = psScriptWithLineBreak) then
907 edtScript.SelText := #13#10;
911 procedure TfrmLog.tbtnPreviewStyleClick(Sender: TObject);
914 sel := Ord(Pref.LogWindowPreviewStyle);
916 if sel > Ord(High(TLogWindowPreviewStyle)) then sel := 0;
917 Pref.LogWindowPreviewStyle := TLogWindowPreviewStyle(sel);
920 lvwLogChange(self, lvwLog.Selected, ctState);
923 function TfrmLog.SelectedBottleLog: TBottleLogList;
925 if tabBottleLog.TabIndex >= 0 then
926 Result := FBottleLogList.Items[tabBottleLog.TabIndex] as TBottleLogList
931 procedure TfrmLog.tabBottleLogChange(Sender: TObject);
933 // StatusBar
\82Ì
\8c\8f\90\94\95\
\8e¦
\82âListView.Items.Count
\82ð
\8dX
\90V
\82·
\82é
935 //
\83A
\83C
\83e
\83\80\82Ì
\91I
\91ð
\8fó
\91Ô
\82ð
\95\9c\8bA
\82·
\82é
936 with SelectedBottleLog do
937 if (SelectedIndex >= 0) and (Count > SelectedIndex) then
939 lvwLog.Items[SelectedIndex].Selected := true;
940 if lvwLog.Focused then lvwLog.Selected.Focused := true;
942 lvwLogChange(Self, nil, ctState);
945 procedure TfrmLog.LogLoaded(Sender: TObject);
947 if SelectedBottleLog = Sender then begin
952 procedure TfrmLog.UpdateTab;
955 cur := tabBottleLog.tabIndex;
956 tabBottleLog.Tabs.Clear;
957 for i := 0 to FBottleLogList.Count - 1 do begin
958 tabBottleLog.Tabs.Add((FBottleLogList[i] as TBottleLogList).Title);
960 if FBottleLogList.Count > 0 then begin
961 if cur < FBottleLogList.Count then
962 tabBottleLog.TabIndex := cur
964 tabBottleLog.TabIndex := FBottleLogList.Count-1;
968 procedure TfrmLog.LogLoadFailure(Sender: TObject; const Message: String);
971 ShowMessage(Message);
972 if Sender = SelectedBottleLog then UpdateWindow;
975 procedure TfrmLog.AgreeLog(const MID: String; const Agree: integer);
980 for i := 0 to FBottleLogList.Count - 1 do begin
981 if (FBottleLogList[i] as TBottleLogList).Bottle(MID) <> nil then begin
982 (FBottleLogList[i] as TBottleLogList).Bottle(MID).Agrees := Agree;
986 if flag then lvwLog.Invalidate;
989 procedure TfrmLog.VoteLog(const MID: String; const Vote: integer);
994 for i := 0 to FBottleLogList.Count - 1 do begin
995 if (FBottleLogList[i] as TBottleLogList).Bottle(MID) <> nil then begin
996 (FBottleLogList[i] as TBottleLogList).Bottle(MID).Votes := Vote;
1000 if flag then lvwLog.Invalidate;
1003 procedure TfrmLog.tabBottleLogChanging(Sender: TObject;
1004 var AllowChange: Boolean);
1006 //
\8c»
\8dÝ
\91I
\91ð
\82³
\82ê
\82Ä
\82¢
\82é
\83\8d\83O
\82Ì
\91I
\91ð
\8fó
\91Ô
\82ð
\95Û
\91¶
1007 if SelectedBottleLog = nil then Exit;
1008 if lvwLog.Selected <> nil then
1009 SelectedBottleLog.SelectedIndex := lvwLog.Selected.Index
1011 SelectedBottleLog.SelectedIndex := -1;
1014 procedure TfrmLog.tabBottleLogContextPopup(Sender: TObject;
1015 MousePos: TPoint; var Handled: Boolean);
1017 with tabBottleLog do begin
1018 Tag := IndexOfTabAt(MousePos.X, MousePos.Y);
1019 if Tag < 0 then Handled := true;
1023 procedure TfrmLog.mnCloseTabClick(Sender: TObject);
1025 DoCloseTab(tabBottleLog.Tag, true);
1028 procedure TfrmLog.tbtnFindBottleClick(Sender: TObject);
1029 var ResultLog: TBottleLogList;
1032 CList, GList: THashedStringList;
1034 Application.CreateForm(TfrmSearchLog, frmSearchLog);
1035 Cond := TSearchCond.Create(nil);
1038 with frmSearchLog do
1040 //
\8c»
\8dÝ
\83\8d\83O
\82É
\82 \82é
\83S
\81[
\83X
\83g
\82Æ
\83`
\83\83\83\93\83l
\83\8b\82Ì
\83\8a\83X
\83g
\82ð
\8eæ
\93¾
1041 //
\8fd
\82½
\82¢
\82©
\82à??
1042 CList := THashedStringList.Create;
1043 GList := THashedStringList.Create;
1045 for i := 0 to BottleLogList.Count-1 do
1047 with BottleLogList[i] as TBottleLogList do
1049 ExtractUniqueChannels(CList);
1050 ExtractUniqueGhosts(GList);
1055 ChannelList := CList;
1064 Cond.Assign(Condition);
1067 frmSearchLog.Release;
1069 //
\8c\9f\8dõ
\8eÀ
\8ds
1070 ResultLog := DoSearchLog(Cond);
1071 //
\90V
\83^
\83u
\82ð
\8dì
\90¬
\82µ
\82Ä
\89æ
\96Ê
\8dX
\90V
1072 BottleLogList.Add(ResultLog);
1074 tabBottleLog.TabIndex := BottleLogList.Count-1;
1081 procedure TfrmLog.tbtnOpenLogClick(Sender: TObject);
1082 var BottleLog: TBottleLogList;
1086 OpenDialog.InitialDir := Pref.LogDir;
1087 if OpenDialog.Execute then begin
1088 for i := 0 to OpenDialog.Files.Count-1 do begin
1089 BottleLog := TBottleLogList.Create(ExtractFileName(OpenDialog.Files[i]));
1093 OnLoaded := LogLoaded;
1094 OnLoadFailure := LogLoadFailure;
1095 OnLoadWork := LogLoadWork;
1096 BottleLog.LoadFromXMLFile(OpenDialog.Files[i]);
1098 Index := BottleLogList.Add(BottleLog); //
\8dÅ
\8cã
\82É
\8aJ
\82¢
\82½
\83\8d\83O
\82Ì
\88Ê
\92u
\82ð
\8bL
\89¯
1104 if Index >= 0 then tabBottleLog.TabIndex := Index;
1109 function TfrmLog.GetDefaultFileName(const Name, Ext: String): String;
1111 Result := StringReplace(Name, '/', '', [rfReplaceAll]);
1112 Result := StringReplace(Result, ' ', '', [rfReplaceAll]);
1113 Result := SafeFileName(Result);
1114 Result := ChangeFileExt(Result, Ext);
1117 function TfrmLog.BottleLogTitled(const LogName: String): TBottleLogList;
1120 for i := 0 to FBottleLogList.Count-1 do begin
1121 if (FBottleLogList[i] as TBottleLogList).Title = LogName then begin
1122 Result := (FBottleLogList[i] as TBottleLogList);
1126 //
\8c©
\82Â
\82©
\82ç
\82È
\82¢
\8fê
\8d\87
1127 Result := TBottleLogList.Create(LogName); //
\90V
\82µ
\82
\8dì
\82é
1128 FBottleLogList.Add(Result);
1130 if FBottleLogList.Count = 1 then tabBottleLog.TabIndex := 0;
1133 procedure TfrmLog.AllBottleOpened;
1135 Log: TBottleLogList;
1137 for i := 0 to FBottleLogList.Count-1 do begin
1138 Log := FBottleLogList[i] as TBottleLogList;
1139 for j := 0 to Log.Count-1 do begin
1140 Log.Bottles[j].State := lsOpened;
1145 procedure TfrmLog.tabBottleLogMouseDown(Sender: TObject;
1146 Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
1149 if Button = mbMiddle then
1151 //
\92\86\83{
\83^
\83\93\83N
\83\8a\83b
\83N
\82Å
\83^
\83u
\8dí
\8f\9c
1152 DoCloseTab(tabBottleLog.IndexOfTabAt(X, Y), true);
1155 with tabBottleLog do begin
1156 Index := IndexOfTabAt(X, Y);
1157 if Index = -1 then Exit; //
\83^
\83u
\82ª
\82È
\82¢
\82Ì
\82Å
\83h
\83\89\83b
\83O
\82Å
\82«
\82È
\82¢
1158 if Button = mbLeft then begin
1159 FDragTabIndex := Index; //
\83h
\83\89\83b
\83O
\82·
\82é
\83^
\83u
\82Ì
\83C
\83\93\83f
\83b
\83N
\83X
\82ð
\95Û
\91¶
1161 FDragTabDest := -1; //
\83h
\83\89\83b
\83O
\98g
\90ü
\95`
\89æ
\83t
\83\89\83O
\83N
\83\8a\83A
\82Ì
\82½
\82ß
1167 procedure TfrmLog.tabBottleLogDragOver(Sender, Source: TObject; X,
1168 Y: Integer; State: TDragState; var Accept: Boolean);
1169 var TargetRect: TRect;
1170 OldDest, Index: integer;
1173 //
\83^
\83u
\82Ì
\83h
\83\89\83b
\83O(
\83^
\83u
\82Ì
\8f\87\94Ô
\93ü
\82ê
\91Ö
\82¦)
\82Ü
\82½
\82Í
\81A
1174 //
\83\8d\83O
\83A
\83C
\83e
\83\80\82Ì
\83h
\83\89\83b
\83O(
\83\8d\83O
\82ð
\95Ê
\82Ì
\83^
\83u
\82É
\88Ú
\93®)
\82Ì
1175 //
\97¼
\95û
\82Ì
\83h
\83\89\83b
\83O
\82ð
\8eó
\82¯
\95t
\82¯
\82é
1177 if Source = tabBottleLog then
1179 //
\83^
\83u
\82Ì
\8f\87\94Ô
\93ü
\82ê
\91Ö
\82¦
\82Ì
\8fê
\8d\87
1181 with tabBottleLog do begin
1182 OldDest := FDragTabDest;
1183 FDragTabDest := IndexOfTabAt(X, Y);
1184 if FDragTabDest = -1 then begin
1185 Accept := false; //
\82±
\82Ì
\8fê
\8d\87\82Í
\83h
\83\8d\83b
\83v
\82ð
\94F
\82ß
\82È
\82¢
1188 with Canvas do begin
1192 if (OldDest <> FDragTabDest) and (OldDest >= 0) then begin
1193 //
\88È
\91O
\82Ì
\98g
\90ü
\8fÁ
\8b\8e
1194 TargetRect := TabRect(OldDest);
1195 with Canvas do begin
1196 Brush.Style := bsClear;
1197 Rectangle(TargetRect.Left, TargetRect.Top,
1198 TargetRect.Right, TargetRect.Bottom);
1201 if (OldDest <> FDragTabDest) then begin
1202 //
\90V
\82µ
\82¢
\98g
\90ü
\95`
\89æ
1203 TargetRect := TabRect(FDragTabDest);
1204 with Canvas do begin
1205 Brush.Style := bsClear;
1206 Rectangle(TargetRect.Left, TargetRect.Top,
1207 TargetRect.Right, TargetRect.Bottom);
1211 end else if Source is TBottleLogDragObject then
1213 //
\83\8d\83O
\8d\80\96Ú
\82Ì
\83h
\83\89\83b
\83O(
\83\8d\83O
\82ð
\95Ê
\82Ì
\83^
\83u
\82É
\88Ú
\93®
\82·
\82é)
\82Ì
\8fê
\8d\87
1214 Index := tabBottleLog.IndexOfTabAt(X, Y);
1215 if tabBottleLog.TabIndex <> Index then
1217 FLVDragDest := -1; //
\98g
\90ü
\82Í
\82Ü
\82¾
\95\
\8e¦
\82³
\82ê
\82È
\82¢
\82Í
\82¸
1218 //
\83^
\83u
\82ð
\90Ø
\91Ö
\82¦
\82é
1219 tabBottleLogChanging(Self, dummy);
1220 tabBottleLog.TabIndex := Index;
1226 procedure TfrmLog.tabBottleLogDragDrop(Sender, Source: TObject; X,
1228 var DestIndex: integer;
1230 with tabBottleLog do begin
1231 DestIndex := IndexOfTabAt(X, Y);
1232 Tabs.Move(FDragTabIndex, DestIndex);
1233 FBottleLogList.Move(FDragTabIndex, DestIndex);
1237 procedure TfrmLog.tabBottleLogEndDrag(Sender, Target: TObject; X,
1240 //
\8b
\90§
\93I
\82É
\83^
\83u
\82ð
\8dÄ
\95`
\89æ
\82³
\82¹
\82é
\81B
\98g
\90ü
\8fÁ
\82µ
\91Î
\8dô
1241 tabBottleLog.Tabs.BeginUpdate;
1242 tabBottleLog.Tabs.EndUpdate;
1245 procedure TfrmLog.LogLoadWork(Sender: TObject);
1247 if Sender = SelectedBottleLog then
1250 lvwLog.Items.Count := SelectedBottleLog.Count;
1254 procedure TfrmLog.lvwLogDrawItem(Sender: TCustomListView; Item: TListItem;
1255 Rect: TRect; State: TOwnerDrawState);
1263 Bottle := SelectedBottleLog.Bottles[Item.Index];
1264 if Bottle.HasURL = huUndefined then
1267 if ExtractURLs(Bottle.Script, nil, nil) then
1268 Bottle.HasURL := huYes
1270 Bottle.HasURL := huNo;
1276 //
\94w
\8ci
\8fÁ
\8b\8e
1277 ListView_GetItemRect(lvwLog.Handle, Item.Index, DestRect, LVIR_BOUNDS);
1279 //
\94w
\8ci
\82Ì
\90F
\82Í
\91I
\91ð
\8fó
\91Ô
\81E
\91I
\91ð
\94ñ
\83A
\83N
\83e
\83B
\83u
\8fó
\91Ô
\81E
\92Ê
\8fí
\8fó
\91Ô
\82Ì3
\92Ê
\82è
1280 lvwLog.Canvas.Brush.Style := bsSolid;
1281 if Item.Selected then begin
1282 if lvwLog.Focused then
1283 lvwLog.Canvas.Brush.Color := clHighlight
1285 lvwLog.Canvas.Brush.Color := clBtnFace;
1287 lvwLog.Canvas.Brush.Color := Pref.BgColor;
1289 lvwLog.Canvas.FillRect(DestRect);
1290 lvwLog.Canvas.Brush.Style := bsClear;
1291 //
\83t
\83H
\81[
\83J
\83X
\82ª
\82 \82é
\8fê
\8d\87\82É
\82Í
\83t
\83H
\81[
\83J
\83X
\82Ì
\98g
\90ü
\82ð
\88ø
\82
1292 if Item.Focused and lvwLog.Focused then
1293 lvwLog.Canvas.DrawFocusRect(DestRect);
1295 //
\83h
\83\89\83b
\83O
\92\86\82È
\82ç
\98g
\90ü
\82ð
\95`
\89æ
\82·
\82é
1296 if FLVDragDest = Item.Index then
1298 DestRect := Item.DisplayRect(drBounds);
1299 DrawListViewDragBorder(DestRect);
1302 if Item.Selected then
1304 if lvwLog.Focused then
1305 lvwLog.Canvas.Font.Color := clHighlightText
1307 lvwLog.Canvas.Font.Color := clWindowText;
1309 lvwLog.Canvas.Font.Color := Pref.TextColor;
1310 lvwLog.Canvas.Refresh;
1312 //
\83L
\83\83\83v
\83V
\83\87\83\93(
\93ú
\95t)
1313 ListView_GetItemRect(lvwLog.Handle, Item.Index, DestRect, LVIR_LABEL);
1314 Inc(DestRect.Left, 2);
1315 Inc(DestRect.Top, 2);
1316 Dec(DestRect.Right, 2);
1317 DrawTextEx(lvwLog.Canvas.Handle, PChar(Item.Caption), -1, DestRect,
1318 DT_SINGLELINE or DT_RIGHT, nil);
1319 ListView_GetItemRect(lvwLog.Handle, Item.Index, DestRect, LVIR_ICON);
1320 Ico := TIcon.Create;
1322 lvwLog.SmallImages.GetIcon(Item.ImageIndex, Ico);
1323 lvwLog.Canvas.Draw(DestRect.Left, DestRect.Top, Ico);
1327 //
\83L
\83\83\83v
\83V
\83\87\83\93\82Å
\82à
\83X
\83N
\83\8a\83v
\83g
\82Å
\82à
\82È
\82¢
\82à
\82Ì
1328 for sub := 0 to Item.SubItems.Count-1 do
1330 if sub = SubScript then Continue;
1331 ListView_GetSubItemRect(lvwLog.Handle, Item.Index, sub + 1,
1332 LVIR_BOUNDS, @DestRect);
1333 if DestRect.Right - DestRect.Left <= 16 then
1335 //
\8b·
\82·
\82¬
\82é
\8fê
\8d\87\82Í
\95¶
\8e\9a\97ñ
\82ð
\95`
\89æ
\82µ
\82È
\82¢
\81B
1336 // 16
\82Æ
\82¢
\82¤
\90\94\8e\9a\82Í
\8eÀ
\91ª
\92l
\81B
\89½
\82©
\82Ì
\83o
\83O
\82Á
\82Û
1337 lvwLog.Canvas.FillRect(DestRect);
1340 Inc(DestRect.Left, 2);
1341 Inc(DestRect.Top, 2);
1342 Dec(DestRect.Right, 2);
1343 Ex := DT_NOPREFIX or DT_SINGLELINE or DT_END_ELLIPSIS;
1344 if lvwLog.Columns[sub+1].Alignment = taRightJustify then
1345 Ex := Ex or DT_RIGHT;
1346 DrawTextEx(lvwLog.Canvas.Handle, PChar(Item.SubItems[sub]), -1, DestRect,
1349 //
\83X
\83N
\83\8a\83v
\83g
1350 ListView_GetSubItemRect(lvwLog.Handle, Item.Index, SubScript + 1,
1351 LVIR_BOUNDS, @DestRect);
1352 Script := Item.SubItems[SubScript];
1353 DrawSingleLineScript(Bottle, DestRect, Item);
1357 procedure TfrmLog.DrawSingleLineScript(LogItem: TLogItem;
1358 Rect: TRect; Item: TListItem);
1361 UnyuTalking, Synchronized, Spaced: boolean;
1362 Mark: TSsMarkUpType;
1365 procedure ScopeChange;
1367 if (not Spaced) and (Pref.LogListPreviewStyle = psTagStripped) then
1374 Script := LogItem.Script;
1377 if LogItem.HasURL = huYes then
1379 Ico := TIcon.Create;
1381 lvwLog.SmallImages.GetIcon(IconURL, Ico);
1382 lvwLog.Canvas.Draw(Rect.Left + x, Rect.Top, Ico);
1389 if Pref.LogListPreviewStyle = psNoColor then
1394 DrawTextEx(lvwLog.Canvas.Handle, PChar(Script), -1, Rect,
1395 DT_SINGLELINE or DT_END_ELLIPSIS or DT_NOPREFIX, nil);
1399 SsParser.LeaveEscape := Pref.LogListPreviewStyle = psNormal;
1400 SsParser.InputString := Script;
1402 UnyuTalking := false;
1403 Synchronized := false;
1404 Spaced := true; //
\83^
\83O
\8fÈ
\97ª
\95\
\8e¦
\8e\9e\82É
\95s
\95K
\97v
\82É
\83X
\83R
\81[
\83v
\95Ï
\8a·
\8e\9e\82Ì
\83X
\83y
\81[
\83X
\82ð
\8bó
\82¯
\82È
\82¢
1405 //
\82½
\82ß
\82Ì
\83t
\83\89\83O
1406 for i := 0 to SsParser.Count - 1 do begin
1407 if SsParser[i] = '\h' then
1409 UnyuTalking := false;
1411 end else if SsParser[i] = '\u' then
1413 UnyuTalking := true;
1415 end else if SsParser[i] = '\_s' then
1417 Synchronized := not Synchronized;
1419 end else if (Pos('\n', SsParser[i]) = 1) or (SsParser[i] = '\c') then
1423 Mark := SsParser.MarkUpType[i];
1427 lvwLog.Canvas.Font.Color := Pref.MetaWordColor;
1431 if Pref.LogListPreviewStyle = psNormal then
1432 lvwLog.Canvas.Font.Color := Pref.MarkUpColor
1438 lvwLog.Canvas.Font.Color := Pref.MarkErrorColor;
1441 if Synchronized then
1442 lvwLog.Canvas.Font.Color := Pref.TalkColorS
1443 else if UnyuTalking then
1444 lvwLog.Canvas.Font.Color := Pref.TalkColorU
1446 lvwLog.Canvas.Font.Color := Pref.TalkColorH;
1449 if Item.Selected then
1451 if lvwLog.Focused then
1452 lvwLog.Canvas.Font.Color := clHighlightText
1454 lvwLog.Canvas.Font.Color := clWindowText;
1456 lvwLog.Canvas.Refresh;
1457 w := lvwLog.Canvas.TextWidth(SsParser[i]);
1458 lvwLog.Canvas.TextRect(Rect, Rect.Left + x, Rect.Top + 2, SsParser[i]);
1460 if Rect.Right - Rect.Left < x then Break;
1464 procedure TfrmLog.mnListPreviewStyleClick(Sender: TObject);
1467 with PopupMenuListPreviewStyle do
1468 for i := 0 to Items.Count-1 do
1469 Items[i].Checked := (Sender as TMenuItem).Tag = Items[i].Tag;
1470 Pref.LogListPreviewStyle := TLogListPreviewStyle((Sender as TMenuItem).Tag);
1474 procedure TfrmLog.tbtnListPreviewStyleClick(Sender: TObject);
1477 sel := Ord(Pref.LogListPreviewStyle);
1479 if sel > Ord(High(TLogListPreviewStyle)) then sel := 0;
1480 Pref.LogListPreviewStyle := TLogListPreviewStyle(sel);
1484 procedure TfrmLog.PopupMenuListPreviewStylePopup(Sender: TObject);
1487 with PopupMenuListPreviewStyle do
1488 for i := 0 to Items.Count-1 do
1489 Items[i].Checked := Items[i].Tag = Ord(Pref.LogListPreviewStyle)
1492 procedure TfrmLog.PreviewStyleChange;
1494 if Pref.LogWindowPreviewStyle = psImageConversation then
1496 if Spps.Count = 0 then
1497 ShowMessage('
\83T
\81[
\83t
\83B
\83X
\83v
\83\8c\83r
\83\85\81[
\97p
\83v
\83\89\83O
\83C
\83\93\82ª
\91¶
\8dÝ
\82µ
\82Ü
\82¹
\82ñ
\81B');
1498 edtScript.Visible := false;
1499 TalkShowFrame.Visible := true;
1502 edtScript.Visible := true;
1503 TalkShowFrame.Visible := false;
1507 procedure TfrmLog.lvwLogDragOver(Sender, Source: TObject; X, Y: Integer;
1508 State: TDragState; var Accept: Boolean);
1512 Rec: TRect; //
\83_
\83~
\81[
\81B
1515 //
\82Æ
\82è
\82 \82¦
\82¸
\8eó
\82¯
\95t
\82¯
\82é
\89Â
\94\
\90«
\82ª
\82 \82é
\82Ì
\82ÍTBottleLogDragObject
\82¾
\82¯
1516 if not (Source is TBottleLogDragObject) then
1519 Target := lvwLog.GetItemAt(X, Y);
1521 //
\82±
\82ê
\88È
\91O
\82É
\95`
\89æ
\82³
\82ê
\82Ä
\82¢
\82½
\98g
\82Ì
\83C
\83\93\83f
\83b
\83N
\83X
1522 OldDest := FLVDragDest;
1524 //
\83h
\83\8d\83b
\83v
\88Ê
\92u
\82É Item
\82ª
\82 \82ê
\82Î
\83h
\83\8d\83b
\83v
\82ð
\8b\96\89Â
\82·
\82é
1525 if Target <> nil then
1528 FLVDragDest := Target.Index;
1535 //
\88È
\91O
\82Ì
\98g
\90ü
\82ð
\8dí
\8f\9c
1536 if (OldDest > -1) and (FLVDragDest <> OldDest) then
1538 Rec := lvwLog.Items[OldDest].DisplayRect(drBounds);
1539 DrawListViewDragBorder(Rec);
1541 //
\83h
\83\89\83b
\83O
\90æ
\82Ì
\98g
\90ü
\82ð
\95`
\89æ
1542 if (Target <> nil) and (FLVDragDest <> OldDest) then
1544 Rec := Target.DisplayRect(drBounds);
1545 DrawListViewDragBorder(Rec);
1548 //
\83X
\83N
\83\8d\81[
\83\8b\8aÖ
\8cW
1549 if lvwLog.Items.Count > 0 then
1551 if (lvwLog.topItem <> nil) and (Y - lvwLog.TopItem.Top < 10) then
1553 FLVScrollDir := lvScrollDown;
1554 if not timScrollTimer.Enabled then
1555 timScrollTimer.Enabled := true;
1556 end else if (lvwLog.Height - Y) < 10 then
1558 FLVScrollDir := lvScrollUp;
1559 if not timScrollTimer.Enabled then
1560 timScrollTimer.Enabled := true;
1563 timScrollTimer.Enabled := false;
1565 timScrollTimer.Enabled := false;
1568 procedure TfrmLog.lvwLogDragDrop(Sender, Source: TObject; X, Y: Integer);
1570 TargetItem: integer;
1571 Src: TBottleLogDragObject;
1574 timScrollTimer.Enabled := false;
1576 if not (Source is TBottleLogDragObject) then
1578 Src := Source as TBottleLogDragObject;
1580 if lvwLog.GetItemAt(X, Y) <> nil then
1581 TargetItem := lvwLog.GetItemAt(X, Y).Index
1585 lvwLog.Items.BeginUpdate; //
\83h
\83\8d\83b
\83v
\92\86\82Í
\95\
\8e¦
\82ð
\97}
\8e~
\82·
\82é
\81@
\8fd
\97v
\81I
1587 //
\83h
\83\8d\83b
\83v
\88Ê
\92u
\82É Item
\82ð
\88Ú
\93®
\82·
\82é
1588 if (GetAsyncKeyState(VK_CONTROL) and $8000) > 0 then
1589 begin //
\83R
\83s
\81[
\88Ú
\93®
\82Ì
\8fê
\8d\87
1590 SrcLog := TLogItem.Create(Src.LogItem);
1591 SelectedBottleLog.LogModified := true; //
\95Ï
\8dX
\88µ
\82¢
\82É
\82·
\82é
1592 end else //
\88Ú
\93®
\82¾
\82¯
\82·
\82é
\8fê
\8d\87
1594 SrcLog := Src.BottleLogList.Extract(Src.LogItem);
1595 //
\88Ú
\93®
\8c³
\82Æ
\88Ú
\93®
\90æ
\82ª
\88á
\82Á
\82Ä
\82¢
\82ê
\82Î
\97¼
\95û
\82Ì
\83t
\83\89\83O
\82ð
\97§
\82Ä
\82é
1596 if SelectedBottleLog.SelectedIndex <> Src.BottleLogList.SelectedIndex then
1598 Src.BottleLogList.LogModified := true; //
\88Ú
\93®
\8c³
1599 SelectedBottleLog.LogModified := true; //
\88Ú
\93®
\90æ
1602 if TargetItem >= 0 then
1604 //
\82·
\82Å
\82É
\91¶
\8dÝ
\82·
\82é
\83A
\83C
\83e
\83\80\82Ì
\8fã
\82É
\83h
\83\8d\83b
\83v
\82µ
\82½
\8fê
\8d\87
1605 SelectedBottleLog.Insert(TargetItem, SrcLog);
1608 // ListView
\82Ì
\97]
\94\92\82É
\83h
\83\8d\83b
\83v
\82µ
\82½
\8fê
\8d\87(Insert
\82Å
\82«
\82È
\82¢)
1609 TargetItem := SelectedBottleLog.Add(SrcLog);
1611 lvwLog.Items[TargetItem].Selected := true;
1612 lvwLog.Items[TargetItem].Focused := true;
1614 lvwLog.Items.EndUpdate;
1619 procedure TfrmLog.timScrollTimerTimer(Sender: TObject);
1621 ScrollHeight: Integer;
1623 //
\83X
\83N
\83\8d\81[
\83\8b\97Ê
\82ð
\8b\81\82ß
\82é
1625 if lvwLog.Items.Count > 2 then
1627 ScrollHeight := lvwLog.Items[1].Top - lvwLog.Items[0].Top;
1630 case FLVScrollDir of
1631 lvScrollUp: lvwLog.Scroll(0, ScrollHeight);
1632 lvSCrollDown: lvwLog.Scroll(0, -ScrollHeight);
1634 lvwLog.Invalidate; //
\8dÅ
\90V
\82Ì
\8fó
\91Ô
\82É
\8dÄ
\95`
\89æ
\82·
\82é
1638 procedure TfrmLog.mnChangeTabNameClick(Sender: TObject);
1641 Name := (FBottleLogList[tabBottleLog.Tag] as TBottleLogList).Title;
1642 InputQuery('
\96¼
\91O
\82Ì
\95Ï
\8dX', '
\90V
\82µ
\82¢
\83^
\83u
\82Ì
\96¼
\91O', Name);
1643 (FBottleLogList[tabBottleLog.Tag] as TBottleLogList).Title := Name;
1647 procedure TfrmLog.lvwLogStartDrag(Sender: TObject;
1648 var DragObject: TDragObject);
1649 var Drag: TBottleLogDragObject;
1651 //
\92Ê
\8fí
\82ÌListView
\97p
\82Ì
\83h
\83\89\83b
\83O
\83I
\83u
\83W
\83F
\83N
\83g
\82Í
1652 // OS
\82É
\82æ
\82Á
\82Ä
\82Í
\81A
\88Ú
\93®
\82·
\82é
\82Æ
\82«
\82É
\83A
\83C
\83e
\83\80\82Ì
\83C
\83\81\81[
\83W
\82ð
\94¼
\93§
\96¾
\82Å
\95`
\89æ
\82µ
\82Ä
\82µ
\82Ü
\82¤
\81B
1653 // TDragObject
\82©
\82ç
\92¼
\90Ú
\8cp
\8f³
\82µ
\82½
\82¾
\82¯
\82Ì
\82à
\82Ì(
\83C
\83\81\81[
\83W
\82ð
\8e\9d\82Á
\82Ä
\82¢
\82È
\82¢)
\82ð
\8eg
\82¤
\82Æ
1654 //
\94¼
\93§
\96¾
\83C
\83\81\81[
\83W
\82Ì
\95`
\89æ
\82Í
\97}
\90§
\82Å
\82«
\82é
\81B
1655 Drag := TBottleLogDragObject.Create(lvwLog);
1656 Drag.BottleLogList := SelectedBottleLog;
1657 Drag.LogItem := SelectedBottleLog.Bottles[lvwLog.Selected.Index];
1661 procedure TfrmLog.lvwLogEndDrag(Sender, Target: TObject; X, Y: Integer);
1663 //
\98g
\90ü
\8fÁ
\82µ
\97p
\82É
\8b
\90§
\93I
\82É
\8dÄ
\95`
\89æ
\82³
\82¹
\82é
1664 timScrollTimer.Enabled := false;
1669 procedure TfrmLog.DrawListViewDragBorder(const Rect: TRect);
1673 InflateRect(Rec, -1, -1);
1674 with lvwLog.Canvas do
1678 Brush.Style := bsClear;
1679 Refresh; //
\95K
\97v
1684 function TfrmLog.DoSaveLogXML(Log: TBottleLogList): integer;
1689 SaveDialog.FileName := GetDefaultFileName(Log.Title, '.xml');
1690 SaveDialog.InitialDir := Pref.LogDir;
1691 SaveDialog.DefaultExt := 'xml';
1692 SaveDialog.FilterIndex := 3;
1693 if SaveDialog.Execute then
1694 Log.SaveToXmlFile(SaveDialog.FileName)
1700 procedure TfrmLog.DoCloseTab(const Index: integer; FCheck: boolean);
1703 PrevSelection: TBottleLogList; //
\95Â
\82¶
\82½
\82Æ
\82«
\83^
\83u
\82ª
\82¸
\82ê
\82È
\82¢
\82æ
\82¤
\82É
\82·
\82é
\8f\88\97\9d\97p
1706 if Pref.ConfirmOnTabClose and FCheck then
1708 Confirm := Format('
\83^
\83u"%s"
\82ð
\95Â
\82¶
\82Ü
\82·
\82©?', [(FBottleLogList[Index] as TBottleLogList).Title]);
1709 if MessageDlg(Confirm, mtConfirmation, mbOkCancel, 0) = mrCancel then
1712 if CheckLogSave(Index) = idCancel then exit; //
\83\8d\83O
\82Ì
\95Û
\91¶
\8am
\94F
1713 PrevSelection := SelectedBottleLog;
1714 FBottleLogList.Delete(Index);
1716 //
\83^
\83u
\82¸
\82ê
\96h
\8e~
\8f\88\97\9d
1717 for i := 0 to FBottleLogList.Count-1 do
1718 if FBottleLogList[i] = PrevSelection then
1719 tabBottleLog.TabIndex := i;
1721 lvwLogChange(Self, nil, ctState);
1724 procedure TfrmLog.HTMLOutputWork(Sender: TObject; const Count: integer;
1725 var Canceled: boolean);
1727 frmHTMLOutputProgress.ProgressBar.Position := Count;
1728 Application.ProcessMessages;
1729 if frmHTMLOutputProgress.Canceled then
1733 function TfrmLog.DoSearchLog(Condition: TSearchCond): TBottleLogList;
1734 var i, UntilIndex: integer;
1736 Result := TBottleLogList.Create('
\8c\9f\8dõ
\8c\8b\89Ê');
1737 if Condition.SearchLogRange in [srSelectedLogList, srAboveSelectedLog] then
1739 if SelectedBottleLog = nil then
1741 ShowMessage('
\8c\9f\8dõ
\91Î
\8fÛ
\82ª
\82 \82è
\82Ü
\82¹
\82ñ');
1747 if Condition.SearchLogRange = srSelectedLogList then
1749 else if lvwLog.Selected = nil then
1752 UntilIndex := lvwLog.Selected.Index;
1753 SearchLogIndivisual(Condition, SelectedBottleLog, Result, UntilIndex);
1755 end else if Condition.SearchLogRange = srAllLogLists then
1757 for i := 0 to BottleLogList.Count-1 do
1759 SearchLogIndivisual(Condition, BottleLogList[i] as TBottleLogList,
1764 if Result.Count = 0 then
1765 Result.AddSystemLog('
\8c©
\82Â
\82©
\82è
\82Ü
\82¹
\82ñ
\82Å
\82µ
\82½
\81B');
1768 procedure TfrmLog.SearchLogIndivisual(Condition: TSearchCond; LogList,
1769 Result: TBottleLogList; UntilIndex: integer = -1);
1772 Bottle, New: TLogItem;
1775 // 1
\8cÂ
\82Ì
\83\8d\83O
\83^
\83u
\82É
\91Î
\82µ
\82Ä
\8c\9f\8dõ
\82ð
\82©
\82¯
\82é
\81BUntilIndex
\82Å
\94Í
\88Í
\8ew
\92è(
\8fÈ
\97ª
\8e\9e\82»
\82Ì
\83^
\83u
\91S
\91Ì)
1776 if UntilIndex >= 0 then
1779 Max := LogList.Count-1;
1780 for i := 0 to Max do
1782 //
\8fð
\8c\8f\94»
\92è
1783 Bottle := LogList.Bottles[i];
1784 if Bottle.LogType <> ltBottle then
1787 //
\83X
\83N
\83\8a\83v
\83g
\83p
\83^
\81[
\83\93\82Å
\89ð
\90Í
1788 if Condition.ScriptPattern <> '' then
1790 if Condition.ScriptRegExp then
1793 if not RegExp.Match(Condition.ScriptPattern, Bottle.Script) then
1797 Ok := false; //
\96
\82È
\90³
\8bK
\95\
\8c»
\82ð
\8fR
\82é
1801 if not AnsiContainsText(Bottle.Script, Condition.ScriptPattern) then
1805 //
\83`
\83\83\83\93\83l
\83\8b\96¼
\81A
\83S
\81[
\83X
\83g
\96¼
\81A
\93\8a\95[
\93¯
\88Ó
1806 if Condition.Channel <> '' then
1807 if not AnsiContainsText(Bottle.Channel, Condition.Channel) then
1809 if Condition.Ghost <> '' then
1810 if not AnsiContainsText(Bottle.Ghost, Condition.Ghost) then
1812 if Condition.MinVote > Bottle.Votes then
1814 if Condition.MinAgree > Bottle.Agrees then
1816 //
\8fð
\8c\8f\82É
\88ê
\92v
\82µ
\82½
\82à
\82Ì
\82ð
\8c\8b\89Ê
\83\8a\83X
\83g
\82É
\92Ç
\89Á
1819 New := TLogItem.Create(Bottle); //
\83R
\83s
\81[
\83R
\83\93\83X
\83g
\83\89\83N
\83^
1820 New.State := lsOpened;
1826 { TBottleLogDragObject }
1828 function TBottleLogDragObject.GetDragImages: TDragImageList;
1830 //
\92\86\93r
\94¼
\92[
\82È
\83h
\83\89\83b
\83O
\83C
\83\81\81[
\83W
\82ð
\95\
\8e¦
\82µ
\82È
\82¢
\82æ
\82¤
\82É
\82·
\82é
1834 procedure TBottleLogDragObject.SetBottleLogList(
1835 const Value: TBottleLogList);
1837 FBottleLogList := Value;
1840 procedure TBottleLogDragObject.SetLogItem(const Value: TLogItem);
1845 procedure TfrmLog.mnTabSaveXMLLogClick(Sender: TObject);
1847 DoSaveLogXML(FBottleLogList[tabBottleLog.Tag] as TBottleLogList);
1850 procedure TfrmLog.mnSaveHTMLClick(Sender: TObject);
1852 LogList, SB: TBottleLogList;
1854 Options: THTMLOutputOptions;
1856 SB := SelectedBottleLog;
1859 if SB.Count = 0 then
1861 Application.CreateForm(TfrmHTMLOutputConfig, frmHTMLOutputConfig);
1862 with frmHTMLOutputConfig do
1864 // Show HTML save option dialog
1867 LogList := TBottleLogList.Create('');
1871 for i := SB.Count-1 downto 0 do
1872 if SB.Bottles[i].LogType = ltBottle then
1873 LogList.Add(TLogItem.Create(SB.Bottles[i]));
1875 if SB.Bottles[lvwLog.Selected.Index].LogType = ltBottle then
1876 LogList.Add(TLogItem.Create(SB.Bottles[lvwLog.Selected.Index]))
1878 ShowMessage('
\82±
\82Ì
\83\81\83b
\83Z
\81[
\83W
\82Í
\95Û
\91¶
\82Å
\82«
\82Ü
\82¹
\82ñ');
1880 for i := lvwLog.Selected.Index downto 0 do
1881 if SB.Bottles[i].LogType = ltBottle then
1882 LogList.Add(TLogItem.Create(SB.Bottles[i]));
1884 Options.ImageDir := ImageDir;
1885 Options.UseColor := UseColor;
1886 Options.ImageType := ImageType;
1887 Application.CreateForm(TfrmHTMLOutputProgress, frmHTMLOutputProgress);
1889 frmHTMLOutputProgress.Show;
1890 LogList.OnHTMLOutputWork := HTMLOutputWork;
1891 LogList.SaveToHTML(FileName, Options, SsParser);
1893 frmHTMLOutputProgress.Release;
1903 procedure TfrmLog.mnPopupCopyGhostClick(Sender: TObject);
1908 Log := SelectedBottleLog.Bottles[frmLog.lvwLog.Selected.Index];
1909 if Log = nil then Exit;
1910 Clip := ClipBoard();
1911 Clip.SetTextBuf(PChar(Log.Ghost));
1914 function TfrmLog.CheckLog(Sender: TObject): integer;
1918 //
\91S
\82Ä
\82Ì
\83\8a\83X
\83g
\81i
\83^
\83u
\81j
\83`
\83F
\83b
\83N
\82·
\82é
1919 // frmSender
\82©
\82ç
\8fI
\97¹
\8e\9e\82É
\8cÄ
\82Ñ
\8fo
\82³
\82ê
\82é
1921 for i := BottleLogList.Count-1 downto 0 do
1923 Res := CheckLogSave(i);
1924 if Res = idCancel then break;
1925 DoCloseTab(i, false);
1930 function TfrmLog.CheckLogSave(const Index: integer): integer;
1935 //
\83\8a\83X
\83g
\82ð
\83`
\83F
\83b
\83N
\82µ
\81A
\95Û
\91¶
\8f\88\97\9d\82ð
\8cÄ
\82Ñ
\8fo
\82·
1937 if (BottleLogList[Index] as TBottleLogList).LogModified then
1939 Confirm := Format('
\83^
\83u"%s"
\82Ì
\93à
\97e
\82Í
\95Ï
\8dX
\82³
\82ê
\82Ä
\82¢
\82Ü
\82·
\81B'#13#10#13#10 +
1940 '
\95Û
\91¶
\82µ
\82Ü
\82·
\82©
\81H', [(FBottleLogList[Index] as TBottleLogList).Title]);
1941 Res := MessageDlg(Confirm, mtConfirmation, mbYesNoCancel, 0);
1943 Res := DoSaveLogXML(FBottleLogList[Index] as TBottleLogList);
1945 (BottleLogList[Index] as TBottleLogList).LogModified := false;
1950 procedure TfrmLog.mnTestActionClick(Sender: TObject);
1952 //
\82±
\82±
\82©
\82ç
\83A
\83N
\83V
\83\87\83\93
1953 Screen.Cursor := crHourGlass;
1954 frmSender.LogInsertCue(true, false); //
\83A
\83N
\83V
\83\87\83\93\83e
\83X
\83g
\81i
\98A
\91±
\8dÄ
\90¶
\81j
1955 Screen.Cursor := crDefault;
1958 procedure TfrmLog.mnSelActionClick(Sender: TObject);
1960 //
\92P
\91Ì
\83A
\83N
\83V
\83\87\83\93
1964 procedure TfrmLog.mnAllActionClick(Sender: TObject);
1966 //
\82±
\82Ì
\83^
\83u
\93à
\91S
\82Ä
\83A
\83N
\83V
\83\87\83\93
1967 Screen.Cursor := crHourGlass;
1968 frmSender.LogInsertCue(true, true); //
\83A
\83N
\83V
\83\87\83\93\83e
\83X
\83g
\81i
\98A
\91±
\8dÄ
\90¶
\81\95\91S
\82Ä
\81j
1969 Screen.Cursor := crDefault;
1972 procedure TfrmLog.LoadSAXLoader(FileName: String);
1973 var Stream : TMemoryStream;
1974 Input : IInputSource;
1975 XMLReader : IXMLReader;
1976 XMLBufReader: IBufferedXMLReader;
1978 ContentHandler: IContentHandler;
1985 FNowOpenFileName := ExtractFileName(FileName);
1986 ContentHandler:= SAXContentHandler1;
1987 Stream := TMemoryStream.Create();
1989 Stream.LoadFromFile(FileName);
1990 // We must reset the stream!
1992 // Now we can create a StreamInputSource. We don't need to free the
1993 // Stream we are passing to it.
1994 Input:= TStreamInputSource.Create(Stream) as IStreamInputSource;
1995 // Get the Default SAX Vendor and XML Reader
1996 Vendor:= GetSAXVendor('MSXML'); // MSXML
\82ð
\97\98\97p
\82·
\82é(
\97v:SAX_WIDESTRINGS)
1997 if Vendor is TBufferedSAXVendor then
1999 XMLBufReader:= TBufferedSAXVendor(Vendor).BufferedXMLReader;
2000 XMLBufReader.setContentHandler(Adapt(ContentHandler, XMLBufReader));
2001 XMLBufReader.setErrorHandler(SAXErrorHandler1);
2002 // This time we send the InputSource we created
2003 XMLBufReader.parse(Input);
2007 XMLReader:= Vendor.XMLReader;
2008 XMLReader.setContentHandler(ContentHandler);
2009 XMLReader.setErrorHandler(SAXErrorHandler1);
2010 // This time we send the InputSource we created
2011 XMLReader.parse(Input);
2015 FCurrLocator := nil;
2016 Stream.Free; //
\83\81\83\82\83\8a\8aJ
\95ú
2020 procedure TfrmLog.LoadSAXItemReset;
2032 procedure TfrmLog.SAXErrorHandler1Error(Sender: TObject;
2033 const Error: ISAXParseError);
2035 frmLog.AddCurrentSystemLog('SAX', '[Error] ' + Error.getMessage + ' Line ' +
2036 IntToStr(Error.getLineNumber) + ' Column ' + IntToStr(Error.getColumnNumber));
2039 procedure TfrmLog.SAXErrorHandler1FatalError(Sender: TObject;
2040 const Error: ISAXParseError);
2042 frmLog.AddCurrentSystemLog('SAX', '[Fatal Error] ' + Error.getMessage + ' Line ' +
2043 IntToStr(Error.getLineNumber) + ' Column ' + IntToStr(Error.getColumnNumber));
2046 procedure TfrmLog.SAXErrorHandler1Warning(Sender: TObject;
2047 const Error: ISAXParseError);
2049 frmLog.AddCurrentSystemLog('SAX', '[Warning] ' + Error.getMessage + ' Line ' +
2050 IntToStr(Error.getLineNumber) + ' Column ' + IntToStr(Error.getColumnNumber));
2053 procedure TfrmLog.SAXContentHandler1Characters(Sender: TObject;
2054 const PCh: WideString);
2056 //
\83\8d\83O
\8fî
\95ñ
\93Ç
\82Ý
\8eæ
\82è
2057 // &
\93\99\82Å
\95ª
\89ð
\82³
\82ê
\82é
\82Ì
\82Å
\8c\8b\8d\87\82·
\82é
\95K
\97v
\82ª
\82 \82é
2058 if(not FReadElm)then Exit; //
\83\8d\83O
\8fî
\95ñ
\88È
\8aO
\82Í
\96³
\8e\8b
2059 if(FNowNode = 'date')then
2061 if(FNowNode = 'channel')then
2062 FsChannel := FsChannel + PCh;
2063 if(FNowNode = 'script')then
2064 FsScript := FsScript + PCh;
2065 if(FNowNode = 'votes')then
2067 if(FNowNode = 'agrees')then
2069 if(FNowNode = 'ghost')then
2070 FsGhost := FsGhost + Pch;
2073 procedure TfrmLog.SAXContentHandler1EndElement(Sender: TObject;
2074 const NamespaceURI, LocalName, QName: WideString);
2075 var Time: TDateTime;
2077 if(qName = 'message')then
2079 FReadMess := false; //
\83\8d\83O
\8fî
\95ñ
\8fI
\82í
\82è
2081 if(FIcount = 6 )then
2083 TryStrToDateTime(Trim(FsDate), Time);
2085 BottleLogTitled(FNowOpenFileName + '_SAX').AddScriptLog(FsScript, FsChannel,
2086 FsMID, FsGhost, Time, StrToIntDef(FsVotes, 0), StrToIntDef(FsAgrees, 0));
2087 LoadSAXItemReset; //
\83\8d\83O
\8fî
\95ñ
\83N
\83\8a\83A
2089 frmLog.AddCurrentSystemLog('SAX', '[err]
\83G
\83\8c\83\81\83\93\83g
\90\94>' + intToStr(FIcount))
2091 FReadElm := false; //
\83^
\83O
\8fI
\97¹
2094 procedure TfrmLog.SAXContentHandler1SetDocumentLocator(Sender: TObject;
2095 const Locator: ILocator);
2097 // Save the locator, this happens before any other content events
2098 FCurrLocator:= Locator;
2101 procedure TfrmLog.SAXContentHandler1StartElement(Sender: TObject;
2102 const NamespaceURI, LocalName, QName: WideString;
2103 const Atts: IAttributes);
2105 FNowNode := qName; //
\8d¡
\8c©
\82Ä
\82¢
\82é
\83m
\81[
\83h
2106 if(qName = 'bottlelog')then // EndElment
\82Å
\83`
\83F
\83b
\83N
\82µ
\82Ä
\82¢
\82È
\82¢
2108 if(Atts.getValue('version') <> '1.0')then
2109 frmLog.AddCurrentSystemLog('SAX', '[version err] ' + Atts.getValue('version'));
2110 end else if(qName = 'message')then
2112 FReadMess := true; //
\83\8d\83O
\8fî
\95ñ
\93Ç
\82Ý
\8d\9e\82ÝON
2113 FsMid := Atts.getValue('mid');
2114 end else if((qName = 'date')
2115 or (qName = 'channel')
2116 or (qName = 'script')
2117 or (qName = 'votes')
2118 or (qName = 'agrees')
2119 or (qName = 'ghost'))then
2121 FReadElm := true; //
\83^
\83O
\8aJ
\8en
2124 frmLog.AddCurrentSystemLog('SAX', '[err]
\95s
\96¾
\82È
\83G
\83\8c\83\81\83\93\83g ' + qName);
2127 procedure TfrmLog.tbtOpenSAXLogClick(Sender: TObject);
2130 OpenDialog.InitialDir := Pref.LogDir;
2131 if OpenDialog.Execute then begin
2132 for i := 0 to OpenDialog.Files.Count-1 do begin
2133 //
\83X
\83\8c\83b
\83g
\82Å
\82È
\82¢
\82Ì
\82Å
\91¼
\82Ì
\8f\88\97\9d\82ª
\82Å
\82«
\82È
\82¢
2134 LoadSAXLoader(OpenDialog.Files[i]);