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 committed by spherallic
parent 94887efa9a
commit f9ad745d4e
5 changed files with 51 additions and 9 deletions

View file

@ -93,7 +93,8 @@ namespace CodeImp.DoomBuilder.Config
private MergeGeometryMode mergegeomode; //mxd
private bool splitjoinedsectors; //mxd
private bool usehighlight; //mxd
private bool switchviewmodes; //mxd
private bool switchviewmodes; //mxd\
private bool autolaunchontest;
//mxd. Script editor settings
private string scriptfontname;
@ -213,7 +214,8 @@ namespace CodeImp.DoomBuilder.Config
public bool KeepTextureFilterFocused { get { return keeptexturefilterfocused; } internal set { keeptexturefilterfocused = value; } } //mxd
public SplitLineBehavior SplitLineBehavior { get { return splitlinebehavior; } set { splitlinebehavior = value; } } //mxd
public MergeGeometryMode MergeGeometryMode { get { return mergegeomode; } internal set { mergegeomode = value; } } //mxd
public bool SplitJoinedSectors { get { return splitjoinedsectors; } internal set { splitjoinedsectors = value; } } //mxd
public bool SplitJoinedSectors { get { return splitjoinedsectors; } internal set { splitjoinedsectors = value; } } //mxd\
public bool AutoLaunchOnTest { get { return autolaunchontest; } internal set { autolaunchontest = value; } }
//mxd. Highlight mode
public bool UseHighlight
@ -372,7 +374,8 @@ namespace CodeImp.DoomBuilder.Config
mergegeomode = (MergeGeometryMode)General.Clamp(cfg.ReadSetting("mergegeometrymode", (int)MergeGeometryMode.REPLACE), 0, Enum.GetValues(typeof(MergeGeometryMode)).Length - 1); //mxd
splitjoinedsectors = cfg.ReadSetting("splitjoinedsectors", true); //mxd
usehighlight = cfg.ReadSetting("usehighlight", true); //mxd
switchviewmodes = cfg.ReadSetting("switchviewmodes", false); //mxd
switchviewmodes = cfg.ReadSetting("switchviewmodes", false); //mxd\
autolaunchontest = cfg.ReadSetting("autolaunchontest", false);
//mxd. Script editor
scriptfontname = cfg.ReadSetting("scriptfontname", "Courier New");
@ -496,7 +499,8 @@ namespace CodeImp.DoomBuilder.Config
cfg.WriteSetting("mergegeometrymode", (int)mergegeomode); //mxd
cfg.WriteSetting("splitjoinedsectors", splitjoinedsectors); //mxd
cfg.WriteSetting("usehighlight", usehighlight); //mxd
cfg.WriteSetting("switchviewmodes", switchviewmodes); //mxd
cfg.WriteSetting("switchviewmodes", switchviewmodes); //mxd\
cfg.WriteSetting("autolaunchontest", autolaunchontest);
//mxd. Script editor
cfg.WriteSetting("scriptfontname", scriptfontname);

View file

@ -602,6 +602,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();
@ -1531,7 +1534,10 @@ namespace CodeImp.DoomBuilder.Windows
{
General.Map.ConfigSettings.CurrentEngineIndex = (int)(((ToolStripMenuItem)sender).Tag);
General.Map.ConfigSettings.Changed = true;
General.Map.Launcher.TestAtSkill(General.Map.ConfigSettings.TestSkill);
if(General.Settings.AutoLaunchOnTest)
General.Map.Launcher.TestAtSkill(General.Map.ConfigSettings.TestSkill);
UpdateSkills();
}
@ -1541,7 +1547,10 @@ namespace CodeImp.DoomBuilder.Windows
int skill = (int)((sender as ToolStripMenuItem).Tag);
General.Settings.TestMonsters = (skill > 0);
General.Map.ConfigSettings.TestSkill = Math.Abs(skill);
General.Map.Launcher.TestAtSkill(Math.Abs(skill));
if(General.Settings.AutoLaunchOnTest)
General.Map.Launcher.TestAtSkill(Math.Abs(skill));
UpdateSkills();
}
@ -2218,7 +2227,20 @@ namespace CodeImp.DoomBuilder.Windows
buttontogglesky.Checked = General.Settings.GZDrawSky;
}
#endregion
/// <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

@ -231,6 +231,7 @@ namespace CodeImp.DoomBuilder.Windows
this.pasteoptions = new CodeImp.DoomBuilder.Controls.PasteOptionsControl();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.browseScreenshotsFolderDialog = new System.Windows.Forms.FolderBrowserDialog();
this.autolaunchontest = new System.Windows.Forms.CheckBox();
label7 = new System.Windows.Forms.Label();
label5 = new System.Windows.Forms.Label();
groupBox1 = new System.Windows.Forms.GroupBox();
@ -301,6 +302,7 @@ namespace CodeImp.DoomBuilder.Windows
//
// groupBox1
//
groupBox1.Controls.Add(this.autolaunchontest);
groupBox1.Controls.Add(this.keepfilterfocused);
groupBox1.Controls.Add(this.maxBackups);
groupBox1.Controls.Add(this.labelBackups);
@ -2640,6 +2642,16 @@ namespace CodeImp.DoomBuilder.Windows
//
this.browseScreenshotsFolderDialog.Description = "Select a Folder to Save Screenshots Into";
//
// 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;
@ -2910,5 +2922,6 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.Label label33;
private System.Windows.Forms.ComboBox textlabelfontsize;
private CodeImp.DoomBuilder.Controls.ColorControl colorguidelines;
private System.Windows.Forms.CheckBox autolaunchontest;
}
}

View file

@ -90,6 +90,7 @@ namespace CodeImp.DoomBuilder.Windows
toolbar_geometry.Checked = General.Settings.ToolbarGeometry;
toolbar_testing.Checked = General.Settings.ToolbarTesting;
showtexturesizes.Checked = General.Settings.ShowTextureSizes;
autolaunchontest.Checked = General.Settings.AutoLaunchOnTest;
//mxd
locatetexturegroup.Checked = General.Settings.LocateTextureGroup;
@ -342,8 +343,7 @@ namespace CodeImp.DoomBuilder.Windows
General.Settings.LocateTextureGroup = locatetexturegroup.Checked; //mxd
General.Settings.KeepTextureFilterFocused = keepfilterfocused.Checked; //mxd
General.Settings.MaxRecentFiles = recentFiles.Value; //mxd
General.Settings.MaxBackups = maxBackups.Value;
General.Settings.ScreenshotsPath = screenshotsfolderpath.Text.Trim(); //mxd
General.Settings.AutoLaunchOnTest = autolaunchontest.Checked;
// Script settings
General.Settings.ScriptFontBold = scriptfontbold.Checked;

View file

@ -150,6 +150,9 @@
<metadata name="label32.GenerateMember" type="System.Boolean, mscorlib, Version=2.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