mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 22:41:46 +00:00
Added option to enter additional parameters when testing a map. Resolves #646
This commit is contained in:
parent
9f85f70deb
commit
a5df323717
5 changed files with 48 additions and 5 deletions
|
@ -187,6 +187,9 @@
|
|||
<DependentUpon>ExternalCommandControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\FolderSelectDialog.cs" />
|
||||
<Compile Include="Controls\PlaceholderToolStripTextBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\Scripting\TextEditorControl.cs" />
|
||||
<Compile Include="Controls\TransparentTrackBar.cs">
|
||||
<SubType>Component</SubType>
|
||||
|
|
|
@ -92,6 +92,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
public bool TestShortPaths { get { return testEngines[currentEngineIndex].TestShortPaths; } internal set { testEngines[currentEngineIndex].TestShortPaths = value; } }
|
||||
public bool TestLinuxPaths { get { return testEngines[currentEngineIndex].TestLinuxPaths; } internal set { testEngines[currentEngineIndex].TestLinuxPaths = value; } }
|
||||
public int TestSkill { get { return testEngines[currentEngineIndex].TestSkill; } internal set { testEngines[currentEngineIndex].TestSkill = value; } }
|
||||
public string TestAdditionalParameters { get { return testEngines[currentEngineIndex].AdditionalParameters; } internal set { testEngines[currentEngineIndex].AdditionalParameters = value; } }
|
||||
public bool CustomParameters { get { return testEngines[currentEngineIndex].CustomParameters; } internal set { testEngines[currentEngineIndex].CustomParameters = value; } }
|
||||
public List<EngineInfo> TestEngines { get { return testEngines; } internal set { testEngines = value; } }
|
||||
public int CurrentEngineIndex { get { return currentEngineIndex; } internal set { currentEngineIndex = value; } }
|
||||
|
@ -143,6 +144,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
info.TestLinuxPaths = General.Settings.ReadSetting("configurations." + settingskey + ".testlinuxpaths", false);
|
||||
info.CustomParameters = General.Settings.ReadSetting("configurations." + settingskey + ".customparameters", false);
|
||||
info.TestSkill = General.Settings.ReadSetting("configurations." + settingskey + ".testskill", 3);
|
||||
info.AdditionalParameters = General.Settings.ReadSetting("configurations." + settingskey + ".additionalparameters", "");
|
||||
testEngines.Add(info);
|
||||
currentEngineIndex = 0;
|
||||
}
|
||||
|
@ -160,6 +162,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
info.TestLinuxPaths = General.Settings.ReadSetting(path + ".testlinuxpaths", false);
|
||||
info.CustomParameters = General.Settings.ReadSetting(path + ".customparameters", false);
|
||||
info.TestSkill = General.Settings.ReadSetting(path + ".testskill", 3);
|
||||
info.AdditionalParameters = General.Settings.ReadSetting(path + ".additionalparameters", "");
|
||||
testEngines.Add(info);
|
||||
}
|
||||
|
||||
|
@ -328,6 +331,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
rlinfo.Add("testlinuxpaths", testEngines[i].TestShortPaths);
|
||||
rlinfo.Add("customparameters", testEngines[i].CustomParameters);
|
||||
rlinfo.Add("testskill", testEngines[i].TestSkill);
|
||||
rlinfo.Add("additionalparameters", testEngines[i].AdditionalParameters);
|
||||
|
||||
// Add structure
|
||||
resinfo.Add("engine" + i.ToString(CultureInfo.InvariantCulture), rlinfo);
|
||||
|
|
|
@ -22,6 +22,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
private string testprogramname;
|
||||
private string testprogram;
|
||||
private Bitmap icon;
|
||||
private string additionalparameters;
|
||||
|
||||
public string TestParameters;
|
||||
public bool CustomParameters;
|
||||
public int TestSkill;
|
||||
|
@ -38,6 +40,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
public string TestProgramName { get { return testprogramname; } set { testprogramname = value; CheckProgramName(); } }
|
||||
public string TestProgram { get { return testprogram; } set { testprogram = value; CheckProgramName(); } }
|
||||
public Bitmap TestProgramIcon { get { if(icon == null) UpdateIcon(); return icon; } }
|
||||
public string AdditionalParameters { get { return additionalparameters; } internal set { additionalparameters = value; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -57,6 +60,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|||
TestSkill = other.TestSkill;
|
||||
TestShortPaths = other.TestShortPaths;
|
||||
TestLinuxPaths = other.TestLinuxPaths;
|
||||
additionalparameters = other.AdditionalParameters;
|
||||
|
||||
UpdateIcon();
|
||||
}
|
||||
|
|
|
@ -350,6 +350,10 @@ namespace CodeImp.DoomBuilder
|
|||
// Make arguments
|
||||
string args = ConvertParameters(General.Map.ConfigSettings.TestParameters, skill, General.Map.ConfigSettings.TestShortPaths, General.Map.ConfigSettings.TestLinuxPaths);
|
||||
|
||||
// Add additional parameters
|
||||
if (!string.IsNullOrWhiteSpace(General.Map.ConfigSettings.TestAdditionalParameters))
|
||||
args += " " + General.Map.ConfigSettings.TestAdditionalParameters;
|
||||
|
||||
// Setup process info
|
||||
ProcessStartInfo processinfo = new ProcessStartInfo();
|
||||
processinfo.Arguments = args;
|
||||
|
|
|
@ -1547,6 +1547,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// Map loaded?
|
||||
if (General.Map != null)
|
||||
{
|
||||
int maxwidth = 0;
|
||||
|
||||
// Make the new items list
|
||||
List<ToolStripItem> items = new List<ToolStripItem>(General.Map.Config.Skills.Count * 2 + General.Map.ConfigSettings.TestEngines.Count + 2);
|
||||
|
||||
|
@ -1559,9 +1561,13 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
menuitem.Tag = si.Index;
|
||||
menuitem.Checked = (General.Settings.TestMonsters && (General.Map.ConfigSettings.TestSkill == si.Index));
|
||||
items.Add(menuitem);
|
||||
|
||||
int width = (int)MeasureString(si.ToString(), menuitem.Font).Width;
|
||||
if (width > maxwidth)
|
||||
maxwidth = width;
|
||||
}
|
||||
|
||||
// Add seperator
|
||||
// Add separator
|
||||
items.Add(new ToolStripSeparator { Padding = new Padding(0, 3, 0, 3) });
|
||||
|
||||
// Negative skills are without monsters
|
||||
|
@ -1573,9 +1579,13 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
menuitem.Tag = -si.Index;
|
||||
menuitem.Checked = (!General.Settings.TestMonsters && (General.Map.ConfigSettings.TestSkill == si.Index));
|
||||
items.Add(menuitem);
|
||||
|
||||
int width = (int)MeasureString(si.ToString(), menuitem.Font).Width;
|
||||
if (width > maxwidth)
|
||||
maxwidth = width;
|
||||
}
|
||||
|
||||
//mxd. Add seperator
|
||||
//mxd. Add separator
|
||||
items.Add(new ToolStripSeparator { Padding = new Padding(0, 3, 0, 3) });
|
||||
|
||||
//mxd. Add test engines
|
||||
|
@ -1588,8 +1598,26 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
menuitem.Tag = i;
|
||||
menuitem.Checked = (i == General.Map.ConfigSettings.CurrentEngineIndex);
|
||||
items.Add(menuitem);
|
||||
|
||||
int width = (int)MeasureString(General.Map.ConfigSettings.TestEngines[i].TestProgramName, menuitem.Font).Width;
|
||||
if (width > maxwidth)
|
||||
maxwidth = width;
|
||||
}
|
||||
|
||||
// Add separator
|
||||
items.Add(new ToolStripSeparator { Padding = new Padding(0, 3, 0, 3) });
|
||||
|
||||
// Text box for additional parameters
|
||||
PlaceholderToolStripTextBox ptstb = new PlaceholderToolStripTextBox();
|
||||
ptstb.BorderStyle = BorderStyle.FixedSingle;
|
||||
ptstb.PlaceholderText = "Additional parameters";
|
||||
ptstb.AutoSize = false;
|
||||
ptstb.Width = maxwidth;
|
||||
ptstb.Text = General.Map.ConfigSettings.TestAdditionalParameters;
|
||||
ptstb.TextChanged += (sender, e) => { General.Map.ConfigSettings.TestAdditionalParameters = ptstb.Text; };
|
||||
ptstb.KeyDown += (sender, e) => { if(e.KeyCode == Keys.Enter) General.Map.Launcher.TestAtSkill(General.Map.ConfigSettings.TestSkill); };
|
||||
items.Add(ptstb);
|
||||
|
||||
// Add to list
|
||||
buttontest.DropDownItems.AddRange(items.ToArray());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue