+procedure TfrmLog.tabBottleLogEndDrag(Sender, Target: TObject; X,
+ Y: Integer);
+begin
+ //\8b\90§\93I\82É\83^\83u\82ð\8dÄ\95`\89æ\82³\82¹\82é\81B\98g\90ü\8fÁ\82µ\91Î\8dô
+ tabBottleLog.Tabs.BeginUpdate;
+ tabBottleLog.Tabs.EndUpdate;
+end;
+
+procedure TfrmLog.LogLoadWork(Sender: TObject);
+begin
+ if Sender = SelectedBottleLog then
+ begin
+ lvwLog.Invalidate;
+ lvwLog.Items.Count := SelectedBottleLog.Count;
+ end;
+end;
+
+procedure TfrmLog.lvwLogDrawItem(Sender: TCustomListView; Item: TListItem;
+ Rect: TRect; State: TOwnerDrawState);
+var
+ DestRect: TRect;
+ Script: String;
+ Ico: TIcon;
+ sub, Ex: integer;
+ Bottle: TLogItem;
+ DummyStr: TStringList;
+begin
+ Bottle := SelectedBottleLog.Bottles[Item.Index];
+ if Bottle.HasURL = huUndefined then
+ begin
+ DummyStr := TStringList.Create;
+ try
+ ExtractURLs(Bottle.Script, DummyStr);
+ if DummyStr.Count > 0 then
+ Bottle.HasURL := huYes
+ else
+ Bottle.HasURL := huNo;
+ finally
+ DummyStr.Free;
+ end;
+ end;
+
+ // \94w\8ci\8fÁ\8b\8e
+ ListView_GetItemRect(lvwLog.Handle, Item.Index, DestRect, LVIR_BOUNDS);
+
+ // \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è
+ lvwLog.Canvas.Brush.Style := bsSolid;
+ if Item.Selected then begin
+ if lvwLog.Focused then
+ lvwLog.Canvas.Brush.Color := clHighlight
+ else
+ lvwLog.Canvas.Brush.Color := clBtnFace;
+ end else begin
+ lvwLog.Canvas.Brush.Color := Pref.BgColor;
+ end;
+ lvwLog.Canvas.FillRect(DestRect);
+ lvwLog.Canvas.Brush.Style := bsClear;
+ // \83t\83H\81[\83J\83X\82ª\82 \82é\8fê\8d\87\82É\82Í\83t\83H\81[\83J\83X\82Ì\98g\90ü\82ð\88ø\82
+ if Item.Focused and lvwLog.Focused then
+ lvwLog.Canvas.DrawFocusRect(DestRect);
+
+ // \83h\83\89\83b\83O\92\86\82È\82ç\98g\90ü\82ð\95`\89æ\82·\82é
+ if FLVDragDest = Item.Index then
+ begin
+ DestRect := Item.DisplayRect(drBounds);
+ DrawListViewDragBorder(DestRect);
+ end;
+
+ if Item.Selected then
+ begin
+ if lvwLog.Focused then
+ lvwLog.Canvas.Font.Color := clHighlightText
+ else
+ lvwLog.Canvas.Font.Color := clWindowText;
+ end else
+ lvwLog.Canvas.Font.Color := Pref.TextColor;
+ lvwLog.Canvas.Refresh;
+
+ // \83L\83\83\83v\83V\83\87\83\93(\93ú\95t)
+ ListView_GetItemRect(lvwLog.Handle, Item.Index, DestRect, LVIR_LABEL);
+ Inc(DestRect.Left, 2);
+ Inc(DestRect.Top, 2);
+ Dec(DestRect.Right, 2);
+ DrawTextEx(lvwLog.Canvas.Handle, PChar(Item.Caption), -1, DestRect,
+ DT_SINGLELINE or DT_RIGHT, nil);
+ ListView_GetItemRect(lvwLog.Handle, Item.Index, DestRect, LVIR_ICON);
+ Ico := TIcon.Create;
+ try
+ lvwLog.SmallImages.GetIcon(Item.ImageIndex, Ico);
+ lvwLog.Canvas.Draw(DestRect.Left, DestRect.Top, Ico);
+ finally
+ Ico.Free;
+ end;
+ // \83L\83\83\83v\83V\83\87\83\93\82Å\82à\83X\83N\83\8a\83v\83g\82Å\82à\82È\82¢\82à\82Ì
+ for sub := 0 to Item.SubItems.Count-1 do
+ begin
+ if sub = SubScript then Continue;
+ ListView_GetSubItemRect(lvwLog.Handle, Item.Index, sub + 1,
+ LVIR_BOUNDS, @DestRect);
+ if DestRect.Right - DestRect.Left <= 16 then
+ begin
+ // \8b·\82·\82¬\82é\8fê\8d\87\82Í\95¶\8e\9a\97ñ\82ð\95`\89æ\82µ\82È\82¢\81B
+ // 16\82Æ\82¢\82¤\90\94\8e\9a\82Í\8eÀ\91ª\92l\81B\89½\82©\82Ì\83o\83O\82Á\82Û
+ lvwLog.Canvas.FillRect(DestRect);
+ Continue;
+ end;
+ Inc(DestRect.Left, 2);
+ Inc(DestRect.Top, 2);
+ Dec(DestRect.Right, 2);
+ Ex := DT_NOPREFIX or DT_SINGLELINE or DT_END_ELLIPSIS;
+ if lvwLog.Columns[sub+1].Alignment = taRightJustify then
+ Ex := Ex or DT_RIGHT;
+ DrawTextEx(lvwLog.Canvas.Handle, PChar(Item.SubItems[sub]), -1, DestRect,
+ Ex, nil);
+ end;
+ // \83X\83N\83\8a\83v\83g
+ ListView_GetSubItemRect(lvwLog.Handle, Item.Index, SubScript + 1,
+ LVIR_BOUNDS, @DestRect);
+ Script := Item.SubItems[SubScript];
+ DrawSingleLineScript(Bottle, DestRect, Item);
+
+end;
+
+procedure TfrmLog.DrawSingleLineScript(LogItem: TLogItem;
+ Rect: TRect; Item: TListItem);
+var
+ i, x, w: integer;
+ UnyuTalking, Synchronized, Spaced: boolean;
+ Mark: TSsMarkUpType;
+ Script: String;
+ Ico: TIcon;
+ procedure ScopeChange;
+ begin
+ if (not Spaced) and (Pref.LogListPreviewStyle = psTagStripped) then
+ begin
+ Inc(x, 7);
+ Spaced := true;
+ end;
+ end;
+begin
+ Script := LogItem.Script;
+ x := 3;
+
+ if LogItem.HasURL = huYes then
+ begin
+ Ico := TIcon.Create;
+ try
+ lvwLog.SmallImages.GetIcon(IconURL, Ico);
+ lvwLog.Canvas.Draw(Rect.Left + x, Rect.Top, Ico);
+ Inc(x, 20);
+ finally
+ Ico.Free;
+ end;
+ end;
+
+ if Pref.LogListPreviewStyle = psNoColor then
+ begin
+ Inc(Rect.Left, x);
+ Inc(Rect.Top, 2);
+ Dec(Rect.Right, 2);
+ DrawTextEx(lvwLog.Canvas.Handle, PChar(Script), -1, Rect,
+ DT_SINGLELINE or DT_END_ELLIPSIS or DT_NOPREFIX, nil);
+ Exit;
+ end;
+
+ SsParser.LeaveEscape := Pref.LogListPreviewStyle = psNormal;
+ SsParser.InputString := Script;
+
+ UnyuTalking := false;
+ Synchronized := false;
+ 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¢
+ // \82½\82ß\82Ì\83t\83\89\83O
+ for i := 0 to SsParser.Count - 1 do begin
+ if SsParser[i] = '\h' then
+ begin
+ UnyuTalking := false;
+ ScopeChange;
+ end else if SsParser[i] = '\u' then
+ begin
+ UnyuTalking := true;
+ ScopeChange;
+ end else if SsParser[i] = '\_s' then
+ begin
+ Synchronized := not Synchronized;
+ ScopeChange;
+ end else if (Pos('\n', SsParser[i]) = 1) or (SsParser[i] = '\c') then
+ begin
+ ScopeChange;
+ end;
+ Mark := SsParser.MarkUpType[i];
+ case Mark of
+ mtMeta:
+ begin
+ lvwLog.Canvas.Font.Color := Pref.MetaWordColor;
+ Spaced := false;
+ end;
+ mtTag:
+ if Pref.LogListPreviewStyle = psNormal then
+ lvwLog.Canvas.Font.Color := Pref.MarkUpColor
+ else
+ begin
+ Continue;
+ end;
+ mtTagErr:
+ lvwLog.Canvas.Font.Color := Pref.MarkErrorColor;
+ else begin
+ Spaced := false;
+ if Synchronized then
+ lvwLog.Canvas.Font.Color := Pref.TalkColorS
+ else if UnyuTalking then
+ lvwLog.Canvas.Font.Color := Pref.TalkColorU
+ else
+ lvwLog.Canvas.Font.Color := Pref.TalkColorH;
+ end;
+ end;
+ if Item.Selected then
+ begin
+ if lvwLog.Focused then
+ lvwLog.Canvas.Font.Color := clHighlightText
+ else
+ lvwLog.Canvas.Font.Color := clWindowText;
+ end;
+ lvwLog.Canvas.Refresh;
+ w := lvwLog.Canvas.TextWidth(SsParser[i]);
+ lvwLog.Canvas.TextRect(Rect, Rect.Left + x, Rect.Top + 2, SsParser[i]);
+ x := x + w;
+ if Rect.Right - Rect.Left < x then Break;
+ end;
+end;
+
+procedure TfrmLog.mnListPreviewStyleClick(Sender: TObject);
+var i: integer;
+begin
+ with PopupMenuListPreviewStyle do
+ for i := 0 to Items.Count-1 do
+ Items[i].Checked := (Sender as TMenuItem).Tag = Items[i].Tag;
+ Pref.LogListPreviewStyle := TLogListPreviewStyle((Sender as TMenuItem).Tag);
+ lvwLog.Invalidate;
+end;
+
+procedure TfrmLog.tbtnListPreviewStyleClick(Sender: TObject);
+var sel: integer;
+begin
+ sel := Ord(Pref.LogListPreviewStyle);
+ sel := sel + 1;
+ if sel > Ord(High(TLogListPreviewStyle)) then sel := 0;
+ Pref.LogListPreviewStyle := TLogListPreviewStyle(sel);
+ lvwLog.Invalidate;
+end;
+
+procedure TfrmLog.PopupMenuListPreviewStylePopup(Sender: TObject);
+var i: integer;
+begin
+ with PopupMenuListPreviewStyle do
+ for i := 0 to Items.Count-1 do
+ Items[i].Checked := Items[i].Tag = Ord(Pref.LogListPreviewStyle)
+end;
+
+procedure TfrmLog.PreviewStyleChange;
+begin
+ if Pref.LogWindowPreviewStyle = psImageConversation then
+ begin
+ if Spps.Count = 0 then
+ 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');
+ edtScript.Visible := false;
+ TalkShowFrame.Visible := true;
+ end else
+ begin
+ edtScript.Visible := true;
+ TalkShowFrame.Visible := false;
+ end;
+end;
+
+procedure TfrmLog.lvwLogDragOver(Sender, Source: TObject; X, Y: Integer;
+ State: TDragState; var Accept: Boolean);
+var
+ Target: TListItem;
+ OldDest: integer;
+ Rec: TRect; // \83_\83~\81[\81B
+begin
+ Accept := False;
+ // \82Æ\82è\82 \82¦\82¸\8eó\82¯\95t\82¯\82é\89Â\94\\90«\82ª\82 \82é\82Ì\82ÍTBottleLogDragObject\82¾\82¯
+ if not (Source is TBottleLogDragObject) then
+ Exit;
+
+ Target := lvwLog.GetItemAt(X, Y);
+
+ // \82±\82ê\88È\91O\82É\95`\89æ\82³\82ê\82Ä\82¢\82½\98g\82Ì\83C\83\93\83f\83b\83N\83X
+ OldDest := FLVDragDest;
+
+ // \83h\83\8d\83b\83v\88Ê\92u\82É Item \82ª\82 \82ê\82Î\83h\83\8d\83b\83v\82ð\8b\96\89Â\82·\82é
+ if Target <> nil then
+ begin
+ Accept := true;
+ FLVDragDest := Target.Index;
+ end else
+ begin
+ Accept := true;
+ FLVDragDest := -1;
+ end;
+
+ // \88È\91O\82Ì\98g\90ü\82ð\8dí\8f\9c
+ if (OldDest > -1) and (FLVDragDest <> OldDest) then
+ begin
+ Rec := lvwLog.Items[OldDest].DisplayRect(drBounds);
+ DrawListViewDragBorder(Rec);
+ end;
+ // \83h\83\89\83b\83O\90æ\82Ì\98g\90ü\82ð\95`\89æ
+ if (Target <> nil) and (FLVDragDest <> OldDest) then
+ begin
+ Rec := Target.DisplayRect(drBounds);
+ DrawListViewDragBorder(Rec);
+ end;
+
+ // \83X\83N\83\8d\81[\83\8b\8aÖ\8cW
+ if lvwLog.Items.Count > 0 then
+ begin
+ if (lvwLog.topItem <> nil) and (Y - lvwLog.TopItem.Top < 10) then
+ begin
+ FLVScrollDir := lvScrollDown;
+ if not timScrollTimer.Enabled then
+ timScrollTimer.Enabled := true;
+ end else if (lvwLog.Height - Y) < 10 then
+ begin
+ FLVScrollDir := lvScrollUp;
+ if not timScrollTimer.Enabled then
+ timScrollTimer.Enabled := true;
+ end
+ else
+ timScrollTimer.Enabled := false;
+ end else
+ timScrollTimer.Enabled := false;
+end;
+
+procedure TfrmLog.lvwLogDragDrop(Sender, Source: TObject; X, Y: Integer);
+var
+ TargetItem: integer;
+ Src: TBottleLogDragObject;
+ SrcLog: TObject;
+begin
+ timScrollTimer.Enabled := false;
+
+ if not (Source is TBottleLogDragObject) then
+ Exit;
+ Src := Source as TBottleLogDragObject;
+
+ if lvwLog.GetItemAt(X, Y) <> nil then
+ TargetItem := lvwLog.GetItemAt(X, Y).Index
+ else
+ TargetItem := -1;
+
+ lvwLog.Items.BeginUpdate; // \83h\83\8d\83b\83v\92\86\82Í\95\\8e¦\82ð\97}\8e~\82·\82é\81@\8fd\97v\81I
+ try
+ // \83h\83\8d\83b\83v\88Ê\92u\82É Item \82ð\88Ú\93®\82·\82é
+ if (GetAsyncKeyState(VK_CONTROL) and $8000) > 0 then
+ begin // \83R\83s\81[\88Ú\93®\82Ì\8fê\8d\87
+ SrcLog := TLogItem.Create(Src.LogItem);
+ SelectedBottleLog.LogModified := true; // \95Ï\8dX\88µ\82¢\82É\82·\82é
+ end else // \88Ú\93®\82¾\82¯\82·\82é\8fê\8d\87
+ begin
+ SrcLog := Src.BottleLogList.Extract(Src.LogItem);
+ // \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é
+ if SelectedBottleLog.SelectedIndex <> Src.BottleLogList.SelectedIndex then
+ begin
+ Src.BottleLogList.LogModified := true; // \88Ú\93®\8c³
+ SelectedBottleLog.LogModified := true; // \88Ú\93®\90æ
+ end;
+ end;
+ if TargetItem >= 0 then
+ begin
+ // \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
+ SelectedBottleLog.Insert(TargetItem, SrcLog);
+ end else
+ begin
+ // ListView\82Ì\97]\94\92\82É\83h\83\8d\83b\83v\82µ\82½\8fê\8d\87(Insert\82Å\82«\82È\82¢)
+ TargetItem := SelectedBottleLog.Add(SrcLog);
+ end;
+ lvwLog.Items[TargetItem].Selected := true;
+ lvwLog.Items[TargetItem].Focused := true;
+ finally
+ lvwLog.Items.EndUpdate;
+ UpdateWindow;
+ end;
+end;
+
+procedure TfrmLog.timScrollTimerTimer(Sender: TObject);
+var
+ ScrollHeight: Integer;
+begin
+ // \83X\83N\83\8d\81[\83\8b\97Ê\82ð\8b\81\82ß\82é
+ ScrollHeight := 0;
+ if lvwLog.Items.Count > 2 then
+ begin
+ ScrollHeight := lvwLog.Items[1].Top - lvwLog.Items[0].Top;
+ end;
+
+ case FLVScrollDir of
+ lvScrollUp: lvwLog.Scroll(0, ScrollHeight);
+ lvSCrollDown: lvwLog.Scroll(0, -ScrollHeight);
+ end;
+ lvwLog.Invalidate; // \8dÅ\90V\82Ì\8fó\91Ô\82É\8dÄ\95`\89æ\82·\82é
+ lvwLog.Update;
+end;
+
+procedure TfrmLog.mnChangeTabNameClick(Sender: TObject);
+var Name: String;
+begin
+ Name := (FBottleLogList[tabBottleLog.Tag] as TBottleLogList).Title;
+ InputQuery('\96¼\91O\82Ì\95Ï\8dX', '\90V\82µ\82¢\83^\83u\82Ì\96¼\91O', Name);
+ (FBottleLogList[tabBottleLog.Tag] as TBottleLogList).Title := Name;
+ UpdateTab;
+end;
+
+procedure TfrmLog.lvwLogStartDrag(Sender: TObject;
+ var DragObject: TDragObject);
+var Drag: TBottleLogDragObject;
+begin
+ // \92Ê\8fí\82ÌListView\97p\82Ì\83h\83\89\83b\83O\83I\83u\83W\83F\83N\83g\82Í
+ // 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
+ // 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Æ
+ // \94¼\93§\96¾\83C\83\81\81[\83W\82Ì\95`\89æ\82Í\97}\90§\82Å\82«\82é\81B
+ Drag := TBottleLogDragObject.Create(lvwLog);
+ Drag.BottleLogList := SelectedBottleLog;
+ Drag.LogItem := SelectedBottleLog.Bottles[lvwLog.Selected.Index];
+ DragObject := Drag;
+end;
+
+procedure TfrmLog.lvwLogEndDrag(Sender, Target: TObject; X, Y: Integer);
+begin
+ // \98g\90ü\8fÁ\82µ\97p\82É\8b\90§\93I\82É\8dÄ\95`\89æ\82³\82¹\82é
+ timScrollTimer.Enabled := false;
+ FLVDragDest := -1;
+ UpdateWindow;
+end;
+
+procedure TfrmLog.DrawListViewDragBorder(const Rect: TRect);
+var Rec: TRect;
+begin
+ Rec := Rect;
+ InflateRect(Rec, -1, -1);
+ with lvwLog.Canvas do
+ begin
+ Pen.Mode := pmNot;
+ Pen.Width := 3;
+ Brush.Style := bsClear;
+ Refresh; // \95K\97v
+ Rectangle(Rec);
+ end;
+end;
+
+function TfrmLog.DoSaveLogXML(Log: TBottleLogList): integer;
+var
+ Res: integer;
+begin
+ Res := idYes;
+ SaveDialog.FileName := GetDefaultFileName(Log.Title, '.xml');
+ SaveDialog.InitialDir := Pref.LogDir;
+ SaveDialog.DefaultExt := 'xml';
+ SaveDialog.FilterIndex := 3;
+ if SaveDialog.Execute then
+ Log.SaveToXmlFile(SaveDialog.FileName)
+ else
+ Res := idCancel;
+ Result := Res;
+end;
+
+procedure TfrmLog.DoCloseTab(const Index: integer);
+var
+ Confirm: String;
+ PrevSelection: TBottleLogList; // \95Â\82¶\82½\82Æ\82«\83^\83u\82ª\82¸\82ê\82È\82¢\82æ\82¤\82É\82·\82é\8f\88\97\9d\97p
+ i: integer;
+begin
+ if CheckLogSave(Index) = idCancel then exit; // \83\8d\83O\82Ì\95Û\91¶\8am\94F
+ if Pref.ConfirmOnTabClose then
+ begin
+ Confirm := Format('\83^\83u"%s"\82ð\95Â\82¶\82Ü\82·\82©?', [(FBottleLogList[Index] as TBottleLogList).Title]);
+ if MessageDlg(Confirm, mtConfirmation, mbOkCancel, 0) = mrCancel then
+ Exit;
+ end;
+ PrevSelection := SelectedBottleLog;
+ FBottleLogList.Delete(Index);
+ UpdateTab;
+ // \83^\83u\82¸\82ê\96h\8e~\8f\88\97\9d
+ for i := 0 to FBottleLogList.Count-1 do
+ if FBottleLogList[i] = PrevSelection then
+ tabBottleLog.TabIndex := i;
+ UpdateWindow;
+ lvwLogChange(Self, nil, ctState);
+end;
+
+procedure TfrmLog.HTMLOutputWork(Sender: TObject; const Count: integer;
+ var Canceled: boolean);
+begin
+ frmHTMLOutputProgress.ProgressBar.Position := Count;
+ Application.ProcessMessages;
+ if frmHTMLOutputProgress.Canceled then
+ Canceled := true;
+end;
+
+function TfrmLog.DoSearchLog(Condition: TSearchCond): TBottleLogList;
+var i, UntilIndex: integer;
+begin
+ Result := TBottleLogList.Create('\8c\9f\8dõ\8c\8b\89Ê');
+ if Condition.SearchLogRange in [srSelectedLogList, srAboveSelectedLog] then
+ begin
+ if SelectedBottleLog = nil then
+ begin
+ ShowMessage('\8c\9f\8dõ\91Î\8fÛ\82ª\82 \82è\82Ü\82¹\82ñ');
+ Result.Free;
+ Result := nil;
+ Exit;
+ end else
+ begin
+ if Condition.SearchLogRange = srSelectedLogList then
+ UntilIndex := -1
+ else if lvwLog.Selected = nil then
+ UntilIndex := -1
+ else
+ UntilIndex := lvwLog.Selected.Index;
+ SearchLogIndivisual(Condition, SelectedBottleLog, Result, UntilIndex);
+ end;
+ end else if Condition.SearchLogRange = srAllLogLists then
+ begin
+ for i := 0 to BottleLogList.Count-1 do
+ begin
+ SearchLogIndivisual(Condition, BottleLogList[i] as TBottleLogList,
+ Result);
+ end;
+ end;
+
+ if Result.Count = 0 then
+ Result.AddSystemLog('\8c©\82Â\82©\82è\82Ü\82¹\82ñ\82Å\82µ\82½\81B');
+end;
+
+procedure TfrmLog.SearchLogIndivisual(Condition: TSearchCond; LogList,
+ Result: TBottleLogList; UntilIndex: integer = -1);
+var
+ i, Max: integer;
+ Bottle, New: TLogItem;
+ Ok: boolean;
+begin
+ // 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Ì)
+ if UntilIndex >= 0 then
+ Max := UntilIndex
+ else
+ Max := LogList.Count-1;
+ for i := 0 to Max do
+ begin
+ // \8fð\8c\8f\94»\92è
+ Bottle := LogList.Bottles[i];
+ if Bottle.LogType <> ltBottle then
+ Continue;
+ Ok := true;
+ // \83X\83N\83\8a\83v\83g\83p\83^\81[\83\93\82Å\89ð\90Í
+ if Condition.ScriptPattern <> '' then
+ begin
+ if Condition.ScriptRegExp then
+ begin
+ try
+ if not RegExp.Match(Condition.ScriptPattern, Bottle.Script) then
+ Ok := false;
+ except
+ on EBRegExpError do
+ Ok := false; //\96\82È\90³\8bK\95\\8c»\82ð\8fR\82é
+ end;
+ end else
+ begin
+ if not AnsiContainsText(Bottle.Script, Condition.ScriptPattern) then
+ Ok := false;
+ end;
+ end;
+ // \83`\83\83\83\93\83l\83\8b\96¼\81A\83S\81[\83X\83g\96¼\81A\93\8a\95[\93¯\88Ó
+ if Condition.Channel <> '' then
+ if not AnsiContainsText(Bottle.Channel, Condition.Channel) then
+ Ok := false;
+ if Condition.Ghost <> '' then
+ if not AnsiContainsText(Bottle.Ghost, Condition.Ghost) then
+ Ok := false;
+ if Condition.MinVote > Bottle.Votes then
+ Ok := false;
+ if Condition.MinAgree > Bottle.Agrees then
+ Ok := false;
+ // \8fð\8c\8f\82É\88ê\92v\82µ\82½\82à\82Ì\82ð\8c\8b\89Ê\83\8a\83X\83g\82É\92Ç\89Á
+ if Ok then
+ begin
+ New := TLogItem.Create(Bottle); // \83R\83s\81[\83R\83\93\83X\83g\83\89\83N\83^
+ New.State := lsOpened;
+ Result.Add(New);
+ end;
+ end;
+end;
+
+{ TBottleLogDragObject }
+
+function TBottleLogDragObject.GetDragImages: TDragImageList;
+begin
+ // \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é
+ Result := nil;
+end;
+
+procedure TBottleLogDragObject.SetBottleLogList(
+ const Value: TBottleLogList);
+begin
+ FBottleLogList := Value;
+end;
+
+procedure TBottleLogDragObject.SetLogItem(const Value: TLogItem);
+begin
+ FLogItem := Value;
+end;
+
+procedure TfrmLog.mnTabSaveXMLLogClick(Sender: TObject);
+begin
+ DoSaveLogXML(FBottleLogList[tabBottleLog.Tag] as TBottleLogList);
+end;
+
+procedure TfrmLog.mnSaveHTMLClick(Sender: TObject);
+var
+ LogList, SB: TBottleLogList;
+ i: integer;
+ Options: THTMLOutputOptions;
+begin
+ SB := SelectedBottleLog;
+ if SB = nil then
+ Exit;
+ if SB.Count = 0 then
+ Exit;
+ Application.CreateForm(TfrmHTMLOutputConfig, frmHTMLOutputConfig);
+ with frmHTMLOutputConfig do
+ try
+ // Show HTML save option dialog
+ if not Execute then
+ Exit;
+ LogList := TBottleLogList.Create('');
+ try
+ case Range of
+ orAll:
+ for i := SB.Count-1 downto 0 do
+ if SB.Bottles[i].LogType = ltBottle then
+ LogList.Add(TLogItem.Create(SB.Bottles[i]));
+ orSelected:
+ if SB.Bottles[lvwLog.Selected.Index].LogType = ltBottle then
+ LogList.Add(TLogItem.Create(SB.Bottles[lvwLog.Selected.Index]))
+ else
+ ShowMessage('\82±\82Ì\83\81\83b\83Z\81[\83W\82Í\95Û\91¶\82Å\82«\82Ü\82¹\82ñ');
+ orUpward:
+ for i := lvwLog.Selected.Index downto 0 do
+ if SB.Bottles[i].LogType = ltBottle then
+ LogList.Add(TLogItem.Create(SB.Bottles[i]));
+ end;
+ Options.ImageDir := ImageDir;
+ Options.UseColor := UseColor;
+ Options.ImageType := ImageType;
+ Application.CreateForm(TfrmHTMLOutputProgress, frmHTMLOutputProgress);
+ try
+ frmHTMLOutputProgress.Show;
+ LogList.OnHTMLOutputWork := HTMLOutputWork;
+ LogList.SaveToHTML(FileName, Options, SsParser);
+ finally
+ frmHTMLOutputProgress.Release;
+ end;
+ finally
+ LogList.Free;
+ end;
+ finally
+ Release;
+ end;
+end;
+
+procedure TfrmLog.mnPopupCopyGhostClick(Sender: TObject);
+var
+ Log: TLogItem;
+ Clip: TClipBoard;
+begin
+ Log := SelectedBottleLog.Bottles[frmLog.lvwLog.Selected.Index];
+ if Log = nil then Exit;
+ Clip := ClipBoard();
+ Clip.SetTextBuf(PChar(Log.Ghost));
+end;
+
+function TfrmLog.CheckLog(Sender: TObject): integer;
+var
+ i, Res: integer;
+begin
+ // \91S\82Ä\82Ì\83\8a\83X\83g\81i\83^\83u\81j\83`\83F\83b\83N\82·\82é
+ // frmSender\82©\82ç\8fI\97¹\8e\9e\82É\8cÄ\82Ñ\8fo\82³\82ê\82é
+ Res := idNo;
+ for i := 0 to BottleLogList.Count-1 do
+ begin
+ Res := CheckLogSave(i);
+ if Res = idCancel then break;
+ end;
+ Result := Res;
+end;
+
+function TfrmLog.CheckLogSave(const Index: integer): integer;
+var
+ Res: integer;
+ Confirm: string;
+begin
+ // \83\8a\83X\83g\82ð\83`\83F\83b\83N\82µ\81A\95Û\91¶\8f\88\97\9d\82ð\8cÄ\82Ñ\8fo\82·
+ Res := idNo;
+ if (BottleLogList[Index] as TBottleLogList).LogModified then
+ begin
+ Confirm := Format('\83^\83u %s \82Ì\93à\97e\82Í\95Ï\8dX\82³\82ê\82Ä\82¢\82Ü\82·\81B'#13#10#13#10 +
+ '\95Û\91¶\82µ\82Ü\82·\82©\81H', [(FBottleLogList[Index] as TBottleLogList).Title]);
+ Res := MessageDlg(Confirm, mtConfirmation, mbYesNoCancel, 0);
+ if Res = idYes then
+ Res := DoSaveLogXML(FBottleLogList[Index] as TBottleLogList);
+ end;
+ Result := Res;
+end;
+
+procedure TfrmLog.mnTestActionClick(Sender: TObject);
+begin
+ Screen.Cursor := crHourGlass;
+ frmSender.LogInsertCue(true); // \83A\83N\83V\83\87\83\93\83e\83X\83g\81i\98A\91±\8dÄ\90¶\81j\97L\8cø
+ Screen.Cursor := crDefault;
+end;
+
+procedure TfrmLog.mnSelActionClick(Sender: TObject);
+begin
+ // \92P\91Ì\83A\83N\83V\83\87\83\93\82Ì\97L\96³\82ð\90Ý\92è
+ if mnSelAction.Checked then
+ mnSelAction.Checked := false
+ else
+ mnSelAction.Checked := true;
+ Pref.LogAction := mnSelAction.Checked;
+end;
+