Beispiel #1
0
        private void UpdateLineDiff()
        {
            int iLine = (ActiveView == ViewA) ? ViewA.Position.Line : ViewB.Position.Line;

            if (iLine == m_iCurrentDiffLine)
            {
                return;
            }

            m_iCurrentDiffLine = iLine;

            DiffViewLine LineOne = null;
            DiffViewLine LineTwo = null;

            if (iLine < ViewA.LineCount)
            {
                LineOne = ViewA.Lines[iLine];
            }
            //Normally, ViewA.LineCount == ViewB.LineCount, but during
            //SetData they'll be mismatched momentarily as each view
            //rebuilds its lines.
            if (iLine < ViewB.LineCount)
            {
                LineTwo = ViewB.Lines[iLine];
            }

            if (LineOne != null && LineTwo != null)
            {
                ViewLineDiff.SetData(LineOne, LineTwo);
            }
        }
Beispiel #2
0
        public DiffViewLines(DiffViewLine LineOne, DiffViewLine LineTwo)
        {
            AddLine(LineOne);
            AddLine(LineTwo);

            m_arDiffStartLines = new int[0];
            m_arDiffEndLines   = new int[0];
        }
Beispiel #3
0
        private void AddLine(DiffViewLine Line)
        {
            CheckLongestLength(Line.Text);

            if (Line.Number >= 0 && Line.Number > m_iMaxLineNumber)
            {
                m_iMaxLineNumber = Line.Number;
            }

            InnerList.Add(Line);
        }
Beispiel #4
0
        private void RenderImage()
        {
            if (m_Image != null)
            {
                m_Image.Dispose();
                m_Image = null;
            }

            int iWidth  = ClientSize.Width;
            int iHeight = ClientSize.Height;

            if (iWidth > 0 && iHeight > 0 && m_View != null && m_View.Lines != null)
            {
                //Draw a bitmap in memory that we can render from
                m_Image = new Bitmap(iWidth, iHeight);
                Graphics G = Graphics.FromImage(m_Image);

                SolidBrush B = new SolidBrush(BackColor);
                G.FillRectangle(B, 0, 0, iWidth, iHeight);

                const float c_fGutter = 2.0F;
                //Make sure each line is at least 1 pixel high
                float         fLineHeight = (float)Math.Max(1.0, GetPixelLineHeightF(1));
                DiffViewLines Lines       = m_View.Lines;
                int           iNumLines   = Lines.Count;
                for (int i = 0; i < iNumLines; i++)
                {
                    DiffViewLine L = Lines[i];
                    if (L.Edited)
                    {
                        B.Color = DiffOptions.GetColorForEditType(L.EditType);
                        float fY = GetPixelLineHeightF(i);
                        G.FillRectangle(B, c_fGutter, fY, iWidth - 2 * c_fGutter, fLineHeight);
                    }
                }

                B.Dispose();
                G.Dispose();
            }
        }