Esempio n. 1
0
        public static ContentField ApplyStartFieldOrder(
            this ScreenContent master, IRowCol CurRowCol, StartFieldOrder StartField)
        {
            ContentField createField = null;
            var          fieldRange  = new RowColRange(CurRowCol, StartField.LL_Length + 1);
            var          buf         = master.GetContentBytes(CurRowCol, StartField.LL_Length + 1);

            // get the fields located within the bounds of the StartField. All of these
            // fields are removed from the ScreenTable.
            if (buf.AllMatch(0x00) == false)
            {
                foreach (var contentField in master.ContentFields(fieldRange))
                {
                    master.FieldDict.Remove(contentField.RowCol);
                    master.SetContentBytes(contentField.RowCol, 0x00);
                }
            }

            // add the field to the content table.
            {
                // store the attrByte at ItemRowCol location of the field.
                master.SetContentBytes(CurRowCol, StartField.AttrByte);

                // store field defn in FieldDict.
                createField =
                    master.FieldDict.AddFieldOrder(CurRowCol as ZeroRowCol, StartField);
            }

            // assign unique fieldKey to the field.
            {
                createField.FieldKey = ContentFieldKey.AssignFieldKey(master, createField);
            }

            return(createField);
        }
Esempio n. 2
0
 public ContentField(ZeroRowCol RowCol, StartFieldOrder FieldOrder)
 {
     this.RowCol     = RowCol;
     this.FieldOrder = FieldOrder;
     this.LL_Length  = FieldOrder.LL_Length;
     this.FFW_Bytes  = FieldOrder.FFW_Bytes;
     this.FCW_Bytes  = FieldOrder.FCW_Bytes;
 }
Esempio n. 3
0
        public void SetupFieldItem(
            StartFieldOrder sfo, Size CharBoxDim, Size KernDim)
        {
            this.IsMonocase   = sfo.IsMonocase;
            this.IsNonDisplay = sfo.IsNonDisplay;
            this.IsBypass     = sfo.IsBypass;
            this.Usage        = ShowUsage.Both;
            this.FFW_Bytes    = sfo.FFW_Bytes;
            SetupFieldItem_Common(CharBoxDim, KernDim);

            this.FromOrder = sfo;
        }
Esempio n. 4
0
        public ContentField AddFieldOrder(ZeroRowCol RowCol, StartFieldOrder Field)
        {
            ContentField contentField = null;

            if (Field.ContinuedFieldSegmentCode == null)
            {
                contentField = new ContentField(RowCol, Field);
            }
            else
            {
                contentField = new ContinuedContentField(RowCol, Field);
            }

            this.Add(RowCol, contentField);
            return(contentField);
        }
        /// <summary>
        /// build a byte stream containing the WTD workstation command orders from all
        /// of the visual items on the canvas. The visual item list is the equivalent of
        /// the 5250 format table.
        /// </summary>
        /// <param name="VisualItems"></param>
        /// <returns></returns>
        public byte[] BuildOrderStream(CanvasPositionCursor Caret)
        {
            ByteArrayBuilder ba = new ByteArrayBuilder();

            // start header order.
            {
                byte[] cmdKeySwitches = new byte[] { 0x00, 0x00, 0x00 };
                var    buf            = StartHeaderOrder.Build(0x00, 0x00, 24, cmdKeySwitches);
                ba.Append(buf);
            }

            // insert cursor order.
            {
                var zeroRowCol = Caret.RowCol as ZeroRowCol;
                var rowCol     = zeroRowCol.ToOneRowCol() as OneRowCol;
                var buf        = InsertCursorOrder.Build(rowCol);
                ba.Append(buf);
            }

            // build sets of SBA, StartField and TextData orders for each visual item. The
            // visual item represents something on the screen. Whether output literal or
            // and input field.
            // VisualItem visualItem = null;
            IVisualItem iVisual = null;
            var         cursor  = this.FirstVisualItem();

            while (cursor != null)
            {
                var pvVisualItem = iVisual;
                iVisual = cursor.GetVisualItem();

                if (iVisual is VisualSpanner)
                {
                }
                else
                {
                    {
                        var buf = SetBufferAddressOrder.Build(
                            iVisual.ItemRowCol.ToOneRowCol() as OneRowCol);
                        ba.Append(buf);
                    }

                    var visualItem = iVisual as VisualItem;
                    if (iVisual.IsField == true)
                    {
                        var vtb = iVisual as VisualTextBlock;
                        var ffw = vtb.FFW_Bytes;

                        byte attrByte = iVisual.AttrByte.Value;
                        int  lgth     = iVisual.ShowText.Length;
                        var  buf      = StartFieldOrder.Build(ffw[0], ffw[1], attrByte, lgth);
                        ba.Append(buf);
                    }

                    // create a text data order from either the text of the literal item. Or the
                    // text value of the entry field.
                    {
                        byte[] buf = null;
                        var    s1  = iVisual.ShowText;
                        if (iVisual.IsField == true)
                        {
                            buf = TextDataOrder.Build(s1, null, iVisual.TailAttrByte);
                        }
                        else if (visualItem.CreateFromItem != null)
                        {
                            var litItem = visualItem.CreateFromItem as ShowLiteralItem;

                            if (litItem.rao_RepeatTextByte != null)
                            {
                                var toRowCol = (iVisual.ItemEndRowCol() as ZeroRowCol).ToOneRowCol();
                                buf = RepeatToAddressOrder.Build(
                                    litItem.rao_RepeatTextByte.Value, toRowCol as OneRowCol);
                            }

                            else
                            {
                                var attrByte = litItem.AttrByte;
                                if (s1.Length < litItem.tdo_Length)
                                {
                                    s1 = s1.PadRight(litItem.tdo_Length);
                                }
                                buf = TextDataOrder.Build(s1, attrByte, iVisual.TailAttrByte);
                            }
                        }
                        else
                        {
                            buf = TextDataOrder.Build(s1, iVisual.AttrByte, iVisual.TailAttrByte);
                        }
                        ba.Append(buf);
                    }
                }
                cursor = cursor.NextItem(true);
            }

            return(ba.ToByteArray());;
        }
Esempio n. 6
0
 public ContinuedContentField(ZeroRowCol RowCol, StartFieldOrder FieldOrder)
     : base(RowCol, FieldOrder)
 {
 }
Esempio n. 7
0
        /// <summary>
        /// build a byte stream containing the WTD workstation command orders from all
        /// of the visual items on the canvas. The visual item list is the equivalent of
        /// the 5250 format table.
        /// </summary>
        /// <returns></returns>
        public byte[] BuildOrderStream()
        {
            var ba = new ByteArrayBuilder();

            // start header order.
            {
                byte[] cmdKeySwitches = new byte[] { 0x00, 0x00, 0x00 };
                var    buf            = StartHeaderOrder.Build(0x00, 0x00, 24, cmdKeySwitches);
                ba.Append(buf);
            }

            // insert cursor order.
            {
                var rowCol = this.CaretRowCol;
                if (rowCol == null)
                {
                    rowCol = new OneRowCol(1, 1, this);
                }
                var buf = InsertCursorOrder.Build(rowCol);
                ba.Append(buf);
            }

            // build sets of SBA, StartField and TextData orders for each visual item. The
            // visual item represents something on the screen. Whether output literal or
            // and input field.
            // VisualItem visualItem = null;
            foreach (var dictItem in this.FieldDict)
            {
                var contentItem = dictItem.Value;
                {
                    var buf = SetBufferAddressOrder.Build(
                        contentItem.RowCol.ToOneRowCol() as OneRowCol);
                    ba.Append(buf);
                }

                if (contentItem is ContentField)
                {
                    var contentField = contentItem as ContentField;
                    var ffw          = contentField.FFW_Bytes;

                    byte attrByte = contentField.GetAttrByte(this).Value;
                    int  lgth     = contentField.LL_Length;
                    var  buf      = StartFieldOrder.Build(ffw[0], ffw[1], attrByte, lgth);
                    ba.Append(buf);
                }

                // create a text data order from either the text of the literal item. Or the
                // text value of the entry field.
                {
                    byte[] buf = null;
                    var    s1  = contentItem.GetShowText(this);
                    if (contentItem is ContentField)
                    {
                        buf = TextDataOrder.Build(s1, null, null);
                    }
                    else
                    {
                        buf = TextDataOrder.Build(s1, contentItem.GetAttrByte(this), null);
                    }
                    ba.Append(buf);
                }
            }

            return(ba.ToByteArray());;
        }