Some progress on new path config
This commit is contained in:
parent
df24f996e9
commit
5f6f1e29b9
|
@ -13,12 +13,6 @@ namespace BizHawk.MultiClient
|
|||
config.NewControllerConfig.ConfigCheckAllControlDefaults(this);
|
||||
}
|
||||
|
||||
// Directories
|
||||
public bool UseRecentForROMs = false;
|
||||
public string LastRomPath = ".";
|
||||
public string BasePath = ".";
|
||||
public string BaseROMPath = ".";
|
||||
|
||||
public string BaseINTV = Path.Combine(".", "Intellivision");
|
||||
public string PathINTVROMs = ".";
|
||||
public string PathINTVSavestates = Path.Combine(".", "State");
|
||||
|
@ -156,6 +150,12 @@ namespace BizHawk.MultiClient
|
|||
public string LogPath = ".";
|
||||
public string FirmwaresPath = Path.Combine(".", "Firmware");
|
||||
|
||||
|
||||
//Path Settings ************************************/
|
||||
public bool UseRecentForROMs = false;
|
||||
public string LastRomPath = ".";
|
||||
public string BasePath = ".";
|
||||
public string BaseROMPath = ".";
|
||||
public PathEntryCollection PathEntries = new PathEntryCollection()
|
||||
{
|
||||
new PathEntry() { System = "Global", Type = "Movies", Path = Path.Combine(".", "Movies"), Ordinal = 0 },
|
||||
|
@ -293,6 +293,7 @@ namespace BizHawk.MultiClient
|
|||
new PathEntry() { System = "Saturn", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
|
||||
new PathEntry() { System = "Saturn", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
|
||||
};
|
||||
//END of Path Settings ************************************/
|
||||
|
||||
//BIOS Paths
|
||||
public Dictionary<string, string> FirmwareUserSpecifications = new Dictionary<string, string>(); //key: sysid+firmwareId; value: absolute path
|
||||
|
|
|
@ -32,6 +32,12 @@
|
|||
this.Cancel = new System.Windows.Forms.Button();
|
||||
this.PathTabControl = new System.Windows.Forms.TabControl();
|
||||
this.SaveBtn = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.RecentForROMs = new System.Windows.Forms.CheckBox();
|
||||
this.BasePathBox = new System.Windows.Forms.TextBox();
|
||||
this.BrowseBase = new System.Windows.Forms.Button();
|
||||
this.BaseDescription = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// OK
|
||||
|
@ -48,6 +54,7 @@
|
|||
// Cancel
|
||||
//
|
||||
this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.Cancel.Location = new System.Drawing.Point(512, 435);
|
||||
this.Cancel.Name = "Cancel";
|
||||
this.Cancel.Size = new System.Drawing.Size(75, 23);
|
||||
|
@ -62,6 +69,7 @@
|
|||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.PathTabControl.Location = new System.Drawing.Point(12, 84);
|
||||
this.PathTabControl.Multiline = true;
|
||||
this.PathTabControl.Name = "PathTabControl";
|
||||
this.PathTabControl.SelectedIndex = 0;
|
||||
this.PathTabControl.Size = new System.Drawing.Size(575, 345);
|
||||
|
@ -78,6 +86,66 @@
|
|||
this.SaveBtn.UseVisualStyleBackColor = true;
|
||||
this.SaveBtn.Click += new System.EventHandler(this.SaveBtn_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(490, 52);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(97, 13);
|
||||
this.label1.TabIndex = 210;
|
||||
this.label1.Text = "Special Commands";
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Image = global::BizHawk.MultiClient.Properties.Resources.Help;
|
||||
this.button1.Location = new System.Drawing.Point(456, 45);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(26, 23);
|
||||
this.button1.TabIndex = 209;
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// RecentForROMs
|
||||
//
|
||||
this.RecentForROMs.AutoSize = true;
|
||||
this.RecentForROMs.Location = new System.Drawing.Point(12, 51);
|
||||
this.RecentForROMs.Name = "RecentForROMs";
|
||||
this.RecentForROMs.Size = new System.Drawing.Size(184, 17);
|
||||
this.RecentForROMs.TabIndex = 207;
|
||||
this.RecentForROMs.Text = "Always use recent path for ROMs";
|
||||
this.RecentForROMs.UseVisualStyleBackColor = true;
|
||||
this.RecentForROMs.CheckedChanged += new System.EventHandler(this.RecentForROMs_CheckedChanged);
|
||||
//
|
||||
// BasePathBox
|
||||
//
|
||||
this.BasePathBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.BasePathBox.Location = new System.Drawing.Point(12, 15);
|
||||
this.BasePathBox.Name = "BasePathBox";
|
||||
this.BasePathBox.Size = new System.Drawing.Size(470, 20);
|
||||
this.BasePathBox.TabIndex = 205;
|
||||
//
|
||||
// BrowseBase
|
||||
//
|
||||
this.BrowseBase.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.BrowseBase.Image = global::BizHawk.MultiClient.Properties.Resources.OpenFile;
|
||||
this.BrowseBase.Location = new System.Drawing.Point(490, 14);
|
||||
this.BrowseBase.Name = "BrowseBase";
|
||||
this.BrowseBase.Size = new System.Drawing.Size(26, 23);
|
||||
this.BrowseBase.TabIndex = 206;
|
||||
this.BrowseBase.UseVisualStyleBackColor = true;
|
||||
this.BrowseBase.Click += new System.EventHandler(this.BrowseBase_Click);
|
||||
//
|
||||
// BaseDescription
|
||||
//
|
||||
this.BaseDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.BaseDescription.AutoSize = true;
|
||||
this.BaseDescription.Location = new System.Drawing.Point(523, 19);
|
||||
this.BaseDescription.Name = "BaseDescription";
|
||||
this.BaseDescription.Size = new System.Drawing.Size(64, 13);
|
||||
this.BaseDescription.TabIndex = 208;
|
||||
this.BaseDescription.Text = "Global Base";
|
||||
//
|
||||
// NewPathConfig
|
||||
//
|
||||
this.AcceptButton = this.OK;
|
||||
|
@ -85,6 +153,12 @@
|
|||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.Cancel;
|
||||
this.ClientSize = new System.Drawing.Size(599, 470);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.RecentForROMs);
|
||||
this.Controls.Add(this.BasePathBox);
|
||||
this.Controls.Add(this.BrowseBase);
|
||||
this.Controls.Add(this.BaseDescription);
|
||||
this.Controls.Add(this.SaveBtn);
|
||||
this.Controls.Add(this.PathTabControl);
|
||||
this.Controls.Add(this.Cancel);
|
||||
|
@ -94,6 +168,7 @@
|
|||
this.Text = "Path Configuration";
|
||||
this.Load += new System.EventHandler(this.NewPathConfig_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
|
@ -103,5 +178,11 @@
|
|||
private System.Windows.Forms.Button Cancel;
|
||||
private System.Windows.Forms.TabControl PathTabControl;
|
||||
private System.Windows.Forms.Button SaveBtn;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.CheckBox RecentForROMs;
|
||||
private System.Windows.Forms.TextBox BasePathBox;
|
||||
private System.Windows.Forms.Button BrowseBase;
|
||||
private System.Windows.Forms.Label BaseDescription;
|
||||
}
|
||||
}
|
|
@ -12,7 +12,6 @@ namespace BizHawk.MultiClient
|
|||
public partial class NewPathConfig : Form
|
||||
{
|
||||
//TODO:
|
||||
//System ID and preferred folder name do not match, needs new param
|
||||
//FInish config entries
|
||||
//Set tab focus based on system ID
|
||||
//Remaining GUI items
|
||||
|
@ -45,6 +44,53 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
|
||||
private void LoadSettings()
|
||||
{
|
||||
RecentForROMs.Checked = Global.Config.UseRecentForROMs;
|
||||
BasePathBox.Text = Global.Config.BasePath;
|
||||
DoTabs();
|
||||
SetDefaultFocusedTab();
|
||||
}
|
||||
|
||||
private void SetDefaultFocusedTab()
|
||||
{
|
||||
switch (Global.Game.System)
|
||||
{
|
||||
case "NULL":
|
||||
PathTabControl.SelectTab(FindTabByName("Global"));
|
||||
break;
|
||||
default:
|
||||
PathTabControl.SelectTab(FindTabByName(Global.Game.System));
|
||||
break;
|
||||
|
||||
//"Sub" Systems and other exceptions go here
|
||||
case "PCECD":
|
||||
case "SGX":
|
||||
PathTabControl.SelectTab(FindTabByName("PCE"));
|
||||
break;
|
||||
case "GBC":
|
||||
PathTabControl.SelectTab(FindTabByName("GB"));
|
||||
break;
|
||||
case "SGB":
|
||||
PathTabControl.SelectTab(FindTabByName("SNES"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private TabPage FindTabByName(string name)
|
||||
{
|
||||
IEnumerable<TabPage> query = from p in PathTabControl.TabPages.OfType<TabPage>() select p;
|
||||
var tab = query.FirstOrDefault(x => x.Name.ToUpper() == name.ToUpper());
|
||||
if (tab == null)
|
||||
{
|
||||
return new TabPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
return tab;
|
||||
}
|
||||
}
|
||||
|
||||
private void DoTabs()
|
||||
{
|
||||
//Separate by system
|
||||
List<string> systems = Global.Config.PathEntries.Select(x => x.System).Distinct().ToList();
|
||||
|
@ -53,11 +99,12 @@ namespace BizHawk.MultiClient
|
|||
|
||||
//TODO: fix anchoring
|
||||
//TODO: fix logic of when to pass in the system (global and base do not want this)
|
||||
foreach(string tab in systems)
|
||||
foreach (string tab in systems)
|
||||
{
|
||||
TabPage t = new TabPage()
|
||||
{
|
||||
Text = tab,
|
||||
Name = tab,
|
||||
};
|
||||
List<PathEntry> paths = Global.Config.PathEntries.Where(x => x.System == tab).OrderBy(x => x.Ordinal).ThenBy(x => x.Type).ToList();
|
||||
|
||||
|
@ -66,9 +113,9 @@ namespace BizHawk.MultiClient
|
|||
int textbox_width = 150;
|
||||
int padding = 10;
|
||||
int button_width = 26;
|
||||
foreach(var path in paths)
|
||||
foreach (var path in paths)
|
||||
{
|
||||
|
||||
|
||||
TextBox box = new TextBox()
|
||||
{
|
||||
Text = path.Path,
|
||||
|
@ -85,7 +132,8 @@ namespace BizHawk.MultiClient
|
|||
Width = button_width,
|
||||
//Anchor = AnchorStyles.Top | AnchorStyles.Right,
|
||||
};
|
||||
btn.Click += new System.EventHandler(delegate {
|
||||
btn.Click += new System.EventHandler(delegate
|
||||
{
|
||||
BrowseFolder(box, path.Type, path.System);
|
||||
});
|
||||
|
||||
|
@ -123,7 +171,33 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void SaveSettings()
|
||||
{
|
||||
Global.Config.UseRecentForROMs = RecentForROMs.Checked;
|
||||
Global.Config.BasePath = BasePathBox.Text;
|
||||
//TODO
|
||||
}
|
||||
|
||||
private void BrowseBase_Click(object sender, EventArgs e)
|
||||
{
|
||||
FolderBrowserEx f = new FolderBrowserEx
|
||||
{
|
||||
Description = "Set the directory for the base global path",
|
||||
SelectedPath = PathManager.MakeAbsolutePath(BasePathBox.Text)
|
||||
};
|
||||
DialogResult result = f.ShowDialog();
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
BasePathBox.Text = f.SelectedPath;
|
||||
}
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
new PathInfo().Show();
|
||||
}
|
||||
|
||||
private void RecentForROMs_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue