mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-16 17:11:28 +00:00
Edit Linedef Dialog:
- fixed an issue where undo snapshots were not created correctly when editing a sidedef's custom UDMF fields. Fixes #920 - fixed an issue where closing the back sidedef's custom UDMF field editing dialog would close the linedef dialog
This commit is contained in:
parent
4dba3a9234
commit
f3ac4c39a4
4 changed files with 19 additions and 12 deletions
|
@ -33,18 +33,26 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
{
|
||||
// Keep a list of elements
|
||||
private ICollection<MapElement> elements;
|
||||
|
||||
|
||||
// Action that runs the undo method from the caller
|
||||
private Action makeundo;
|
||||
|
||||
// Constructor
|
||||
public CustomFieldsForm()
|
||||
public CustomFieldsForm(Action makeundo)
|
||||
{
|
||||
this.makeundo = makeundo;
|
||||
|
||||
if (makeundo == null)
|
||||
throw new NotImplementedException("No method to create an undo snapshot specified. This would potentially lead to data loss.");
|
||||
|
||||
// Initialize
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
// This shows the dialog, returns false when cancelled
|
||||
public static bool ShowDialog(IWin32Window owner, string title, string elementname, ICollection<MapElement> elements, List<UniversalFieldInfo> fixedfields)
|
||||
public static bool ShowDialog(IWin32Window owner, Action makeundo, string title, string elementname, ICollection<MapElement> elements, List<UniversalFieldInfo> fixedfields)
|
||||
{
|
||||
CustomFieldsForm f = new CustomFieldsForm();
|
||||
CustomFieldsForm f = new CustomFieldsForm(makeundo);
|
||||
f.Setup(title, elementname, elements, fixedfields);
|
||||
bool result = (f.ShowDialog(owner) == DialogResult.OK);
|
||||
f.Dispose();
|
||||
|
@ -76,8 +84,11 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// OK clicked
|
||||
private void apply_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Create an undo snapshot using the method specified by the caller
|
||||
makeundo();
|
||||
|
||||
// Apply fields to all elements
|
||||
foreach(MapElement el in elements) fieldslist.Apply(el.Fields);
|
||||
foreach (MapElement el in elements) fieldslist.Apply(el.Fields);
|
||||
|
||||
// Done
|
||||
General.Map.IsChanged = true;
|
||||
|
|
|
@ -1042,7 +1042,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
//
|
||||
// custombackbutton
|
||||
//
|
||||
this.custombackbutton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.custombackbutton.Location = new System.Drawing.Point(98, 170);
|
||||
this.custombackbutton.Name = "custombackbutton";
|
||||
this.custombackbutton.Size = new System.Drawing.Size(130, 25);
|
||||
|
|
|
@ -1020,7 +1020,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
List<MapElement> sides = new List<MapElement>(lines.Count);
|
||||
foreach(Linedef l in lines) if(l.Front != null) sides.Add(l.Front);
|
||||
|
||||
if(!CustomFieldsForm.ShowDialog(this, "Front side custom fields", "sidedef", sides, General.Map.Config.SidedefFields)) return;
|
||||
if(!CustomFieldsForm.ShowDialog(this, MakeUndo, "Front side custom fields", "sidedef", sides, General.Map.Config.SidedefFields)) return;
|
||||
|
||||
//Apply values
|
||||
Sidedef fs = General.GetByIndex(sides, 0) as Sidedef;
|
||||
|
@ -1083,7 +1083,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
foreach(Linedef l in lines) if(l.Back != null) sides.Add(l.Back);
|
||||
|
||||
// Edit these
|
||||
if(!CustomFieldsForm.ShowDialog(this, "Back side custom fields", "sidedef", sides, General.Map.Config.SidedefFields)) return;
|
||||
if(!CustomFieldsForm.ShowDialog(this, MakeUndo, "Back side custom fields", "sidedef", sides, General.Map.Config.SidedefFields)) return;
|
||||
|
||||
//Apply values
|
||||
Sidedef fs = General.GetByIndex(sides, 0) as Sidedef;
|
||||
|
|
|
@ -146,7 +146,7 @@
|
|||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADM
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAAQgBAQEIAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
CAAAAk1TRnQBSQFMAgEBAgEAARABAQEQAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
|
@ -186,7 +186,4 @@
|
|||
BAAB/wKAAQEEAAH/AcECgQQAAf8B4wLDBAAC/wLnBAAE/wQACw==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="tooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
Loading…
Reference in a new issue