/// <summary> /// Constructor /// </summary> /// <param name="controls"></param> /// <param name="newParent"></param> public ChangeParentCommand(List <GUIControl> controls, GUIControl newParent, int index) { foreach (GUIControl control in controls) { ControlState controlState = new ControlState(); controlState.mControl = control; controlState.mParent = control.Parent; controlState.mIndex = control.Parent.Controls.IndexOf(control); controlState.mCenter = control.Center; controlState.mRotation = control.Rotation; controlState.mLocation = control.Location; // Store the original frame layouts and things foreach (GUIAnimation animation in control.ParentView.Animations) { foreach (GUIAnimationChannel channel in animation.AnimationChannels) { if (channel.Control != control) { continue; } ChannelState channelState = new ChannelState(); channelState.mChannel = channel; foreach (KeyFrame keyFrame in channel.KeyFrames) { channelState.mLayouts.Add((ControlLayout)keyFrame.Layout.Clone()); } controlState.mChannelStates.Add(channelState); } } mControlStates.Add(controlState); } mControls.AddRange(controls); mNewParent = newParent; mIndex = index; }
/// <summary> /// Constructor /// </summary> /// <param name="controls"></param> /// <param name="newParent"></param> public ChangeParentCommand(List<GUIControl> controls, GUIControl newParent, int index) { foreach (GUIControl control in controls) { ControlState controlState = new ControlState(); controlState.mControl = control; controlState.mParent = control.Parent; controlState.mIndex = control.Parent.Controls.IndexOf(control); controlState.mCenter = control.Center; controlState.mRotation = control.Rotation; controlState.mLocation = control.Location; // Store the original frame layouts and things foreach (GUIAnimation animation in control.ParentView.Animations) { foreach (GUIAnimationChannel channel in animation.AnimationChannels) { if (channel.Control != control) continue; ChannelState channelState = new ChannelState(); channelState.mChannel = channel; foreach (KeyFrame keyFrame in channel.KeyFrames) { channelState.mLayouts.Add((ControlLayout)keyFrame.Layout.Clone()); } controlState.mChannelStates.Add(channelState); } } mControlStates.Add(controlState); } mControls.AddRange(controls); mNewParent = newParent; mIndex = index; }