mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 22:41:46 +00:00
- renamed selection methods
- create undo for flipping linedefs/sidedefs
This commit is contained in:
parent
bc8151d7f7
commit
4dd8877eba
8 changed files with 57 additions and 23 deletions
|
@ -73,8 +73,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
foreach(Vertex v in verts) v.Marked = true;
|
||||
|
||||
// Get line collections
|
||||
selectedlines = General.Map.Map.GetLinedefsSelection(true);
|
||||
unselectedlines = General.Map.Map.GetLinedefsSelection(false);
|
||||
selectedlines = General.Map.Map.GetSelectedLinedefs(true);
|
||||
unselectedlines = General.Map.Map.GetSelectedLinedefs(false);
|
||||
|
||||
// Initialize
|
||||
base.StartDrag(basemode, dragstartmappos);
|
||||
|
|
|
@ -73,8 +73,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
foreach(Vertex v in verts) v.Marked = true;
|
||||
|
||||
// Get selected lines
|
||||
selectedlines = General.Map.Map.GetLinedefsSelection(true);
|
||||
selectedsectors = General.Map.Map.GetSectorsSelection(true);
|
||||
selectedlines = General.Map.Map.GetSelectedLinedefs(true);
|
||||
selectedsectors = General.Map.Map.GetSelectedSectors(true);
|
||||
|
||||
// Initialize
|
||||
base.StartDrag(basemode, dragstartmappos);
|
||||
|
|
|
@ -284,7 +284,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
protected override void OnEndEdit()
|
||||
{
|
||||
// Anything selected?
|
||||
ICollection<Linedef> selected = General.Map.Map.GetLinedefsSelection(true);
|
||||
ICollection<Linedef> selected = General.Map.Map.GetSelectedLinedefs(true);
|
||||
if(selected.Count > 0)
|
||||
{
|
||||
// Show line edit dialog
|
||||
|
@ -396,10 +396,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
[BeginAction("fliplinedefs")]
|
||||
public void FlipLinedefs()
|
||||
{
|
||||
// Go for all selected linedefs
|
||||
General.Map.Map.ClearMarkedLinedefs(false);
|
||||
General.Map.Map.MarkSelectedLinedefs(true, true);
|
||||
ICollection<Linedef> selected = General.Map.Map.GetMarkedLinedefs(true);
|
||||
// Any selected lines?
|
||||
ICollection<Linedef> selected = General.Map.Map.GetSelectedLinedefs(true);
|
||||
if(selected.Count > 0)
|
||||
{
|
||||
// Make undo
|
||||
General.Map.UndoRedo.CreateUndo("Flip linedefs", UndoGroup.None, 0);
|
||||
|
||||
// Flip all selected linedefs
|
||||
foreach(Linedef l in selected)
|
||||
{
|
||||
l.FlipVertices();
|
||||
|
@ -409,6 +413,28 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Redraw
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
[BeginAction("flipsidedefs")]
|
||||
public void FlipSidedefs()
|
||||
{
|
||||
// Any selected lines?
|
||||
ICollection<Linedef> selected = General.Map.Map.GetSelectedLinedefs(true);
|
||||
if(selected.Count > 0)
|
||||
{
|
||||
// Make undo
|
||||
General.Map.UndoRedo.CreateUndo("Flip sidedefs", UndoGroup.None, 0);
|
||||
|
||||
// Flip sidedefs in all selected linedefs
|
||||
foreach(Linedef l in selected)
|
||||
{
|
||||
l.FlipSidedefs();
|
||||
}
|
||||
|
||||
// Redraw
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -299,7 +299,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
protected override void OnEndEdit()
|
||||
{
|
||||
// Anything selected?
|
||||
ICollection<Sector> selected = General.Map.Map.GetSectorsSelection(true);
|
||||
ICollection<Sector> selected = General.Map.Map.GetSelectedSectors(true);
|
||||
if(selected.Count > 0)
|
||||
{
|
||||
// Show sector edit dialog
|
||||
|
|
|
@ -253,7 +253,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
protected override void OnEndEdit()
|
||||
{
|
||||
// Anything selected?
|
||||
ICollection<Thing> selected = General.Map.Map.GetThingsSelection(true);
|
||||
ICollection<Thing> selected = General.Map.Map.GetSelectedThings(true);
|
||||
if(selected.Count > 0)
|
||||
{
|
||||
// Show thing edit dialog
|
||||
|
|
|
@ -121,7 +121,7 @@ triangulatormode
|
|||
|
||||
fliplinedefs
|
||||
{
|
||||
title = "Linedefs: Flip Linedefs";
|
||||
title = "Lines: Flip Linedefs";
|
||||
description = "This flips the selected linedefs around and keeps sidedefs on the correct side.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
|
@ -130,7 +130,7 @@ fliplinedefs
|
|||
|
||||
flipsidedefs
|
||||
{
|
||||
title = "Linedefs: Flip Sidedefs";
|
||||
title = "Lines: Flip Sidedefs";
|
||||
description = "This flips the sidedefs on the selected linedefs around, keeping the line in the same direction.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
|
|
|
@ -276,7 +276,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
|||
if(General.Interface.CheckActionActive(null, "classicedit"))
|
||||
{
|
||||
// Anything selected?
|
||||
selected = General.Map.Map.GetSectorsSelection(true);
|
||||
selected = General.Map.Map.GetSelectedSectors(true);
|
||||
if(selected.Count > 0)
|
||||
{
|
||||
// Remove highlight
|
||||
|
|
|
@ -404,8 +404,16 @@ namespace CodeImp.DoomBuilder.Map
|
|||
foreach(Sector s in sectors) s.Selected = false;
|
||||
}
|
||||
|
||||
// Returns a collection of vertices that match a selected state
|
||||
public ICollection<Vertex> GetSelectedVertices(bool selected)
|
||||
{
|
||||
List<Vertex> list = new List<Vertex>(things.Count >> 1);
|
||||
foreach(Vertex v in vertices) if(v.Selected == selected) list.Add(v);
|
||||
return list;
|
||||
}
|
||||
|
||||
// Returns a collection of things that match a selected state
|
||||
public ICollection<Thing> GetThingsSelection(bool selected)
|
||||
public ICollection<Thing> GetSelectedThings(bool selected)
|
||||
{
|
||||
List<Thing> list = new List<Thing>(things.Count >> 1);
|
||||
foreach(Thing t in things) if(t.Selected == selected) list.Add(t);
|
||||
|
@ -413,7 +421,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
}
|
||||
|
||||
// Returns a collection of linedefs that match a selected state
|
||||
public ICollection<Linedef> GetLinedefsSelection(bool selected)
|
||||
public ICollection<Linedef> GetSelectedLinedefs(bool selected)
|
||||
{
|
||||
List<Linedef> list = new List<Linedef>(linedefs.Count >> 1);
|
||||
foreach(Linedef l in linedefs) if(l.Selected == selected) list.Add(l);
|
||||
|
@ -421,7 +429,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
}
|
||||
|
||||
// Returns a collection of sectors that match a selected state
|
||||
public ICollection<Sector> GetSectorsSelection(bool selected)
|
||||
public ICollection<Sector> GetSelectedSectors(bool selected)
|
||||
{
|
||||
List<Sector> list = new List<Sector>(sectors.Count >> 1);
|
||||
foreach(Sector s in sectors) if(s.Selected == selected) list.Add(s);
|
||||
|
|
Loading…
Reference in a new issue