Added test configuration option to use Linux paths, added different font for text labels (PR#268 by NickZ)

* Add Linux Path option to test config

* make shortpaths and linuxpaths mutually exclusive
This commit is contained in:
NickZ 2019-12-25 12:45:19 -05:00 committed by jewalky
parent 96f3b74647
commit 1aa020b2d0
9 changed files with 137 additions and 64 deletions

View file

@ -90,6 +90,7 @@ namespace CodeImp.DoomBuilder.Config
public string TestProgram { get { return testEngines[currentEngineIndex].TestProgram; } internal set { testEngines[currentEngineIndex].TestProgram = value; } }
public string TestParameters { get { return testEngines[currentEngineIndex].TestParameters; } internal set { testEngines[currentEngineIndex].TestParameters = value; } }
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 bool CustomParameters { get { return testEngines[currentEngineIndex].CustomParameters; } internal set { testEngines[currentEngineIndex].CustomParameters = value; } }
public List<EngineInfo> TestEngines { get { return testEngines; } internal set { testEngines = value; } }
@ -139,6 +140,7 @@ namespace CodeImp.DoomBuilder.Config
info.TestProgramName = General.Settings.ReadSetting("configurations." + settingskey + ".testprogramname", EngineInfo.DEFAULT_ENGINE_NAME);
info.TestParameters = General.Settings.ReadSetting("configurations." + settingskey + ".testparameters", "");
info.TestShortPaths = General.Settings.ReadSetting("configurations." + settingskey + ".testshortpaths", false);
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);
testEngines.Add(info);
@ -155,6 +157,7 @@ namespace CodeImp.DoomBuilder.Config
info.TestProgramName = General.Settings.ReadSetting(path + ".testprogramname", EngineInfo.DEFAULT_ENGINE_NAME);
info.TestParameters = General.Settings.ReadSetting(path + ".testparameters", "");
info.TestShortPaths = General.Settings.ReadSetting(path + ".testshortpaths", false);
info.TestLinuxPaths = General.Settings.ReadSetting(path + ".testlinuxpaths", false);
info.CustomParameters = General.Settings.ReadSetting(path + ".customparameters", false);
info.TestSkill = General.Settings.ReadSetting(path + ".testskill", 3);
testEngines.Add(info);
@ -317,6 +320,7 @@ namespace CodeImp.DoomBuilder.Config
rlinfo.Add("testprogram", testEngines[i].TestProgram);
rlinfo.Add("testparameters", testEngines[i].TestParameters);
rlinfo.Add("testshortpaths", testEngines[i].TestShortPaths);
rlinfo.Add("testlinuxpaths", testEngines[i].TestShortPaths);
rlinfo.Add("customparameters", testEngines[i].CustomParameters);
rlinfo.Add("testskill", testEngines[i].TestSkill);

View file

@ -66,6 +66,7 @@ namespace CodeImp.DoomBuilder.Config
private readonly int linedefactivationsfilter;
private readonly string testparameters;
private readonly bool testshortpaths;
private readonly bool testlinuxpaths;
private readonly string makedoortrack;
private readonly string makedoordoor; //mxd
private readonly string makedoorceil; //mxd
@ -204,6 +205,7 @@ namespace CodeImp.DoomBuilder.Config
public int LinedefActivationsFilter { get { return linedefactivationsfilter; } }
public string TestParameters { get { return testparameters; } }
public bool TestShortPaths { get { return testshortpaths; } }
public bool TestLinuxPaths { get; internal set; }
public string MakeDoorTrack { get { return makedoortrack; } }
public string MakeDoorDoor { get { return makedoordoor; } } //mxd
public string MakeDoorCeiling { get { return makedoorceil; } } //mxd
@ -385,6 +387,7 @@ namespace CodeImp.DoomBuilder.Config
linedefactivationsfilter = cfg.ReadSetting("linedefactivationsfilter", 0);
testparameters = cfg.ReadSetting("testparameters", "");
testshortpaths = cfg.ReadSetting("testshortpaths", false);
testlinuxpaths = cfg.ReadSetting("testlinuxpaths", false);
makedoortrack = cfg.ReadSetting("makedoortrack", "-");
makedoordoor = cfg.ReadSetting("makedoordoor", "-"); //mxd
makedoorceil = cfg.ReadSetting("makedoorceil", "-"); //mxd

View file

@ -363,7 +363,7 @@ namespace CodeImp.DoomBuilder.Config
scriptautoshowautocompletion = cfg.ReadSetting("scriptautoshowautocompletion", true);
//mxd. Text labels
textlabelfontname = cfg.ReadSetting("textlabelfontname", "Microsoft Sans Serif");
textlabelfontname = cfg.ReadSetting("textlabelfontname", "Arial");
textlabelfontsize = cfg.ReadSetting("textlabelfontsize", 10);
textlabelfontbold = cfg.ReadSetting("textlabelfontbold", false);

View file

@ -26,6 +26,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
public bool CustomParameters;
public int TestSkill;
public bool TestShortPaths;
public bool TestLinuxPaths;
// Disposing
private bool isdisposed;
@ -55,6 +56,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
CustomParameters = other.CustomParameters;
TestSkill = other.TestSkill;
TestShortPaths = other.TestShortPaths;
TestLinuxPaths = other.TestLinuxPaths;
UpdateIcon();
}

View file

@ -2060,6 +2060,23 @@ namespace CodeImp.DoomBuilder
#endif
}
public static string GetLinuxFilePath(string longpath)
{
string linuxpath;
linuxpath = longpath.Replace('\\', '/');
string wineprefix = Environment.GetEnvironmentVariable("WINEPREFIX");
if (linuxpath.Substring(0, 2) == "C:")
{
linuxpath = wineprefix + "/drive_c" + linuxpath.Substring(2);
}
else if (linuxpath.Substring(0,2) == "Z:")
{
linuxpath = linuxpath.Substring(2);
}
return linuxpath;
}
//mxd
internal static ScriptConfiguration GetScriptConfiguration(ScriptType type)
{

View file

@ -112,7 +112,7 @@ namespace CodeImp.DoomBuilder
// This takes the unconverted parameters (with placeholders) and converts it
// to parameters with full paths, names and numbers where placeholders were put.
// The tempfile must be the full path and filename to the PWAD file to test.
public string ConvertParameters(string parameters, int skill, bool shortpaths)
public string ConvertParameters(string parameters, int skill, bool shortpaths, bool linuxpaths)
{
string outp = parameters;
DataLocation iwadloc;
@ -124,7 +124,7 @@ namespace CodeImp.DoomBuilder
// Make short path if needed
if(shortpaths) f = General.GetShortFilePath(f);
else if (linuxpaths) f = General.GetLinuxFilePath(f);
// Find the first IWAD file
if(General.Map.Data.FindFirstIWAD(out iwadloc))
{
@ -136,6 +136,11 @@ namespace CodeImp.DoomBuilder
p_wp = General.GetShortFilePath(p_wp);
p_wf = General.GetShortFilePath(p_wf);
}
else if (linuxpaths)
{
p_wp = General.GetLinuxFilePath(p_wp);
p_wf = General.GetLinuxFilePath(p_wf);
}
}
// Make a list of all data locations, including map location
@ -164,6 +169,11 @@ namespace CodeImp.DoomBuilder
p_ap += General.GetShortFilePath(dl.location) + " ";
p_apq += "\"" + General.GetShortFilePath(dl.location) + "\" ";
}
else if (linuxpaths)
{
p_ap += General.GetLinuxFilePath(dl.location) + " ";
p_apq += "\"" + General.GetLinuxFilePath(dl.location) + "\" ";
}
else
{
p_ap += dl.location + " ";
@ -301,6 +311,7 @@ namespace CodeImp.DoomBuilder
// Set parameters to the default ones
General.Map.ConfigSettings.TestParameters = General.Map.Config.TestParameters;
General.Map.ConfigSettings.TestShortPaths = General.Map.Config.TestShortPaths;
General.Map.ConfigSettings.TestLinuxPaths = General.Map.Config.TestLinuxPaths;
}
// Remove temporary file
@ -320,7 +331,7 @@ namespace CodeImp.DoomBuilder
if(General.Map.Errors.Count == 0)
{
// Make arguments
string args = ConvertParameters(General.Map.ConfigSettings.TestParameters, skill, General.Map.ConfigSettings.TestShortPaths);
string args = ConvertParameters(General.Map.ConfigSettings.TestParameters, skill, General.Map.ConfigSettings.TestShortPaths, General.Map.ConfigSettings.TestLinuxPaths);
// Setup process info
ProcessStartInfo processinfo = new ProcessStartInfo();

View file

@ -40,6 +40,7 @@ namespace CodeImp.DoomBuilder.Windows
System.Windows.Forms.Label label8;
System.Windows.Forms.Label label4;
System.Windows.Forms.Label label10;
this.linuxpaths = new System.Windows.Forms.CheckBox();
this.labelparameters = new System.Windows.Forms.Label();
this.cancel = new System.Windows.Forms.Button();
this.apply = new System.Windows.Forms.Button();
@ -76,10 +77,10 @@ namespace CodeImp.DoomBuilder.Windows
this.startmode = new System.Windows.Forms.ComboBox();
this.label11 = new System.Windows.Forms.Label();
this.listmodes = new System.Windows.Forms.ListView();
this.colmodename = new System.Windows.Forms.ColumnHeader();
this.colmodeplugin = new System.Windows.Forms.ColumnHeader();
this.colmodename = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colmodeplugin = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.listconfigs = new System.Windows.Forms.ListView();
this.columnname = new System.Windows.Forms.ColumnHeader();
this.columnname = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.copypastemenu = new System.Windows.Forms.ContextMenuStrip(this.components);
this.copyall = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
@ -217,6 +218,18 @@ namespace CodeImp.DoomBuilder.Windows
label10.TabIndex = 25;
label10.Text = resources.GetString("label10.Text");
//
// linuxpaths
//
this.linuxpaths.AutoSize = true;
this.linuxpaths.Location = new System.Drawing.Point(375, 217);
this.linuxpaths.Name = "linuxpaths";
this.linuxpaths.Size = new System.Drawing.Size(102, 17);
this.linuxpaths.TabIndex = 41;
this.linuxpaths.Text = "Use Linux paths";
this.linuxpaths.UseVisualStyleBackColor = true;
this.linuxpaths.Visible = false;
this.linuxpaths.CheckedChanged += new System.EventHandler(this.Linuxpaths_CheckedChanged);
//
// labelparameters
//
this.labelparameters.AutoSize = true;
@ -339,6 +352,7 @@ namespace CodeImp.DoomBuilder.Windows
//
// tabtesting
//
this.tabtesting.Controls.Add(this.linuxpaths);
this.tabtesting.Controls.Add(this.btnRemoveEngine);
this.tabtesting.Controls.Add(this.btnNewEngine);
this.tabtesting.Controls.Add(this.cbEngineSelector);
@ -394,8 +408,8 @@ namespace CodeImp.DoomBuilder.Windows
this.cbEngineSelector.Name = "cbEngineSelector";
this.cbEngineSelector.Size = new System.Drawing.Size(340, 21);
this.cbEngineSelector.TabIndex = 38;
this.cbEngineSelector.SelectedIndexChanged += new System.EventHandler(this.cbEngineSelector_SelectedIndexChanged);
this.cbEngineSelector.DropDown += new System.EventHandler(this.cbEngineSelector_DropDown);
this.cbEngineSelector.SelectedIndexChanged += new System.EventHandler(this.cbEngineSelector_SelectedIndexChanged);
//
// label13
//
@ -708,8 +722,8 @@ namespace CodeImp.DoomBuilder.Windows
this.listconfigs.TabIndex = 0;
this.listconfigs.UseCompatibleStateImageBehavior = false;
this.listconfigs.View = System.Windows.Forms.View.Details;
this.listconfigs.MouseUp += new System.Windows.Forms.MouseEventHandler(this.listconfigs_MouseUp);
this.listconfigs.KeyUp += new System.Windows.Forms.KeyEventHandler(this.listconfigs_KeyUp);
this.listconfigs.MouseUp += new System.Windows.Forms.MouseEventHandler(this.listconfigs_MouseUp);
//
// columnname
//
@ -903,5 +917,6 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.Label hintlabel;
private System.Windows.Forms.PictureBox hint;
private System.Windows.Forms.ToolTip tooltip;
private System.Windows.Forms.CheckBox linuxpaths;
}
}

View file

@ -239,6 +239,7 @@ namespace CodeImp.DoomBuilder.Windows
testapplication.Text = "";
testparameters.Text = "";
shortpaths.Checked = false;
linuxpaths.Checked = false;
skill.Value = 0;
skill.ClearInfo();
customparameters.Checked = false;
@ -352,7 +353,7 @@ namespace CodeImp.DoomBuilder.Windows
if(General.Map != null)
{
// Make converted parameters
testresult.Text = General.Map.Launcher.ConvertParameters(testparameters.Text, skill.Value, shortpaths.Checked);
testresult.Text = General.Map.Launcher.ConvertParameters(testparameters.Text, skill.Value, shortpaths.Checked, linuxpaths.Checked);
}
}
@ -449,6 +450,7 @@ namespace CodeImp.DoomBuilder.Windows
labelparameters.Visible = customparameters.Checked;
testparameters.Visible = customparameters.Checked;
shortpaths.Visible = customparameters.Checked;
linuxpaths.Visible = customparameters.Checked;
// Check if a map is loaded
if(General.Map != null)
@ -472,14 +474,31 @@ namespace CodeImp.DoomBuilder.Windows
{
// Leave when no configuration selected
if(configinfo == null) return;
if (linuxpaths.Checked && shortpaths.Checked)
{
linuxpaths.Checked = false;
}
// Apply to selected configuration
configinfo.TestShortPaths = shortpaths.Checked;
configinfo.Changed = true; //mxd
CreateParametersExample();
}
private void Linuxpaths_CheckedChanged(object sender, EventArgs e)
{
// Leave when no configuration selected
if (configinfo == null) return;
if (linuxpaths.Checked && shortpaths.Checked)
{
shortpaths.Checked = false;
}
// Apply to selected configuration
configinfo.TestLinuxPaths = linuxpaths.Checked;
configinfo.Changed = true; //mxd
CreateParametersExample();
}
// Skill changes
private void skill_ValueChanges(object sender, EventArgs e)
{
@ -778,12 +797,14 @@ namespace CodeImp.DoomBuilder.Windows
{
configinfo.TestParameters = gameconfig.TestParameters;
configinfo.TestShortPaths = gameconfig.TestShortPaths;
configinfo.TestLinuxPaths = gameconfig.TestLinuxPaths;
}
configinfo.TestProgramName = cbEngineSelector.Text;
testapplication.Text = configinfo.TestProgram;
testparameters.Text = configinfo.TestParameters;
shortpaths.Checked = configinfo.TestShortPaths;
linuxpaths.Checked = configinfo.TestLinuxPaths;
int skilllevel = configinfo.TestSkill;
skill.Value = skilllevel - 1; //mxd. WHY???

View file

@ -117,39 +117,39 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="label5.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label6.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="label5.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label6.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="label6.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label3.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="label3.Text" xml:space="preserve">
<value>The nodebuilder is a compiler which builds geometry structures for your map. You need these structures to be able to play the map in the game. For each purpose you can choose the desired nodebuilder configuration here.</value>
</data>
<metadata name="label2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label7.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="label2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label7.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label7.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label9.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
@ -159,18 +159,18 @@
<metadata name="label8.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label4.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label4.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label10.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="label4.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label10.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label10.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="label10.Text" xml:space="preserve">
<value>Here you can select the editing modes that you wish to use in this configuration. This is useful in case there are plugins with additional editing modes that can be used as a replacement for the original editing modes.</value>
</data>
@ -214,10 +214,10 @@
</metadata>
<data name="smallimages.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAA4
CAAAAk1TRnQBSQFMAwEBAAHUAQEB1AEBARMBAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
CAAAAk1TRnQBSQFMAwEBAAH0AQEB9AEBARMBAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
AUwDAAEQAwABAQEAAQgFAAHAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA