diff --git a/Source/Core/Builder.csproj b/Source/Core/Builder.csproj index 5b1ede18..41245a24 100644 --- a/Source/Core/Builder.csproj +++ b/Source/Core/Builder.csproj @@ -804,6 +804,7 @@ FlagsForm.cs + Form diff --git a/Source/Core/Windows/ISectorEditForm.cs b/Source/Core/Windows/ISectorEditForm.cs new file mode 100644 index 00000000..07c7e7e7 --- /dev/null +++ b/Source/Core/Windows/ISectorEditForm.cs @@ -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 Selection { get; } + } +} diff --git a/Source/Core/Windows/MainForm.cs b/Source/Core/Windows/MainForm.cs index de9f3233..08f95562 100644 --- a/Source/Core/Windows/MainForm.cs +++ b/Source/Core/Windows/MainForm.cs @@ -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{ diff --git a/Source/Core/Windows/SectorEditForm.cs b/Source/Core/Windows/SectorEditForm.cs index 1ae32ac4..5f5a89c5 100644 --- a/Source/Core/Windows/SectorEditForm.cs +++ b/Source/Core/Windows/SectorEditForm.cs @@ -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; diff --git a/Source/Core/Windows/SectorEditFormUDMF.cs b/Source/Core/Windows/SectorEditFormUDMF.cs index a47a8315..962679e4 100644 --- a/Source/Core/Windows/SectorEditFormUDMF.cs +++ b/Source/Core/Windows/SectorEditFormUDMF.cs @@ -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 sectors; private List flags; - + + #endregion + + #region ================== Properties + + public ICollection 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 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 } } diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySector.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySector.cs index f4fadc7b..d815fd43 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySector.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySector.cs @@ -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