コード例 #1
0
        /// <summary>
        /// create visual items from the show items and place those visual items on the
        /// canvase.
        /// </summary>
        /// <param name="ShowItemList"></param>
        private void PaintScreen_Actual(List <ShowItemBase> ShowItemList)
        {
            foreach (IVisualItem iShowItem in ShowItemList)
            {
                // a literal value. look first for any fields on the screen which the
                // literal is applied to.
                if (iShowItem is ShowLiteralItem)
                {
                    var findNode = VisualItems.FindFieldItem(iShowItem);
                    if (findNode != null)
                    {
                        // replace textbock segment with the spanner.
                        var visualItem = findNode.Value as IVisualItem;
                        if (visualItem is VisualTextBlockSegment)
                        {
                            var seg = visualItem as VisualTextBlockSegment;
                            visualItem = seg.Parent;
                        }

                        var vim = visualItem as IVisualItemMore;

                        // pos within the canvas item at which to place literal text.
                        int bx = iShowItem.ShowRowCol( ).ColNum - visualItem.ShowRowCol().ColNum;

                        // apply the literal text.
                        vim.ApplyText(iShowItem.ShowText, bx);

                        visualItem.TailAttrByte = iShowItem.TailAttrByte;
                        continue;
                    }
                }

                {
                    var visualItem = VisualItemFactory(iShowItem);
                    visualItem.CreateFromItem = (ShowItemBase)iShowItem;

                    var iMore = visualItem as IVisualItemMore;
                    var node  = iMore.InsertIntoVisualItemsList(this.VisualItems);

                    // var node = InsertIntoVisualItemsList(visualItem as IVisualItem);
                    (visualItem as IVisualItemMore).AddToCanvas(this);

                    if (iShowItem is ShowFieldItem)
                    {
                        var fieldItem = iShowItem as ShowFieldItem;
                        iMore.SetupFieldItem(
                            fieldItem, this.CanvasDefn.CharBoxDim, this.CanvasDefn.KernDim);
                        iMore.CreateFromItem = fieldItem;
                    }
                }
            }
        }
コード例 #2
0
        private void PaintScreen_ApplyTextDataOrder(TextDataOrder tdo, IRowCol curRowCol)
        {
            var showText = tdo.ShowText;

            var showRowCol    = tdo.ShowRowCol(curRowCol);
            var itemEndRowCol = tdo.ItemEndRowCol(showRowCol);
            var itemRange     = new RowColRange(curRowCol, itemEndRowCol);

            IVisualItem ivi = null;

            // range if visual items which overlap this tdo.
            var overlapItems = VisualItems.GetOverlapItems(itemRange);

            if (overlapItems != null)
            {
                foreach (var cursor in overlapItems)
                {
                    var item         = cursor.GetVisualItem();
                    var itemRowCol   = item.ItemRowCol;
                    var tailAttrByte = tdo.TailAttrByte;
                    if ((tdo.TailAttrByte != null) &&
                        (item.AttrByte != null) &&
                        (tdo.ItemEndRowCol(curRowCol).CompareTo(item.ItemRowCol) == 0))
                    {
                        int xx = 4;
                    }
                }
            }
            else
            {
            }

            if (itemEndRowCol != null)
            {
                ivi = VisualItems.FindFieldItem(curRowCol, showRowCol, itemEndRowCol);
            }
            if (ivi != null)
            {
                // replace textbock segment with the spanner.
                if (ivi is VisualTextBlockSegment)
                {
                    var seg = ivi as VisualTextBlockSegment;
                    ivi = seg.Parent;
                }

                var vim = ivi as IVisualItemMore;

                // pos within the canvas item at which to place literal text.
                int bx = showRowCol.ColNum - ivi.ShowRowCol().ColNum;

                // apply the literal text.
                vim.ApplyText(showText, bx);
                if (tdo.TailAttrByte != null)
                {
                    ivi.TailAttrByte = tdo.TailAttrByte;
                }
            }
            else if (itemEndRowCol != null)
            {
                var visualItem = VisualItemFactory(
                    tdo.ShowText, (ZeroRowCol)curRowCol, tdo.AttrByte,
                    tdo.TailAttrByte);
                visualItem.FromOrder = tdo;

                var iMore = visualItem as IVisualItemMore;
                var node  = iMore.InsertIntoVisualItemsList(this.VisualItems);
                iMore.AddToCanvas(this);
            }
        }