示例#1
0
        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);
            }
        }
        public void TestToString()
        {
            DateTime committerTime = DateTime.Now;
            DateTime authorTime    = DateTime.Now;

            StringBuilder expectedHeader = new StringBuilder();

            expectedHeader.AppendLine("Author: Author");
            expectedHeader.AppendLine("AuthorTime: " + authorTime.ToString());
            expectedHeader.AppendLine("Committer: committer");
            expectedHeader.AppendLine("CommitterTime: " + committerTime.ToString());
            expectedHeader.AppendLine("Summary: test summary");
            expectedHeader.AppendLine();
            expectedHeader.Append("FileName: fileName.txt");

            GitBlameHeader header = new GitBlameHeader
            {
                Author        = "Author",
                AuthorMail    = "*****@*****.**",
                AuthorTime    = authorTime,
                Committer     = "committer",
                CommitterTime = committerTime,
                Summary       = "test summary",
                FileName      = "fileName.txt"
            };

            Assert.AreEqual(expectedHeader.ToString(), header.ToString());
        }
示例#3
0
        void BlameFile_MouseMove(object sender, MouseEventArgs e)
        {
            if (_blame == null)
            {
                return;
            }

            int line = BlameFile.GetLineFromVisualPosY(e.Y);

            if (line >= _blame.Lines.Count)
            {
                return;
            }

            GitBlameHeader blameHeader = _blame.FindHeaderForCommitGuid(_blame.Lines[line].CommitGuid);

            string tooltipText = blameHeader.ToString();

            if (lastTooltip != tooltipText)
            {
                BlameCommitter.ClearHighlighting();
                BlameFile.ClearHighlighting();
                for (int i = 0; i < _blame.Lines.Count; i++)
                {
                    if (_blame.Lines[i].CommitGuid == blameHeader.CommitGuid)
                    {
                        BlameCommitter.HighlightLine(i, Color.FromArgb(225, 225, 225));
                        BlameFile.HighlightLine(i, Color.FromArgb(225, 225, 225));
                    }
                }
                BlameCommitter.Refresh();
                BlameFile.Refresh();
            }

            int newTooltipX = e.X + splitContainer2.SplitterDistance + 20;
            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);
            }
        }