示例#1
0
        private static void _ParseNode(ElementNode node)
        {
            PositionValue positionValue = new PositionValue(0, 1);
            PositionMap   positions     = _ParseChildren(node, positionValue);

            _nodePositionMap.AddRange(positions);
        }
示例#2
0
        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);
        }
示例#3
0
 private void listBoxNodeChildren_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listBoxNodeChildren.SelectedItem != null)
     {
         PositionValue position = _positions[listBoxNodeChildren.SelectedIndex];
         _Start = position.Start;
         _Width = position.Width;
     }
 }
示例#4
0
        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;
            }
        }
示例#5
0
 public PositionValue(PositionValue value)
     : this(value.Start, value.Width)
 {
 }
示例#6
0
        private void _UpdatePosition()
        {
            PositionValue position = new PositionValue(_Start, _Width);

            _positions[listBoxNodeChildren.SelectedIndex] = position;
        }
示例#7
0
 public PositionValue(PositionValue value)
     : this(value.Start, value.Width)
 {
 }
示例#8
0
		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;
		}
示例#9
0
		private static void _ParseNode(ElementNode node)
		{
			PositionValue positionValue = new PositionValue(0, 1);
			PositionMap positions = _ParseChildren(node, positionValue);
			_nodePositionMap.AddRange(positions);
		}
示例#10
0
		private static PositionValue _Multiply(PositionValue parentPosition, PositionValue childPosition)
		{
			return new PositionValue(parentPosition.Start + childPosition.Start*parentPosition.Width,
			                         childPosition.Width*parentPosition.Width);
		}
示例#11
0
 private static PositionValue _Multiply(PositionValue parentPosition, PositionValue childPosition)
 {
     return(new PositionValue(parentPosition.Start + childPosition.Start * parentPosition.Width,
                              childPosition.Width * parentPosition.Width));
 }
示例#12
0
 private void _UpdatePosition()
 {
     PositionValue position = new PositionValue(_Start, _Width);
     _positions[listBoxNodeChildren.SelectedIndex] = position;
 }