Added actions to keep only single-sided or double-sided lines selected (default keys: Shift+1 and Shift+2)

This commit is contained in:
codeimp 2009-03-01 20:03:15 +00:00
parent 1bbb3e8009
commit 1b2121c3f1
5 changed files with 107 additions and 6 deletions

View file

@ -529,6 +529,42 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Actions
// This keeps only the single-sided lines selected
[BeginAction("selectsinglesided")]
public void SelectSingleSided()
{
int counter = 0;
ICollection<Linedef> selected = General.Map.Map.GetSelectedLinedefs(true);
foreach(Linedef ld in selected)
{
if((ld.Front != null) && (ld.Back != null))
ld.Selected = false;
else
counter++;
}
General.Interface.DisplayStatus(StatusType.Action, "Selected only single-sided linedefs (" + counter + ")");
General.Interface.RedrawDisplay();
}
// This keeps only the double-sided lines selected
[BeginAction("selectdoublesided")]
public void SelectDoubleSided()
{
int counter = 0;
ICollection<Linedef> selected = General.Map.Map.GetSelectedLinedefs(true);
foreach(Linedef ld in selected)
{
if((ld.Front == null) || (ld.Back == null))
ld.Selected = false;
else
counter++;
}
General.Interface.DisplayStatus(StatusType.Action, "Selected only double-sided linedefs (" + counter + ")");
General.Interface.RedrawDisplay();
}
// This clears the selection
[BeginAction("clearselection", BaseAction = true)]
public void ClearSelection()

View file

@ -43,6 +43,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.globalstrip = new System.Windows.Forms.ToolStrip();
this.manualstrip = new System.Windows.Forms.ToolStrip();
this.buttonbrightnessgradient = new System.Windows.Forms.ToolStripButton();
this.selectsinglesideditem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator();
this.selectdoublesideditem = new System.Windows.Forms.ToolStripMenuItem();
this.menustrip.SuspendLayout();
this.manualstrip.SuspendLayout();
this.SuspendLayout();
@ -61,6 +64,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// linedefsmenu
//
this.linedefsmenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.selectsinglesideditem,
this.selectdoublesideditem,
this.toolStripMenuItem4,
this.fliplinedefsitem,
this.flipsidedefsitem,
this.toolStripMenuItem1,
@ -75,7 +81,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// fliplinedefsitem
//
this.fliplinedefsitem.Name = "fliplinedefsitem";
this.fliplinedefsitem.Size = new System.Drawing.Size(169, 22);
this.fliplinedefsitem.Size = new System.Drawing.Size(202, 22);
this.fliplinedefsitem.Tag = "fliplinedefs";
this.fliplinedefsitem.Text = "Flip Linedefs";
this.fliplinedefsitem.Click += new System.EventHandler(this.InvokeTaggedAction);
@ -83,7 +89,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// flipsidedefsitem
//
this.flipsidedefsitem.Name = "flipsidedefsitem";
this.flipsidedefsitem.Size = new System.Drawing.Size(169, 22);
this.flipsidedefsitem.Size = new System.Drawing.Size(202, 22);
this.flipsidedefsitem.Tag = "flipsidedefs";
this.flipsidedefsitem.Text = "Flip Sidedefs";
this.flipsidedefsitem.Click += new System.EventHandler(this.InvokeTaggedAction);
@ -91,12 +97,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(166, 6);
this.toolStripMenuItem1.Size = new System.Drawing.Size(199, 6);
//
// curvelinedefsitem
//
this.curvelinedefsitem.Name = "curvelinedefsitem";
this.curvelinedefsitem.Size = new System.Drawing.Size(169, 22);
this.curvelinedefsitem.Size = new System.Drawing.Size(202, 22);
this.curvelinedefsitem.Tag = "curvelinesmode";
this.curvelinedefsitem.Text = "Curve Linedefs...";
this.curvelinedefsitem.Click += new System.EventHandler(this.InvokeTaggedAction);
@ -104,12 +110,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(166, 6);
this.toolStripMenuItem3.Size = new System.Drawing.Size(199, 6);
//
// splitlinedefsitem
//
this.splitlinedefsitem.Name = "splitlinedefsitem";
this.splitlinedefsitem.Size = new System.Drawing.Size(169, 22);
this.splitlinedefsitem.Size = new System.Drawing.Size(202, 22);
this.splitlinedefsitem.Tag = "splitlinedefs";
this.splitlinedefsitem.Text = "Split Linedefs";
this.splitlinedefsitem.Click += new System.EventHandler(this.InvokeTaggedAction);
@ -176,6 +182,27 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.buttonbrightnessgradient.Text = "Make Brightness Gradient";
this.buttonbrightnessgradient.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// selectsinglesideditem
//
this.selectsinglesideditem.Name = "selectsinglesideditem";
this.selectsinglesideditem.Size = new System.Drawing.Size(202, 22);
this.selectsinglesideditem.Tag = "selectsinglesided";
this.selectsinglesideditem.Text = "Select Single-sided only";
this.selectsinglesideditem.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// toolStripMenuItem4
//
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(199, 6);
//
// selectdoublesideditem
//
this.selectdoublesideditem.Name = "selectdoublesideditem";
this.selectdoublesideditem.Size = new System.Drawing.Size(202, 22);
this.selectdoublesideditem.Tag = "selectdoublesided";
this.selectdoublesideditem.Text = "Select Double-sided only";
this.selectdoublesideditem.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// MenusForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -219,5 +246,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
private System.Windows.Forms.ToolStrip globalstrip;
private System.Windows.Forms.ToolStrip manualstrip;
private System.Windows.Forms.ToolStripButton buttonbrightnessgradient;
private System.Windows.Forms.ToolStripMenuItem selectsinglesideditem;
private System.Windows.Forms.ToolStripMenuItem selectdoublesideditem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4;
}
}

View file

@ -117,13 +117,25 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menustrip.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="menustrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="globalstrip.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="globalstrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>118, 17</value>
</metadata>
<metadata name="manualstrip.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="manualstrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>210, 17</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View file

@ -148,6 +148,28 @@ triangulatormode
debugonly = true;
}
selectsinglesided
{
title = "Select Single-sided";
category = "linedefs";
description = "This keeps only the single-sided lines in your selection selected.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
default = 65585;
}
selectdoublesided
{
title = "Select Double-sided";
category = "linedefs";
description = "This keeps only the double-sided lines in your selection selected.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
default = 65586;
}
fliplinedefs
{
title = "Flip Linedefs";

View file

@ -800,4 +800,5 @@ showerrors
allowkeys = true;
allowmouse = true;
allowscroll = false;
default = 122;
}