Changed: Undo/Redo menu items show their next function, Panels in form are now docked, Positions of controls in form cleaned up a bit,

This commit is contained in:
quinnvoker
2019-01-01 10:45:48 -08:00
parent 296e261135
commit 4b3f6a7d53
5 changed files with 139 additions and 77 deletions
+23
View File
@@ -22,6 +22,19 @@ namespace AnimationEditor.Modifications
get { return position < changes.Count - 1; }
}
private EventHandler onHistoryUpdated;
public event EventHandler HistoryUpdated
{
add
{
onHistoryUpdated += value;
}
remove
{
onHistoryUpdated -= value;
}
}
public History()
{
changes = new List<IModification>();
@@ -35,6 +48,7 @@ namespace AnimationEditor.Modifications
}
changes.Add(change);
position = changes.Count - 1;
OnHistoryUpdated();
}
public void Undo()
@@ -43,6 +57,7 @@ namespace AnimationEditor.Modifications
{
changes[position].Undo();
position--;
OnHistoryUpdated();
}
}
@@ -53,6 +68,7 @@ namespace AnimationEditor.Modifications
Console.Write("Hist.Pos(" + position + "): ");
ModHelper.UndoAndRestoreSelection(changes[position], animBox, frameBox, spriteBox);
position--;
OnHistoryUpdated();
}
}
@@ -62,6 +78,7 @@ namespace AnimationEditor.Modifications
{
changes[position + 1].Do();
position++;
OnHistoryUpdated();
}
}
@@ -72,6 +89,7 @@ namespace AnimationEditor.Modifications
Console.Write("Hist.Pos(" + position + "): ");
ModHelper.RedoAndRestoreSelection(changes[position + 1], animBox, frameBox, spriteBox);
position++;
OnHistoryUpdated();
}
}
@@ -90,5 +108,10 @@ namespace AnimationEditor.Modifications
else
return "Redo " + changes[position + 1];
}
public void OnHistoryUpdated()
{
onHistoryUpdated?.Invoke(this, new EventArgs());
}
}
}