예제 #1
0
        public void AddLines(SvnOrigin origin, Collection <SvnBlameEventArgs> blameResult)
        {
            _origin = origin;

            SortedList <long, AnnotateSource> sources = new SortedList <long, AnnotateSource>();

            AnnotateRegion section = null;

            blameSections.Clear();

            foreach (SvnBlameEventArgs e in blameResult)
            {
                AnnotateSource src;
                if (!sources.TryGetValue(e.Revision, out src))
                {
                    sources.Add(e.Revision, src = new AnnotateSource(e, origin));
                }

                int line = (int)e.LineNumber;

                if (section == null || section.Source != src)
                {
                    section = new AnnotateRegion(line, src);
                    blameSections.Add(section);
                }
                else
                {
                    section.EndLine = line;
                }
            }
            blameMarginControl1.Invalidate();
        }
예제 #2
0
        bool IsSelected(AnnotateRegion region)
        {
            if (region == null)
            {
                throw new ArgumentNullException("region");
            }
            else if (_control == null)
            {
                return(false);
            }

            AnnotateSource src = _control.Selected;

            if (src == null)
            {
                return(false);
            }

            if (region.Source == src)
            {
                return(true);
            }

            return(false);
        }
예제 #3
0
        void ShowTip(AnnotateRegion region)
        {
            Point     mp   = PointToClient(MousePosition);
            Rectangle rect = GetRectangle(region);

            if (rect.Contains(mp))
            {
                AnnotateSource src = region.Source;
                StringBuilder  sb  = new StringBuilder();
                if (src.Revision >= 0)
                {
                    sb.AppendFormat(AnnotateResources.RevisonHead, src.Revision);
                    sb.AppendLine();
                    sb.AppendFormat(AnnotateResources.AuthorHead, src.Author);
                    sb.AppendLine();
                    sb.AppendFormat(AnnotateResources.TimeHead, src.Time.ToLocalTime());

                    if (!string.IsNullOrEmpty(src.LogMessage))
                    {
                        sb.AppendLine();
                        sb.Append(src.LogMessage);
                    }
                }
                else
                {
                    sb.Append(AnnotateResources.LocalChange);
                }

                _toolTip.Show(sb.ToString(), this, mp);
                _tipSection = region;
            }
        }
예제 #4
0
        void DoMove(EventArgs e)
        {
            AnnotateRegion region = GetSection(PointToClient(MousePosition));

            if (_hoverSection != null && _hoverSection != region)
            {
                _hoverSection.Hovered = false;
                Invalidate(GetRectangle(_hoverSection));
                _hoverSection = null;
            }

            if (region != _hoverSection)
            {
                _hoverSection  = region;
                region.Hovered = true;
                Invalidate(GetRectangle(region));
            }

            if (_tipSection != null && _tipSection != region)
            {
                HideTip();

                NativeMethods.TRACKMOUSEEVENT tme;
                tme.cbSize      = (uint)Marshal.SizeOf(typeof(NativeMethods.TRACKMOUSEEVENT));
                tme.dwFlags     = NativeMethods.TME_HOVER;
                tme.hwndTrack   = Handle;
                tme.dwHoverTime = NativeMethods.HOVER_DEFAULT;

                NativeMethods.TrackMouseEvent(ref tme);
            }
        }
예제 #5
0
        Rectangle GetRectangle(AnnotateRegion section)
        {
            int top    = (section.StartLine - _firstLine) * LineHeight + TopLine;
            int height = (section.EndLine - section.StartLine + 1) * LineHeight;

            return(new Rectangle(0, top, Width, height));
        }
예제 #6
0
        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);

            if (DesignMode)
            {
                return;
            }

            DoMove(e);

            if (_hoverSection != null)
            {
                _hoverSection.Hovered = false;
                Invalidate(GetRectangle(_hoverSection));
                _hoverSection = null;
            }

            if (_tipSection != null)
            {
                HideTip();
            }
        }
예제 #7
0
        protected override void OnMouseClick(MouseEventArgs e)
        {
            base.OnMouseClick(e);

            DoMove(e);

            AnnotateRegion section = GetSection(e.Location);

            if (section == null)
            {
                _control.SetSelection(null);
            }
            else
            {
                _control.SetSelection(section.Source);
            }

            Invalidate();

            if (e.Button == MouseButtons.Right)
            {
                ShowContextMenu();
            }
        }
예제 #8
0
 void HideTip()
 {
     _tipSection = null;
     _toolTip.Hide(this);
 }