Sector Edit form, UDMF: it was impossible to remove a sound sequence if it was set previously.

Error Check form: number of selected items is now shown in the window's title.
Error Check form: fixed slowdowns when trying to select many (like 1000) results at once.
This commit is contained in:
MaxED 2015-02-14 18:15:11 +00:00
parent e8e2cac1f3
commit ec964e9db0
3 changed files with 84 additions and 23 deletions

View file

@ -41,11 +41,12 @@
System.Windows.Forms.Label label6; System.Windows.Forms.Label label6;
System.Windows.Forms.Label label5; System.Windows.Forms.Label label5;
this.tagSelector = new CodeImp.DoomBuilder.GZBuilder.Controls.TagSelector(); this.tagSelector = new CodeImp.DoomBuilder.GZBuilder.Controls.TagSelector();
this.resetsoundsequence = new System.Windows.Forms.Button();
this.fadeColor = new CodeImp.DoomBuilder.GZBuilder.Controls.ColorFieldsControl(); this.fadeColor = new CodeImp.DoomBuilder.GZBuilder.Controls.ColorFieldsControl();
this.lightColor = new CodeImp.DoomBuilder.GZBuilder.Controls.ColorFieldsControl(); this.lightColor = new CodeImp.DoomBuilder.GZBuilder.Controls.ColorFieldsControl();
this.brightness = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.brightness = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.desaturation = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.desaturation = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.soundSequence = new System.Windows.Forms.TextBox(); this.soundsequence = new System.Windows.Forms.TextBox();
this.gravity = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.gravity = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.browseeffect = new System.Windows.Forms.Button(); this.browseeffect = new System.Windows.Forms.Button();
this.effect = new CodeImp.DoomBuilder.Controls.ActionSelectorControl(); this.effect = new CodeImp.DoomBuilder.Controls.ActionSelectorControl();
@ -152,6 +153,7 @@
// //
groupeffect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) groupeffect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
groupeffect.Controls.Add(this.resetsoundsequence);
groupeffect.Controls.Add(this.fadeColor); groupeffect.Controls.Add(this.fadeColor);
groupeffect.Controls.Add(this.lightColor); groupeffect.Controls.Add(this.lightColor);
groupeffect.Controls.Add(this.brightness); groupeffect.Controls.Add(this.brightness);
@ -159,7 +161,7 @@
groupeffect.Controls.Add(label14); groupeffect.Controls.Add(label14);
groupeffect.Controls.Add(label9); groupeffect.Controls.Add(label9);
groupeffect.Controls.Add(label13); groupeffect.Controls.Add(label13);
groupeffect.Controls.Add(this.soundSequence); groupeffect.Controls.Add(this.soundsequence);
groupeffect.Controls.Add(this.gravity); groupeffect.Controls.Add(this.gravity);
groupeffect.Controls.Add(label2); groupeffect.Controls.Add(label2);
groupeffect.Controls.Add(this.browseeffect); groupeffect.Controls.Add(this.browseeffect);
@ -172,6 +174,17 @@
groupeffect.TabStop = false; groupeffect.TabStop = false;
groupeffect.Text = " Effects "; groupeffect.Text = " Effects ";
// //
// resetsoundsequence
//
this.resetsoundsequence.Image = global::CodeImp.DoomBuilder.Properties.Resources.Reset;
this.resetsoundsequence.Location = new System.Drawing.Point(456, 52);
this.resetsoundsequence.Name = "resetsoundsequence";
this.resetsoundsequence.Size = new System.Drawing.Size(28, 25);
this.resetsoundsequence.TabIndex = 31;
this.resetsoundsequence.Text = " ";
this.resetsoundsequence.UseVisualStyleBackColor = true;
this.resetsoundsequence.Click += new System.EventHandler(this.resetsoundsequence_Click);
//
// fadeColor // fadeColor
// //
this.fadeColor.DefaultValue = 0; this.fadeColor.DefaultValue = 0;
@ -250,12 +263,14 @@
label13.Text = "Desaturation:"; label13.Text = "Desaturation:";
label13.TextAlign = System.Drawing.ContentAlignment.TopRight; label13.TextAlign = System.Drawing.ContentAlignment.TopRight;
// //
// soundSequence // soundsequence
// //
this.soundSequence.Location = new System.Drawing.Point(125, 55); this.soundsequence.Location = new System.Drawing.Point(125, 55);
this.soundSequence.Name = "soundSequence"; this.soundsequence.Name = "soundsequence";
this.soundSequence.Size = new System.Drawing.Size(325, 20); this.soundsequence.Size = new System.Drawing.Size(325, 20);
this.soundSequence.TabIndex = 2; this.soundsequence.TabIndex = 2;
this.soundsequence.TextChanged += new System.EventHandler(this.soundsequence_TextChanged);
this.soundsequence.MouseDown += new System.Windows.Forms.MouseEventHandler(this.soundsequence_MouseDown);
// //
// gravity // gravity
// //
@ -551,7 +566,7 @@
// //
// floorAngleControl // floorAngleControl
// //
this.floorAngleControl.Angle = -720; this.floorAngleControl.Angle = 0;
this.floorAngleControl.AngleOffset = 90; this.floorAngleControl.AngleOffset = 90;
this.floorAngleControl.Location = new System.Drawing.Point(6, 132); this.floorAngleControl.Location = new System.Drawing.Point(6, 132);
this.floorAngleControl.Name = "floorAngleControl"; this.floorAngleControl.Name = "floorAngleControl";
@ -770,7 +785,7 @@
// //
// ceilAngleControl // ceilAngleControl
// //
this.ceilAngleControl.Angle = -720; this.ceilAngleControl.Angle = 0;
this.ceilAngleControl.AngleOffset = 90; this.ceilAngleControl.AngleOffset = 90;
this.ceilAngleControl.Location = new System.Drawing.Point(6, 132); this.ceilAngleControl.Location = new System.Drawing.Point(6, 132);
this.ceilAngleControl.Name = "ceilAngleControl"; this.ceilAngleControl.Name = "ceilAngleControl";
@ -1137,7 +1152,7 @@
private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.GroupBox groupBox3;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox gravity; private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox gravity;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox desaturation; private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox desaturation;
private System.Windows.Forms.TextBox soundSequence; private System.Windows.Forms.TextBox soundsequence;
private CodeImp.DoomBuilder.GZBuilder.Controls.ColorFieldsControl fadeColor; private CodeImp.DoomBuilder.GZBuilder.Controls.ColorFieldsControl fadeColor;
private CodeImp.DoomBuilder.GZBuilder.Controls.ColorFieldsControl lightColor; private CodeImp.DoomBuilder.GZBuilder.Controls.ColorFieldsControl lightColor;
private CodeImp.DoomBuilder.Controls.CheckboxArrayControl flags; private CodeImp.DoomBuilder.Controls.CheckboxArrayControl flags;
@ -1154,5 +1169,6 @@
private System.Windows.Forms.Label labelFloorScale; private System.Windows.Forms.Label labelFloorScale;
private System.Windows.Forms.Label labelCeilOffsets; private System.Windows.Forms.Label labelCeilOffsets;
private System.Windows.Forms.Label labelCeilScale; private System.Windows.Forms.Label labelCeilScale;
private System.Windows.Forms.Button resetsoundsequence;
} }
} }

View file

@ -22,6 +22,12 @@ namespace CodeImp.DoomBuilder.Windows
#endregion #endregion
#region ================== Constants
private const string NO_SOUND_SEQUENCE = "None"; //mxd
#endregion
#region ================== Variables #region ================== Variables
private ICollection<Sector> sectors; private ICollection<Sector> sectors;
@ -300,7 +306,7 @@ namespace CodeImp.DoomBuilder.Windows
floorRenderStyle.SelectedIndex = Array.IndexOf(renderstyles, sc.Fields.GetValue("renderstylefloor", "translucent")); floorRenderStyle.SelectedIndex = Array.IndexOf(renderstyles, sc.Fields.GetValue("renderstylefloor", "translucent"));
//Misc //Misc
soundSequence.Text = sc.Fields.GetValue("soundsequence", string.Empty); soundsequence.Text = sc.Fields.GetValue("soundsequence", NO_SOUND_SEQUENCE);
gravity.Text = sc.Fields.GetValue("gravity", 1.0f).ToString(); gravity.Text = sc.Fields.GetValue("gravity", 1.0f).ToString();
desaturation.Text = General.Clamp(sc.Fields.GetValue("desaturation", 0.0f), 0f, 1f).ToString(); desaturation.Text = General.Clamp(sc.Fields.GetValue("desaturation", 0.0f), 0f, 1f).ToString();
@ -404,7 +410,7 @@ namespace CodeImp.DoomBuilder.Windows
floorRenderStyle.SelectedIndex = -1; floorRenderStyle.SelectedIndex = -1;
//Misc //Misc
if(s.Fields.GetValue("soundsequence", string.Empty) != soundSequence.Text) soundSequence.Text = ""; if(s.Fields.GetValue("soundsequence", NO_SOUND_SEQUENCE) != soundsequence.Text) soundsequence.Text = "";
if(s.Fields.GetValue("gravity", 1.0f).ToString() != gravity.Text) gravity.Text = ""; if(s.Fields.GetValue("gravity", 1.0f).ToString() != gravity.Text) gravity.Text = "";
if(s.Fields.GetValue("desaturation", 0.0f).ToString() != desaturation.Text) desaturation.Text = ""; if(s.Fields.GetValue("desaturation", 0.0f).ToString() != desaturation.Text) desaturation.Text = "";
@ -667,11 +673,11 @@ namespace CodeImp.DoomBuilder.Windows
} }
// Misc // Misc
if(soundSequence.Text != "") if(!string.IsNullOrEmpty(soundsequence.Text))
s.Fields["soundsequence"] = new UniValue(UniversalType.String, soundSequence.Text); UDMFTools.SetString(s.Fields, "soundsequence", soundsequence.Text, NO_SOUND_SEQUENCE);
if(gravity.Text != "") if(!string.IsNullOrEmpty(gravity.Text))
UDMFTools.SetFloat(s.Fields, "gravity", gravity.GetResultFloat(s.Fields.GetValue("gravity", 1.0f)), 1.0f); UDMFTools.SetFloat(s.Fields, "gravity", gravity.GetResultFloat(s.Fields.GetValue("gravity", 1.0f)), 1.0f);
if(desaturation.Text != "") if(!string.IsNullOrEmpty(desaturation.Text))
{ {
float val = General.Clamp(desaturation.GetResultFloat(s.Fields.GetValue("desaturation", 0f)), 0f, 1f); float val = General.Clamp(desaturation.GetResultFloat(s.Fields.GetValue("desaturation", 0f)), 0f, 1f);
UDMFTools.SetFloat(s.Fields, "desaturation", val, 0f); UDMFTools.SetFloat(s.Fields, "desaturation", val, 0f);
@ -765,6 +771,22 @@ namespace CodeImp.DoomBuilder.Windows
floorRotation.StepValues = (cbUseFloorLineAngles.Checked ? anglesteps : null); floorRotation.StepValues = (cbUseFloorLineAngles.Checked ? anglesteps : null);
} }
private void resetsoundsequence_Click(object sender, EventArgs e)
{
soundsequence.Text = NO_SOUND_SEQUENCE;
}
private void soundsequence_TextChanged(object sender, EventArgs e)
{
soundsequence.ForeColor = (soundsequence.Text == NO_SOUND_SEQUENCE ? SystemColors.GrayText : SystemColors.WindowText);
resetsoundsequence.Enabled = (soundsequence.Text != NO_SOUND_SEQUENCE);
}
private void soundsequence_MouseDown(object sender, MouseEventArgs e)
{
if(soundsequence.Text == NO_SOUND_SEQUENCE) soundsequence.SelectAll();
}
#endregion #endregion
#region ================== Sector Realtime events (mxd) #region ================== Sector Realtime events (mxd)

View file

@ -54,6 +54,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
private Size initialsize; //mxd private Size initialsize; //mxd
private List<ErrorResult> resultslist; //mxd private List<ErrorResult> resultslist; //mxd
private List<Type> hiddentresulttypes; //mxd private List<Type> hiddentresulttypes; //mxd
private bool bathselectioninprogress; //mxd
#endregion #endregion
@ -183,8 +184,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
private void UpdateTitle() private void UpdateTitle()
{ {
int hiddencount = resultslist.Count - results.Items.Count; int hiddencount = resultslist.Count - results.Items.Count;
this.Text = "Map Analysis [" + resultslist.Count + " results" string title = "Map Analysis [" + resultslist.Count + " results";
+ (hiddencount > 0 ? ", " + hiddencount + " are hidden]" : "]"); //mxd if(hiddencount > 0) title += hiddencount + " hidden";
title += ", " + results.SelectedItems.Count + " selected";
this.Text = title + @"]";
} }
// This stops checking (only called from the checking management thread) // This stops checking (only called from the checking management thread)
@ -204,13 +207,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
running = false; running = false;
blockmap.Dispose(); blockmap.Dispose();
blockmap = null; blockmap = null;
UpdateTitle(); //mxd
// When no results found, show "no results" and disable the list // When no results found, show "no results" and disable the list
if(resultslist.Count == 0) if(resultslist.Count == 0)
{ {
results.Items.Add(new ResultNoErrors()); results.Items.Add(new ResultNoErrors());
results.Enabled = false; results.Enabled = false;
UpdateTitle(); //mxd
} }
else else
{ {
@ -297,6 +300,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
fix1.Visible = false; fix1.Visible = false;
fix2.Visible = false; fix2.Visible = false;
fix3.Visible = false; fix3.Visible = false;
UpdateTitle(); //mxd
} }
// This runs in a seperate thread to manage the checking threads // This runs in a seperate thread to manage the checking threads
@ -458,6 +463,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Results selection changed // Results selection changed
private void results_SelectedIndexChanged(object sender, EventArgs e) private void results_SelectedIndexChanged(object sender, EventArgs e)
{ {
//mxd
if(bathselectioninprogress) return;
// Anything selected? // Anything selected?
if(results.SelectedItems.Count > 0) if(results.SelectedItems.Count > 0)
{ {
@ -519,6 +527,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
editmode.CenterOnArea(zoomarea, 0.6f); editmode.CenterOnArea(zoomarea, 0.6f);
} }
} }
UpdateTitle(); //mxd
} }
else else
{ {
@ -660,7 +670,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
hiddentresulttypes.Clear(); hiddentresulttypes.Clear();
// Do the obvious // Do the obvious
UpdateTitle();
ClearSelectedResult(); ClearSelectedResult();
} }
@ -677,10 +686,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
// Remove from the list // Remove from the list
results.BeginUpdate();
foreach (ErrorResult r in tohide) results.Items.Remove(r); foreach (ErrorResult r in tohide) results.Items.Remove(r);
results.EndUpdate();
// Do the obvious // Do the obvious
UpdateTitle();
ClearSelectedResult(); ClearSelectedResult();
} }
@ -701,7 +711,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
results.Items.AddRange(filtered.ToArray()); results.Items.AddRange(filtered.ToArray());
// Do the obvious // Do the obvious
UpdateTitle();
ClearSelectedResult(); ClearSelectedResult();
} }
@ -730,7 +739,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
results.Items.AddRange(filtered.ToArray()); results.Items.AddRange(filtered.ToArray());
// Do the obvious // Do the obvious
UpdateTitle();
ClearSelectedResult(); ClearSelectedResult();
} }
@ -758,7 +766,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
else if(e.Control && e.KeyCode == Keys.A) else if(e.Control && e.KeyCode == Keys.A)
{ {
results.SelectedItems.Clear(); results.SelectedItems.Clear();
bathselectioninprogress = true; //mxd
results.BeginUpdate(); //mxd
for(int i = 0; i < results.Items.Count; i++) results.SelectedItems.Add(results.Items[i]); for(int i = 0; i < results.Items.Count; i++) results.SelectedItems.Add(results.Items[i]);
results.EndUpdate(); //mxd
bathselectioninprogress = false; //mxd
results_SelectedIndexChanged(this, EventArgs.Empty); //trigger update manually
} }
} }
@ -767,10 +782,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
Dictionary<Type, bool> toselect = GetSelectedTypes(); Dictionary<Type, bool> toselect = GetSelectedTypes();
results.SelectedItems.Clear(); results.SelectedItems.Clear();
bathselectioninprogress = true; //mxd
results.BeginUpdate(); //mxd
for(int i = 0; i < results.Items.Count; i++) for(int i = 0; i < results.Items.Count; i++)
{ {
if(toselect.ContainsKey(results.Items[i].GetType())) results.SelectedItems.Add(results.Items[i]); if(toselect.ContainsKey(results.Items[i].GetType())) results.SelectedItems.Add(results.Items[i]);
} }
results.EndUpdate(); //mxd
bathselectioninprogress = false; //mxd
results_SelectedIndexChanged(this, EventArgs.Empty); //trigger update manually
} }
#endregion #endregion