/
n-dimens
/
pascalabcnet
Обзор
Документация
Войти
/
n-dimens
/
pascalabcnet
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ICSharpCode.TextEditorLinux/Src/Undo/UndoQueue.cs
53 строки
1 KB
Mikhalkovich Stanislav
Для Linux-версии исправлен DockContent, редактор (показ всплывающего окна)
30 июн 2022, 09:47
30 июн 2022, 09:47
3072383
Код
Авторство
О чём код?
// <file> // <copyright see="prj:///doc/copyright.txt"/> // <license see="prj:///doc/license.txt"/> // <owner name="Mike Krüger" email="mike@icsharpcode.net"/> // <version>$Revision: 2161 $</version> // </file> using System; using System.Collections.Generic; using System.Diagnostics; namespace ICSharpCode.TextEditor.Undo { /// <summary> /// This class stacks the last x operations from the undostack and makes /// one undo/redo operation from it. /// </summary> internal sealed class UndoQueue : IUndoableOperation { List<IUndoableOperation> undolist = new List<IUndoableOperation>(); /// <summary> /// </summary> public UndoQueue(Stack<IUndoableOperation> stack, int numops) { if (stack == null) { throw new ArgumentNullException("stack"); } Debug.Assert(numops > 0 , "ICSharpCode.TextEditor.Undo.UndoQueue : numops should be > 0"); if (numops > stack.Count) { numops = stack.Count; } for (int i = 0; i < numops; ++i) { undolist.Add(stack.Pop()); } } public void Undo() { for (int i = 0; i < undolist.Count; ++i) { undolist[i].Undo(); } } public void Redo() { for (int i = undolist.Count - 1 ; i >= 0 ; --i) { undolist[i].Redo(); } } } }