Added undo for some Map Analysis corrections

This commit is contained in:
codeimp 2009-06-20 06:05:41 +00:00
parent d45b61f041
commit 052e0a1d63
6 changed files with 13 additions and 2 deletions

View file

@ -132,6 +132,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Fix by creating a sidedef // Fix by creating a sidedef
public override bool Button2Click() public override bool Button2Click()
{ {
General.Map.UndoRedo.CreateUndo("Create front sidedef");
Sidedef newside = General.Map.Map.CreateSidedef(line, true, copysidedef.Sector); Sidedef newside = General.Map.Map.CreateSidedef(line, true, copysidedef.Sector);
copysidedef.CopyPropertiesTo(newside); copysidedef.CopyPropertiesTo(newside);
line.ApplySidedFlags(); line.ApplySidedFlags();

View file

@ -161,6 +161,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(copysidedeffront != null) if(copysidedeffront != null)
{ {
// Front // Front
General.Map.UndoRedo.CreateUndo("Create front sidedef");
Sidedef newside = General.Map.Map.CreateSidedef(line, true, copysidedeffront.Sector); Sidedef newside = General.Map.Map.CreateSidedef(line, true, copysidedeffront.Sector);
copysidedeffront.CopyPropertiesTo(newside); copysidedeffront.CopyPropertiesTo(newside);
} }
@ -169,6 +170,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Back // Back
// Because the line is single-sided, we make the sidedef on the front. // Because the line is single-sided, we make the sidedef on the front.
// We will then flip it to make sure to ends up in the right position. // We will then flip it to make sure to ends up in the right position.
General.Map.UndoRedo.CreateUndo("Create front sidedef");
Sidedef newside = General.Map.Map.CreateSidedef(line, true, copysidedefback.Sector); Sidedef newside = General.Map.Map.CreateSidedef(line, true, copysidedefback.Sector);
copysidedefback.CopyPropertiesTo(newside); copysidedefback.CopyPropertiesTo(newside);
line.FlipVertices(); line.FlipVertices();
@ -183,6 +185,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public override bool Button2Click() public override bool Button2Click()
{ {
Sidedef newside; Sidedef newside;
General.Map.UndoRedo.CreateUndo("Create sidedefs");
// Front // Front
newside = General.Map.Map.CreateSidedef(line, true, copysidedeffront.Sector); newside = General.Map.Map.CreateSidedef(line, true, copysidedeffront.Sector);

View file

@ -122,6 +122,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Fix by flipping linedefs // Fix by flipping linedefs
public override bool Button1Click() public override bool Button1Click()
{ {
General.Map.UndoRedo.CreateUndo("Linedef flags change");
line.ApplySidedFlags(); line.ApplySidedFlags();
General.Map.Map.Update(); General.Map.Map.Update();
return true; return true;
@ -130,6 +131,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Fix by creating a sidedef // Fix by creating a sidedef
public override bool Button2Click() public override bool Button2Click()
{ {
General.Map.UndoRedo.CreateUndo("Create back sidedef");
Sidedef newside = General.Map.Map.CreateSidedef(line, false, copysidedef.Sector); Sidedef newside = General.Map.Map.CreateSidedef(line, false, copysidedef.Sector);
copysidedef.CopyPropertiesTo(newside); copysidedef.CopyPropertiesTo(newside);
line.ApplySidedFlags(); line.ApplySidedFlags();

View file

@ -87,6 +87,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Fix by flipping linedefs // Fix by flipping linedefs
public override bool Button1Click() public override bool Button1Click()
{ {
General.Map.UndoRedo.CreateUndo("Linedef flags change");
line.ApplySidedFlags(); line.ApplySidedFlags();
General.Map.Map.Update(); General.Map.Map.Update();
return true; return true;
@ -95,6 +96,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Fix by creating a sidedef // Fix by creating a sidedef
public override bool Button2Click() public override bool Button2Click()
{ {
General.Map.UndoRedo.CreateUndo("Remove back sidedef");
line.Back.Dispose(); line.Back.Dispose();
line.ApplySidedFlags(); line.ApplySidedFlags();
General.Map.Map.Update(); General.Map.Map.Update();

View file

@ -102,6 +102,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Fix by setting default texture // Fix by setting default texture
public override bool Button1Click() public override bool Button1Click()
{ {
General.Map.UndoRedo.CreateUndo("Missing texture correction");
General.Settings.FindDefaultDrawSettings(); General.Settings.FindDefaultDrawSettings();
switch (part) switch (part)
{ {

View file

@ -101,6 +101,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Fix by removing texture // Fix by removing texture
public override bool Button1Click() public override bool Button1Click()
{ {
General.Map.UndoRedo.CreateUndo("Remove unknown texture");
switch(part) switch(part)
{ {
case SidedefPart.Upper: side.SetTextureHigh("-"); break; case SidedefPart.Upper: side.SetTextureHigh("-"); break;
@ -115,6 +116,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Fix by setting default texture // Fix by setting default texture
public override bool Button2Click() public override bool Button2Click()
{ {
General.Map.UndoRedo.CreateUndo("Unknown texture correction");
General.Settings.FindDefaultDrawSettings(); General.Settings.FindDefaultDrawSettings();
switch(part) switch(part)
{ {