Added "Point Thing to cursor" action.

This commit is contained in:
MaxED 2013-04-08 14:37:37 +00:00
parent ee6430c922
commit 8f40e113fe
8 changed files with 137 additions and 60 deletions

View file

@ -400,6 +400,9 @@
<ItemGroup>
<None Include="Resources\DrawCurveMode.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\ThingPointAtCursor.png" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View file

@ -856,6 +856,46 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RedrawDisplay();
}
[BeginAction("thinglookatcursor")]
public void ThingPointAtCursor() {
// Make list of selected things
List<Thing> selected = new List<Thing>(General.Map.Map.GetSelectedThings(true));
if((selected.Count == 0) && (highlighted != null) && !highlighted.IsDisposed)
selected.Add(highlighted);
if(!mousemappos.IsFinite()) {
General.Interface.DisplayStatus(StatusType.Warning, "Invalid mouse position!");
return;
}
if(selected.Count == 0) {
General.Interface.DisplayStatus(StatusType.Warning, "This action requires a selection!");
return;
}
// Make undo
if(selected.Count > 1) {
General.Map.UndoRedo.CreateUndo("Rotate " + selected.Count + " things");
General.Interface.DisplayStatus(StatusType.Action, "Rotated " + selected.Count + " things.");
} else {
General.Map.UndoRedo.CreateUndo("Rotate thing");
General.Interface.DisplayStatus(StatusType.Action, "Rotated a thing.");
}
//change angle
foreach(Thing t in selected){
ThingTypeInfo info = General.Map.Data.GetThingInfo(t.Type);
if(info == null || info.Category == null || info.Category.Arrow == 0) continue;
t.Rotate(Vector2D.GetAngle(mousemappos, t.Position));
}
// Update cache values
General.Map.IsChanged = true;
// Redraw screen
General.Interface.RedrawDisplay();
}
#endregion
}
}

View file

@ -43,24 +43,25 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.joinsectorsitem = new System.Windows.Forms.ToolStripMenuItem();
this.mergesectorsitem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.thingsmenu = new System.Windows.Forms.ToolStripMenuItem();
this.alignToWallItem = new System.Windows.Forms.ToolStripMenuItem();
this.globalstrip = new System.Windows.Forms.ToolStrip();
this.manualstrip = new System.Windows.Forms.ToolStrip();
this.seperatorcopypaste = new System.Windows.Forms.ToolStripSeparator();
this.separatorsectors1 = new System.Windows.Forms.ToolStripSeparator();
this.brightnessGradientMode = new System.Windows.Forms.ToolStripComboBox();
this.thingsmenu = new System.Windows.Forms.ToolStripMenuItem();
this.buttoncopyproperties = new System.Windows.Forms.ToolStripButton();
this.buttonpasteproperties = new System.Windows.Forms.ToolStripButton();
this.seperatorcopypaste = new System.Windows.Forms.ToolStripSeparator();
this.buttonselectionnumbers = new System.Windows.Forms.ToolStripButton();
this.separatorsectors1 = new System.Windows.Forms.ToolStripSeparator();
this.buttonbrightnessgradient = new System.Windows.Forms.ToolStripButton();
this.buttonfloorgradient = new System.Windows.Forms.ToolStripButton();
this.buttonceilinggradient = new System.Windows.Forms.ToolStripButton();
this.buttonflipselectionh = new System.Windows.Forms.ToolStripButton();
this.buttonflipselectionv = new System.Windows.Forms.ToolStripButton();
this.buttoncurvelinedefs = new System.Windows.Forms.ToolStripButton();
this.brightnessGradientMode = new System.Windows.Forms.ToolStripComboBox();
this.buttonMarqueSelectTouching = new System.Windows.Forms.ToolStripButton();
this.alignToWallItem = new System.Windows.Forms.ToolStripMenuItem();
this.buttonAlignThingsToWall = new System.Windows.Forms.ToolStripButton();
this.pointAtCursorItem = new System.Windows.Forms.ToolStripMenuItem();
this.menustrip.SuspendLayout();
this.manualstrip.SuspendLayout();
this.SuspendLayout();
@ -189,6 +190,25 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(146, 6);
//
// thingsmenu
//
this.thingsmenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.alignToWallItem,
this.pointAtCursorItem});
this.thingsmenu.Name = "thingsmenu";
this.thingsmenu.Size = new System.Drawing.Size(55, 20);
this.thingsmenu.Text = "Things";
this.thingsmenu.Visible = false;
//
// alignToWallItem
//
this.alignToWallItem.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.AlignThings;
this.alignToWallItem.Name = "alignToWallItem";
this.alignToWallItem.Size = new System.Drawing.Size(202, 22);
this.alignToWallItem.Tag = "thingaligntowall";
this.alignToWallItem.Text = "&Align To Closest Linedef";
this.alignToWallItem.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// globalstrip
//
this.globalstrip.Location = new System.Drawing.Point(0, 24);
@ -220,34 +240,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.manualstrip.TabIndex = 2;
this.manualstrip.Text = "toolStrip1";
//
// seperatorcopypaste
//
this.seperatorcopypaste.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.seperatorcopypaste.Name = "seperatorcopypaste";
this.seperatorcopypaste.Size = new System.Drawing.Size(6, 25);
//
// separatorsectors1
//
this.separatorsectors1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.separatorsectors1.Name = "separatorsectors1";
this.separatorsectors1.Size = new System.Drawing.Size(6, 25);
//
// brightnessGradientMode
//
this.brightnessGradientMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.brightnessGradientMode.Name = "brightnessGradientMode";
this.brightnessGradientMode.Size = new System.Drawing.Size(75, 25);
this.brightnessGradientMode.ToolTipText = "Brightness Gradient affects:";
//
// thingsmenu
//
this.thingsmenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.alignToWallItem});
this.thingsmenu.Name = "thingsmenu";
this.thingsmenu.Size = new System.Drawing.Size(55, 20);
this.thingsmenu.Text = "Things";
this.thingsmenu.Visible = false;
//
// buttoncopyproperties
//
this.buttoncopyproperties.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
@ -270,6 +262,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.buttonpasteproperties.Text = "Paste Properties";
this.buttonpasteproperties.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// seperatorcopypaste
//
this.seperatorcopypaste.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.seperatorcopypaste.Name = "seperatorcopypaste";
this.seperatorcopypaste.Size = new System.Drawing.Size(6, 25);
//
// buttonselectionnumbers
//
this.buttonselectionnumbers.CheckOnClick = true;
@ -281,6 +279,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.buttonselectionnumbers.Text = "View Selection Numbering";
this.buttonselectionnumbers.Click += new System.EventHandler(this.buttonselectionnumbers_Click);
//
// separatorsectors1
//
this.separatorsectors1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
this.separatorsectors1.Name = "separatorsectors1";
this.separatorsectors1.Size = new System.Drawing.Size(6, 25);
//
// buttonbrightnessgradient
//
this.buttonbrightnessgradient.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
@ -348,6 +352,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.buttoncurvelinedefs.Text = "Curve Linedefs";
this.buttoncurvelinedefs.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// brightnessGradientMode
//
this.brightnessGradientMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.brightnessGradientMode.Name = "brightnessGradientMode";
this.brightnessGradientMode.Size = new System.Drawing.Size(75, 25);
this.brightnessGradientMode.ToolTipText = "Brightness Gradient affects:";
//
// buttonMarqueSelectTouching
//
this.buttonMarqueSelectTouching.CheckOnClick = true;
@ -361,15 +372,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
"";
this.buttonMarqueSelectTouching.Click += new System.EventHandler(this.buttonMarqueSelectTouching_Click);
//
// alignToWallItem
//
this.alignToWallItem.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.AlignThings;
this.alignToWallItem.Name = "alignToWallItem";
this.alignToWallItem.Size = new System.Drawing.Size(202, 22);
this.alignToWallItem.Tag = "thingaligntowall";
this.alignToWallItem.Text = "&Align To Closest Linedef";
this.alignToWallItem.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// buttonAlignThingsToWall
//
this.buttonAlignThingsToWall.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
@ -381,6 +383,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.buttonAlignThingsToWall.ToolTipText = "Align selected things to closest linedef";
this.buttonAlignThingsToWall.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// pointAtCursorItem
//
this.pointAtCursorItem.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.ThingPointAtCursor;
this.pointAtCursorItem.Name = "pointAtCursorItem";
this.pointAtCursorItem.Size = new System.Drawing.Size(202, 22);
this.pointAtCursorItem.Tag = "thinglookatcursor";
this.pointAtCursorItem.Text = "&Point at Cursor";
this.pointAtCursorItem.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// MenusForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -442,5 +453,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
private System.Windows.Forms.ToolStripMenuItem thingsmenu;
private System.Windows.Forms.ToolStripMenuItem alignToWallItem;
private System.Windows.Forms.ToolStripButton buttonAlignThingsToWall;
private System.Windows.Forms.ToolStripMenuItem pointAtCursorItem;
}
}

View file

@ -123,18 +123,18 @@
<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">
<metadata name="globalstrip.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="manualstrip.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>

View file

@ -214,6 +214,13 @@ namespace CodeImp.DoomBuilder.BuilderModes.Properties {
}
}
internal static System.Drawing.Bitmap ThingPointAtCursor {
get {
object obj = ResourceManager.GetObject("ThingPointAtCursor", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap treeview {
get {
object obj = ResourceManager.GetObject("treeview", resourceCulture);

View file

@ -136,8 +136,8 @@
<data name="ColorPick" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ColorPick.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="FlipSelectionV" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\FlipSelectionV.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="AlignThings" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlignThings.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Text" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Text.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -145,14 +145,14 @@
<data name="treeview" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\treeview.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DrawRectMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\DrawRectMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="BrightnessGradient" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\BrightnessGradient.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Angle" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Angle.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="DrawRectMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\DrawRectMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="SnapVerts" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SnapVerts.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="CeilsGradient" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\CeilsGradient.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -166,11 +166,11 @@
<data name="CurveLines" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\CurveLines.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="List_Images" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\List_Images.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="Angle" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Angle.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="SnapVerts" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SnapVerts.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="FlipSelectionV" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\FlipSelectionV.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="VisualModeGZ" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\VisualModeGZ.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -187,10 +187,13 @@
<data name="FloorAlign" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\FloorAlign.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="AlignThings" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlignThings.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DrawCurveMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\DrawCurveMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="List_Images" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\List_Images.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ThingPointAtCursor" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ThingPointAtCursor.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View file

@ -334,6 +334,18 @@ thingaligntowall
default = 196673; //ctrl-shift-a
}
//mxd
thinglookatcursor
{
title = "Point Thing to cursor";
category = "things";
description = "Points selected things to cursor position.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
default = 131148; //Ctrl-L
}
makesectormode
{
title = "Make Sector Mode";

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB