Get ctrl-y working - redo.
This commit is contained in:
parent
c705ac0db3
commit
fd777e56b3
@ -62,6 +62,7 @@ namespace EduNetworkBuilder
|
||||
|
||||
private List<HelpURL> HelpURLs = new List<HelpURL>();
|
||||
private List<Network> storedNetworkStates = new List<Network>(); //for ctrl-z going back in time to past state
|
||||
private List<Network> ForwardstoredNetworkStates = new List<Network>(); //for ctrl-y going forward to a ctrl-y state
|
||||
|
||||
public BuilderWindow(string FirstArg="")
|
||||
{
|
||||
@ -234,10 +235,20 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
if(storedNetworkStates.Count > 0)
|
||||
{
|
||||
ForwardstoredNetworkStates.Insert(0, myNetwork);//So we can ctrl-y to this state. Undo the undo
|
||||
ChangeToPastState(storedNetworkStates[0]);
|
||||
storedNetworkStates.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
if (e.KeyCode == Keys.Y && e.Modifiers == Keys.Control)
|
||||
{
|
||||
if (ForwardstoredNetworkStates.Count > 0)
|
||||
{
|
||||
storedNetworkStates.Insert(0, myNetwork);
|
||||
ChangeToPastState(ForwardstoredNetworkStates[0]);
|
||||
ForwardstoredNetworkStates.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
//MessageBox.Show(e.KeyCode.ToString());
|
||||
}
|
||||
|
||||
@ -246,6 +257,7 @@ namespace EduNetworkBuilder
|
||||
if (storedNetworkStates.Count > 0 && toStore.Equals(storedNetworkStates[0]))
|
||||
return; //The states are identical. Do not store this state.
|
||||
storedNetworkStates.Insert(0,Network.DeepClone(toStore));
|
||||
ForwardstoredNetworkStates.Clear();
|
||||
int maxCount = 30;
|
||||
if(storedNetworkStates.Count > maxCount)
|
||||
{
|
||||
@ -259,6 +271,7 @@ namespace EduNetworkBuilder
|
||||
public void ClearStoredNetworkStates()
|
||||
{
|
||||
storedNetworkStates.Clear();
|
||||
ForwardstoredNetworkStates.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user