When choosing a difficulty or engine in the test toolbar button the engine will not be launched immediately. This can be reverted in the preferences. Resolves #626

This commit is contained in:
biwa 2021-12-11 12:43:33 +01:00
parent a75249b315
commit 9f85f70deb
5 changed files with 2395 additions and 2351 deletions

View file

@ -97,6 +97,7 @@ namespace CodeImp.DoomBuilder.Config
private bool switchviewmodes; //mxd
private bool showfps;
private int[] colordialogcustomcolors;
private bool autolaunchontest;
//mxd. Script editor settings
private string scriptfontname;
@ -207,6 +208,7 @@ namespace CodeImp.DoomBuilder.Config
public bool SplitJoinedSectors { get { return splitjoinedsectors; } internal set { splitjoinedsectors = value; } } //mxd
public bool ShowFPS { get { return showfps; } internal set { showfps = value; } }
public int[] ColorDialogCustomColors { get { return colordialogcustomcolors; } internal set { colordialogcustomcolors = value; } }
public bool AutoLaunchOnTest { get { return autolaunchontest; } internal set { autolaunchontest = value; } }
//mxd. Highlight mode
public bool UseHighlight
@ -354,6 +356,7 @@ namespace CodeImp.DoomBuilder.Config
usehighlight = cfg.ReadSetting("usehighlight", true); //mxd
switchviewmodes = cfg.ReadSetting("switchviewmodes", false); //mxd
showfps = cfg.ReadSetting("showfps", false);
autolaunchontest = cfg.ReadSetting("autolaunchontest", false);
//mxd. Script editor
scriptfontname = cfg.ReadSetting("scriptfontname", "Courier New");
@ -491,6 +494,7 @@ namespace CodeImp.DoomBuilder.Config
cfg.WriteSetting("usehighlight", usehighlight); //mxd
cfg.WriteSetting("switchviewmodes", switchviewmodes); //mxd
cfg.WriteSetting("showfps", showfps);
cfg.WriteSetting("autolaunchontest", autolaunchontest);
//mxd. Script editor
cfg.WriteSetting("scriptfontname", scriptfontname);

View file

@ -586,6 +586,9 @@ namespace CodeImp.DoomBuilder.Windows
this.DragEnter += OnDragEnter;
this.DragDrop += OnDragDrop;
// For checking if the drop down should really be closed
buttontest.DropDown.Closing += ButtonTestDropDown_Closing;
// Info panel state?
bool expandedpanel = General.Settings.ReadSetting("windows." + configname + ".expandedinfopanel", true);
if(expandedpanel != IsInfoPanelExpanded) ToggleInfoPanel();
@ -1608,7 +1611,10 @@ namespace CodeImp.DoomBuilder.Windows
{
General.Map.ConfigSettings.CurrentEngineIndex = (int)(((ToolStripMenuItem)sender).Tag);
General.Map.ConfigSettings.Changed = true;
if(General.Settings.AutoLaunchOnTest)
General.Map.Launcher.TestAtSkill(General.Map.ConfigSettings.TestSkill);
UpdateSkills();
}
@ -1618,7 +1624,10 @@ namespace CodeImp.DoomBuilder.Windows
int skill = (int)((sender as ToolStripMenuItem).Tag);
General.Settings.TestMonsters = (skill > 0);
General.Map.ConfigSettings.TestSkill = Math.Abs(skill);
if(General.Settings.AutoLaunchOnTest)
General.Map.Launcher.TestAtSkill(Math.Abs(skill));
UpdateSkills();
}
@ -2294,6 +2303,19 @@ namespace CodeImp.DoomBuilder.Windows
}
}
/// <summary>
/// Called when the test button drop down wants to close. Prevents closing when auto-launching is disabled
/// </summary>
/// <param name="sender">The sneder</param>
/// <param name="e">The event</param>
private void ButtonTestDropDown_Closing(object sender, ToolStripDropDownClosingEventArgs e)
{
if (General.Settings.AutoLaunchOnTest == false && e.CloseReason == ToolStripDropDownCloseReason.ItemClicked)
{
e.Cancel = true;
}
}
#endregion
#region ================== Toolbar context menu (mxd)

View file

@ -211,6 +211,7 @@ namespace CodeImp.DoomBuilder.Windows
this.tabpasting = new System.Windows.Forms.TabPage();
this.label16 = new System.Windows.Forms.Label();
this.pasteoptions = new CodeImp.DoomBuilder.Controls.PasteOptionsControl();
this.autolaunchontest = new System.Windows.Forms.CheckBox();
groupBox1 = new System.Windows.Forms.GroupBox();
label7 = new System.Windows.Forms.Label();
label5 = new System.Windows.Forms.Label();
@ -259,6 +260,7 @@ namespace CodeImp.DoomBuilder.Windows
//
// groupBox1
//
groupBox1.Controls.Add(this.autolaunchontest);
groupBox1.Controls.Add(this.texturesizesbelow);
groupBox1.Controls.Add(this.blackbrowsers);
groupBox1.Controls.Add(this.checkforupdates);
@ -2375,6 +2377,16 @@ namespace CodeImp.DoomBuilder.Windows
this.pasteoptions.Size = new System.Drawing.Size(666, 427);
this.pasteoptions.TabIndex = 0;
//
// autolaunchontest
//
this.autolaunchontest.AutoSize = true;
this.autolaunchontest.Location = new System.Drawing.Point(16, 392);
this.autolaunchontest.Name = "autolaunchontest";
this.autolaunchontest.Size = new System.Drawing.Size(301, 17);
this.autolaunchontest.TabIndex = 50;
this.autolaunchontest.Text = "Automatically launch engine when test parameters change";
this.autolaunchontest.UseVisualStyleBackColor = true;
//
// PreferencesForm
//
this.AcceptButton = this.apply;
@ -2625,5 +2637,6 @@ namespace CodeImp.DoomBuilder.Windows
private CodeImp.DoomBuilder.Controls.ColorControl colorguidelines;
private System.Windows.Forms.CheckBox texturesizesbelow;
private System.Windows.Forms.CheckBox cbShowFPS;
private System.Windows.Forms.CheckBox autolaunchontest;
}
}

View file

@ -96,6 +96,7 @@ namespace CodeImp.DoomBuilder.Windows
showtexturesizes.Checked = General.Settings.ShowTextureSizes;
texturesizesbelow.Checked = General.Settings.TextureSizesBelow;
cbShowFPS.Checked = General.Settings.ShowFPS;
autolaunchontest.Checked = General.Settings.AutoLaunchOnTest;
//mxd
locatetexturegroup.Checked = General.Settings.LocateTextureGroup;
@ -333,6 +334,7 @@ namespace CodeImp.DoomBuilder.Windows
General.Settings.MaxRecentFiles = recentFiles.Value; //mxd
General.Settings.ScreenshotsPath = screenshotsfolderpath.Text.Trim(); //mxd
General.Settings.ShowFPS = cbShowFPS.Checked;
General.Settings.AutoLaunchOnTest = autolaunchontest.Checked;
// Script settings
General.Settings.ScriptFontBold = scriptfontbold.Checked;

View file

@ -141,6 +141,9 @@
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="scriptallmanstyle.ToolTip" xml:space="preserve">
<value>When enabled, the opening brace
will be placed on a new line when