diff --git a/Source/Core/Editing/UndoManager.cs b/Source/Core/Editing/UndoManager.cs index e2e0be09..2d084915 100755 --- a/Source/Core/Editing/UndoManager.cs +++ b/Source/Core/Editing/UndoManager.cs @@ -67,6 +67,10 @@ namespace CodeImp.DoomBuilder.Editing AddThing, RemThing, PrpThing, + IndexLinedef, + IndexThing, + IndexSector, + IndexVertex, } #endregion @@ -425,6 +429,10 @@ namespace CodeImp.DoomBuilder.Editing case StreamCodes.AddThing: PlayAddThing(ds); break; case StreamCodes.RemThing: PlayRemThing(ds); break; case StreamCodes.PrpThing: PlayPrpThing(ds); break; + case StreamCodes.IndexLinedef: PlayIndexLinedef(ds); break; + case StreamCodes.IndexThing: PlayIndexThing(ds); break; + case StreamCodes.IndexSector: PlayIndexSector(ds); break; + case StreamCodes.IndexVertex: PlayIndexVertex(ds); break; } // Sanity check @@ -1326,6 +1334,82 @@ namespace CodeImp.DoomBuilder.Editing t.Marked = true; } + internal void RecIndexLinedef(int oldindex, int newindex) + { + if (!BeginRecordData(StreamCodes.IndexLinedef)) return; + ss.wInt(oldindex); + ss.wInt(newindex); + EndRecordData(); + } + + private static void PlayIndexLinedef(DeserializerStream ds) + { + ds.rInt(out int oldindex); + ds.rInt(out int newindex); + + // Record again because redo will not work otherwise (for map elements this regularly happens in BeforePropsChange + // oldindex and newindex are flipped here because we have to change them back + General.Map.UndoRedo.RecIndexLinedef(newindex, oldindex); + General.Map.Map.ChangeLindefIndex(newindex, oldindex); + } + + internal void RecIndexThing(int oldindex, int newindex) + { + if (!BeginRecordData(StreamCodes.IndexThing)) return; + ss.wInt(oldindex); + ss.wInt(newindex); + EndRecordData(); + } + + private static void PlayIndexThing(DeserializerStream ds) + { + ds.rInt(out int oldindex); + ds.rInt(out int newindex); + + // Record again because redo will not work otherwise (for map elements this regularly happens in BeforePropsChange + // oldindex and newindex are flipped here because we have to change them back + General.Map.UndoRedo.RecIndexThing(newindex, oldindex); + General.Map.Map.ChangeThingIndex(newindex, oldindex); + } + + internal void RecIndexSector(int oldindex, int newindex) + { + if (!BeginRecordData(StreamCodes.IndexSector)) return; + ss.wInt(oldindex); + ss.wInt(newindex); + EndRecordData(); + } + + private static void PlayIndexSector(DeserializerStream ds) + { + ds.rInt(out int oldindex); + ds.rInt(out int newindex); + + // Record again because redo will not work otherwise (for map elements this regularly happens in BeforePropsChange + // oldindex and newindex are flipped here because we have to change them back + General.Map.UndoRedo.RecIndexSector(newindex, oldindex); + General.Map.Map.ChangeSectorIndex(newindex, oldindex); + } + + internal void RecIndexVertex(int oldindex, int newindex) + { + if (!BeginRecordData(StreamCodes.IndexVertex)) return; + ss.wInt(oldindex); + ss.wInt(newindex); + EndRecordData(); + } + + private static void PlayIndexVertex(DeserializerStream ds) + { + ds.rInt(out int oldindex); + ds.rInt(out int newindex); + + // Record again because redo will not work otherwise (for map elements this regularly happens in BeforePropsChange + // oldindex and newindex are flipped here because we have to change them back + General.Map.UndoRedo.RecIndexVertex(newindex, oldindex); + General.Map.Map.ChangeVertexIndex(newindex, oldindex); + } + #endregion } } diff --git a/Source/Core/Map/Linedef.cs b/Source/Core/Map/Linedef.cs index fc27cc30..4285b517 100755 --- a/Source/Core/Map/Linedef.cs +++ b/Source/Core/Map/Linedef.cs @@ -1364,6 +1364,16 @@ namespace CodeImp.DoomBuilder.Map colorPresetIndex = -1; } + /// + /// Changes the linedef's index to a new index. + /// + /// The new index to set + public void ChangeIndex(int newindex) + { + General.Map.UndoRedo.RecIndexLinedef(Index, newindex); + map?.ChangeLindefIndex(Index, newindex); + } + // String representation public override string ToString() { diff --git a/Source/Core/Map/MapSet.cs b/Source/Core/Map/MapSet.cs index 40cbfcb1..c5630ef9 100755 --- a/Source/Core/Map/MapSet.cs +++ b/Source/Core/Map/MapSet.cs @@ -813,7 +813,43 @@ namespace CodeImp.DoomBuilder.Map { RemoveItem(ref things, index, ref numthings); } - + + private void ChangeItemIndex(ref T[] array, int oldindex, int newindex, int counter) where T : MapElement + { + if (oldindex == newindex || oldindex < 0 || newindex < 0 || oldindex >= array.Length || newindex >= array.Length) + return; + + T item = array[oldindex]; + + if (oldindex > newindex) // Shift everything right + { + for (int i = oldindex; i > newindex; i--) + { + array[i] = array[i - 1]; + array[i].Index++; + } + } + else // Shift everything left + { + for (int i = oldindex; i < newindex; i++) + { + array[i] = array[i + 1]; + array[i].Index--; + } + } + + array[newindex] = item; + array[newindex].Index = newindex; + } + + internal void ChangeLindefIndex(int oldindex, int newindex) => ChangeItemIndex(ref linedefs, oldindex, newindex, numlinedefs); + + internal void ChangeThingIndex(int oldindex, int newindex) => ChangeItemIndex(ref things, oldindex, newindex, numthings); + + internal void ChangeSectorIndex(int oldindex, int newindex) => ChangeItemIndex(ref sectors, oldindex, newindex, numsectors); + + internal void ChangeVertexIndex(int oldindex, int newindex) => ChangeItemIndex(ref vertices, oldindex, newindex, numvertices); + #endregion #region ================== Serialization diff --git a/Source/Core/Map/Sector.cs b/Source/Core/Map/Sector.cs index af750648..279465ca 100755 --- a/Source/Core/Map/Sector.cs +++ b/Source/Core/Map/Sector.cs @@ -819,6 +819,16 @@ namespace CodeImp.DoomBuilder.Map return new Geometry.Plane(new Vector3D(0, 0, -1), s.CeilHeight); } + /// + /// Changes the sector's index to a new index. + /// + /// The new index to set + public void ChangeIndex(int newindex) + { + General.Map.UndoRedo.RecIndexSector(Index, newindex); + map?.ChangeSectorIndex(Index, newindex); + } + // String representation public override string ToString() { diff --git a/Source/Core/Map/Thing.cs b/Source/Core/Map/Thing.cs index 2925ee26..f2119590 100755 --- a/Source/Core/Map/Thing.cs +++ b/Source/Core/Map/Thing.cs @@ -740,6 +740,16 @@ namespace CodeImp.DoomBuilder.Map return Vector2D.Distance(p, pos); } + /// + /// Changes the thing's index to a new index. + /// + /// The new index to set + public void ChangeIndex(int newindex) + { + General.Map.UndoRedo.RecIndexThing(Index, newindex); + map?.ChangeThingIndex(Index, newindex); + } + #endregion } } diff --git a/Source/Core/Map/Vertex.cs b/Source/Core/Map/Vertex.cs index bb9db97b..145b0f2d 100755 --- a/Source/Core/Map/Vertex.cs +++ b/Source/Core/Map/Vertex.cs @@ -338,6 +338,16 @@ namespace CodeImp.DoomBuilder.Map General.Map.IsChanged = true; } + /// + /// Changes the thing's index to a new index. + /// + /// The new index to set + public void ChangeIndex(int newindex) + { + General.Map.UndoRedo.RecIndexVertex(Index, newindex); + map?.ChangeVertexIndex(Index, newindex); + } + // String representation public override string ToString() { diff --git a/Source/Plugins/BuilderModes/BuilderModes.csproj b/Source/Plugins/BuilderModes/BuilderModes.csproj index 8ceabcce..45b9da79 100755 --- a/Source/Plugins/BuilderModes/BuilderModes.csproj +++ b/Source/Plugins/BuilderModes/BuilderModes.csproj @@ -165,6 +165,12 @@ + + Form + + + ChangeMapElementIndexForm.cs + Form @@ -223,6 +229,9 @@ + + ChangeMapElementIndexForm.cs + ImageExportSettingsForm.cs diff --git a/Source/Plugins/BuilderModes/BuilderModesMono.csproj b/Source/Plugins/BuilderModes/BuilderModesMono.csproj index 9cfd1a84..7179da61 100644 --- a/Source/Plugins/BuilderModes/BuilderModesMono.csproj +++ b/Source/Plugins/BuilderModes/BuilderModesMono.csproj @@ -163,6 +163,12 @@ + + Form + + + ChangeMapElementIndexForm.cs + Form @@ -221,6 +227,9 @@ + + ChangeMapElementIndexForm.cs + ImageExportSettingsForm.cs diff --git a/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs index 744f9af9..09e5e875 100755 --- a/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs @@ -2158,6 +2158,31 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Interface.DisplayStatus(StatusType.Action, "Added 'lightfog' flag to " + addedcout + " sidedefs, removed it from " + removedcount + " sidedefs."); } + [BeginAction("changemapelementindex")] + private void ChangeMapElementIndex() + { + // Make list of selected linedefs + List selected = General.Map.Map.GetSelectedLinedefs(true).ToList(); + if ((selected.Count == 0) && (highlighted != null) && !highlighted.IsDisposed) selected.Add(highlighted); + if (selected.Count != 1) + { + General.ToastManager.ShowToast(ToastMessages.CHANGEMAPELEMENTINDEX, ToastType.WARNING, "Changing linedef index failed", "You need to select or highlight exactly 1 linedef."); + return; + } + + ChangeMapElementIndexForm f = new ChangeMapElementIndexForm("linedef", selected[0].Index, General.Map.Map.Linedefs.Count - 1); + if (f.ShowDialog() == DialogResult.OK) + { + int newindex = f.GetNewIndex(); + int oldindex = selected[0].Index; + General.Map.UndoRedo.CreateUndo("Change linedef index"); + + selected[0].ChangeIndex(newindex); + + General.ToastManager.ShowToast(ToastMessages.CHANGEMAPELEMENTINDEX, ToastType.INFO, "Successfully change linedef index", $"Changed index of linedef {oldindex} to {newindex}."); + } + } + #endregion } } diff --git a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs index 8f95a04b..227ae03a 100755 --- a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs @@ -20,6 +20,7 @@ using System; using System.Collections.Generic; using System.Drawing; using System.Diagnostics; +using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; using System.Collections.Concurrent; @@ -2838,6 +2839,31 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Interface.RedrawDisplay(); } + [BeginAction("changemapelementindex")] + private void ChangeMapElementIndex() + { + // Make list of selected linedefs + List selected = General.Map.Map.GetSelectedSectors(true).ToList(); + if ((selected.Count == 0) && (highlighted != null) && !highlighted.IsDisposed) selected.Add(highlighted); + if (selected.Count != 1) + { + General.ToastManager.ShowToast(ToastMessages.CHANGEMAPELEMENTINDEX, ToastType.WARNING, "Changing sector index failed", "You need to select or highlight exactly 1 sector."); + return; + } + + ChangeMapElementIndexForm f = new ChangeMapElementIndexForm("sector", selected[0].Index, General.Map.Map.Sectors.Count - 1); + if (f.ShowDialog() == DialogResult.OK) + { + int newindex = f.GetNewIndex(); + int oldindex = selected[0].Index; + General.Map.UndoRedo.CreateUndo("Change sector index"); + + selected[0].ChangeIndex(newindex); + + General.ToastManager.ShowToast(ToastMessages.CHANGEMAPELEMENTINDEX, ToastType.INFO, "Successfully change sector index", $"Changed index of sector {oldindex} to {newindex}."); + } + } + #endregion } } diff --git a/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs index cbd92183..5fb00a5f 100755 --- a/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs @@ -1607,6 +1607,31 @@ namespace CodeImp.DoomBuilder.BuilderModes } } + [BeginAction("changemapelementindex")] + private void ChangeMapElementIndex() + { + // Make list of selected linedefs + List selected = General.Map.Map.GetSelectedThings(true).ToList(); + if ((selected.Count == 0) && (highlighted != null) && !highlighted.IsDisposed) selected.Add(highlighted); + if (selected.Count != 1) + { + General.ToastManager.ShowToast(ToastMessages.CHANGEMAPELEMENTINDEX, ToastType.WARNING, "Changing thing index failed", "You need to select or highlight exactly 1 thing."); + return; + } + + ChangeMapElementIndexForm f = new ChangeMapElementIndexForm("thing", selected[0].Index, General.Map.Map.Things.Count - 1); + if (f.ShowDialog() == DialogResult.OK) + { + int newindex = f.GetNewIndex(); + int oldindex = selected[0].Index; + General.Map.UndoRedo.CreateUndo("Change thing index"); + + selected[0].ChangeIndex(newindex); + + General.ToastManager.ShowToast(ToastMessages.CHANGEMAPELEMENTINDEX, ToastType.INFO, "Successfully change thing index", $"Changed index of thing {oldindex} to {newindex}."); + } + } + #endregion } } diff --git a/Source/Plugins/BuilderModes/ClassicModes/VerticesMode.cs b/Source/Plugins/BuilderModes/ClassicModes/VerticesMode.cs index a17bdd20..2accf6b9 100755 --- a/Source/Plugins/BuilderModes/ClassicModes/VerticesMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/VerticesMode.cs @@ -1219,11 +1219,36 @@ namespace CodeImp.DoomBuilder.BuilderModes } } + [BeginAction("changemapelementindex")] + private void ChangeMapElementIndex() + { + // Make list of selected linedefs + List selected = General.Map.Map.GetSelectedVertices(true).ToList(); + if ((selected.Count == 0) && (highlighted != null) && !highlighted.IsDisposed) selected.Add(highlighted); + if (selected.Count != 1) + { + General.ToastManager.ShowToast(ToastMessages.CHANGEMAPELEMENTINDEX, ToastType.WARNING, "Changing vertex index failed", "You need to select or highlight exactly 1 vertex."); + return; + } + + ChangeMapElementIndexForm f = new ChangeMapElementIndexForm("vertex", selected[0].Index, General.Map.Map.Vertices.Count - 1); + if (f.ShowDialog() == DialogResult.OK) + { + int newindex = f.GetNewIndex(); + int oldindex = selected[0].Index; + General.Map.UndoRedo.CreateUndo("Change vertex index"); + + selected[0].ChangeIndex(newindex); + + General.ToastManager.ShowToast(ToastMessages.CHANGEMAPELEMENTINDEX, ToastType.INFO, "Successfully change vertex index", $"Changed index of vertex {oldindex} to {newindex}."); + } + } + #endregion #region ================== Action assist (mxd) - //mxd + //mxd private static void MergeLines(ICollection selected, Linedef ld1, Linedef ld2, Vertex v) { Vertex v1 = (ld1.Start == v) ? ld1.End : ld1.Start; diff --git a/Source/Plugins/BuilderModes/General/BuilderPlug.cs b/Source/Plugins/BuilderModes/General/BuilderPlug.cs index 9b35433f..a0a31d64 100755 --- a/Source/Plugins/BuilderModes/General/BuilderPlug.cs +++ b/Source/Plugins/BuilderModes/General/BuilderPlug.cs @@ -45,6 +45,7 @@ namespace CodeImp.DoomBuilder.BuilderModes internal class ToastMessages { public static readonly string VISUALSLOPING = "visualsloping"; + public static readonly string CHANGEMAPELEMENTINDEX = "changemapelementindex"; } public class BuilderPlug : Plug @@ -257,6 +258,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // Register toasts General.ToastManager.RegisterToast(ToastMessages.VISUALSLOPING, "Visual sloping", "Toasts related to visual sloping"); + General.ToastManager.RegisterToast(ToastMessages.CHANGEMAPELEMENTINDEX, "Change map element index", "Toasts related to changing the index of map elements"); } // Disposer diff --git a/Source/Plugins/BuilderModes/Interface/ChangeMapElementIndexForm.Designer.cs b/Source/Plugins/BuilderModes/Interface/ChangeMapElementIndexForm.Designer.cs new file mode 100644 index 00000000..e3241463 --- /dev/null +++ b/Source/Plugins/BuilderModes/Interface/ChangeMapElementIndexForm.Designer.cs @@ -0,0 +1,181 @@ + +namespace CodeImp.DoomBuilder.BuilderModes.Interface +{ + partial class ChangeMapElementIndexForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.bntNewIndex = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); + this.lbCurrentIndex = new System.Windows.Forms.Label(); + this.lbMaximumIndex = new System.Windows.Forms.Label(); + this.btnOk = new System.Windows.Forms.Button(); + this.btnCancel = new System.Windows.Forms.Button(); + this.pbWarning = new System.Windows.Forms.PictureBox(); + this.toolTip = new System.Windows.Forms.ToolTip(this.components); + ((System.ComponentModel.ISupportInitialize)(this.pbWarning)).BeginInit(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(22, 22); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(72, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Current index:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(22, 55); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(82, 13); + this.label2.TabIndex = 1; + this.label2.Text = "Maximum index:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(22, 88); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(60, 13); + this.label3.TabIndex = 2; + this.label3.Text = "New index:"; + // + // bntNewIndex + // + this.bntNewIndex.AllowDecimal = false; + this.bntNewIndex.AllowExpressions = false; + this.bntNewIndex.AllowNegative = false; + this.bntNewIndex.AllowRelative = false; + this.bntNewIndex.ButtonStep = 1; + this.bntNewIndex.ButtonStepBig = 10F; + this.bntNewIndex.ButtonStepFloat = 1F; + this.bntNewIndex.ButtonStepSmall = 0.1F; + this.bntNewIndex.ButtonStepsUseModifierKeys = false; + this.bntNewIndex.ButtonStepsWrapAround = false; + this.bntNewIndex.Location = new System.Drawing.Point(111, 83); + this.bntNewIndex.Name = "bntNewIndex"; + this.bntNewIndex.Size = new System.Drawing.Size(100, 24); + this.bntNewIndex.StepValues = null; + this.bntNewIndex.TabIndex = 3; + this.bntNewIndex.WhenTextChanged += new System.EventHandler(this.bntNewIndex_WhenTextChanged); + // + // lbCurrentIndex + // + this.lbCurrentIndex.AutoSize = true; + this.lbCurrentIndex.Location = new System.Drawing.Point(110, 22); + this.lbCurrentIndex.Name = "lbCurrentIndex"; + this.lbCurrentIndex.Size = new System.Drawing.Size(25, 13); + this.lbCurrentIndex.TabIndex = 4; + this.lbCurrentIndex.Text = "123"; + // + // lbMaximumIndex + // + this.lbMaximumIndex.AutoSize = true; + this.lbMaximumIndex.Location = new System.Drawing.Point(110, 55); + this.lbMaximumIndex.Name = "lbMaximumIndex"; + this.lbMaximumIndex.Size = new System.Drawing.Size(37, 13); + this.lbMaximumIndex.TabIndex = 5; + this.lbMaximumIndex.Text = "65535"; + // + // btnOk + // + this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK; + this.btnOk.Location = new System.Drawing.Point(55, 133); + this.btnOk.Name = "btnOk"; + this.btnOk.Size = new System.Drawing.Size(75, 23); + this.btnOk.TabIndex = 6; + this.btnOk.Text = "OK"; + this.btnOk.UseVisualStyleBackColor = true; + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(136, 133); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.TabIndex = 7; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + // + // pbWarning + // + this.pbWarning.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.Warning; + this.pbWarning.Location = new System.Drawing.Point(217, 87); + this.pbWarning.Name = "pbWarning"; + this.pbWarning.Size = new System.Drawing.Size(16, 16); + this.pbWarning.TabIndex = 8; + this.pbWarning.TabStop = false; + this.toolTip.SetToolTip(this.pbWarning, "The new index is too high"); + this.pbWarning.Visible = false; + // + // ChangeMapElementIndexForm + // + this.AcceptButton = this.btnOk; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.btnCancel; + this.ClientSize = new System.Drawing.Size(264, 168); + this.Controls.Add(this.pbWarning); + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.btnOk); + this.Controls.Add(this.lbMaximumIndex); + this.Controls.Add(this.lbCurrentIndex); + this.Controls.Add(this.bntNewIndex); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ChangeMapElementIndexForm"; + this.Text = "ChangeMapElementIndexForm"; + ((System.ComponentModel.ISupportInitialize)(this.pbWarning)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private Controls.ButtonsNumericTextbox bntNewIndex; + private System.Windows.Forms.Label lbCurrentIndex; + private System.Windows.Forms.Label lbMaximumIndex; + private System.Windows.Forms.Button btnOk; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.PictureBox pbWarning; + private System.Windows.Forms.ToolTip toolTip; + } +} \ No newline at end of file diff --git a/Source/Plugins/BuilderModes/Interface/ChangeMapElementIndexForm.cs b/Source/Plugins/BuilderModes/Interface/ChangeMapElementIndexForm.cs new file mode 100644 index 00000000..a86ee388 --- /dev/null +++ b/Source/Plugins/BuilderModes/Interface/ChangeMapElementIndexForm.cs @@ -0,0 +1,84 @@ +#region ================== Copyright (c) 2023 Boris Iwanski + +/* + * This program is free software: you can redistribute it and/or modify + * + * it under the terms of the GNU General Public License as published by + * + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the + * + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program.If not, see. + */ + +#endregion + +using CodeImp.DoomBuilder.Windows; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CodeImp.DoomBuilder.BuilderModes.Interface +{ + public partial class ChangeMapElementIndexForm : DelayedForm + { + private int currentindex; + private int maxindex; + + public ChangeMapElementIndexForm(string typetitle, int currentindex, int maxindex) + { + InitializeComponent(); + + Text = $"Change {typetitle} index"; + + this.currentindex = currentindex; + this.maxindex = maxindex; + + lbCurrentIndex.Text = currentindex.ToString(); + lbMaximumIndex.Text = maxindex.ToString(); + bntNewIndex.Text = "0"; + } + + public int GetNewIndex() + { + return bntNewIndex.GetResult(0); + } + + private void bntNewIndex_WhenTextChanged(object sender, EventArgs e) + { + int targetindex = bntNewIndex.GetResult(0); + + if(targetindex > maxindex) + { + toolTip.SetToolTip(pbWarning, "The new index is too high"); + btnOk.Enabled = false; + pbWarning.Visible = true; + } + else if(targetindex == currentindex) + { + toolTip.SetToolTip(pbWarning, "The new and old indices are the same"); + btnOk.Enabled = false; + pbWarning.Visible = true; + } + else + { + btnOk.Enabled = true; + pbWarning.Visible = false; + } + } + } +} diff --git a/Source/Plugins/BuilderModes/Interface/ChangeMapElementIndexForm.resx b/Source/Plugins/BuilderModes/Interface/ChangeMapElementIndexForm.resx new file mode 100644 index 00000000..b9c442f0 --- /dev/null +++ b/Source/Plugins/BuilderModes/Interface/ChangeMapElementIndexForm.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 17, 17 + + \ No newline at end of file diff --git a/Source/Plugins/BuilderModes/Interface/MenusForm.Designer.cs b/Source/Plugins/BuilderModes/Interface/MenusForm.Designer.cs index f8334323..681ef7c6 100755 --- a/Source/Plugins/BuilderModes/Interface/MenusForm.Designer.cs +++ b/Source/Plugins/BuilderModes/Interface/MenusForm.Designer.cs @@ -44,6 +44,7 @@ namespace CodeImp.DoomBuilder.BuilderModes this.curvelinedefsitem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); this.splitlinedefsitem = new System.Windows.Forms.ToolStripMenuItem(); + this.changeLindefIndexToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.updatelightfogitem = new System.Windows.Forms.ToolStripMenuItem(); this.aligntexturesitem = new System.Windows.Forms.ToolStripMenuItem(); this.alignFloorToFrontItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -79,27 +80,15 @@ namespace CodeImp.DoomBuilder.BuilderModes this.selectSimilarVertsItem = new System.Windows.Forms.ToolStripMenuItem(); this.globalstrip = new System.Windows.Forms.ToolStrip(); this.manualstrip = new System.Windows.Forms.ToolStrip(); - this.buttoncopyproperties = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); - this.buttonpasteproperties = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); - this.buttonpastepropertiesoptions = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); this.seperatorcopypaste = new System.Windows.Forms.ToolStripSeparator(); this.buttonselectionnumbers = new System.Windows.Forms.ToolStripButton(); this.buttonselectioneffects = new System.Windows.Forms.ToolStripButton(); this.separatorsectors1 = new System.Windows.Forms.ToolStripSeparator(); - this.buttonMakeDoor = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); this.separatorsectors2 = new System.Windows.Forms.ToolStripSeparator(); - this.buttonbrightnessgradient = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); - this.buttonfloorgradient = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); - this.buttonceilinggradient = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); - this.buttonflipselectionh = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); - this.buttonflipselectionv = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); - this.buttoncurvelinedefs = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); this.gradientModeMenu = new System.Windows.Forms.ToolStripComboBox(); this.gradientInterpolationMenu = new System.Windows.Forms.ToolStripComboBox(); this.separatorsectors3 = new System.Windows.Forms.ToolStripSeparator(); this.buttonMarqueSelectTouching = new System.Windows.Forms.ToolStripButton(); - this.syncthingteditbutton = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); - this.buttonAlignThingsToWall = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); this.buttonTextureOffsetLock = new System.Windows.Forms.ToolStripButton(); this.buttonTextureOffset3DFloorLock = new System.Windows.Forms.ToolStripButton(); this.buttonlightradii = new System.Windows.Forms.ToolStripButton(); @@ -116,6 +105,21 @@ namespace CodeImp.DoomBuilder.BuilderModes this.viewmenuitem = new System.Windows.Forms.ToolStripMenuItem(); this.itemlightradii = new System.Windows.Forms.ToolStripMenuItem(); this.itemsoundradii = new System.Windows.Forms.ToolStripMenuItem(); + this.changeThingIndexToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.changeSectorIndexToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.buttoncopyproperties = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); + this.buttonpasteproperties = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); + this.buttonpastepropertiesoptions = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); + this.buttonMakeDoor = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); + this.buttonbrightnessgradient = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); + this.buttonfloorgradient = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); + this.buttonceilinggradient = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); + this.buttonflipselectionh = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); + this.buttonflipselectionv = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); + this.buttoncurvelinedefs = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); + this.syncthingteditbutton = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); + this.buttonAlignThingsToWall = new CodeImp.DoomBuilder.Controls.ToolStripActionButton(); + this.changeVertexIndexToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menustrip.SuspendLayout(); this.manualstrip.SuspendLayout(); this.fileMenuStrip.SuspendLayout(); @@ -150,6 +154,7 @@ namespace CodeImp.DoomBuilder.BuilderModes this.curvelinedefsitem, this.toolStripMenuItem3, this.splitlinedefsitem, + this.changeLindefIndexToolStripMenuItem, this.updatelightfogitem, this.aligntexturesitem, this.toolStripSeparator5, @@ -261,6 +266,14 @@ namespace CodeImp.DoomBuilder.BuilderModes this.splitlinedefsitem.Text = "S&plit Linedefs"; this.splitlinedefsitem.Click += new System.EventHandler(this.InvokeTaggedAction); // + // changeLindefIndexToolStripMenuItem + // + this.changeLindefIndexToolStripMenuItem.Name = "changeLindefIndexToolStripMenuItem"; + this.changeLindefIndexToolStripMenuItem.Size = new System.Drawing.Size(223, 22); + this.changeLindefIndexToolStripMenuItem.Tag = "changemapelementindex"; + this.changeLindefIndexToolStripMenuItem.Text = "Change Lindef Index"; + this.changeLindefIndexToolStripMenuItem.Click += new System.EventHandler(this.InvokeTaggedAction); + // // updatelightfogitem // this.updatelightfogitem.Name = "updatelightfogitem"; @@ -339,6 +352,7 @@ namespace CodeImp.DoomBuilder.BuilderModes this.alignsectorlinedefsitem, this.toolStripSeparator8, this.makedooritem, + this.changeSectorIndexToolStripMenuItem, this.toolStripSeparator4, this.selectSimilarSectors}); this.sectorsmenu.Name = "sectorsmenu"; @@ -449,6 +463,7 @@ namespace CodeImp.DoomBuilder.BuilderModes this.toolStripSeparator3, this.alignToWallItem, this.pointAtCursorItem, + this.changeThingIndexToolStripMenuItem, this.toolStripSeparator6, this.selectSimilarThingsItem}); this.thingsmenu.Name = "thingsmenu"; @@ -515,6 +530,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // this.vertsmenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.placethingsv, + this.changeVertexIndexToolStripMenuItem, this.toolStripSeparator7, this.selectSimilarVertsItem}); this.vertsmenu.Name = "vertsmenu"; @@ -526,7 +542,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // this.placethingsv.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.PlaceThings; this.placethingsv.Name = "placethingsv"; - this.placethingsv.Size = new System.Drawing.Size(153, 22); + this.placethingsv.Size = new System.Drawing.Size(182, 22); this.placethingsv.Tag = "placethings"; this.placethingsv.Text = "&Place Things..."; this.placethingsv.Click += new System.EventHandler(this.InvokeTaggedAction); @@ -534,13 +550,13 @@ namespace CodeImp.DoomBuilder.BuilderModes // toolStripSeparator7 // this.toolStripSeparator7.Name = "toolStripSeparator7"; - this.toolStripSeparator7.Size = new System.Drawing.Size(150, 6); + this.toolStripSeparator7.Size = new System.Drawing.Size(179, 6); // // selectSimilarVertsItem // this.selectSimilarVertsItem.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.Similar; this.selectSimilarVertsItem.Name = "selectSimilarVertsItem"; - this.selectSimilarVertsItem.Size = new System.Drawing.Size(153, 22); + this.selectSimilarVertsItem.Size = new System.Drawing.Size(182, 22); this.selectSimilarVertsItem.Tag = "selectsimilar"; this.selectSimilarVertsItem.Text = "Select Similar..."; this.selectSimilarVertsItem.Click += new System.EventHandler(this.InvokeTaggedAction); @@ -587,40 +603,6 @@ namespace CodeImp.DoomBuilder.BuilderModes this.manualstrip.TabIndex = 2; this.manualstrip.Text = "toolStrip1"; // - // buttoncopyproperties - // - this.buttoncopyproperties.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.buttoncopyproperties.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.CopyProperties; - this.buttoncopyproperties.ImageTransparentColor = System.Drawing.Color.Magenta; - this.buttoncopyproperties.Name = "buttoncopyproperties"; - this.buttoncopyproperties.Size = new System.Drawing.Size(23, 22); - this.buttoncopyproperties.Tag = "classiccopyproperties"; - this.buttoncopyproperties.Text = "Copy Properties"; - this.buttoncopyproperties.Click += new System.EventHandler(this.InvokeTaggedAction); - // - // buttonpasteproperties - // - this.buttonpasteproperties.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.buttonpasteproperties.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.PasteProperties; - this.buttonpasteproperties.ImageTransparentColor = System.Drawing.Color.Magenta; - this.buttonpasteproperties.Name = "buttonpasteproperties"; - this.buttonpasteproperties.Size = new System.Drawing.Size(23, 22); - this.buttonpasteproperties.Tag = "classicpasteproperties"; - this.buttonpasteproperties.Text = "Paste Properties"; - this.buttonpasteproperties.Click += new System.EventHandler(this.InvokeTaggedAction); - // - // buttonpastepropertiesoptions - // - this.buttonpastepropertiesoptions.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.buttonpastepropertiesoptions.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.PastePropertiesOptions; - this.buttonpastepropertiesoptions.ImageTransparentColor = System.Drawing.Color.Magenta; - this.buttonpastepropertiesoptions.Name = "buttonpastepropertiesoptions"; - this.buttonpastepropertiesoptions.Size = new System.Drawing.Size(23, 22); - this.buttonpastepropertiesoptions.Tag = "classicpastepropertieswithoptions"; - this.buttonpastepropertiesoptions.Text = "Paste Properties Special..."; - this.buttonpastepropertiesoptions.TextAlign = System.Drawing.ContentAlignment.TopRight; - this.buttonpastepropertiesoptions.Click += new System.EventHandler(this.InvokeTaggedAction); - // // seperatorcopypaste // this.seperatorcopypaste.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); @@ -655,89 +637,12 @@ namespace CodeImp.DoomBuilder.BuilderModes this.separatorsectors1.Name = "separatorsectors1"; this.separatorsectors1.Size = new System.Drawing.Size(6, 25); // - // buttonMakeDoor - // - this.buttonMakeDoor.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.buttonMakeDoor.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.Door; - this.buttonMakeDoor.ImageTransparentColor = System.Drawing.Color.Magenta; - this.buttonMakeDoor.Name = "buttonMakeDoor"; - this.buttonMakeDoor.Size = new System.Drawing.Size(23, 22); - this.buttonMakeDoor.Tag = "makedoor"; - this.buttonMakeDoor.Text = "Make Door From Selection"; - this.buttonMakeDoor.Click += new System.EventHandler(this.InvokeTaggedAction); - // // separatorsectors2 // this.separatorsectors2.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); this.separatorsectors2.Name = "separatorsectors2"; this.separatorsectors2.Size = new System.Drawing.Size(6, 25); // - // buttonbrightnessgradient - // - this.buttonbrightnessgradient.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.buttonbrightnessgradient.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.BrightnessGradient; - this.buttonbrightnessgradient.ImageTransparentColor = System.Drawing.Color.Magenta; - this.buttonbrightnessgradient.Name = "buttonbrightnessgradient"; - this.buttonbrightnessgradient.Size = new System.Drawing.Size(23, 22); - this.buttonbrightnessgradient.Tag = "gradientbrightness"; - this.buttonbrightnessgradient.Text = "Make Brightness Gradient"; - this.buttonbrightnessgradient.Click += new System.EventHandler(this.InvokeTaggedAction); - // - // buttonfloorgradient - // - this.buttonfloorgradient.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.buttonfloorgradient.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.FloorsGradient; - this.buttonfloorgradient.ImageTransparentColor = System.Drawing.Color.Magenta; - this.buttonfloorgradient.Name = "buttonfloorgradient"; - this.buttonfloorgradient.Size = new System.Drawing.Size(23, 22); - this.buttonfloorgradient.Tag = "gradientfloors"; - this.buttonfloorgradient.Text = "Make Floor Heights Gradient"; - this.buttonfloorgradient.Click += new System.EventHandler(this.InvokeTaggedAction); - // - // buttonceilinggradient - // - this.buttonceilinggradient.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.buttonceilinggradient.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.CeilsGradient; - this.buttonceilinggradient.ImageTransparentColor = System.Drawing.Color.Magenta; - this.buttonceilinggradient.Name = "buttonceilinggradient"; - this.buttonceilinggradient.Size = new System.Drawing.Size(23, 22); - this.buttonceilinggradient.Tag = "gradientceilings"; - this.buttonceilinggradient.Text = "Make Ceiling Heights Gradient"; - this.buttonceilinggradient.Click += new System.EventHandler(this.InvokeTaggedAction); - // - // buttonflipselectionh - // - this.buttonflipselectionh.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.buttonflipselectionh.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.FlipSelectionH; - this.buttonflipselectionh.ImageTransparentColor = System.Drawing.Color.Magenta; - this.buttonflipselectionh.Name = "buttonflipselectionh"; - this.buttonflipselectionh.Size = new System.Drawing.Size(23, 22); - this.buttonflipselectionh.Tag = "flipselectionh"; - this.buttonflipselectionh.Text = "Flip Selection Horizontally"; - this.buttonflipselectionh.Click += new System.EventHandler(this.InvokeTaggedAction); - // - // buttonflipselectionv - // - this.buttonflipselectionv.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.buttonflipselectionv.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.FlipSelectionV; - this.buttonflipselectionv.ImageTransparentColor = System.Drawing.Color.Magenta; - this.buttonflipselectionv.Name = "buttonflipselectionv"; - this.buttonflipselectionv.Size = new System.Drawing.Size(23, 22); - this.buttonflipselectionv.Tag = "flipselectionv"; - this.buttonflipselectionv.Text = "Flip Selection Vertically"; - this.buttonflipselectionv.Click += new System.EventHandler(this.InvokeTaggedAction); - // - // buttoncurvelinedefs - // - this.buttoncurvelinedefs.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.buttoncurvelinedefs.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.CurveLines; - this.buttoncurvelinedefs.ImageTransparentColor = System.Drawing.Color.Magenta; - this.buttoncurvelinedefs.Name = "buttoncurvelinedefs"; - this.buttoncurvelinedefs.Size = new System.Drawing.Size(23, 22); - this.buttoncurvelinedefs.Tag = "curvelinesmode"; - this.buttoncurvelinedefs.Text = "Curve Linedefs"; - this.buttoncurvelinedefs.Click += new System.EventHandler(this.InvokeTaggedAction); - // // gradientModeMenu // this.gradientModeMenu.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -773,29 +678,6 @@ namespace CodeImp.DoomBuilder.BuilderModes ""; this.buttonMarqueSelectTouching.Click += new System.EventHandler(this.buttonMarqueSelectTouching_Click); // - // syncthingteditbutton - // - this.syncthingteditbutton.CheckOnClick = true; - this.syncthingteditbutton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.syncthingteditbutton.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.SelectThingsInSectors; - this.syncthingteditbutton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.syncthingteditbutton.Name = "syncthingteditbutton"; - this.syncthingteditbutton.Size = new System.Drawing.Size(23, 22); - this.syncthingteditbutton.Tag = "syncedthingedit"; - this.syncthingteditbutton.Text = "Synchronized Things Editing"; - this.syncthingteditbutton.Click += new System.EventHandler(this.InvokeTaggedAction); - // - // buttonAlignThingsToWall - // - this.buttonAlignThingsToWall.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.buttonAlignThingsToWall.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.AlignThings; - this.buttonAlignThingsToWall.ImageTransparentColor = System.Drawing.Color.Magenta; - this.buttonAlignThingsToWall.Name = "buttonAlignThingsToWall"; - this.buttonAlignThingsToWall.Size = new System.Drawing.Size(23, 22); - this.buttonAlignThingsToWall.Tag = "thingaligntowall"; - this.buttonAlignThingsToWall.ToolTipText = "Align Things to Nearest Linedef"; - this.buttonAlignThingsToWall.Click += new System.EventHandler(this.InvokeTaggedAction); - // // buttonTextureOffsetLock // this.buttonTextureOffsetLock.CheckOnClick = true; @@ -949,6 +831,164 @@ namespace CodeImp.DoomBuilder.BuilderModes this.itemsoundradii.Text = "Show Ambient Sound Radii"; this.itemsoundradii.Click += new System.EventHandler(this.buttonsoundradii_Click); // + // changeThingIndexToolStripMenuItem + // + this.changeThingIndexToolStripMenuItem.Name = "changeThingIndexToolStripMenuItem"; + this.changeThingIndexToolStripMenuItem.Size = new System.Drawing.Size(244, 22); + this.changeThingIndexToolStripMenuItem.Tag = "changemapelementindex"; + this.changeThingIndexToolStripMenuItem.Text = "Change Thing Index"; + this.changeThingIndexToolStripMenuItem.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // changeSectorIndexToolStripMenuItem + // + this.changeSectorIndexToolStripMenuItem.Name = "changeSectorIndexToolStripMenuItem"; + this.changeSectorIndexToolStripMenuItem.Size = new System.Drawing.Size(223, 22); + this.changeSectorIndexToolStripMenuItem.Tag = "changemapelementindex"; + this.changeSectorIndexToolStripMenuItem.Text = "Change Sector Index"; + this.changeSectorIndexToolStripMenuItem.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // buttoncopyproperties + // + this.buttoncopyproperties.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.buttoncopyproperties.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.CopyProperties; + this.buttoncopyproperties.ImageTransparentColor = System.Drawing.Color.Magenta; + this.buttoncopyproperties.Name = "buttoncopyproperties"; + this.buttoncopyproperties.Size = new System.Drawing.Size(23, 22); + this.buttoncopyproperties.Tag = "classiccopyproperties"; + this.buttoncopyproperties.Text = "Copy Properties"; + this.buttoncopyproperties.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // buttonpasteproperties + // + this.buttonpasteproperties.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.buttonpasteproperties.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.PasteProperties; + this.buttonpasteproperties.ImageTransparentColor = System.Drawing.Color.Magenta; + this.buttonpasteproperties.Name = "buttonpasteproperties"; + this.buttonpasteproperties.Size = new System.Drawing.Size(23, 22); + this.buttonpasteproperties.Tag = "classicpasteproperties"; + this.buttonpasteproperties.Text = "Paste Properties"; + this.buttonpasteproperties.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // buttonpastepropertiesoptions + // + this.buttonpastepropertiesoptions.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.buttonpastepropertiesoptions.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.PastePropertiesOptions; + this.buttonpastepropertiesoptions.ImageTransparentColor = System.Drawing.Color.Magenta; + this.buttonpastepropertiesoptions.Name = "buttonpastepropertiesoptions"; + this.buttonpastepropertiesoptions.Size = new System.Drawing.Size(23, 22); + this.buttonpastepropertiesoptions.Tag = "classicpastepropertieswithoptions"; + this.buttonpastepropertiesoptions.Text = "Paste Properties Special..."; + this.buttonpastepropertiesoptions.TextAlign = System.Drawing.ContentAlignment.TopRight; + this.buttonpastepropertiesoptions.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // buttonMakeDoor + // + this.buttonMakeDoor.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.buttonMakeDoor.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.Door; + this.buttonMakeDoor.ImageTransparentColor = System.Drawing.Color.Magenta; + this.buttonMakeDoor.Name = "buttonMakeDoor"; + this.buttonMakeDoor.Size = new System.Drawing.Size(23, 22); + this.buttonMakeDoor.Tag = "makedoor"; + this.buttonMakeDoor.Text = "Make Door From Selection"; + this.buttonMakeDoor.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // buttonbrightnessgradient + // + this.buttonbrightnessgradient.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.buttonbrightnessgradient.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.BrightnessGradient; + this.buttonbrightnessgradient.ImageTransparentColor = System.Drawing.Color.Magenta; + this.buttonbrightnessgradient.Name = "buttonbrightnessgradient"; + this.buttonbrightnessgradient.Size = new System.Drawing.Size(23, 22); + this.buttonbrightnessgradient.Tag = "gradientbrightness"; + this.buttonbrightnessgradient.Text = "Make Brightness Gradient"; + this.buttonbrightnessgradient.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // buttonfloorgradient + // + this.buttonfloorgradient.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.buttonfloorgradient.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.FloorsGradient; + this.buttonfloorgradient.ImageTransparentColor = System.Drawing.Color.Magenta; + this.buttonfloorgradient.Name = "buttonfloorgradient"; + this.buttonfloorgradient.Size = new System.Drawing.Size(23, 22); + this.buttonfloorgradient.Tag = "gradientfloors"; + this.buttonfloorgradient.Text = "Make Floor Heights Gradient"; + this.buttonfloorgradient.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // buttonceilinggradient + // + this.buttonceilinggradient.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.buttonceilinggradient.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.CeilsGradient; + this.buttonceilinggradient.ImageTransparentColor = System.Drawing.Color.Magenta; + this.buttonceilinggradient.Name = "buttonceilinggradient"; + this.buttonceilinggradient.Size = new System.Drawing.Size(23, 22); + this.buttonceilinggradient.Tag = "gradientceilings"; + this.buttonceilinggradient.Text = "Make Ceiling Heights Gradient"; + this.buttonceilinggradient.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // buttonflipselectionh + // + this.buttonflipselectionh.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.buttonflipselectionh.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.FlipSelectionH; + this.buttonflipselectionh.ImageTransparentColor = System.Drawing.Color.Magenta; + this.buttonflipselectionh.Name = "buttonflipselectionh"; + this.buttonflipselectionh.Size = new System.Drawing.Size(23, 22); + this.buttonflipselectionh.Tag = "flipselectionh"; + this.buttonflipselectionh.Text = "Flip Selection Horizontally"; + this.buttonflipselectionh.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // buttonflipselectionv + // + this.buttonflipselectionv.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.buttonflipselectionv.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.FlipSelectionV; + this.buttonflipselectionv.ImageTransparentColor = System.Drawing.Color.Magenta; + this.buttonflipselectionv.Name = "buttonflipselectionv"; + this.buttonflipselectionv.Size = new System.Drawing.Size(23, 22); + this.buttonflipselectionv.Tag = "flipselectionv"; + this.buttonflipselectionv.Text = "Flip Selection Vertically"; + this.buttonflipselectionv.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // buttoncurvelinedefs + // + this.buttoncurvelinedefs.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.buttoncurvelinedefs.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.CurveLines; + this.buttoncurvelinedefs.ImageTransparentColor = System.Drawing.Color.Magenta; + this.buttoncurvelinedefs.Name = "buttoncurvelinedefs"; + this.buttoncurvelinedefs.Size = new System.Drawing.Size(23, 22); + this.buttoncurvelinedefs.Tag = "curvelinesmode"; + this.buttoncurvelinedefs.Text = "Curve Linedefs"; + this.buttoncurvelinedefs.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // syncthingteditbutton + // + this.syncthingteditbutton.CheckOnClick = true; + this.syncthingteditbutton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.syncthingteditbutton.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.SelectThingsInSectors; + this.syncthingteditbutton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.syncthingteditbutton.Name = "syncthingteditbutton"; + this.syncthingteditbutton.Size = new System.Drawing.Size(23, 22); + this.syncthingteditbutton.Tag = "syncedthingedit"; + this.syncthingteditbutton.Text = "Synchronized Things Editing"; + this.syncthingteditbutton.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // buttonAlignThingsToWall + // + this.buttonAlignThingsToWall.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.buttonAlignThingsToWall.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.AlignThings; + this.buttonAlignThingsToWall.ImageTransparentColor = System.Drawing.Color.Magenta; + this.buttonAlignThingsToWall.Name = "buttonAlignThingsToWall"; + this.buttonAlignThingsToWall.Size = new System.Drawing.Size(23, 22); + this.buttonAlignThingsToWall.Tag = "thingaligntowall"; + this.buttonAlignThingsToWall.ToolTipText = "Align Things to Nearest Linedef"; + this.buttonAlignThingsToWall.Click += new System.EventHandler(this.InvokeTaggedAction); + // + // changeVertexIndexToolStripMenuItem + // + this.changeVertexIndexToolStripMenuItem.Name = "changeVertexIndexToolStripMenuItem"; + this.changeVertexIndexToolStripMenuItem.Size = new System.Drawing.Size(182, 22); + this.changeVertexIndexToolStripMenuItem.Tag = "changemapelementindex"; + this.changeVertexIndexToolStripMenuItem.Text = "Change Vertex Index"; + this.changeVertexIndexToolStripMenuItem.Click += new System.EventHandler(this.InvokeTaggedAction); + // // MenusForm // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -1066,5 +1106,9 @@ namespace CodeImp.DoomBuilder.BuilderModes private System.Windows.Forms.ToolStripMenuItem itemsoundradii; private System.Windows.Forms.ToolStripButton buttonTextureOffset3DFloorLock; private System.Windows.Forms.ToolStripMenuItem selectionToImageToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem changeLindefIndexToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem changeThingIndexToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem changeSectorIndexToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem changeVertexIndexToolStripMenuItem; } } \ No newline at end of file diff --git a/Source/Plugins/BuilderModes/Resources/Actions.cfg b/Source/Plugins/BuilderModes/Resources/Actions.cfg index a2542399..b30a1bab 100755 --- a/Source/Plugins/BuilderModes/Resources/Actions.cfg +++ b/Source/Plugins/BuilderModes/Resources/Actions.cfg @@ -1551,4 +1551,14 @@ applycamerarotationtothings allowkeys = true; allowmouse = true; allowscroll = false; +} + +changemapelementindex +{ + title = "Change Map Element Index"; + category = "linedefs"; + description = "Changes the index of the highlighted or selected vertex, linedef, sector, or thing. Only works on a single map element. It will shift all indices between the old and new index."; + allowkeys = true; + allowmouse = true; + allowscroll = false; } \ No newline at end of file