Пример #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;
 }