예제 #1
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);

            if (blameHeader != lastBlameHeader)
            {
                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();
                lastBlameHeader = blameHeader;
            }
        }
예제 #2
0
        private 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);

            if (blameHeader != _lastBlameHeader)
            {
                BlameCommitter.ClearHighlighting();
                BlameFile.ClearHighlighting();
                int startLine = -1;
                int prevLine  = -1;
                for (int i = 0; i < _blame.Lines.Count; i++)
                {
                    if (_blame.Lines[i].CommitGuid == blameHeader.CommitGuid)
                    {
                        if (prevLine != i - 1 && startLine != -1)
                        {
                            BlameCommitter.HighlightLines(startLine, prevLine, Color.FromArgb(225, 225, 225));
                            BlameFile.HighlightLines(startLine, prevLine, Color.FromArgb(225, 225, 225));
                            startLine = -1;
                        }

                        prevLine = i;
                        if (startLine == -1)
                        {
                            startLine = i;
                        }
                    }
                }

                if (startLine != -1)
                {
                    BlameCommitter.HighlightLines(startLine, prevLine, Color.FromArgb(225, 225, 225));
                    BlameFile.HighlightLines(startLine, prevLine, Color.FromArgb(225, 225, 225));
                }

                BlameCommitter.Refresh();
                BlameFile.Refresh();
                _lastBlameHeader = blameHeader;
            }
        }
예제 #3
0
        private void HighlightLinesForCommit([CanBeNull] GitBlameCommit commit)
        {
            if (commit == _highlightedCommit)
            {
                return;
            }

            _highlightedCommit = commit;

            BlameCommitter.ClearHighlighting();
            BlameFile.ClearHighlighting();

            if (commit == null)
            {
                return;
            }

            int startLine = -1;
            int prevLine  = -1;

            for (int i = 0; i < _blame.Lines.Count; i++)
            {
                if (ReferenceEquals(_blame.Lines[i].Commit, commit))
                {
                    if (prevLine != i - 1 && startLine != -1)
                    {
                        BlameCommitter.HighlightLines(startLine, prevLine, SystemColors.ControlLight);
                        BlameFile.HighlightLines(startLine, prevLine, SystemColors.ControlLight);
                        startLine = -1;
                    }

                    prevLine = i;
                    if (startLine == -1)
                    {
                        startLine = i;
                    }
                }
            }

            if (startLine != -1)
            {
                BlameCommitter.HighlightLines(startLine, prevLine, SystemColors.ControlLight);
                BlameFile.HighlightLines(startLine, prevLine, SystemColors.ControlLight);
            }

            BlameCommitter.Refresh();
            BlameFile.Refresh();
        }
예제 #4
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);
            }
        }