private VisualItem VisualItemFactory(IVisualItem ShowItem) { VisualItem visualItem = null; if (ShowItem.DoesShowSpanMultipleRows() == true) { visualItem = new VisualSpanner( ShowItem.ShowText, ShowItem.ItemRowCol, ShowItem.AttrByte, this.CanvasDefn); visualItem.CreateFromItem = (ShowItemBase)ShowItem; } else { visualItem = new VisualTextBlock( ShowItem.ShowText, ShowItem.ItemRowCol, ShowItem.AttrByte, this.CanvasDefn.CharBoxDim, this.CanvasDefn.KernDim, this.CanvasDefn.FontDefn); visualItem.CreateFromItem = (ShowItemBase)ShowItem; } return(visualItem); }
/// <summary> /// create VisualTextBlock or VisualSpanner from string to display on the /// canvase. If string spans multiple rows, create VisualSpanner which in turn /// contains multiple VisualTextBlock segments. /// </summary> /// <param name="ShowText"></param> /// <param name="ItemRowCol"></param> /// <param name="AttrByte"></param> /// <param name="TailAttrByte"></param> /// <returns></returns> public VisualItem VisualItemFactory(string ShowText, ZeroRowCol ItemRowCol, byte?AttrByte, byte?TailAttrByte) { VisualItem visualItem = null; if (CanvasCommon.DoesSpanMultipleRows( ItemRowCol, AttrByte, ShowText.Length) == true) { visualItem = new VisualSpanner(ShowText, ItemRowCol, AttrByte, this.CanvasDefn); } else { visualItem = new VisualTextBlock( ShowText, ItemRowCol, AttrByte, this.CanvasDefn.CharBoxDim, this.CanvasDefn.KernDim, this.CanvasDefn.FontDefn); visualItem.TailAttrByte = TailAttrByte; } return(visualItem); }
/// <summary> /// create visual items from the show items and place those visual items on the /// canvase. /// </summary> /// <param name="ShowItemList"></param> private OneRowCol PaintScreen_Actual( WriteToDisplayCommand WTD_command, TelnetLogList LogList = null) { IRowCol curRowCol = new ZeroRowCol(0, 0); OneRowCol caret = null; foreach (var order in WTD_command.OrderList) { if (LogList != null) { LogList.AddItem(Direction.Read, "PaintScreen. " + order.ToString()); } if (order is TextDataOrder) { var tdo = order as TextDataOrder; if (tdo.IsEmpty() == false) { PaintScreen_ApplyTextDataOrder(tdo, curRowCol); } curRowCol = tdo.Advance(curRowCol); } else if (order is SetBufferAddressOrder) { var sba = order as SetBufferAddressOrder; curRowCol = sba.GetRowCol(this.ScreenDim).ToZeroRowCol(); } else if (order.OrderCode == WtdOrder.InsertCursor) { var ico = order as InsertCursorOrder; caret = ico.RowCol; } else if (order is StartFieldOrder) { var sfo = order as StartFieldOrder; { var showText = new String(' ', sfo.LL_Length); var vtb = new VisualTextBlock( showText, (ZeroRowCol)curRowCol, sfo.AttrByte, this.CanvasDefn.CharBoxDim, this.CanvasDefn.KernDim, this.CanvasDefn.FontDefn); var iMore = vtb as IVisualItemMore; var node = iMore.InsertIntoVisualItemsList(this.VisualItems); iMore.AddToCanvas(this); vtb.SetupFieldItem( sfo, this.CanvasDefn.CharBoxDim, this.CanvasDefn.KernDim); } curRowCol = curRowCol.Advance(1); } else if (order is RepeatToAddressOrder) { var rao = order as RepeatToAddressOrder; this.VisualItems.ApplyRepeatToAddressOrder(curRowCol, rao, this); var lx = rao.RepeatLength((ZeroRowCol)curRowCol); curRowCol = curRowCol.Advance(lx); } else if (order is EraseToAddressOrder) { var eao = order as EraseToAddressOrder; this.VisualItems.ApplyEraseToAddressOrder(curRowCol, eao, this); var lx = eao.EraseLength((ZeroRowCol)curRowCol); curRowCol = curRowCol.Advance(lx); } } return(caret); }