private void UpdateEditor() { if (_editor != null) { _editor.VisualContainer.Children.CollectionChanged -= Controls_CollectionChanged; _editor.SelectedItems.CollectionChanged -= SelectedControls_CollectionChanged; } if (Editor is PanelDocument) { _editor = (Editor as PanelDocument).PanelEditor; } else if (Editor is MonitorDocument) { _editor = (Editor as MonitorDocument).MonitorEditor; } else { _editor = null; } if (_editor != null) { _editor.VisualContainer.Children.CollectionChanged += Controls_CollectionChanged; _editor.SelectedItems.CollectionChanged += SelectedControls_CollectionChanged; } CopyControlsList(); }
public SelectionAdorner(HeliosVisualContainerEditor adornedElement) : base(adornedElement) { _children = new VisualCollection(this); _editor = adornedElement; _editor.SelectedItems.CollectionSizeChanged += new EventHandler(SelectedItems_PropertyChanged); _editor.GotKeyboardFocus += new KeyboardFocusChangedEventHandler(Editor_GotKeyboardFocus); _editor.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(Editor_LostKeyboardFocus); _drawFocus = Keyboard.FocusedElement.Equals(_editor); SelectionBorderPen.DashStyle = DashStyles.Dash; SelectionResizeBrush.Opacity = 0.5d; BuildAdornerCorner(ref _topLeft, Cursors.SizeNWSE, new DragStartedEventHandler(TopLeft_DragStarted)); BuildAdornerCorner(ref _topRight, Cursors.SizeNESW, new DragStartedEventHandler(TopRight_DragStarted)); BuildAdornerCorner(ref _bottomLeft, Cursors.SizeNESW, new DragStartedEventHandler(BottomLeft_DragStarted)); BuildAdornerCorner(ref _bottomRight, Cursors.SizeNWSE, new DragStartedEventHandler(BottomRight_DragStarted)); CheckLine(); }
private static void CloseDoucments(HeliosVisual visual, HeliosVisualContainerEditor editor) { ProfileEditorCommands.CloseProfileItem.Execute(visual, editor); foreach (HeliosVisual child in visual.Children) { CloseDoucments(child, editor); } }
private static void DeleteSelection(HeliosVisualContainerEditor editor) { List<HeliosVisual> removedControls = new List<HeliosVisual>(); List<int> removedIndexes = new List<int>(); foreach (HeliosVisual control in editor.SelectedItems) { removedControls.Add(control); removedIndexes.Add(editor.VisualContainer.Children.IndexOf(control)); } foreach (HeliosVisual control in removedControls) { editor.VisualContainer.Children.Remove(control); CloseDoucments(control, editor); } ConfigManager.UndoManager.AddUndoItem(new ControlDeleteUndoEvent(editor.VisualContainer, removedControls, removedIndexes)); editor.SelectedItems.Clear(); }