/// <summary>
        /// Prints the selection.
        /// </summary>
        public virtual void Print()
        {
            ILayoutNodeState State       = StateView.State;
            ILayoutListInner ParentInner = State.PropertyToInner(PropertyName) as ILayoutListInner;

            Debug.Assert(ParentInner != null);

            LayoutControllerView ControllerView = StateView.ControllerView;

            Debug.Assert(ControllerView.PrintContext != null);
            ControllerView.UpdateLayout();

            Debug.Assert(StartIndex <= EndIndex);

            ILayoutNodeStateView FirstStateView = (ILayoutNodeStateView)ControllerView.StateViewTable[ParentInner.StateList[StartIndex]];
            Point Origin = FirstStateView.CellOrigin.Opposite;

            for (int i = StartIndex; i < EndIndex; i++)
            {
                ILayoutNodeStateView StateView = (ILayoutNodeStateView)ControllerView.StateViewTable[ParentInner.StateList[i]];
                Debug.Assert(RegionHelper.IsValid(StateView.ActualCellSize));

                StateView.PrintCells(Origin);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Draws all visible cells in the view using <see cref="DrawContext"/>.
        /// <param name="stateView">The view to draw.</param>
        /// </summary>
        public virtual void Draw(ILayoutNodeStateView stateView)
        {
            UpdateLayout();

            if (IsCaretShown)
            {
                DrawContext.HideCaret();
            }

            Debug.Assert(RegionHelper.IsValid(stateView.ActualCellSize));
            stateView.DrawCells();

            if (ShowLineNumber)
            {
                DisplayLineNumber(DrawCellViewLineNumber);
            }

            if (IsCaretShown)
            {
                if (IsCaretOnText(out ILayoutStringContentFocus TextFocus))
                {
                    DrawTextCaret(TextFocus);
                }
                else if (IsCaretOnComment(out ILayoutCommentFocus CommentFocus))
                {
                    DrawCommentCaret(CommentFocus);
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutCommentCellView"/> class.
 /// </summary>
 /// <param name="stateView">The state view containing the tree with this cell.</param>
 /// <param name="parentCellView">The collection of cell views containing this view. Null for the root of the cell tree.</param>
 /// <param name="frame">The frame that created this cell view.</param>
 /// <param name="documentation">The comment this cell is displaying.</param>
 public LayoutCommentCellView(ILayoutNodeStateView stateView, ILayoutCellViewCollection parentCellView, ILayoutFrame frame, Document documentation)
     : base(stateView, parentCellView, frame, documentation)
 {
     CellOrigin     = RegionHelper.InvalidOrigin;
     CellSize       = RegionHelper.InvalidSize;
     CellPadding    = Padding.Empty;
     ActualCellSize = RegionHelper.InvalidSize;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutContainerCellView"/> class.
 /// </summary>
 /// <param name="stateView">The state view containing the tree with this cell.</param>
 /// <param name="parentCellView">The collection of cell views containing this view.</param>
 /// <param name="childStateView">The state view of the state associated to this cell.</param>
 /// <param name="frame">The frame that was used to create this cell.</param>
 public LayoutContainerCellView(ILayoutNodeStateView stateView, ILayoutCellViewCollection parentCellView, ILayoutNodeStateView childStateView, ILayoutFrame frame)
     : base(stateView, parentCellView, childStateView, frame)
 {
     CellOrigin     = RegionHelper.InvalidOrigin;
     CellSize       = RegionHelper.InvalidSize;
     CellPadding    = Padding.Empty;
     ActualCellSize = RegionHelper.InvalidSize;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutCellViewCollection"/> class.
 /// </summary>
 /// <param name="stateView">The state view containing the tree with this cell.</param>
 /// <param name="parentCellView">The collection of cell views containing this view. Null for the root of the cell tree.</param>
 /// <param name="cellViewList">The list of child cell views.</param>
 /// <param name="frame">The frame that was used to create this cell. Can be null.</param>
 public LayoutCellViewCollection(ILayoutNodeStateView stateView, ILayoutCellViewCollection parentCellView, ILayoutCellViewList cellViewList, ILayoutFrame frame)
     : base(stateView, parentCellView, cellViewList, frame)
 {
     CellOrigin     = RegionHelper.InvalidOrigin;
     CellSize       = RegionHelper.InvalidSize;
     ActualCellSize = RegionHelper.InvalidSize;
     CellPadding    = Padding.Empty;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutContentFocusableCellView"/> class.
 /// </summary>
 /// <param name="stateView">The state view containing the tree with this cell.</param>
 /// <param name="parentCellView">The collection of cell views containing this view. Null for the root of the cell tree.</param>
 /// <param name="frame">The frame that created this cell view.</param>
 /// <param name="propertyName">Property corresponding to the component of the node.</param>
 public LayoutContentFocusableCellView(ILayoutNodeStateView stateView, ILayoutCellViewCollection parentCellView, ILayoutFrame frame, string propertyName)
     : base(stateView, parentCellView, frame, propertyName)
 {
     CellOrigin     = RegionHelper.InvalidOrigin;
     CellSize       = RegionHelper.InvalidSize;
     CellPadding    = Padding.Empty;
     ActualCellSize = RegionHelper.InvalidSize;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutBlockCellView"/> class.
 /// </summary>
 /// <param name="stateView">The state view containing the tree with this cell.</param>
 /// <param name="parentCellView">The collection of cell views containing this view.</param>
 /// <param name="blockStateView">The block state view of the state associated to this cell.</param>
 public LayoutBlockCellView(ILayoutNodeStateView stateView, ILayoutCellViewCollection parentCellView, LayoutBlockStateView blockStateView)
     : base(stateView, parentCellView, blockStateView)
 {
     CellOrigin     = RegionHelper.InvalidOrigin;
     CellSize       = RegionHelper.InvalidSize;
     CellPadding    = Padding.Empty;
     ActualCellSize = RegionHelper.InvalidSize;
 }
Exemplo n.º 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LayoutDiscreteContentFocusableCellView"/> class.
        /// </summary>
        /// <param name="stateView">The state view containing the tree with this cell.</param>
        /// <param name="parentCellView">The collection of cell views containing this view. Null for the root of the cell tree.</param>
        /// <param name="frame">The frame that created this cell view.</param>
        /// <param name="propertyName">Property corresponding to the component of the node.</param>
        /// <param name="keywordFrame">The keyword frame that was used to create this cell.</param>
        public LayoutDiscreteContentFocusableCellView(ILayoutNodeStateView stateView, ILayoutCellViewCollection parentCellView, ILayoutFrame frame, string propertyName, ILayoutKeywordFrame keywordFrame)
            : base(stateView, parentCellView, frame, propertyName, keywordFrame)
        {
            Debug.Assert(keywordFrame.ParentFrame is ILayoutDiscreteFrame);

            CellOrigin     = RegionHelper.InvalidOrigin;
            CellSize       = RegionHelper.InvalidSize;
            CellPadding    = Padding.Empty;
            ActualCellSize = RegionHelper.InvalidSize;
        }
Exemplo n.º 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LayoutLine"/> class.
        /// </summary>
        /// <param name="stateView">The state view containing the tree with this cell.</param>
        /// <param name="parentCellView">The collection of cell views containing this view. Null for the root of the cell tree.</param>
        /// <param name="cellViewList">The list of child cell views.</param>
        /// <param name="frame">Frame providing the horizontal separator to insert between cells. Can be null.</param>
        public LayoutLine(ILayoutNodeStateView stateView, ILayoutCellViewCollection parentCellView, ILayoutCellViewList cellViewList, ILayoutFrame frame)
            : base(stateView, parentCellView, cellViewList, frame)
        {
            Debug.Assert(frame is ILayoutFrameWithHorizontalSeparator);

            CellOrigin     = RegionHelper.InvalidOrigin;
            CellSize       = RegionHelper.InvalidSize;
            CellPadding    = Padding.Empty;
            ActualCellSize = RegionHelper.InvalidSize;
        }
Exemplo n.º 10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LayoutFocusableCellView"/> class.
        /// </summary>
        /// <param name="stateView">The state view containing the tree with this cell.</param>
        /// <param name="parentCellView">The collection of cell views containing this view. Null for the root of the cell tree.</param>
        /// <param name="frame">The frame that created this cell view.</param>
        public LayoutFocusableCellView(ILayoutNodeStateView stateView, ILayoutCellViewCollection parentCellView, ILayoutFrame frame)
            : base(stateView, parentCellView, frame)
        {
            Debug.Assert(frame is ILayoutMeasurableFrame);
            Debug.Assert(frame is ILayoutDrawableFrame);

            CellOrigin     = RegionHelper.InvalidOrigin;
            CellSize       = RegionHelper.InvalidSize;
            CellPadding    = Padding.Empty;
            ActualCellSize = RegionHelper.InvalidSize;
        }
        private protected virtual void MeasureCells()
        {
            ILayoutPlaceholderNodeState RootState     = Controller.RootState;
            ILayoutNodeStateView        RootStateView = (ILayoutNodeStateView)StateViewTable[RootState];

            RootStateView.MeasureCells(null, null, Measure.Floating);

            InternalViewSize = RootStateView.CellSize;

            Debug.Assert(RegionHelper.IsFixed(InternalViewSize));
        }
Exemplo n.º 12
0
        /// <summary>
        /// Prints all visible cells in a view using <see cref="PrintContext"/>.
        /// </summary>
        /// <param name="stateView">The view to print.</param>
        /// <param name="origin">The origin from where to start printing.</param>
        public virtual void Print(ILayoutNodeStateView stateView, Point origin)
        {
            UpdateLayout();

            Debug.Assert(RegionHelper.IsValid(stateView.ActualCellSize));
            stateView.PrintCells(origin);

            if (ShowLineNumber)
            {
                DisplayLineNumber(PrintCellViewLineNumber);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Updates all floating sizes and positions.
        /// </summary>
        public void UpdateLayout()
        {
            if (IsInvalidated)
            {
                MeasureAndArrange();
            }

            ILayoutNodeState     RootState     = Controller.RootState;
            ILayoutNodeStateView RootStateView = (ILayoutNodeStateView)StateViewTable[RootState];

            RootStateView.UpdateActualCellsSize();
            Debug.Assert(RegionHelper.IsValid(RootStateView.ActualCellSize));
        }
Exemplo n.º 14
0
        /// <summary>
        /// Measures a cell created with this frame.
        /// </summary>
        /// <param name="measureContext">The context used to measure the cell.</param>
        /// <param name="cellView">The cell to measure.</param>
        /// <param name="collectionWithSeparator">A collection that can draw separators around the cell.</param>
        /// <param name="referenceContainer">The cell view in <paramref name="collectionWithSeparator"/> that contains this cell.</param>
        /// <param name="separatorLength">The length of the separator in <paramref name="collectionWithSeparator"/>.</param>
        /// <param name="size">The cell size upon return, padding included.</param>
        /// <param name="padding">The cell padding.</param>
        public virtual void Measure(ILayoutMeasureContext measureContext, ILayoutCellView cellView, ILayoutCellViewCollection collectionWithSeparator, ILayoutCellView referenceContainer, Measure separatorLength, out Size size, out Padding padding)
        {
            ILayoutContainerCellView ContainerCellView = cellView as ILayoutContainerCellView;

            Debug.Assert(ContainerCellView != null);

            ILayoutNodeStateView ChildStateView = ContainerCellView.ChildStateView;

            Debug.Assert(ChildStateView != null);
            ChildStateView.MeasureCells(collectionWithSeparator, referenceContainer, separatorLength);

            Debug.Assert(RegionHelper.IsValid(ChildStateView.CellSize));

            size = ChildStateView.CellSize;
            measureContext.UpdatePadding(LeftMargin, RightMargin, ref size, out padding);

            Debug.Assert(RegionHelper.IsValid(size));
        }
        private protected virtual void ArrangeCells()
        {
            ILayoutPlaceholderNodeState RootState     = Controller.RootState;
            ILayoutNodeStateView        RootStateView = (ILayoutNodeStateView)StateViewTable[RootState];

            Point ViewOrigin;

            if (ShowLineNumber)
            {
                Measure Width = MeasureLineNumberWidth();
                ViewOrigin = new Point(Width, Measure.Zero);
            }
            else
            {
                ViewOrigin = Point.Origin;
            }

            RootStateView.ArrangeCells(ViewOrigin);

            Debug.Assert(Point.IsEqual(RootStateView.CellOrigin, ViewOrigin));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutCellViewTreeContext"/> class.
 /// </summary>
 /// <param name="controllerView">The view in which cells are created.</param>
 /// <param name="stateView">The state view for which to create cells.</param>
 /// <param name="forcedCommentStateView">The state view for which the comment must be visible, even if empty.</param>
 public LayoutCellViewTreeContext(LayoutControllerView controllerView, ILayoutNodeStateView stateView, ILayoutNodeStateView forcedCommentStateView)
     : base(controllerView, stateView, forcedCommentStateView)
 {
 }
Exemplo n.º 17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutCommentSelection"/> class.
 /// </summary>
 /// <param name="stateView">The state view that encompasses the selection.</param>
 /// <param name="start">Index of the first character in the selected text.</param>
 /// <param name="end">Index following the last character in the selected text.</param>
 public LayoutCommentSelection(ILayoutNodeStateView stateView, int start, int end)
     : base(stateView, start, end)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutStringContentSelection"/> class.
 /// </summary>
 /// <param name="stateView">The state view that encompasses the selection.</param>
 /// <param name="propertyName">The property name.</param>
 /// <param name="start">Index of the first character in the selected text.</param>
 /// <param name="end">Index following the last character in the selected text.</param>
 public LayoutStringContentSelection(ILayoutNodeStateView stateView, string propertyName, int start, int end)
     : base(stateView, propertyName, start, end)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutNodeListSelection"/> class.
 /// </summary>
 /// <param name="stateView">The state view that encompasses the selection.</param>
 /// <param name="propertyName">The property name.</param>
 /// <param name="startIndex">Index of the first selected node in the list.</param>
 /// <param name="endIndex">Index of the last selected node in the list.</param>
 public LayoutNodeListSelection(ILayoutNodeStateView stateView, string propertyName, int startIndex, int endIndex)
     : base(stateView, propertyName, startIndex, endIndex)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutDiscreteContentSelection"/> class.
 /// </summary>
 /// <param name="stateView">The state view that encompasses the selection.</param>
 /// <param name="propertyName">The property name.</param>
 public LayoutDiscreteContentSelection(ILayoutNodeStateView stateView, string propertyName)
     : base(stateView, propertyName)
 {
 }
Exemplo n.º 21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutNodeSelection"/> class.
 /// </summary>
 /// <param name="stateView">The selected state view.</param>
 public LayoutNodeSelection(ILayoutNodeStateView stateView)
     : base(stateView)
 {
 }