void BlameCommitter_MouseMove(object sender, MouseEventArgs e) { if (!BlameFile.Focused) { BlameFile.Focus(); } if (_blame == null) { return; } int line = BlameCommitter.GetLineFromVisualPosY(e.Y); if (line >= _blame.Lines.Count) { return; } GitBlameHeader blameHeader = _blame.FindHeaderForCommitGuid(_blame.Lines[line].CommitGuid); string tooltipText = blameHeader.ToString(); int newTooltipX = splitContainer2.SplitterDistance + 60; int newTooltipY = e.Y + splitContainer1.SplitterDistance + 20; if (lastTooltip != tooltipText || Math.Abs(lastTooltipX - newTooltipX) > 5 || Math.Abs(lastTooltipY - newTooltipY) > 5) { lastTooltip = tooltipText; lastTooltipX = newTooltipX; lastTooltipY = newTooltipY; blameTooltip.Show(tooltipText, this, newTooltipX, newTooltipY); } }
private int GetBlameLine() { if (_blame == null) { return(-1); } Point position = BlameCommitter.PointToClient(MousePosition); int line = BlameCommitter.GetLineFromVisualPosY(position.Y); if (line >= _blame.Lines.Count) { return(-1); } return(line); }
private void BlameCommitter_MouseMove(object sender, MouseEventArgs e) { if (!BlameFile.Focused) { BlameFile.Focus(); } if (_blame == null) { return; } var lineIndex = BlameCommitter.GetLineFromVisualPosY(e.Y); var blameCommit = lineIndex < _blame.Lines.Count ? _blame.Lines[lineIndex].Commit : null; HighlightLinesForCommit(blameCommit); if (blameCommit == null) { return; } int newTooltipX = splitContainer2.SplitterDistance + 60; int newTooltipY = e.Y + splitContainer1.SplitterDistance + 20; if (_tooltipCommit != blameCommit || Math.Abs(_lastTooltipX - newTooltipX) > 5 || Math.Abs(_lastTooltipY - newTooltipY) > 5) { _tooltipCommit = blameCommit; _lastTooltipX = newTooltipX; _lastTooltipY = newTooltipY; blameTooltip.Show(blameCommit.ToString(), this, newTooltipX, newTooltipY); } }