Ejemplo n.º 1
0
 public void AddUndoEntity(UndoEntity entity)
 {
     if (!_disableUndo)
     {
         _undoEngine.AddUndoEntity(entity);
         enableUndo();
     }
 }
Ejemplo n.º 2
0
 public void AddUndoEntity(UndoEntity entity)
 {
     if (!_disableUndo)
     {
         _undoEngine.AddUndoEntity(entity);
         OnHasUndoChange();
     }
 }
Ejemplo n.º 3
0
 public void CommitUndoTransaction(string transactionName)
 {
     if (_undoTransaction != null && _undoTransaction.ContainsKey(transactionName))
     {
         MathExpGroupUndo _currStates = _undoTransaction[transactionName];
         MathExpGroupUndo objRedo     = new MathExpGroupUndo(this, (MathExpGroup)root.Export().Clone());
         UndoEntity       undo        = new UndoEntity(_currStates, objRedo);
         _undoTransaction.Remove(transactionName);
         _undoEngine.AddUndoEntity(undo);
         enableUndo();
         _disableUndo = false;
     }
 }
Ejemplo n.º 4
0
        protected override void OnSizeChanged(EventArgs e)
        {
            base.OnSizeChanged(e);
            IMathDesigner md = this.Parent as IMathDesigner;

            if (md != null)
            {
                md.ReSelectComponent(this);
                if (!md.DisableUndo)
                {
                    UndoEntity entity = new UndoEntity(new SizeUndo(md, this.ActiveDrawingID, _size0), new SizeUndo(md, this.ActiveDrawingID, this.Size));
                    md.AddUndoEntity(entity);
                }
            }
            setChanged();
        }
        private void miAddLineNode_Click(object sender, EventArgs e)
        {
            MenuItem mi = sender as MenuItem;

            if (mi != null)
            {
                NodeData nd = mi.Tag as NodeData;
                if (nd != null)
                {
                    LinkLineNode node = nd.Node;

                    if (node != null)
                    {
                        if (nd.Data != null)
                        {
                            if (nd.Data.GetType().Equals(typeof(Point)))
                            {
                                Point pt = (Point)nd.Data;
                                if (node.Line != null)
                                {
                                    UInt32       key2    = node.ActiveDrawingID;
                                    LinkLineNode newNode = node.InsertNode(pt.X + 5, pt.Y + 5);
                                    if (UndoHost != null)
                                    {
                                        if (!UndoHost.DisableUndo)
                                        {
                                            UInt32     key1   = newNode.ActiveDrawingID;
                                            UndoEntity entity = new UndoEntity(
                                                new LinkLineUndoDelete(UndoHost, key1), new LinkLineUndoAdd(UndoHost, key2, pt));
                                            UndoHost.AddUndoEntity(entity);
                                        }
                                    }
                                    newNode.SaveLocation();
                                    newNode.Selected = true;
                                    ActiveDrawing.RefreshControl(this);
                                    OnLineNodeAdded(newNode);
                                }
                            }
                        }
                    }
                }
            }
        }
        protected override void OnMouseUp(MouseEventArgs e)
        {
            if (bMD && this.Capture)
            {
                IMathDesigner p = this.Parent as IMathDesigner;
                if (p != null && !p.DisableUndo)
                {
                    UndoEntity entity = new UndoEntity(new PositionUndo(p, this.ActiveDrawingID, _location), new PositionUndo(p, this.ActiveDrawingID, this.Location));
                    p.AddUndoEntity(entity);
                    _location = this.Location;
                }
            }
            bMD          = false;
            this.Capture = false;
            Diagram dg = this.Parent as Diagram;

            if (dg != null)
            {
                dg.SetMouseUpControl();
            }
        }
Ejemplo n.º 7
0
        void componentChangeService_ComponentChanged(object sender, ComponentChangedEventArgs e)
        {
            if (!_disableUndo)
            {
                if (e.OldValue != null)
                {
                    Point pOld = (Point)e.OldValue;

                    if (e.NewValue != null)
                    {
                        Point          pNew = (Point)e.NewValue;
                        IActiveDrawing c    = e.Component as IActiveDrawing;
                        if (c != null)
                        {
                            UInt32     key    = c.ActiveDrawingID;
                            UndoEntity entity = new UndoEntity(new PositionUndo(this, key, pOld), new PositionUndo(this, key, pNew));
                            AddUndoEntity(entity);
                        }
                    }
                }
            }
        }