Esempio n. 1
0
        public void AddItem(HistoryItem item)
        {
            Debug.Assert(item != null);
            Debug.Assert(m_undoList.Count <= m_maxUndoLevel);

            if (m_maxUndoLevel == 0)
                return;

            if (m_undoList.Count == m_maxUndoLevel)
            {
                // Remove the oldest entry from the undo list to make room.
                item = (HistoryItem)m_undoList[0];
                m_undoList.RemoveAt(0);
            }

            // Insert the new undoable command into the undo list.
            m_undoList.Add(item);

            // Clear the redo stack.
            ClearRedo();
        }
Esempio n. 2
0
        public void AddItem(HistoryItem item)
        {
            Debug.Assert(item != null);
            Debug.Assert(m_undoList.Count <= m_maxUndoLevel);

            if (m_maxUndoLevel == 0)
            {
                return;
            }

            if (m_undoList.Count == m_maxUndoLevel)
            {
                // Remove the oldest entry from the undo list to make room.
                item = (HistoryItem)m_undoList[0];
                m_undoList.RemoveAt(0);
            }

            // Insert the new undoable command into the undo list.
            m_undoList.Add(item);

            // Clear the redo stack.
            ClearRedo();
        }