Esempio n. 1
0
 private void Control_EndResize(HtmlDesignMovableControl c)
 {
     if (c.Control.Size != _PreviousSize)
     {
         HtmlPage.AddUndoOperation(HtmlControlModification.GetResized(c, _PreviousSize));
         UpdateUndoRedoState();
     }
 }
Esempio n. 2
0
 private void ControlProperty_ValueChanging(object control, string propertyName, object oldValue, object newValue)
 {
     if (!_IsUndoRedoState)
     {
         HtmlPage.AddUndoOperation(HtmlControlModification.GetPropertyChanged((HtmlControl)control, propertyName, oldValue));
         UpdateUndoRedoState();
     }
 }
Esempio n. 3
0
        private void miDelete_Click(object sender, EventArgs e)
        {
#if CHECKERS
            if (IsSelectionEmpty)
            {
                throw new InvalidOperationException();
            }
#endif
            var  b       = new StringBuilder();
            bool isFirst = true;
            foreach (var c in _selectionList)
            {
                if (!isFirst)
                {
                    b.Append(", ");
                }
                else
                {
                    isFirst = false;
                }
                b.Append(c.Owner.Title);
            }

            if (Extenders.ConfirmDelete(b.ToString()))
            {
                var list = _selectionList.ToArray();
                UnSelectAll();
                var mg = new ModificationCollection <HtmlControlModification>();
                foreach (var c in list)
                {
                    FreeResources(c.Owner);
                    HtmlDesignMovableControl owner = c.Owner;
                    owner.NotifyDelete();

                    mg.Add(HtmlControlModification.GetRemoved(owner));

                    owner.Parent = null;
                }
                if (mg.Count > 0)
                {
                    HtmlPage.AddUndoOperation(mg.Count == 1 ? (IModification)mg[0] : mg);
                }
                else
                {
                    throw new InvalidOperationException();
                }
                UpdateUndoRedoState();
            }
        }
Esempio n. 4
0
 private void PanelClick(object sender, EventArgs e)
 {
     if (CheckedButton != null)
     {
         var c = ((Type)CheckedButton.Tag).Create <HtmlDesignMovableControl>();
         c.Parent           = HtmlPage;
         c.Control.Location = HtmlPage.Control.PointToClient(MousePosition);
         SetUpControl(c);
         UnSelectAllInternal();
         SelectControl(c);
         CheckedButton = null;
         c.Control.Focus();
         HtmlPage.AddUndoOperation(HtmlControlModification.GetAdded(c));
         UpdateUndoRedoState();
     }
     else
     {
         HtmlPage.Control.Focus();
         UnSelectAll();
         Forms.PropertyEditor.SetContext(HtmlPage, GetScope(), PropertyEditorSelectedObjectChanged).ValueChanging += ControlProperty_ValueChanging;
     }
 }
Esempio n. 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;
        }