New Path Config - defaults button

This commit is contained in:
adelikat 2013-08-11 20:06:27 +00:00
parent b7fd907802
commit fa8cbf650d
2 changed files with 26 additions and 3 deletions

View File

@ -38,6 +38,7 @@
this.BasePathBox = new System.Windows.Forms.TextBox(); this.BasePathBox = new System.Windows.Forms.TextBox();
this.BrowseBase = new System.Windows.Forms.Button(); this.BrowseBase = new System.Windows.Forms.Button();
this.BaseDescription = new System.Windows.Forms.Label(); this.BaseDescription = new System.Windows.Forms.Label();
this.DefaultsBtn = new System.Windows.Forms.Button();
this.SuspendLayout(); this.SuspendLayout();
// //
// OK // OK
@ -148,6 +149,16 @@
this.BaseDescription.TabIndex = 208; this.BaseDescription.TabIndex = 208;
this.BaseDescription.Text = "Global Base"; this.BaseDescription.Text = "Global Base";
// //
// DefaultsBtn
//
this.DefaultsBtn.Location = new System.Drawing.Point(93, 411);
this.DefaultsBtn.Name = "DefaultsBtn";
this.DefaultsBtn.Size = new System.Drawing.Size(75, 23);
this.DefaultsBtn.TabIndex = 211;
this.DefaultsBtn.Text = "&Defaults";
this.DefaultsBtn.UseVisualStyleBackColor = true;
this.DefaultsBtn.Click += new System.EventHandler(this.DefaultsBtn_Click);
//
// NewPathConfig // NewPathConfig
// //
this.AcceptButton = this.OK; this.AcceptButton = this.OK;
@ -155,6 +166,7 @@
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, 446); this.ClientSize = new System.Drawing.Size(618, 446);
this.Controls.Add(this.DefaultsBtn);
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);
@ -187,5 +199,6 @@
private System.Windows.Forms.TextBox BasePathBox; private System.Windows.Forms.TextBox BasePathBox;
private System.Windows.Forms.Button BrowseBase; private System.Windows.Forms.Button BrowseBase;
private System.Windows.Forms.Label BaseDescription; private System.Windows.Forms.Label BaseDescription;
private System.Windows.Forms.Button DefaultsBtn;
} }
} }

View File

@ -43,7 +43,7 @@ namespace BizHawk.MultiClient
{ {
RecentForROMs.Checked = Global.Config.UseRecentForROMs; RecentForROMs.Checked = Global.Config.UseRecentForROMs;
BasePathBox.Text = Global.Config.BasePath; BasePathBox.Text = Global.Config.BasePath;
DoTabs(); DoTabs(Global.Config.PathEntries.Paths);
SetDefaultFocusedTab(); SetDefaultFocusedTab();
DoROMToggle(); DoROMToggle();
} }
@ -87,8 +87,11 @@ namespace BizHawk.MultiClient
} }
} }
private void DoTabs() private void DoTabs(List<PathEntry> PathCollection)
{ {
PathTabControl.SuspendLayout();
PathTabControl.TabPages.Clear();
//Separate by system //Separate by system
List<string> systems = Global.Config.PathEntries.Select(x => x.System).Distinct().ToList(); List<string> systems = Global.Config.PathEntries.Select(x => x.System).Distinct().ToList();
systems.Sort(); systems.Sort();
@ -105,7 +108,7 @@ namespace BizHawk.MultiClient
Text = systemId, Text = systemId,
Name = systemId, Name = systemId,
}; };
List<PathEntry> paths = Global.Config.PathEntries.Where(x => x.System == systemId).OrderBy(x => x.Ordinal).ThenBy(x => x.Type).ToList(); List<PathEntry> paths = PathCollection.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;
@ -186,6 +189,8 @@ namespace BizHawk.MultiClient
PathTabControl.TabPages.Add(t); PathTabControl.TabPages.Add(t);
} }
PathTabControl.ResumeLayout();
} }
private void BrowseFolder(TextBox box, string _Name, string System) private void BrowseFolder(TextBox box, string _Name, string System)
@ -308,5 +313,10 @@ namespace BizHawk.MultiClient
return _AllPathControls; return _AllPathControls;
} }
} }
private void DefaultsBtn_Click(object sender, EventArgs e)
{
DoTabs(PathEntryCollection.DefaultValues);
}
} }
} }