private void UnSelectControlInternal(HtmlDesignMovableControl c) { int index = _selectionList.FindIndex(bc => bc.Owner.Equals(c)); #if CHECKERS if (index < 0) { throw new FireFlyException("{0} is not selected", c.Title); } #endif Control winControl = c.Control; winControl.KeyUp -= ControlKeyUp; c.BeginMove -= Control_BeginMove; c.EndMove -= Control_EndMove; c.BeginResize -= Control_BeginResize; c.EndResize -= Control_EndResize; Forms.Main.UnRegisterToolBoxItems(winControl); _selectionList[index].Dispose(); _selectionList.RemoveAt(index); Debug.WriteLine("PageEditor: '" + c.Title + "' - DeSelected"); }
private void FreeResources(HtmlDesignMovableControl c) { if ((c as HtmlCodeSnippet) != null) { (c.Control as CodeSnippet).DeleteResources(); } }
private void UnSelectControl(HtmlDesignMovableControl c) { UnSelectControlInternal(c); SelectionChanged(); c.Control.Focus(); }
private void SelectControl(HtmlDesignMovableControl c) { #if CHECKERS if (IsControlSelected(c)) { throw new FireFlyException("{0} is already selected", c.Title); } #endif _selectionList.Add(new BoundControl(c)); Control winControl = c.Control; winControl.KeyUp += ControlKeyUp; c.BeginMove += Control_BeginMove; c.EndMove += Control_EndMove; c.BeginResize += Control_BeginResize; c.EndResize += Control_EndResize; Action d = () => { if (IsControlSelected(c)) { UnSelectControl(c); } }; c.Deleting += d; c.Disposed += d; if (c is HtmlCodeSnippet) { Forms.Main.RegisterToolBoxButton(winControl, miEditInMSWord)(true); } Forms.Main.RegisterToolBoxButton(winControl, miProperties)(true); Forms.Main.RegisterToolBoxButton(winControl, miDelete)(true); Debug.WriteLine("PageEditor: '" + c.Title + "' - Selected"); SelectionChanged(); }
private void Control_EndMove(HtmlDesignMovableControl c) { IModification m; if (_selectionList.Count == 1) { HtmlDesignMovableControl o = _selectionList[0].Owner; Point previousLocation = _PreviousLocations[o]; m = previousLocation != o.Control.Location ? HtmlControlModification.GetMoved(o, previousLocation) : (IModification)null; } else { var list = new ModificationCollection<HtmlControlModification>(); foreach (var bc in _selectionList) { HtmlDesignMovableControl o = bc.Owner; Point previousLocation = _PreviousLocations[o]; if (previousLocation != o.Control.Location) { list.Add(HtmlControlModification.GetMoved(o, previousLocation)); } } if (list.Count == 1) { m = list[0]; } else { m = list.Count > 0 ? list : null; } } if(m != null) { HtmlPage.AddUndoOperation(m); UpdateUndoRedoState(); } c.Control.LocationChanged -= Control_LocationChanged; }
private void Control_BeginMove(HtmlDesignMovableControl c) { foreach (var bc in _selectionList) { HtmlDesignMovableControl owner = bc.Owner; _PreviousLocations[owner] = owner.Control.Location; } c.Control.LocationChanged += Control_LocationChanged; }
private void Control_EndResize(HtmlDesignMovableControl c) { if (c.Control.Size != _PreviousSize) { HtmlPage.AddUndoOperation(HtmlControlModification.GetResized(c, _PreviousSize)); UpdateUndoRedoState(); } }
private void Control_BeginResize(HtmlDesignMovableControl c) { _PreviousSize = c.Control.Size; }