コード例 #1
0
        public Rectangle[] GetRectanglesForVisibleMarks(TextView view)
        {
            List <Rectangle> rectList = null;

            lock (_marksSyncRoot)
            {
                if (_positions != null)
                {
                    _positions.ForEachInOrderBetween(
                        view.VisibleTextStart - _markLength,
                        view.VisibleTextEnd + _markLength,
                        (x) =>
                    {
                        Rectangle rect = view.GetRectangleForMark(x, _markLength);
                        // Do not draw multiline marks
                        if (rect != Rectangle.Empty && rect.Height <= view.LineHeight)
                        {
                            rect.Width  -= 1;
                            rect.Height -= 1;

                            if (rectList == null)
                            {
                                rectList = new List <Rectangle>();
                            }
                            rectList.Add(rect);
                        }
                    }
                        );
                }
            }

            if (rectList != null)
            {
                return(rectList.ToArray());
            }

            return(null);
        }
コード例 #2
0
        public void ForEachInOrderBetween(int min, int max, NodeValueAction action)
        {
            if (Left != null && min < x)
            {
                Left.ForEachInOrderBetween(min, max, action);
            }

            if (min <= x && x <= max)
            {
                action(x);
            }

            if (Right != null && x < max)
            {
                Right.ForEachInOrderBetween(min, max, action);
            }
        }