private static void _ParseNode(ElementNode node) { PositionValue positionValue = new PositionValue(0, 1); PositionMap positions = _ParseChildren(node, positionValue); _nodePositionMap.AddRange(positions); }
private static PositionMap _ParseChildren(ElementNode parentNode, PositionValue parentPosition) { // Traverse every node. Nodes with the position property will affect the childrens' // positions. PositionMap childValues = new PositionMap(); PositionModule positionProperty = parentNode.Properties.Get(PositionDescriptor._typeId) as PositionModule; foreach (ElementNode childNode in parentNode.Children) { PositionValue childPosition = positionProperty.GetPositionValues(childNode.Id); if (childPosition != null) { // Parent has a modifying position for the child. childPosition = _Multiply(parentPosition, childPosition); } else { // Child inherits parent's position. childPosition = new PositionValue(parentPosition); } childValues[childNode.Id] = childPosition; childValues.AddRange(_ParseChildren(childNode, childPosition)); } return(childValues); }
private void listBoxNodeChildren_SelectedIndexChanged(object sender, EventArgs e) { if (listBoxNodeChildren.SelectedItem != null) { PositionValue position = _positions[listBoxNodeChildren.SelectedIndex]; _Start = position.Start; _Width = position.Width; } }
private void buttonOK_Click(object sender, EventArgs e) { PositionData data = _positionProperty.StaticModuleData as PositionData; for (int i = 0; i < _positions.Length; i++) { ElementNode child = _children[i]; PositionValue childPosition = _positions[i]; data.ChildrenPositions[child.Id] = childPosition; } }
public PositionValue(PositionValue value) : this(value.Start, value.Width) { }
private void _UpdatePosition() { PositionValue position = new PositionValue(_Start, _Width); _positions[listBoxNodeChildren.SelectedIndex] = position; }
public PositionValue(PositionValue value) : this(value.Start, value.Width) { }
private static PositionMap _ParseChildren(ElementNode parentNode, PositionValue parentPosition) { // Traverse every node. Nodes with the position property will affect the childrens' // positions. PositionMap childValues = new PositionMap(); PositionModule positionProperty = parentNode.Properties.Get(PositionDescriptor._typeId) as PositionModule; foreach (ElementNode childNode in parentNode.Children) { PositionValue childPosition = positionProperty.GetPositionValues(childNode.Id); if (childPosition != null) { // Parent has a modifying position for the child. childPosition = _Multiply(parentPosition, childPosition); } else { // Child inherits parent's position. childPosition = new PositionValue(parentPosition); } childValues[childNode.Id] = childPosition; childValues.AddRange(_ParseChildren(childNode, childPosition)); } return childValues; }
private static void _ParseNode(ElementNode node) { PositionValue positionValue = new PositionValue(0, 1); PositionMap positions = _ParseChildren(node, positionValue); _nodePositionMap.AddRange(positions); }
private static PositionValue _Multiply(PositionValue parentPosition, PositionValue childPosition) { return new PositionValue(parentPosition.Start + childPosition.Start*parentPosition.Width, childPosition.Width*parentPosition.Width); }
private static PositionValue _Multiply(PositionValue parentPosition, PositionValue childPosition) { return(new PositionValue(parentPosition.Start + childPosition.Start * parentPosition.Width, childPosition.Width * parentPosition.Width)); }
private void _UpdatePosition() { PositionValue position = new PositionValue(_Start, _Width); _positions[listBoxNodeChildren.SelectedIndex] = position; }