예제 #1
0
        internal void Arrange(ArrangeDataForDecorations horizontalArrangement, ArrangeDataForDecorations verticalArrangement)
        {
            this.ArrangeRowDecorations(horizontalArrangement, verticalArrangement);
            this.ArrangeColumnDecorations(horizontalArrangement, verticalArrangement);

            this.rowLinesElementsPool.FullyRecycleElements();
            this.columnLinesElementsPool.FullyRecycleElements();
        }
예제 #2
0
        private static RadRect GetArrangeRect(SelectionRegionInfo region, ArrangeDataForDecorations horizontalArrangement, ArrangeDataForDecorations verticalArrangement)
        {
            double left   = -1;
            double right  = -2;
            double top    = -1;
            double bottom = -2;

            var startRowLayout = region.StartItem.RowItemInfo.LayoutInfo;
            var endRowLayout   = region.EndItem.RowItemInfo.LayoutInfo;

            var invalidInfo = new LayoutInfo {
                Line = -1
            };

            LayoutInfo startColumnLayout = region.StartItem.Column != null ? region.StartItem.Column.ItemInfo.LayoutInfo : invalidInfo;
            LayoutInfo endColumnLayout   = region.EndItem.Column != null ? region.EndItem.Column.ItemInfo.LayoutInfo : invalidInfo;

            if (IsInsideArrangement(verticalArrangement, startRowLayout, endRowLayout))
            {
                if (!verticalArrangement.TryGetStartOfSlot(startRowLayout.Line, out top) && verticalArrangement.SlotsStartLine >= startRowLayout.Line)
                {
                    top = verticalArrangement.SlotsStart;
                }

                if (!verticalArrangement.TryGetEndOfSlot(endRowLayout.Line + endRowLayout.LineSpan - 1, out bottom) && verticalArrangement.SlotsEndLine <= endRowLayout.Line)
                {
                    bottom = verticalArrangement.SlotsEnd;
                }

                if (startColumnLayout.Equals(invalidInfo) || endColumnLayout.Equals(invalidInfo) || IsInsideArrangement(horizontalArrangement, startColumnLayout, endColumnLayout))
                {
                    if (!horizontalArrangement.TryGetStartOfSlot(startColumnLayout.Line, out left) && (horizontalArrangement.SlotsStartLine >= startColumnLayout.Line || startColumnLayout.Equals(invalidInfo)))
                    {
                        left = horizontalArrangement.SlotsStart;
                    }

                    if (!horizontalArrangement.TryGetEndOfSlot(endColumnLayout.Line + endColumnLayout.LineSpan - 1, out right) && (horizontalArrangement.SlotsEndLine <= endColumnLayout.Line || endColumnLayout.Equals(invalidInfo)))
                    {
                        right = horizontalArrangement.SlotsEnd;
                    }
                }
            }

            return(new RadRect(left, top, right - left, bottom - top));
        }
예제 #3
0
        internal void Arrange(ArrangeDataForDecorations horizontalArrangement, ArrangeDataForDecorations verticalArrangement, IEnumerable <SelectionRegionInfo> selectionRegions)
        {
            this.selectionRegionsPool.RecycleAll();

            foreach (var region in selectionRegions)
            {
                var rect = GetArrangeRect(region, horizontalArrangement, verticalArrangement);

                if (rect.IsSizeValid())
                {
                    var visualContainer = this.CreateDecorator(region);

                    this.decoratorPresenter.ArrangeDecorator(visualContainer, rect);
                }
            }

            this.selectionRegionsPool.FullyRecycleElements();
        }
예제 #4
0
        private void ArrangeRowDecorations(ArrangeDataForDecorations horizontalArrangement, ArrangeDataForDecorations verticalArrangement)
        {
            double top;
            double bottom;
            double left;
            double right;

            foreach (var rowDecoratorPair in this.displayedRowDecorationsMap)
            {
                LineDecorationModel decorator  = rowDecoratorPair.Value;
                LayoutInfo          layoutInfo = decorator.ItemInfo.LayoutInfo;

                top    = verticalArrangement.GetStartOfSlot(layoutInfo.Line);
                bottom = verticalArrangement.GetEndOfSlot(layoutInfo.Line + layoutInfo.LineSpan - 1);
                left   = horizontalArrangement.GetStartOfLevel(layoutInfo.Level);
                right  = layoutInfo.SpansThroughCells ? horizontalArrangement.SlotsEnd : horizontalArrangement.GetEndOfLevel(layoutInfo.Level + layoutInfo.LevelSpan - 1);

                var thickness = this.decorationPresenter.ArrangeDecorator(decorator, new RadRect(left, top, right, bottom));
            }
        }
예제 #5
0
 private static bool IsInsideArrangement(ArrangeDataForDecorations verticalArrangement, LayoutInfo startLayout, LayoutInfo endLayout)
 {
     return((verticalArrangement.SlotsStartLine <= endLayout.Line && endLayout.Line <= verticalArrangement.SlotsEndLine) ||
            (verticalArrangement.SlotsStartLine <= startLayout.Line && startLayout.Line <= verticalArrangement.SlotsEndLine) ||
            (verticalArrangement.SlotsStartLine >= startLayout.Line && verticalArrangement.SlotsEndLine <= endLayout.Line));
 }