Пример #1
0
        private void SetupChildren(PlotCommit <L> currCommit)
        {
            int nParents = currCommit.ParentCount;

            for (int i = 0; i < nParents; i++)
            {
                ((PlotCommit)currCommit.GetParent(i)).AddChild(currCommit);
            }
        }
Пример #2
0
        /// <summary>Paint one commit using the underlying graphics library.</summary>
        /// <remarks>Paint one commit using the underlying graphics library.</remarks>
        /// <param name="commit">the commit to render in this cell. Must not be null.</param>
        /// <param name="h">total height (in pixels) of this cell.</param>
        protected internal virtual void PaintCommit(PlotCommit <TLane> commit, int h)
        {
            int    dotSize   = ComputeDotSize(h);
            TLane  myLane    = commit.GetLane();
            int    myLaneX   = LaneC(myLane);
            TColor myColor   = LaneColor(myLane);
            int    maxCenter = 0;

            foreach (TLane passingLane in (TLane[])commit.passingLanes)
            {
                int    cx = LaneC(passingLane);
                TColor c  = LaneColor(passingLane);
                DrawLine(c, cx, 0, cx, h, LINE_WIDTH);
                maxCenter = Math.Max(maxCenter, cx);
            }
            int nParent = commit.ParentCount;

            for (int i = 0; i < nParent; i++)
            {
                PlotCommit <TLane> p;
                TLane  pLane;
                TColor pColor;
                int    cx;
                p     = (PlotCommit <TLane>)commit.GetParent(i);
                pLane = p.GetLane();
                if (pLane == null)
                {
                    continue;
                }
                pColor = LaneColor(pLane);
                cx     = LaneC(pLane);
                if (Math.Abs(myLaneX - cx) > LANE_WIDTH)
                {
                    if (myLaneX < cx)
                    {
                        int ix = cx - LANE_WIDTH / 2;
                        DrawLine(pColor, myLaneX, h / 2, ix, h / 2, LINE_WIDTH);
                        DrawLine(pColor, ix, h / 2, cx, h, LINE_WIDTH);
                    }
                    else
                    {
                        int ix = cx + LANE_WIDTH / 2;
                        DrawLine(pColor, myLaneX, h / 2, ix, h / 2, LINE_WIDTH);
                        DrawLine(pColor, ix, h / 2, cx, h, LINE_WIDTH);
                    }
                }
                else
                {
                    DrawLine(pColor, myLaneX, h / 2, cx, h, LINE_WIDTH);
                }
                maxCenter = Math.Max(maxCenter, cx);
            }
            int dotX = myLaneX - dotSize / 2 - 1;
            int dotY = (h - dotSize) / 2;

            if (commit.GetChildCount() > 0)
            {
                DrawLine(myColor, myLaneX, 0, myLaneX, dotY, LINE_WIDTH);
            }
            if (commit.Has(RevFlag.UNINTERESTING))
            {
                DrawBoundaryDot(dotX, dotY, dotSize, dotSize);
            }
            else
            {
                DrawCommitDot(dotX, dotY, dotSize, dotSize);
            }
            int textx = Math.Max(maxCenter + LANE_WIDTH / 2, dotX + dotSize) + 8;
            int n     = commit.refs.Length;

            for (int i_1 = 0; i_1 < n; ++i_1)
            {
                textx += DrawLabel(textx + dotSize, h / 2, commit.refs[i_1]);
            }
            string msg = commit.GetShortMessage();

            DrawText(msg, textx + dotSize + n * 2, h / 2);
        }