convert SNES Game Genie encoder/decoder to IToolFormAutoConfig

This commit is contained in:
adelikat 2015-01-01 18:45:14 +00:00
parent 1ee7cfc153
commit 1854544f01
3 changed files with 4 additions and 147 deletions

View File

@ -345,10 +345,6 @@ namespace BizHawk.Client.Common
public ToolDialogSettings NesGGSettings = new ToolDialogSettings();
public bool NESGGAutoload = false;
// SNES Game Genie Encoder/Decoder
public ToolDialogSettings SnesGGSettings = new ToolDialogSettings();
public bool SNESGGAutoload = false;
// GB/GG Game Genie Encoder/Decoder
public ToolDialogSettings GbGGSettings = new ToolDialogSettings();
public bool GBGGAutoload = false;

View File

@ -57,19 +57,11 @@
this.label4 = new System.Windows.Forms.Label();
this.ClearButton = new System.Windows.Forms.Button();
this.menuStrip1 = new MenuStripEx();
this.OptionsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.AutoloadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SaveWindowPositionMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.CheatNameBox = new System.Windows.Forms.TextBox();
this.AlwaysOnTopMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.FloatingWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.GameGenieCodeBox.SuspendLayout();
this.ButtonPanel.SuspendLayout();
this.groupBox1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
@ -384,55 +376,12 @@
// menuStrip1
//
this.menuStrip1.ClickThrough = true;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.OptionsSubMenu});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(292, 24);
this.menuStrip1.TabIndex = 8;
this.menuStrip1.Text = "menuStrip1";
//
// OptionsSubMenu
//
this.OptionsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.AutoloadMenuItem,
this.SaveWindowPositionMenuItem,
this.AlwaysOnTopMenuItem,
this.FloatingWindowMenuItem,
this.toolStripSeparator1,
this.ExitMenuItem});
this.OptionsSubMenu.Name = "OptionsSubMenu";
this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20);
this.OptionsSubMenu.Text = "&Options";
this.OptionsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened);
//
// AutoloadMenuItem
//
this.AutoloadMenuItem.Name = "AutoloadMenuItem";
this.AutoloadMenuItem.Size = new System.Drawing.Size(191, 22);
this.AutoloadMenuItem.Text = "Autoload";
this.AutoloadMenuItem.Click += new System.EventHandler(this.AutoloadMenuItem_Click);
//
// SaveWindowPositionMenuItem
//
this.SaveWindowPositionMenuItem.Name = "SaveWindowPositionMenuItem";
this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(191, 22);
this.SaveWindowPositionMenuItem.Text = "Save Window Position";
this.SaveWindowPositionMenuItem.Click += new System.EventHandler(this.SaveWindowPositionMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(188, 6);
//
// ExitMenuItem
//
this.ExitMenuItem.Name = "ExitMenuItem";
this.ExitMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4)));
this.ExitMenuItem.Size = new System.Drawing.Size(191, 22);
this.ExitMenuItem.Text = "E&xit";
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.CheatNameBox);
@ -445,7 +394,7 @@
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Cheat Title (Uses GG code if left empty)";
//
// cheatname
// CheatNameBox
//
this.CheatNameBox.Location = new System.Drawing.Point(18, 23);
this.CheatNameBox.Margin = new System.Windows.Forms.Padding(2);
@ -453,20 +402,6 @@
this.CheatNameBox.Size = new System.Drawing.Size(227, 20);
this.CheatNameBox.TabIndex = 0;
//
// AlwaysOnTopMenuItem
//
this.AlwaysOnTopMenuItem.Name = "AlwaysOnTopMenuItem";
this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(191, 22);
this.AlwaysOnTopMenuItem.Text = "Always on Top";
this.AlwaysOnTopMenuItem.Click += new System.EventHandler(this.AlwaysOnTopMenuItem_Click);
//
// FloatingWindowMenuItem
//
this.FloatingWindowMenuItem.Name = "FloatingWindowMenuItem";
this.FloatingWindowMenuItem.Size = new System.Drawing.Size(191, 22);
this.FloatingWindowMenuItem.Text = "Floating Window";
this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click);
//
// SNESGameGenie
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -494,8 +429,6 @@
this.ButtonPanel.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
@ -532,16 +465,9 @@
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button ClearButton;
private MenuStripEx menuStrip1;
private System.Windows.Forms.ToolStripMenuItem OptionsSubMenu;
private System.Windows.Forms.ToolStripMenuItem AutoloadMenuItem;
private System.Windows.Forms.ToolStripMenuItem SaveWindowPositionMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem ExitMenuItem;
private MenuStripEx menuStrip1;
private System.Windows.Forms.MaskedTextBox GGCodeMaskBox;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox CheatNameBox;
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem;
}
}

View File

@ -11,7 +11,7 @@ using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class SNESGameGenie : Form, IToolForm
public partial class SNESGameGenie : Form, IToolFormAutoConfig
{
[RequiredService]
public LibsnesCore Emulator { get; set; }
@ -46,22 +46,11 @@ namespace BizHawk.Client.EmuHawk
public SNESGameGenie()
{
InitializeComponent();
TopMost = Global.Config.SnesGGSettings.TopMost;
Closing += (o, e) =>
{
Global.Config.SnesGGSettings.Wndx = Location.X;
Global.Config.SnesGGSettings.Wndy = Location.Y;
};
}
private void SNESGameGenie_Load(object sender, EventArgs e)
{
addcheatbt.Enabled = false;
if (Global.Config.SnesGGSettings.UseWindowPosition)
{
Location = Global.Config.SnesGGSettings.WindowPosition;
}
}
#region Public API
@ -180,59 +169,7 @@ namespace BizHawk.Client.EmuHawk
return code;
}
private void RefreshFloatingWindowControl()
{
Owner = Global.Config.SnesGGSettings.FloatingWindow ? null : GlobalWin.MainForm;
}
#region Events
#region Menu
private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e)
{
AutoloadMenuItem.Checked = Global.Config.SNESGGAutoload;
SaveWindowPositionMenuItem.Checked = Global.Config.SnesGGSettings.SaveWindowPosition;
AlwaysOnTopMenuItem.Checked = Global.Config.SnesGGSettings.TopMost;
FloatingWindowMenuItem.Checked = Global.Config.SnesGGSettings.FloatingWindow;
}
private void AutoloadMenuItem_Click(object sender, EventArgs e)
{
Global.Config.SNESGGAutoload ^= true;
}
private void SaveWindowPositionMenuItem_Click(object sender, EventArgs e)
{
Global.Config.SnesGGSettings.SaveWindowPosition ^= true;
}
private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e)
{
Global.Config.SnesGGSettings.TopMost ^= true;
TopMost = Global.Config.SnesGGSettings.TopMost;
}
private void FloatingWindowMenuItem_Click(object sender, EventArgs e)
{
Global.Config.SnesGGSettings.FloatingWindow ^= true;
RefreshFloatingWindowControl();
}
private void ExitMenuItem_Click(object sender, EventArgs e)
{
Close();
}
#endregion
#region Dialog and Controls
protected override void OnShown(EventArgs e)
{
RefreshFloatingWindowControl();
base.OnShown(e);
}
#region Dialog and Control Events
private void ClearButton_Click(object sender, EventArgs e)
{
@ -420,7 +357,5 @@ namespace BizHawk.Client.EmuHawk
}
#endregion
#endregion
}
}