Mercurial > repos > IBBoard
changeset 41:d5dcd1c09c28
* Make sure we reset "cleanPos" in the command stack when we clear it
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 26 Sep 2009 09:57:38 +0000 |
parents | c71855e241fc |
children | 7e74c7954be9 |
files | Commands/CommandStack.cs |
diffstat | 1 files changed, 9 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/Commands/CommandStack.cs Sat Aug 22 10:50:17 2009 +0000 +++ b/Commands/CommandStack.cs Sat Sep 26 09:57:38 2009 +0000 @@ -3,7 +3,7 @@ // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. using System; -using System.Collections; +using System.Collections.Generic; namespace IBBoard.Commands { @@ -12,7 +12,7 @@ /// </summary> public class CommandStack { - private ArrayList commandStack; + private List<Command> commandStack; private int listPos = -1; private int listMax = -1; private int cleanPos; @@ -21,7 +21,7 @@ public CommandStack() { - commandStack = new ArrayList(10); + commandStack = new List<Command>(10); cleanPos = -1; } @@ -64,7 +64,8 @@ { commandStack.Clear(); listMax = -1; - listPos = -1; + listPos = -1; + cleanPos = -1; DoCommandStackUpdated(); } @@ -72,7 +73,7 @@ { if (CanUndo()) { - ((Command)commandStack[listPos]).Undo(); + commandStack[listPos].Undo(); listPos--; DoCommandStackUpdated(); } @@ -86,7 +87,7 @@ { if (CanRedo()) { - ((Command)commandStack[listPos+1]).Redo(); + commandStack[listPos+1].Redo(); listPos++; DoCommandStackUpdated(); } @@ -152,7 +153,7 @@ backCount = backCount - 1; if (backCount > -1 && backCount <= listPos) { - return (Command)commandStack[listPos-backCount]; + return commandStack[listPos-backCount]; } else { @@ -169,7 +170,7 @@ { if (forwardCount > 0 && listPos+forwardCount <= listMax) { - return (Command)commandStack[listPos+forwardCount]; + return commandStack[listPos+forwardCount]; } else {