示例#1
0
        /// <summary>
        /// Render the new highlights taking into consideration the old highlights
        /// (this means that only the differences are actually rendered)
        /// </summary>
        private void RenderHighlightDiffs(IntervalTree <AtomicHighlight> atomicHighlights)
        {
            //System.Console.WriteLine("Rendering highlight diffs");
            IList <AtomicHighlight> hl = atomicHighlights.GetValues();

            foreach (AtomicHighlight h in hl)
            {
                //System.Console.WriteLine("  Checking {0}", h);
                IList <AtomicHighlight> overlaps = prevAtomicHighlights.SearchOverlap(h);
                foreach (AtomicHighlight overlap in overlaps)
                {
                    AtomicHighlight hTmp = new AtomicHighlight(h);
                    hTmp.Intersect(overlap);
                    AtomicHighlight oTmp = new AtomicHighlight(overlap);
                    oTmp.Intersect(h);
                    //System.Console.WriteLine("    Overlaps with {0}", oTmp);

                    bool diffType = oTmp.Type != hTmp.Type;

                    Drawer.HighlightType left, right, oleft, oright;

                    hTmp.GetAbyssHighlights(out left, out right);
                    oTmp.GetAbyssHighlights(out oleft, out oright);

                    bool diffAbyss = (left != oleft) || (right != oright);

                    if (diffType || diffAbyss)
                    {
                        //System.Console.Write(diffType?"      DiffType> ":"      DiffFlags> ");
                        //System.Console.WriteLine(hTmp);
                        RenderHighlight(hTmp);
                    }
                }
            }
        }
示例#2
0
        private AtomicHighlight[] SplitAtomicPrioritized(AtomicHighlight q, Highlight r)
        {
            AtomicHighlight[] ha;

            if (q.Type > r.Type)
            {
                ha = new AtomicHighlight[3] {
                    new AtomicHighlight(r), new AtomicHighlight(q), new AtomicHighlight(r)
                };
                Util.Range.SplitAtomic(ha, r, q);
                ha[1].AddContainer(r);
            }
            else
            {
                ha = new AtomicHighlight[3] {
                    new AtomicHighlight(q), new AtomicHighlight(r), new AtomicHighlight(q)
                };
                Util.Range.SplitAtomic(ha, q, r);
                foreach (Highlight h in q.Containers)
                {
                    ha[1].AddContainer(h);
                }
            }

            return(ha);
        }
示例#3
0
        /// <summary>
        /// Renders a <see cref="Util.Range"/> of data using a specified <see cref="Drawer.HighlightType"/>
        /// </summary>
        private void RenderHighlight(AtomicHighlight h)
        {
            Drawer.HighlightType left;
            Drawer.HighlightType right;
            h.GetAbyssHighlights(out left, out right);

            //System.Console.WriteLine("  Rendering {0}  ({1} {2})", h, left, right);
            foreach (Area a in areas)
            {
                a.RenderHighlight(h, left, right);
            }
        }
示例#4
0
        private void RenderCursor(IntervalTree <AtomicHighlight> atomicHighlights)
        {
            // find the kind of highlight the cursor was previously on
            // if we don't find an overlap this means that either
            // 1. the prev cursor position is not visible on the screen
            // 2. the prev cursor position is at or beyond the end of the file
            IList <AtomicHighlight> overlaps = atomicHighlights.SearchOverlap(new Util.Range(prevCursorOffset, prevCursorOffset));

            AtomicHighlight h = null;

            // if we find an overlap create a highlight
            // to use to restore the prev position
            if (overlaps.Count > 0)
            {
                h       = new AtomicHighlight(overlaps[0]);
                h.Start = prevCursorOffset;
                h.End   = prevCursorOffset;
            }

            bool prevCursorBeyondEof = prevCursorOffset >= byteBuffer.Size;

            if (h != null)
            {
                RenderHighlight(h);
            }
            else if (prevCursorBeyondEof)       // case 2
            {
                foreach (Area a in areas)
                {
                    a.BlankOffset(prevCursorOffset);
                }
            }

            if (selection.IsEmpty())
            {
                foreach (Area a in areas)
                {
                    a.RenderCursor();
                }
            }
        }
示例#5
0
 public AtomicHighlight(AtomicHighlight h) : base(h)
 {
     this.containers = new System.Collections.Generic.List <Highlight>(h.containers);
 }