예제 #1
0
        /// <summary>
        /// Prints the selection.
        /// </summary>
        public virtual void Print()
        {
            ILayoutNodeState      State       = StateView.State;
            ILayoutBlockListInner ParentInner = State.PropertyToInner(PropertyName) as ILayoutBlockListInner;

            Debug.Assert(ParentInner != null);
            Debug.Assert(BlockIndex >= 0 && BlockIndex < ParentInner.BlockStateList.Count);

            ILayoutBlockState BlockState = ParentInner.BlockStateList[BlockIndex];

            ILayoutControllerView ControllerView = StateView.ControllerView;

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

            Debug.Assert(StartIndex <= EndIndex);

            ILayoutNodeStateView FirstStateView = ControllerView.StateViewTable[BlockState.StateList[StartIndex]];
            Point Origin = FirstStateView.CellOrigin.Opposite;

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

                StateView.PrintCells(Origin);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutBlockStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="blockState">The block state.</param>
 public LayoutBlockStateView(LayoutControllerView controllerView, ILayoutBlockState blockState)
     : base(controllerView, blockState)
 {
     CellOrigin     = RegionHelper.InvalidOrigin;
     CellSize       = RegionHelper.InvalidSize;
     ActualCellSize = RegionHelper.InvalidSize;
 }
        /// <summary>
        /// Handler called every time two blocks are merged.
        /// </summary>
        /// <param name="operation">Details of the operation performed.</param>
        private protected override void OnBlocksMerged(WriteableMergeBlocksOperation operation)
        {
            base.OnBlocksMerged(operation);

            ILayoutBlockState BlockState = ((LayoutMergeBlocksOperation)operation).BlockState;

            Debug.Assert(BlockState != null);
            Debug.Assert(!BlockStateViewTable.ContainsKey(BlockState));
        }
        /// <summary>
        /// Handler called every time a block view must be removed from the controller view.
        /// </summary>
        /// <param name="operation">Details of the operation performed.</param>
        private protected override void OnBlockViewRemoved(WriteableRemoveBlockViewOperation operation)
        {
            base.OnBlockViewRemoved(operation);

            ILayoutBlockState BlockState = ((LayoutRemoveBlockViewOperation)operation).BlockState;

            Debug.Assert(BlockState != null);
            Debug.Assert(!BlockStateViewTable.ContainsKey(BlockState));

            Debug.Assert(!StateViewTable.ContainsKey(BlockState.PatternState));
            Debug.Assert(!StateViewTable.ContainsKey(BlockState.SourceState));

            foreach (ILayoutNodeState State in BlockState.StateList)
            {
                Debug.Assert(!StateViewTable.ContainsKey(State));
            }
        }
        /// <summary>
        /// Handler called every time a block state is removed from the controller.
        /// </summary>
        /// <param name="operation">Details of the operation performed.</param>
        private protected override void OnBlockStateRemoved(IWriteableRemoveBlockOperation operation)
        {
            base.OnBlockStateRemoved(operation);

            ILayoutBlockState BlockState = ((ILayoutRemoveBlockOperation)operation).BlockState;

            Debug.Assert(BlockState != null);
            Debug.Assert(!BlockStateViewTable.ContainsKey(BlockState));

            Debug.Assert(!StateViewTable.ContainsKey(BlockState.PatternState));
            Debug.Assert(!StateViewTable.ContainsKey(BlockState.SourceState));

            ILayoutNodeState RemovedState = ((ILayoutRemoveBlockOperation)operation).RemovedState;

            Debug.Assert(!StateViewTable.ContainsKey(RemovedState));

            Debug.Assert(BlockState.StateList.Count == 0);
        }
        /// <summary>
        /// Handler called every time a block state is inserted in the controller.
        /// </summary>
        /// <param name="operation">Details of the operation performed.</param>
        private protected override void OnBlockStateInserted(IWriteableInsertBlockOperation operation)
        {
            base.OnBlockStateInserted(operation);

            ILayoutBlockState BlockState = ((ILayoutInsertBlockOperation)operation).BlockState;

            Debug.Assert(BlockState != null);
            Debug.Assert(BlockStateViewTable.ContainsKey(BlockState));

            Debug.Assert(StateViewTable.ContainsKey(BlockState.PatternState));
            Debug.Assert(StateViewTable.ContainsKey(BlockState.SourceState));

            Debug.Assert(BlockState.StateList.Count == 1);

            ILayoutPlaceholderNodeState ChildState = ((ILayoutInsertBlockOperation)operation).ChildState;

            Debug.Assert(ChildState == BlockState.StateList[0]);
            Debug.Assert(ChildState.ParentIndex == ((ILayoutInsertBlockOperation)operation).BrowsingIndex);
            Debug.Assert(StateViewTable.ContainsKey(ChildState));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutBlockStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="blockState">The block state.</param>
 /// <param name="template">The frame template.</param>
 protected LayoutBlockStateView(LayoutControllerView controllerView, ILayoutBlockState blockState, ILayoutTemplate template)
     : base(controllerView, blockState, template)
 {
 }
예제 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutPatternState{IInner}"/> class.
 /// </summary>
 /// <param name="parentBlockState">The parent block state.</param>
 /// <param name="index">The index used to create the state.</param>
 public LayoutPatternState(ILayoutBlockState parentBlockState, ILayoutBrowsingPatternIndex index)
     : base(parentBlockState, index)
 {
 }
예제 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutSourceState{IInner}"/> class.
 /// </summary>
 /// <param name="parentBlockState">The parent block state.</param>
 /// <param name="index">The index used to create the state.</param>
 public LayoutSourceState(ILayoutBlockState parentBlockState, ILayoutBrowsingSourceIndex index)
     : base(parentBlockState, index)
 {
 }