Added: SelectionState; New Undoable Mods: AddAnimation, RemoveAnimation, AddFrame, RemoveFrame, RemoveSprite

This commit is contained in:
quinnvoker
2018-12-26 21:07:21 -08:00
parent 2e72c46b7b
commit aaa80bd654
16 changed files with 761 additions and 120 deletions
@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using QURO;
using QURO.Animation;
using System.Windows.Forms;
namespace AnimationEditor.Modifications
{
class AddAnimation : IModification
{
private SelectionState preChangeSelection;
private SelectionState postChangeSelection;
private BindingList<Animation> animations;
private ComboBox animationBox;
private Animation animationToAdd;
public AddAnimation(BindingList<Animation> animList, ComboBox animBox, Animation anim = null)
{
animations = animList;
animationBox = animBox;
if (anim != null)
animationToAdd = anim;
else animationToAdd = new Animation();
}
public void Do()
{
animations.Add(animationToAdd);
animationBox.SelectedIndex = animations.Count - 1;
}
public void Undo()
{
animations.RemoveAt(animations.Count - 1);
}
public SelectionState GetPreChangeSelection()
{
return preChangeSelection;
}
public void SetPreChangeSelection(SelectionState currentSelection)
{
preChangeSelection = currentSelection;
}
public SelectionState GetPostChangeSelection()
{
return postChangeSelection;
}
public void SetPostChangeSelection(SelectionState currentSelection)
{
postChangeSelection = currentSelection;
}
public override string ToString()
{
return "Add Animation";
}
}
}