示例#1
0
        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");
        }
示例#2
0
 private void FreeResources(HtmlDesignMovableControl c)
 {
     if ((c as HtmlCodeSnippet) != null)
     {
         (c.Control as CodeSnippet).DeleteResources();
     }
 }
示例#3
0
 private void UnSelectControl(HtmlDesignMovableControl c)
 {
     UnSelectControlInternal(c);
     SelectionChanged();
     c.Control.Focus();
 }
示例#4
0
        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();
        }
示例#5
0
 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;
 }
示例#6
0
 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;
 }
示例#7
0
 private void Control_EndResize(HtmlDesignMovableControl c)
 {
     if (c.Control.Size != _PreviousSize)
     {
         HtmlPage.AddUndoOperation(HtmlControlModification.GetResized(c, _PreviousSize));
         UpdateUndoRedoState();
     }
 }
示例#8
0
 private void Control_BeginResize(HtmlDesignMovableControl c)
 {
     _PreviousSize = c.Control.Size;
 }