Exemple #1
0
        public TREEBox MakeNewSpecialBox(TREEBoxType type)
        {
            //add box at end. no delta needs to be applied.
            var box = new TREEBox(this);

            box.InternalID      = (short)Entries.Count;
            box.PosisionInvalid = true;
            box.Type            = type;
            Entries.Add(box);
            return(box);
        }
Exemple #2
0
        public TREEBox MakeNewPrimitiveBox(TREEBoxType type)
        {
            var primEnd = PrimitiveCount;

            ApplyPointerDelta(1, primEnd);
            //find end of primitives and add box there. apply delta
            var box = new TREEBox(this);

            box.InternalID      = (short)primEnd;
            box.PosisionInvalid = true;
            box.Type            = type;
            Entries.Insert(primEnd, box);
            return(box);
        }
Exemple #3
0
        public void Read(IoBuffer io, int version)
        {
            Type         = (TREEBoxType)io.ReadUInt16();
            Unknown      = io.ReadUInt16();
            Width        = io.ReadInt16();
            Height       = io.ReadInt16();
            X            = io.ReadInt16();
            Y            = io.ReadInt16();
            CommentSize  = io.ReadInt16();
            TruePointer  = io.ReadInt16();
            Special      = io.ReadInt16();
            FalsePointer = io.ReadInt32();
            Comment      = io.ReadNullTerminatedString();
            if (Comment.Length % 2 == 0)
            {
                io.ReadByte();                          //padding to 2 byte align
            }
            if (version > 0)
            {
                TrailingZero = io.ReadInt32();
            }

            if (!Enum.IsDefined(typeof(TREEBoxType), Type))
            {
                throw new Exception("Unexpected TREE box type: " + Type.ToString());
            }
            if (Special < -1 || Special > 0)
            {
                throw new Exception("Unexpected TREE special: " + Special);
            }
            if (Unknown != 0)
            {
                throw new Exception("Unexpected Unknown: " + Unknown);
            }
            if (TrailingZero != 0)
            {
                Console.WriteLine("Unexpected TrailingZero: " + TrailingZero);
            }
        }
Exemple #4
0
        public void SetPlacement(TREEBoxType type, PrimitiveBox target)
        {
            PlacingName.Visible = true;
            PlacingDesc.Visible = true;

            var tree = BHAVView.EditTargetTree;
            var box  = new TREEBox(tree);

            if (target != null)
            {
                box.TruePointer = target.TreeBox.InternalID;
            }
            box.Width  = 200;
            box.Height = 60;
            box.Type   = type;
            if (type == TREEBoxType.Label)
            {
                box.Comment = "Label " + (tree.Entries.Count(x => x.Type == TREEBoxType.Label) + 1);
            }
            Placement           = new PrimitiveBox(box, BHAVView);
            PlacingName.Caption = "Placing " + type.ToString();
            Placement.Parent    = this;
        }
Exemple #5
0
 public void SetPlacement(TREEBoxType type)
 {
     SetPlacement(type, null);
 }