/// <summary> /// Ends the action associated with the cursor. If it had any effect, a CommandReady /// event is fired. /// </summary> public void EndEdit() { if (commandList.IsEmpty) return; OnCommand(new UndoEventArgs(commandList)); commandList = new UndoCommandList(Name); }
public UndoEventArgs(UndoCommandList c) { this.Command = c; }
public void RemoveSprite(Sprite s) { var l = new UndoCommandList("Remove sprite " + s.Name); RemoveSprite(s, l); Undo.DoCommand(l); }
public Cursor() { commandList = new UndoCommandList(Name); }
public void RemoveSprite(Sprite s, UndoCommandList list) { foreach (var map in maps) { foreach (var l in map.Value.layerGroups) { if (!(l is SimpleLayerGroup)) continue; foreach (var o in l[0].objects) { if (o != null && o.Sprite == s) { throw new CannotRemoveException(o.ToString()); } } } } string name = s.Name; list.Add(new UndoCommand( delegate() { sprites.Remove(name); }, delegate() { sprites.Add(name, s); } )); }
public void RemoveMusic(BigFile music) { var list = new UndoCommandList("Remove audio file"); RemoveMusic(music, list); Undo.DoCommand(list); }
public void RemoveMusic(BigFile music, UndoCommandList list) { string name = null; foreach (var m in musics) { if (m.Value == music) { name = m.Key; } } if (name == null) throw new ArgumentException("Music is not in the list!"); list.Add(new UndoCommand( delegate() { musics.Remove(name); }, delegate() { musics.Add(name, music); } )); }
public void RemoveAnimation(Animation a) { var undoComm = new UndoCommandList("Remove animation " + a.Name); RemoveAnimation(a, undoComm); Undo.DoCommand(undoComm); }
public void RemoveAnimation(Animation a, UndoCommandList list) { foreach (var sprite in sprites.Values) { if (sprite.animation == a) { throw new CannotRemoveException("Sprite " + sprite.Name); } } string name = a.Name; list.Add(new UndoCommand( delegate() { animations.Remove(name); }, delegate() { animations.Add(name, a); } )); }