"Select Things in Selected Sectors" action now works from any classic mode.

Selection is now snapped to grid when pasted.
This commit is contained in:
MaxED 2013-11-01 09:13:40 +00:00
parent 5c19a12ab7
commit 6c639c029b
4 changed files with 67 additions and 39 deletions

View file

@ -326,6 +326,36 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();
} }
//mxd
[BeginAction("thingsselectinsectors")]
public void SelectThingsInSelectedSectors() {
General.Map.Map.ConvertSelection(SelectionType.Sectors);
if(General.Map.Map.SelectedSectorsCount == 0) {
General.Interface.DisplayStatus(StatusType.Warning, "No Sectors are Selected!");
General.Map.Map.ConvertSelection(SelectionType.Linedefs);
return;
}
int selectedCount = 0;
ICollection<Sector> sectors = General.Map.Map.GetSelectedSectors(true);
foreach(Thing t in General.Map.Map.Things) {
t.DetermineSector();
if(!t.Selected && t.Sector != null && sectors.Contains(t.Sector)) {
t.Selected = true;
selectedCount++;
}
}
General.Interface.DisplayStatus(StatusType.Info, "Selected " + selectedCount + (selectedCount == 1 ? " Thing" : " Things"));
General.Map.Map.ConvertSelection(SelectionType.Linedefs);
// Redraw screen
General.Interface.RedrawDisplay();
}
#endregion #endregion
} }
} }

View file

@ -982,7 +982,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Mouse in screen? // Mouse in screen?
if(mouseinside) if(mouseinside)
{ {
offset = mousemappos - size / 2; offset = General.Map.Grid.SnappedToGrid(mousemappos - size / 2); //mxd
} }
else else
{ {

View file

@ -941,36 +941,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();
} }
//mxd
[BeginAction("thingsselectinsectors")]
public void SelectThingsInSelectedSectors() {
General.Map.Map.ConvertSelection(SelectionType.Sectors);
if(General.Map.Map.SelectedSectorsCount == 0) {
General.Interface.DisplayStatus(StatusType.Warning, "No Sectors are Selected!");
General.Map.Map.ConvertSelection(SelectionType.Linedefs);
return;
}
int selectedCount = 0;
ICollection<Sector> sectors = General.Map.Map.GetSelectedSectors(true);
foreach(Thing t in General.Map.Map.Things) {
t.DetermineSector();
if(!t.Selected && t.Sector != null && sectors.Contains(t.Sector)) {
t.Selected = true;
selectedCount++;
}
}
General.Interface.DisplayStatus(StatusType.Info, "Selected " + selectedCount + (selectedCount == 1 ? " Thing" : " Things"));
General.Map.Map.ConvertSelection(SelectionType.Linedefs);
// Redraw screen
General.Interface.RedrawDisplay();
}
#endregion #endregion
} }
} }

View file

@ -76,6 +76,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.buttonMarqueSelectTouching = new System.Windows.Forms.ToolStripButton(); this.buttonMarqueSelectTouching = new System.Windows.Forms.ToolStripButton();
this.buttonAlignThingsToWall = new System.Windows.Forms.ToolStripButton(); this.buttonAlignThingsToWall = new System.Windows.Forms.ToolStripButton();
this.buttonTextureOffsetLock = new System.Windows.Forms.ToolStripButton(); this.buttonTextureOffsetLock = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.selectInSectorsItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.selectInSectorsItem3 = new System.Windows.Forms.ToolStripMenuItem();
this.menustrip.SuspendLayout(); this.menustrip.SuspendLayout();
this.manualstrip.SuspendLayout(); this.manualstrip.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -97,6 +100,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// //
this.linedefsmenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.linedefsmenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.placethingsl, this.placethingsl,
this.selectInSectorsItem3,
this.toolStripSeparator2, this.toolStripSeparator2,
this.selectsinglesideditem, this.selectsinglesideditem,
this.selectdoublesideditem, this.selectdoublesideditem,
@ -237,6 +241,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// //
this.sectorsmenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.sectorsmenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.placethingss, this.placethingss,
this.selectInSectorsItem2,
this.toolStripSeparator1, this.toolStripSeparator1,
this.joinsectorsitem, this.joinsectorsitem,
this.mergesectorsitem, this.mergesectorsitem,
@ -249,7 +254,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// placethingss // placethingss
// //
this.placethingss.Name = "placethingss"; this.placethingss.Name = "placethingss";
this.placethingss.Size = new System.Drawing.Size(150, 22); this.placethingss.Size = new System.Drawing.Size(245, 22);
this.placethingss.Tag = "placethings"; this.placethingss.Tag = "placethings";
this.placethingss.Text = "&Place Things..."; this.placethingss.Text = "&Place Things...";
this.placethingss.Click += new System.EventHandler(this.InvokeTaggedAction); this.placethingss.Click += new System.EventHandler(this.InvokeTaggedAction);
@ -257,12 +262,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
// toolStripSeparator1 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(147, 6); this.toolStripSeparator1.Size = new System.Drawing.Size(242, 6);
// //
// joinsectorsitem // joinsectorsitem
// //
this.joinsectorsitem.Name = "joinsectorsitem"; this.joinsectorsitem.Name = "joinsectorsitem";
this.joinsectorsitem.Size = new System.Drawing.Size(150, 22); this.joinsectorsitem.Size = new System.Drawing.Size(245, 22);
this.joinsectorsitem.Tag = "joinsectors"; this.joinsectorsitem.Tag = "joinsectors";
this.joinsectorsitem.Text = "&Join Sectors"; this.joinsectorsitem.Text = "&Join Sectors";
this.joinsectorsitem.Click += new System.EventHandler(this.InvokeTaggedAction); this.joinsectorsitem.Click += new System.EventHandler(this.InvokeTaggedAction);
@ -270,7 +275,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// mergesectorsitem // mergesectorsitem
// //
this.mergesectorsitem.Name = "mergesectorsitem"; this.mergesectorsitem.Name = "mergesectorsitem";
this.mergesectorsitem.Size = new System.Drawing.Size(150, 22); this.mergesectorsitem.Size = new System.Drawing.Size(245, 22);
this.mergesectorsitem.Tag = "mergesectors"; this.mergesectorsitem.Tag = "mergesectors";
this.mergesectorsitem.Text = "&Merge Sectors"; this.mergesectorsitem.Text = "&Merge Sectors";
this.mergesectorsitem.Click += new System.EventHandler(this.InvokeTaggedAction); this.mergesectorsitem.Click += new System.EventHandler(this.InvokeTaggedAction);
@ -278,15 +283,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
// toolStripMenuItem2 // toolStripMenuItem2
// //
this.toolStripMenuItem2.Name = "toolStripMenuItem2"; this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(147, 6); this.toolStripMenuItem2.Size = new System.Drawing.Size(242, 6);
this.toolStripMenuItem2.Visible = false; this.toolStripMenuItem2.Visible = false;
// //
// thingsmenu // thingsmenu
// //
this.thingsmenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.thingsmenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.selectInSectorsItem,
this.toolStripSeparator3,
this.alignToWallItem, this.alignToWallItem,
this.pointAtCursorItem, this.pointAtCursorItem});
this.selectInSectorsItem});
this.thingsmenu.Name = "thingsmenu"; this.thingsmenu.Name = "thingsmenu";
this.thingsmenu.Size = new System.Drawing.Size(55, 20); this.thingsmenu.Size = new System.Drawing.Size(55, 20);
this.thingsmenu.Text = "Things"; this.thingsmenu.Text = "Things";
@ -330,7 +336,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// placethingsv // placethingsv
// //
this.placethingsv.Name = "placethingsv"; this.placethingsv.Name = "placethingsv";
this.placethingsv.Size = new System.Drawing.Size(152, 22); this.placethingsv.Size = new System.Drawing.Size(150, 22);
this.placethingsv.Tag = "placethings"; this.placethingsv.Tag = "placethings";
this.placethingsv.Text = "&Place Things..."; this.placethingsv.Text = "&Place Things...";
this.placethingsv.Click += new System.EventHandler(this.InvokeTaggedAction); this.placethingsv.Click += new System.EventHandler(this.InvokeTaggedAction);
@ -535,6 +541,25 @@ namespace CodeImp.DoomBuilder.BuilderModes
"tant while sector is dragged"; "tant while sector is dragged";
this.buttonTextureOffsetLock.Click += new System.EventHandler(this.buttonTextureOffsetLock_Click); this.buttonTextureOffsetLock.Click += new System.EventHandler(this.buttonTextureOffsetLock_Click);
// //
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(242, 6);
//
// selectInSectorsItem2
//
this.selectInSectorsItem2.Name = "selectInSectorsItem2";
this.selectInSectorsItem2.Size = new System.Drawing.Size(245, 22);
this.selectInSectorsItem2.Tag = "thingsselectinsectors";
this.selectInSectorsItem2.Text = "&Select Things in Selected Sectors";
//
// selectInSectorsItem3
//
this.selectInSectorsItem3.Name = "selectInSectorsItem3";
this.selectInSectorsItem3.Size = new System.Drawing.Size(245, 22);
this.selectInSectorsItem3.Tag = "thingsselectinsectors";
this.selectInSectorsItem3.Text = "&Select Things in Selected Sectors";
//
// MenusForm // MenusForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -611,5 +636,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
private System.Windows.Forms.ToolStripMenuItem placethingss; private System.Windows.Forms.ToolStripMenuItem placethingss;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripButton buttonselectioneffects; private System.Windows.Forms.ToolStripButton buttonselectioneffects;
private System.Windows.Forms.ToolStripMenuItem selectInSectorsItem3;
private System.Windows.Forms.ToolStripMenuItem selectInSectorsItem2;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
} }
} }