// Adds changes on the selected element to the history. private void onElementPropertyChanged(object s, PropertyValueChangedEventArgs e) { PlayFieldEditor.Invalidate(); IChange change = new PropertyChange((PinballElement)elementInspector.SelectedObject, e.ChangedItem.PropertyDescriptor.Name, e.ChangedItem.Value, e.OldValue); PlayFieldEditor.History.Add(change); }
// Adds changes on the machine to the history. private void onMachinePropertyChanged(object s, PropertyValueChangedEventArgs e) { IChange change = new PropertyChange(PlayFieldEditor.PinballMachine, e.ChangedItem.PropertyDescriptor.Name, e.ChangedItem.Value, e.OldValue); PlayFieldEditor.History.Add(change); }
protected override void OnMouseUp(object sender, MouseEventArgs e) { if (State == SelectionState.Dragging && posChange != null) { Editor.History.Add(posChange); posChange = null; } if (State == SelectionState.Shaping && currentPoint != shapeData.startPoint) { var translation = new TranslationChange(SelectedElement, SelectedElement.Location - shapeData.initialPoint); var scale = new PropertyChange(SelectedElement, "Scale", SelectedElement.Scale, shapeData.initialScale); var rotation = new PropertyChange(SelectedElement, "BaseRotation", SelectedElement.BaseRotation, shapeData.initialRotation); Editor.History.Add(new CompoundChange(new IChange[] { translation, scale, rotation })); } State = SelectionState.Idle; Editor.Invalidate(); }