Ejemplo n.º 1
0
        /// <summary>
        /// Remembers a point that is about to be moved
        /// </summary>
        /// <param name="p">The point that is about to move</param>
        internal void AddMove(PointFeature p)
        {
            UpdateUndoMarker um = m_Moves.Peek();

            Debug.Assert(um != null);
            um.AddMove(p);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Rolls back changes (moves) that have occurred since the last undo marker (as defined
        /// via a prior call to <see cref="SetUndoMarker"/>).
        /// </summary>
        /// <returns>True if an undo marker was rolled back. False if everything has already
        /// been undone.</returns>
        internal bool Undo()
        {
            if (m_Moves.Count == 0)
            {
                return(false);
            }

            UpdateUndoMarker um = m_Moves.Pop();

            Debug.Assert(um != null);
            um.Undo();
            return(true);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Sets an undo marker to indicate a savepoint that the user may go back to
        /// while making a series of editing revisions.
        /// </summary>
        internal void SetUndoMarker()
        {
            UpdateUndoMarker um = new UpdateUndoMarker();

            if (m_Moves.Count > 0)
            {
                UpdateUndoMarker lastMarker = m_Moves.Peek();
                if (lastMarker != null && lastMarker.EditSequence == um.EditSequence)
                {
                    // If the last marker is empty, just get rid of it (user may have cancelled
                    // from previous edit)
                    if (lastMarker.IsEmpty)
                    {
                        m_Moves.Pop();
                    }
                    else
                    {
                        throw new InvalidOperationException("Attempt to create another undo marker for the same edit");
                    }
                }
            }

            m_Moves.Push(um);
        }