Sector Edit form, UDMF: sectors were not updated properly after closing the form because of changes in Doom/Hexen Sector Edit form.

This commit is contained in:
MaxED 2013-07-09 13:13:00 +00:00
parent 7a35751100
commit 4b018957aa
6 changed files with 52 additions and 16 deletions

View file

@ -804,6 +804,7 @@
<Compile Include="Windows\FlagsForm.Designer.cs">
<DependentUpon>FlagsForm.cs</DependentUpon>
</Compile>
<Compile Include="Windows\ISectorEditForm.cs" />
<Compile Include="Windows\MenuSection.cs" />
<Compile Include="Windows\PasteOptionsForm.cs">
<SubType>Form</SubType>

View file

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
using CodeImp.DoomBuilder.Map;
namespace CodeImp.DoomBuilder.Windows
{
public interface ISectorEditForm
{
event EventHandler OnValuesChanged;
ICollection<Sector> Selection { get; }
}
}

View file

@ -3008,6 +3008,7 @@ namespace CodeImp.DoomBuilder.Windows
if(General.Map.UDMF){ //mxd
SectorEditFormUDMF f = new SectorEditFormUDMF();
f.Setup(sectors);
f.OnValuesChanged += new EventHandler(EditForm_OnValuesChanged);
result = f.ShowDialog(this);
f.Dispose();
}else{

View file

@ -26,7 +26,7 @@ using CodeImp.DoomBuilder.Types;
namespace CodeImp.DoomBuilder.Windows
{
public partial class SectorEditForm : DelayedForm
public partial class SectorEditForm : DelayedForm, ISectorEditForm
{
#region ================== Events
@ -42,8 +42,6 @@ namespace CodeImp.DoomBuilder.Windows
private struct SectorProperties //mxd
{
//public int Tag;
//public int Effect;
public int Brightness;
public int FloorHeight;
public int CeilHeight;
@ -51,8 +49,6 @@ namespace CodeImp.DoomBuilder.Windows
public string CeilTexture;
public SectorProperties(Sector s) {
//Tag = s.Tag;
//Effect = s.Effect;
Brightness = s.Brightness;
FloorHeight = s.FloorHeight;
CeilHeight = s.CeilHeight;

View file

@ -8,12 +8,29 @@ using CodeImp.DoomBuilder.GZBuilder.Tools;
namespace CodeImp.DoomBuilder.Windows
{
public partial class SectorEditFormUDMF : DelayedForm
public partial class SectorEditFormUDMF : DelayedForm, ISectorEditForm
{
// Variables
#region ================== Events
public event EventHandler OnValuesChanged; //mxd
#endregion
#region ================== Variables
private ICollection<Sector> sectors;
private List<CheckBox> flags;
#endregion
#region ================== Properties
public ICollection<Sector> Selection { get { return sectors; } } //mxd
#endregion
#region ================== Constructor
public SectorEditFormUDMF() {
InitializeComponent();
@ -40,6 +57,10 @@ namespace CodeImp.DoomBuilder.Windows
fieldslist.Setup("sector");
}
#endregion
#region ================== Methods
// This sets up the form to edit the given sectors
public void Setup(ICollection<Sector> sectors) {
Sector sc;
@ -236,6 +257,10 @@ namespace CodeImp.DoomBuilder.Windows
}
}
#endregion
#region ================== Events
private void apply_Click(object sender, EventArgs e) {
string undodesc = "sector";
@ -362,6 +387,10 @@ namespace CodeImp.DoomBuilder.Windows
// Done
General.Map.IsChanged = true;
//dbg
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
this.DialogResult = DialogResult.OK;
this.Close();
}
@ -408,5 +437,7 @@ namespace CodeImp.DoomBuilder.Windows
private void ceilRotation_WhenTextChanged(object sender, EventArgs e) {
ceilAngleControl.Angle = General.ClampAngle(360 - ceilRotation.GetResult(0));
}
#endregion
}
}

View file

@ -243,13 +243,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
Linedef targetLine = MapSet.NearestLinedef(lines, hitpos);
if(targetLine == null) return;
foreach(Sidedef side in highlightedSector.Sidedefs) {
if(side.Line == targetLine && side.Line.Front != null && side.Line.Front == side) {
isFront = true;
break;
}
}
isFront = targetLine.SideOfLine(hitpos) > 0;
Sector.Sector.Fields.BeforeFieldsChange();
//find an angle to rotate texture
@ -652,7 +646,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
private void Interface_OnEditFormValuesChanged(object sender, System.EventArgs e) {
SectorEditForm form = sender as SectorEditForm;
ISectorEditForm form = sender as ISectorEditForm;
if(form == null) return;
// Update what must be updated