public void PreparePrimitive() { Descriptor = PrimitiveRegistry.GetDescriptor(Instruction.Opcode); Operand = (VMPrimitiveOperand)Activator.CreateInstance(Descriptor.OperandType); Operand.Read(Instruction.Operand); Nodes = new PrimitiveNode[2]; Nodes[0] = new PrimitiveNode(); Nodes[0].Type = NodeType.False; Nodes[1] = new PrimitiveNode(); Nodes[1].Type = NodeType.True; Title = new UILabel(); Title.Alignment = TextAlignment.Middle | TextAlignment.Center; Title.Y = 0; Title.X = 0; this.Add(Title); Title.CaptionStyle = TextStyle.DefaultLabel.Clone(); Title.CaptionStyle.Font = FSO.Client.GameFacade.EdithFont; Title.CaptionStyle.VFont = FSO.Client.GameFacade.EdithVectorFont; Title.CaptionStyle.Size = 14; Index = new UILabel(); Index.Alignment = TextAlignment.Right | TextAlignment.Center; Index.Y = 0; Index.X = 0; this.Add(Index); Index.CaptionStyle = TextStyle.DefaultLabel.Clone(); Index.CaptionStyle.Font = FSO.Client.GameFacade.EdithFont; Index.CaptionStyle.VFont = FSO.Client.GameFacade.EdithVectorFont; Index.CaptionStyle.Size = 10; Index.Visible = false; BodyTextStyle = TextStyle.DefaultLabel.Clone(); BodyTextStyle.Font = FSO.Client.GameFacade.EdithFont; BodyTextStyle.VFont = FSO.Client.GameFacade.EdithVectorFont; BodyTextStyle.Size = 12; CommentNode = new CommentContainer(TreeBox.Comment); CommentNode.OnCommentChanged += CommentNode_OnCommentChanged; CommentNode.Y = -3; Add(CommentNode); this.Add(Nodes[0]); this.Add(Nodes[1]); UpdateDisplay(); }
public PrimitiveBox(BHAVInstruction inst, byte ptr, BHAVContainer master) { Type = PrimBoxType.Primitive; Instruction = inst; Descriptor = PrimitiveRegistry.GetDescriptor(inst.Opcode); Operand = (VMPrimitiveOperand)Activator.CreateInstance(Descriptor.OperandType); Operand.Read(inst.Operand); InstPtr = ptr; Nodes = new PrimitiveNode[2]; Nodes[0] = new PrimitiveNode { Type = NodeType.False }; Nodes[1] = new PrimitiveNode { Type = NodeType.True }; Title = new UILabel { Alignment = TextAlignment.Middle | TextAlignment.Center, Y = 0, X = 0 }; this.Add(Title); Title.CaptionStyle = TextStyle.DefaultLabel.Clone(); Title.CaptionStyle.Font = Client.GameFacade.EdithFont; Title.CaptionStyle.Size = 14; BodyTextStyle = TextStyle.DefaultLabel.Clone(); BodyTextStyle.Font = Client.GameFacade.EdithFont; BodyTextStyle.Size = 12; this.Add(Nodes[0]); this.Add(Nodes[1]); HitTest = ListenForMouse(new Rectangle(0, 0, Width, Height), new UIMouseEvent(MouseEvents)); Master = master; UpdateDisplay(); }