diff --git a/BizHawk.Client.Common/config/PathEntry.cs b/BizHawk.Client.Common/config/PathEntry.cs index 4e3b4e127a..4dcb34aacc 100644 --- a/BizHawk.Client.Common/config/PathEntry.cs +++ b/BizHawk.Client.Common/config/PathEntry.cs @@ -149,16 +149,16 @@ namespace BizHawk.Client.Common new PathEntry { System = "NES", SystemDisplayName="NES", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, new PathEntry { System = "NES", SystemDisplayName="NES", Type = "Palettes", Path = Path.Combine(".", "Palettes"), Ordinal = 6 }, - new PathEntry { System = "SNES_SGB", SystemDisplayName="SNES", Type = "Base", Path= Path.Combine(".", "SNES"), Ordinal = 0 }, + new PathEntry { System = "SNES_SGB", SystemDisplayName="SNES", Type = "Base", Path = Path.Combine(".", "SNES"), Ordinal = 0 }, new PathEntry { System = "SNES_SGB", SystemDisplayName="SNES", Type = "ROM", Path = ".", Ordinal = 1 }, new PathEntry { System = "SNES_SGB", SystemDisplayName="SNES", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, new PathEntry { System = "SNES_SGB", SystemDisplayName="SNES", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, new PathEntry { System = "SNES_SGB", SystemDisplayName="SNES", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, new PathEntry { System = "SNES_SGB", SystemDisplayName="SNES", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - new PathEntry { System = "GBA", SystemDisplayName="GBA", Type = "Base", Path= Path.Combine(".", "GBA"), Ordinal = 0 }, + new PathEntry { System = "GBA", SystemDisplayName="GBA", Type = "Base", Path = Path.Combine(".", "GBA"), Ordinal = 0 }, new PathEntry { System = "GBA", SystemDisplayName="GBA", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry { System = "GBA", SystemDisplayName="GBA", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, + new PathEntry { System = "GBA", SystemDisplayName="GBA", Type = "Savestates", Path = Path.Combine(".", "State"), Ordinal = 2 }, new PathEntry { System = "GBA", SystemDisplayName="GBA", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, new PathEntry { System = "GBA", SystemDisplayName="GBA", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, new PathEntry { System = "GBA", SystemDisplayName="GBA", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, @@ -170,28 +170,28 @@ namespace BizHawk.Client.Common new PathEntry { System = "SMS", SystemDisplayName="SMS", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, new PathEntry { System = "SMS", SystemDisplayName="SMS", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - new PathEntry { System = "GG", SystemDisplayName="GG", Type = "Base", Path= Path.Combine(".", "Game Gear"), Ordinal = 0 }, + new PathEntry { System = "GG", SystemDisplayName="GG", Type = "Base", Path = Path.Combine(".", "Game Gear"), Ordinal = 0 }, new PathEntry { System = "GG", SystemDisplayName="GG", Type = "ROM", Path = ".", Ordinal = 1 }, new PathEntry { System = "GG", SystemDisplayName="GG", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, new PathEntry { System = "GG", SystemDisplayName="GG", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, new PathEntry { System = "GG", SystemDisplayName="GG", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, new PathEntry { System = "GG", SystemDisplayName="GG", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - new PathEntry { System = "SG", SystemDisplayName="SG", Type = "Base", Path= Path.Combine(".", "SG-1000"), Ordinal = 0 }, + new PathEntry { System = "SG", SystemDisplayName="SG", Type = "Base", Path = Path.Combine(".", "SG-1000"), Ordinal = 0 }, new PathEntry { System = "SG", SystemDisplayName="SG", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry { System = "SG", SystemDisplayName="SG", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, + new PathEntry { System = "SG", SystemDisplayName="SG", Type = "Savestates", Path = Path.Combine(".", "State"), Ordinal = 2 }, new PathEntry { System = "SG", SystemDisplayName="SG", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, new PathEntry { System = "SG", SystemDisplayName="SG", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, new PathEntry { System = "SG", SystemDisplayName="SG", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - new PathEntry { System = "GEN", SystemDisplayName="Genesis", Type = "Base", Path= Path.Combine(".", "Genesis"), Ordinal = 0 }, + new PathEntry { System = "GEN", SystemDisplayName="Genesis", Type = "Base", Path = Path.Combine(".", "Genesis"), Ordinal = 0 }, new PathEntry { System = "GEN", SystemDisplayName="Genesis", Type = "ROM", Path = ".", Ordinal = 1 }, new PathEntry { System = "GEN", SystemDisplayName="Genesis", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, new PathEntry { System = "GEN", SystemDisplayName="Genesis", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, new PathEntry { System = "GEN", SystemDisplayName="Genesis", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, new PathEntry { System = "GEN", SystemDisplayName="Genesis", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - new PathEntry { System = "PCE_PCECD_SGX", SystemDisplayName="PC Engine", Type = "Base", Path= Path.Combine(".", "PC Engine"), Ordinal = 0 }, + new PathEntry { System = "PCE_PCECD_SGX", SystemDisplayName="PC Engine", Type = "Base", Path = Path.Combine(".", "PC Engine"), Ordinal = 0 }, new PathEntry { System = "PCE_PCECD_SGX", SystemDisplayName="PC Engine", Type = "ROM", Path = ".", Ordinal = 1 }, new PathEntry { System = "PCE_PCECD_SGX", SystemDisplayName="PC Engine", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, new PathEntry { System = "PCE_PCECD_SGX", SystemDisplayName="PC Engine", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, @@ -214,40 +214,40 @@ namespace BizHawk.Client.Common new PathEntry { System = "DGB", SystemDisplayName="Dual Gameboy", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, new PathEntry { System = "DGB", SystemDisplayName="Dual Gameboy", Type = "Palettes", Path = Path.Combine(".", "Palettes"), Ordinal = 6 }, - new PathEntry { System = "TI83", SystemDisplayName="TI83", Type = "Base", Path= Path.Combine(".", "TI83"), Ordinal = 0 }, + new PathEntry { System = "TI83", SystemDisplayName="TI83", Type = "Base", Path = Path.Combine(".", "TI83"), Ordinal = 0 }, new PathEntry { System = "TI83", SystemDisplayName="TI83", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry { System = "TI83", SystemDisplayName="TI83", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, + new PathEntry { System = "TI83", SystemDisplayName="TI83", Type = "Savestates", Path = Path.Combine(".", "State"), Ordinal = 2 }, new PathEntry { System = "TI83", SystemDisplayName="TI83", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, new PathEntry { System = "TI83", SystemDisplayName="TI83", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, new PathEntry { System = "TI83", SystemDisplayName="TI83", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - new PathEntry { System = "A26", SystemDisplayName="Atari 2600", Type = "Base", Path= Path.Combine(".", "Atari 2600"), Ordinal = 0 }, + new PathEntry { System = "A26", SystemDisplayName="Atari 2600", Type = "Base", Path = Path.Combine(".", "Atari 2600"), Ordinal = 0 }, new PathEntry { System = "A26", SystemDisplayName="Atari 2600", Type = "ROM", Path = ".", Ordinal = 1 }, new PathEntry { System = "A26", SystemDisplayName="Atari 2600", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, new PathEntry { System = "A26", SystemDisplayName="Atari 2600", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, new PathEntry { System = "A26", SystemDisplayName="Atari 2600", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - new PathEntry { System = "A78", SystemDisplayName="Atari 7800", Type = "Base", Path= Path.Combine(".", "Atari 7800"), Ordinal = 0 }, + new PathEntry { System = "A78", SystemDisplayName="Atari 7800", Type = "Base", Path = Path.Combine(".", "Atari 7800"), Ordinal = 0 }, new PathEntry { System = "A78", SystemDisplayName="Atari 7800", Type = "ROM", Path = ".", Ordinal = 1 }, new PathEntry { System = "A78", SystemDisplayName="Atari 7800", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, new PathEntry { System = "A78", SystemDisplayName="Atari 7800", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, new PathEntry { System = "A78", SystemDisplayName="Atari 7800", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, new PathEntry { System = "A78", SystemDisplayName="Atari 7800", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - new PathEntry { System = "C64", SystemDisplayName="Commodore 64", Type = "Base", Path= Path.Combine(".", "C64"), Ordinal = 0 }, + new PathEntry { System = "C64", SystemDisplayName="Commodore 64", Type = "Base", Path = Path.Combine(".", "C64"), Ordinal = 0 }, new PathEntry { System = "C64", SystemDisplayName="Commodore 64", Type = "ROM", Path = ".", Ordinal = 1 }, new PathEntry { System = "C64", SystemDisplayName="Commodore 64", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, new PathEntry { System = "C64", SystemDisplayName="Commodore 64", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, new PathEntry { System = "C64", SystemDisplayName="Commodore 64", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - new PathEntry { System = "PSX", SystemDisplayName="Playstation", Type = "Base", Path= Path.Combine(".", "PSX"), Ordinal = 0 }, + new PathEntry { System = "PSX", SystemDisplayName="Playstation", Type = "Base", Path = Path.Combine(".", "PSX"), Ordinal = 0 }, new PathEntry { System = "PSX", SystemDisplayName="Playstation", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry { System = "PSX", SystemDisplayName="Playstation", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, + new PathEntry { System = "PSX", SystemDisplayName="Playstation", Type = "Savestates", Path = Path.Combine(".", "State"), Ordinal = 2 }, new PathEntry { System = "PSX", SystemDisplayName="Playstation", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, new PathEntry { System = "PSX", SystemDisplayName="Playstation", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, new PathEntry { System = "PSX", SystemDisplayName="Playstation", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - new PathEntry { System = "Coleco", SystemDisplayName = "Coleco", Type = "Base", Path= Path.Combine(".", "Coleco"), Ordinal = 0 }, + new PathEntry { System = "Coleco", SystemDisplayName = "Coleco", Type = "Base", Path = Path.Combine(".", "Coleco"), Ordinal = 0 }, new PathEntry { System = "Coleco", SystemDisplayName = "Coleco", Type = "ROM", Path = ".", Ordinal = 1 }, new PathEntry { System = "Coleco", SystemDisplayName = "Coleco", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, new PathEntry { System = "Coleco", SystemDisplayName = "Coleco", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, @@ -260,19 +260,12 @@ namespace BizHawk.Client.Common new PathEntry { System = "N64", SystemDisplayName = "N64", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, new PathEntry { System = "N64", SystemDisplayName = "N64", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - new PathEntry { System = "SAT", SystemDisplayName = "Saturn", Type = "Base", Path= Path.Combine(".", "Saturn"), Ordinal = 0 }, + new PathEntry { System = "SAT", SystemDisplayName = "Saturn", Type = "Base", Path = Path.Combine(".", "Saturn"), Ordinal = 0 }, new PathEntry { System = "SAT", SystemDisplayName = "Saturn", Type = "ROM", Path = ".", Ordinal = 1 }, new PathEntry { System = "SAT", SystemDisplayName = "Saturn", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, new PathEntry { System = "SAT", SystemDisplayName = "Saturn", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, new PathEntry { System = "SAT", SystemDisplayName = "Saturn", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, new PathEntry { System = "SAT", SystemDisplayName = "Saturn", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, - - new PathEntry { System = "DEBUG", SystemDisplayName = "DEBUG", Type = "Base", Path= Path.Combine(".", "Saturn"), Ordinal = 0 }, - new PathEntry { System = "DEBUG", SystemDisplayName = "DEBUG", Type = "ROM", Path = ".", Ordinal = 1 }, - new PathEntry { System = "DEBUG", SystemDisplayName = "DEBUG", Type = "Savestates", Path= Path.Combine(".", "State"), Ordinal = 2 }, - new PathEntry { System = "DEBUG", SystemDisplayName = "DEBUG", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 }, - new PathEntry { System = "DEBUG", SystemDisplayName = "DEBUG", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 }, - new PathEntry { System = "DEBUG", SystemDisplayName = "DEBUG", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 }, }; } } diff --git a/BizHawk.Client.EmuHawk/config/PathConfig.Designer.cs b/BizHawk.Client.EmuHawk/config/PathConfig.Designer.cs index e9122a643d..e7b9267eda 100644 --- a/BizHawk.Client.EmuHawk/config/PathConfig.Designer.cs +++ b/BizHawk.Client.EmuHawk/config/PathConfig.Designer.cs @@ -28,12 +28,12 @@ /// private void InitializeComponent() { - this.OK = new System.Windows.Forms.Button(); + this.Ok = new System.Windows.Forms.Button(); 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.SpecialCommandsBtn = 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(); @@ -41,16 +41,16 @@ this.DefaultsBtn = new System.Windows.Forms.Button(); this.SuspendLayout(); // - // OK + // Ok // - this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.OK.Location = new System.Drawing.Point(471, 411); - this.OK.Name = "OK"; - this.OK.Size = new System.Drawing.Size(75, 23); - this.OK.TabIndex = 0; - this.OK.Text = "&Ok"; - this.OK.UseVisualStyleBackColor = true; - this.OK.Click += new System.EventHandler(this.OK_Click); + this.Ok.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.Ok.Location = new System.Drawing.Point(471, 411); + this.Ok.Name = "Ok"; + this.Ok.Size = new System.Drawing.Size(75, 23); + this.Ok.TabIndex = 0; + this.Ok.Text = "&Ok"; + this.Ok.UseVisualStyleBackColor = true; + this.Ok.Click += new System.EventHandler(this.Ok_Click); // // Cancel // @@ -98,16 +98,16 @@ this.label1.TabIndex = 210; this.label1.Text = "Special Commands"; // - // button1 + // SpecialCommandsBtn // - this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.button1.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Help; - this.button1.Location = new System.Drawing.Point(496, 47); - 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); + this.SpecialCommandsBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.SpecialCommandsBtn.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Help; + this.SpecialCommandsBtn.Location = new System.Drawing.Point(496, 47); + this.SpecialCommandsBtn.Name = "SpecialCommandsBtn"; + this.SpecialCommandsBtn.Size = new System.Drawing.Size(26, 23); + this.SpecialCommandsBtn.TabIndex = 209; + this.SpecialCommandsBtn.UseVisualStyleBackColor = true; + this.SpecialCommandsBtn.Click += new System.EventHandler(this.SpecialCommandsBtn_Click); // // RecentForROMs // @@ -163,14 +163,14 @@ // // PathConfig // - this.AcceptButton = this.OK; + this.AcceptButton = this.Ok; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.Cancel; this.ClientSize = new System.Drawing.Size(639, 446); this.Controls.Add(this.DefaultsBtn); this.Controls.Add(this.label1); - this.Controls.Add(this.button1); + this.Controls.Add(this.SpecialCommandsBtn); this.Controls.Add(this.RecentForROMs); this.Controls.Add(this.BasePathBox); this.Controls.Add(this.BrowseBase); @@ -178,7 +178,7 @@ this.Controls.Add(this.SaveBtn); this.Controls.Add(this.PathTabControl); this.Controls.Add(this.Cancel); - this.Controls.Add(this.OK); + this.Controls.Add(this.Ok); this.MinimumSize = new System.Drawing.Size(360, 250); this.Name = "PathConfig"; this.ShowIcon = false; @@ -192,12 +192,12 @@ #endregion - private System.Windows.Forms.Button OK; + private System.Windows.Forms.Button Ok; 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.Button SpecialCommandsBtn; private System.Windows.Forms.CheckBox RecentForROMs; private System.Windows.Forms.TextBox BasePathBox; private System.Windows.Forms.Button BrowseBase; diff --git a/BizHawk.Client.EmuHawk/config/PathConfig.cs b/BizHawk.Client.EmuHawk/config/PathConfig.cs index 0c7bc07014..dd249ff10b 100644 --- a/BizHawk.Client.EmuHawk/config/PathConfig.cs +++ b/BizHawk.Client.EmuHawk/config/PathConfig.cs @@ -10,12 +10,17 @@ namespace BizHawk.Client.EmuHawk { public partial class PathConfig : Form { - //All path text boxes should do some kind of error checking - //config path under base, config will default to %exe% + // All path text boxes should do some kind of error checking + // Config path under base, config will default to %exe% + private bool _preventSelectedChangeEvent; // Selected Index Changed events are a pain private void LockDownCores() { - if (VersionInfo.INTERIM) return; + if (VersionInfo.INTERIM) + { + return; + } + string[] coresToHide = { "PSX", "GBA", "INTV", "C64", "GEN" }; foreach (var core in coresToHide) @@ -45,30 +50,6 @@ namespace BizHawk.Client.EmuHawk InitializeComponent(); } - private void NewPathConfig_Load(object sender, EventArgs e) - { - LoadSettings(); - LockDownCores(); - } - - private void OK_Click(object sender, EventArgs e) - { - SaveSettings(); - GlobalWin.OSD.AddMessage("Path settings saved"); - Close(); - } - - private void Cancel_Click(object sender, EventArgs e) - { - GlobalWin.OSD.AddMessage("Path config aborted"); - Close(); - } - - private void SaveBtn_Click(object sender, EventArgs e) - { - SaveSettings(); - } - private void LoadSettings() { RecentForROMs.Checked = Global.Config.UseRecentForROMs; @@ -175,7 +156,7 @@ namespace BizHawk.Client.EmuHawk } var sys = tabPage.Name; - if (tabPage.Name == "PCE") //Hack + if (tabPage.Name == "PCE") // Hack { sys = "PCECD"; } @@ -199,6 +180,7 @@ namespace BizHawk.Client.EmuHawk MessageBox.Show("C-C-C-Combo Breaker!", "Nice try, but"); return; } + var f = new FirmwaresConfig { TargetSystem = sys }; f.ShowDialog(this); }; @@ -207,17 +189,18 @@ namespace BizHawk.Client.EmuHawk } } - //TODO: this is only used by the defaults button, refactor since it is now redundant code (will have to force the rebuilding of all tabpages, currently they only build as necessar + // TODO: this is only used by the defaults button, refactor since it is now redundant code (will have to force the rebuilding of all tabpages, currently they only build as necessar private void DoTabs(List pathCollection) { - PathTabControl.SuspendLayout(); + _preventSelectedChangeEvent = true; + PathTabControl.Visible = false; PathTabControl.TabPages.Clear(); - //Separate by system + // Separate by system var systems = Global.Config.PathEntries.Select(x => x.SystemDisplayName).Distinct().ToList(); systems.Sort(); - //Hacky way to put global first + // Hacky way to put global first var global = systems.FirstOrDefault(x => x == "Global"); systems.Remove(global); systems.Insert(0, global); @@ -292,7 +275,7 @@ namespace BizHawk.Client.EmuHawk } var sys = systemDisplayName; - if (systemDisplayName == "PCE") //Hack + if (systemDisplayName == "PCE") // Hack { sys = "PCECD"; } @@ -310,7 +293,7 @@ namespace BizHawk.Client.EmuHawk }; firmwareButton.Click += delegate { - var f = new FirmwaresConfig {TargetSystem = sys}; + var f = new FirmwaresConfig { TargetSystem = sys }; f.ShowDialog(); }; @@ -318,15 +301,16 @@ namespace BizHawk.Client.EmuHawk } tabPages.Add(t); - } + PathTabControl.TabPages.AddRange(tabPages.ToArray()); - PathTabControl.ResumeLayout(); + PathTabControl.Visible = true; + _preventSelectedChangeEvent = false; } - private void BrowseFolder(TextBox box, string name, string system) + private static void BrowseFolder(TextBox box, string name, string system) { - //Ugly hack, we don't want to pass in the system in for system base and global paths + // Ugly hack, we don't want to pass in the system in for system base and global paths if (name == "Base" || system == "Global" || system == "Global_NULL") { system = null; @@ -351,8 +335,73 @@ namespace BizHawk.Client.EmuHawk foreach (var t in AllPathBoxes) { - var path_entry = Global.Config.PathEntries.FirstOrDefault(x => x.System == t.Parent.Name && x.Type == t.Name); - path_entry.Path = t.Text; + var pathEntry = Global.Config.PathEntries.FirstOrDefault(x => x.System == t.Parent.Name && x.Type == t.Name); + pathEntry.Path = t.Text; + } + } + + private void DoRomToggle() + { + var pcontrols = AllPathControls.Where(x => x.Name == "ROM").ToList(); + foreach (var c in pcontrols) + { + c.Enabled = !RecentForROMs.Checked; + } + } + + private IEnumerable AllPathBoxes + { + get + { + var allPathBoxes = new List(); + foreach (TabPage tp in PathTabControl.TabPages) + { + allPathBoxes.AddRange(tp.Controls.OfType()); + } + return allPathBoxes; + } + } + + private IEnumerable AllPathControls + { + get + { + var allPathControls = new List(); + foreach (TabPage tp in PathTabControl.TabPages) + { + allPathControls.AddRange(tp.Controls.OfType()); + } + return allPathControls; + } + } + + private IEnumerable AllTabPages + { + get { return PathTabControl.TabPages.Cast(); } + } + + #region Events + + private void NewPathConfig_Load(object sender, EventArgs e) + { + LoadSettings(); + LockDownCores(); + } + + private void RecentForROMs_CheckedChanged(object sender, EventArgs e) + { + DoRomToggle(); + } + + private void PathTabControl_SelectedIndexChanged(object sender, EventArgs e) + { + if (!_preventSelectedChangeEvent && PathTabControl.TabPages.Count > 0) + { + var tabPage = (sender as TabControl).SelectedTab; + if (tabPage.Controls.Count == 0) + { + DoTabPage((sender as TabControl).SelectedTab); + } } } @@ -370,56 +419,14 @@ namespace BizHawk.Client.EmuHawk } } - private void button1_Click(object sender, EventArgs e) + private void SpecialCommandsBtn_Click(object sender, EventArgs e) { new PathInfo().Show(); } - private void RecentForROMs_CheckedChanged(object sender, EventArgs e) + private void SaveBtn_Click(object sender, EventArgs e) { - DoRomToggle(); - } - - private void DoRomToggle() - { - var pcontrols = AllPathControls.Where(x => x.Name == "ROM").ToList(); - foreach (var c in pcontrols) - { - c.Enabled = !RecentForROMs.Checked; - } - } - - private IEnumerable AllPathBoxes - { - get - { - var _AllPathBoxes = new List(); - foreach (TabPage tp in PathTabControl.TabPages) - { - var boxes = tp.Controls.OfType(); - _AllPathBoxes.AddRange(boxes); - } - return _AllPathBoxes; - } - } - - private IEnumerable AllPathControls - { - get - { - var _AllPathControls = new List(); - foreach (TabPage tp in PathTabControl.TabPages) - { - var control = tp.Controls.OfType(); - _AllPathControls.AddRange(control); - } - return _AllPathControls; - } - } - - private IEnumerable AllTabPages - { - get { return PathTabControl.TabPages.Cast(); } + SaveSettings(); } private void DefaultsBtn_Click(object sender, EventArgs e) @@ -427,13 +434,19 @@ namespace BizHawk.Client.EmuHawk DoTabs(PathEntryCollection.DefaultValues); } - private void PathTabControl_SelectedIndexChanged(object sender, EventArgs e) + private void Ok_Click(object sender, EventArgs e) { - var tabPage = (sender as TabControl).SelectedTab; - if (tabPage.Controls.Count == 0) - { - DoTabPage((sender as TabControl).SelectedTab); - } + SaveSettings(); + GlobalWin.OSD.AddMessage("Path settings saved"); + Close(); } + + private void Cancel_Click(object sender, EventArgs e) + { + GlobalWin.OSD.AddMessage("Path config aborted"); + Close(); + } + + #endregion } }