New Path config - add Firmware button to systems that have firmwares that will open the firmware dialog directly to the given system

This commit is contained in:
adelikat 2013-08-11 19:05:05 +00:00
parent 00d370db23
commit b0880eb4c0
3 changed files with 47 additions and 15 deletions

View File

@ -26,7 +26,7 @@ namespace BizHawk.MultiClient
public partial class FirmwaresConfig : Form public partial class FirmwaresConfig : Form
{ {
//friendlier names than the system Ids //friendlier names than the system Ids
static readonly Dictionary<string, string> systemGroupNames = new Dictionary<string, string>() public static readonly Dictionary<string, string> SystemGroupNames = new Dictionary<string, string>()
{ {
{ "NES", "NES" }, { "NES", "NES" },
{ "SNES", "SNES" }, { "SNES", "SNES" },
@ -40,7 +40,7 @@ namespace BizHawk.MultiClient
{ "C64", "C64" }, { "C64", "C64" },
}; };
public string TargetSystem = null;
private const int idUnsure = 0; private const int idUnsure = 0;
private const int idMissing = 1; private const int idMissing = 1;
@ -82,7 +82,7 @@ namespace BizHawk.MultiClient
} }
//makes sure that the specified SystemId is selected in the list (and that all the firmwares for it are visible) //makes sure that the specified SystemId is selected in the list (and that all the firmwares for it are visible)
public void WarpToSystemId(string sysid) private void WarpToSystemId(string sysid)
{ {
bool selectedFirst = false; bool selectedFirst = false;
foreach (ListViewItem lvi in lvFirmwares.Items) foreach (ListViewItem lvi in lvFirmwares.Items)
@ -123,7 +123,7 @@ namespace BizHawk.MultiClient
//build the groups in the listview as we go: //build the groups in the listview as we go:
if (!groups.ContainsKey(fr.systemId)) if (!groups.ContainsKey(fr.systemId))
{ {
lvFirmwares.Groups.Add(fr.systemId, systemGroupNames[fr.systemId]); lvFirmwares.Groups.Add(fr.systemId, SystemGroupNames[fr.systemId]);
var lvg = lvFirmwares.Groups[lvFirmwares.Groups.Count - 1]; var lvg = lvFirmwares.Groups[lvFirmwares.Groups.Count - 1];
groups[fr.systemId] = lvg; groups[fr.systemId] = lvg;
} }
@ -135,6 +135,11 @@ namespace BizHawk.MultiClient
lvFirmwares.AutoResizeColumn(2, ColumnHeaderAutoResizeStyle.ColumnContent); lvFirmwares.AutoResizeColumn(2, ColumnHeaderAutoResizeStyle.ColumnContent);
lvFirmwares.AutoResizeColumn(3, ColumnHeaderAutoResizeStyle.ColumnContent); lvFirmwares.AutoResizeColumn(3, ColumnHeaderAutoResizeStyle.ColumnContent);
if (TargetSystem != null)
{
WarpToSystemId(TargetSystem);
}
DoScan(); DoScan();
} }

View File

@ -43,7 +43,7 @@
// OK // OK
// //
this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OK.Location = new System.Drawing.Point(450, 387); this.OK.Location = new System.Drawing.Point(450, 411);
this.OK.Name = "OK"; this.OK.Name = "OK";
this.OK.Size = new System.Drawing.Size(75, 23); this.OK.Size = new System.Drawing.Size(75, 23);
this.OK.TabIndex = 0; this.OK.TabIndex = 0;
@ -55,7 +55,7 @@
// //
this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 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.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Cancel.Location = new System.Drawing.Point(531, 387); this.Cancel.Location = new System.Drawing.Point(531, 411);
this.Cancel.Name = "Cancel"; this.Cancel.Name = "Cancel";
this.Cancel.Size = new System.Drawing.Size(75, 23); this.Cancel.Size = new System.Drawing.Size(75, 23);
this.Cancel.TabIndex = 1; this.Cancel.TabIndex = 1;
@ -72,13 +72,13 @@
this.PathTabControl.Multiline = true; this.PathTabControl.Multiline = true;
this.PathTabControl.Name = "PathTabControl"; this.PathTabControl.Name = "PathTabControl";
this.PathTabControl.SelectedIndex = 0; this.PathTabControl.SelectedIndex = 0;
this.PathTabControl.Size = new System.Drawing.Size(594, 297); this.PathTabControl.Size = new System.Drawing.Size(594, 321);
this.PathTabControl.TabIndex = 2; this.PathTabControl.TabIndex = 2;
// //
// SaveBtn // SaveBtn
// //
this.SaveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.SaveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.SaveBtn.Location = new System.Drawing.Point(12, 387); this.SaveBtn.Location = new System.Drawing.Point(12, 411);
this.SaveBtn.Name = "SaveBtn"; this.SaveBtn.Name = "SaveBtn";
this.SaveBtn.Size = new System.Drawing.Size(75, 23); this.SaveBtn.Size = new System.Drawing.Size(75, 23);
this.SaveBtn.TabIndex = 3; this.SaveBtn.TabIndex = 3;
@ -154,7 +154,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.Cancel; this.CancelButton = this.Cancel;
this.ClientSize = new System.Drawing.Size(618, 422); this.ClientSize = new System.Drawing.Size(618, 446);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.Controls.Add(this.RecentForROMs); this.Controls.Add(this.RecentForROMs);

View File

@ -98,15 +98,14 @@ namespace BizHawk.MultiClient
systems.Remove(global); systems.Remove(global);
systems.Insert(0, global); systems.Insert(0, global);
//TODO: fix anchoring foreach (string systemId in systems)
foreach (string tab in systems)
{ {
TabPage t = new TabPage() TabPage t = new TabPage()
{ {
Text = tab, Text = systemId,
Name = tab, Name = systemId,
}; };
List<PathEntry> paths = Global.Config.PathEntries.Where(x => x.System == tab).OrderBy(x => x.Ordinal).ThenBy(x => x.Type).ToList(); List<PathEntry> paths = Global.Config.PathEntries.Where(x => x.System == systemId).OrderBy(x => x.Ordinal).ThenBy(x => x.Type).ToList();
int _x = 6; int _x = 6;
int _y = 14; int _y = 14;
@ -114,6 +113,7 @@ namespace BizHawk.MultiClient
int padding = 5; int padding = 5;
int button_width = 26; int button_width = 26;
int widget_offset = 85; int widget_offset = 85;
int row_height = 30;
foreach (var path in paths) foreach (var path in paths)
{ {
@ -154,7 +154,34 @@ namespace BizHawk.MultiClient
t.Controls.Add(btn); t.Controls.Add(btn);
t.Controls.Add(box); t.Controls.Add(box);
_y += 30; _y += row_height;
}
string sys = systemId;
if (systemId == "PCE") //Hack
{
sys = "PCECD";
}
bool hasFirmwares = FirmwaresConfig.SystemGroupNames.Any(x => x.Key == sys);
if (hasFirmwares)
{
Button firmwareButton = new Button()
{
Name = sys,
Text = "&Firmware",
Location = new Point(_x, _y),
Width = 75,
};
firmwareButton.Click += new System.EventHandler(delegate
{
FirmwaresConfig f = new FirmwaresConfig();
f.TargetSystem = sys;
f.ShowDialog();
});
t.Controls.Add(firmwareButton);
} }
PathTabControl.TabPages.Add(t); PathTabControl.TabPages.Add(t);