public SchematicEditor(Circuit.Schematic Schematic) : base(Schematic) { InitializeComponent(); CommandBindings.Add(new CommandBinding(ApplicationCommands.Save, Save_Executed)); CommandBindings.Add(new CommandBinding(ApplicationCommands.SaveAs, SaveAs_Executed)); CommandBindings.Add(new CommandBinding(ApplicationCommands.Delete, Delete_Executed, Delete_CanExecute)); CommandBindings.Add(new CommandBinding(ApplicationCommands.Cut, Cut_Executed, Cut_CanExecute)); CommandBindings.Add(new CommandBinding(ApplicationCommands.Copy, Copy_Executed, Copy_CanExecute)); CommandBindings.Add(new CommandBinding(ApplicationCommands.Paste, Paste_Executed, Paste_CanExecute)); CommandBindings.Add(new CommandBinding(ApplicationCommands.SelectAll, SelectAll_Executed, SelectAll_CanExecute)); CommandBindings.Add(new CommandBinding(ApplicationCommands.Undo, Undo_Executed, Undo_CanExecute)); CommandBindings.Add(new CommandBinding(ApplicationCommands.Redo, Redo_Executed, Redo_CanExecute)); Focusable = true; Cursor = Cursors.Cross; edits = new EditStack(); Tool = new SelectionTool(this); Width = 1600; Height = 1600; Origin = SnapToGrid(new Circuit.Coord((int)Width / 2, (int)Height / 2)); }
void properties_PropertyValueChanged(object sender, PropertyValueChangedEventArgs e) { IEnumerable <object> selected = Properties.SelectedObjects; PropertyInfo property = selected.First().GetType().GetProperty(e.ChangedItem.PropertyDescriptor.Name); EditStack edits = (EditStack)Properties.Tag; edits.Did(EditList.New(selected.Select(i => new PropertyEdit(i, property, property.GetValue(i, null), e.OldValues[i])))); }