From a4672027c91c755d7482cf2bd01dd234e457e223 Mon Sep 17 00:00:00 2001 From: adelikat <adelikat@tasvideos.org> Date: Tue, 13 Jun 2017 20:29:42 -0500 Subject: [PATCH] bsnes - layer toggling move ui from menu items to checkboxes in the options dialog --- BizHawk.Client.EmuHawk/MainForm.Designer.cs | 91 ------------- BizHawk.Client.EmuHawk/MainForm.Events.cs | 65 --------- .../config/SNES/SNESOptions.Designer.cs | 128 +++++++++++++++++- .../config/SNES/SNESOptions.cs | 32 ++++- 4 files changed, 154 insertions(+), 162 deletions(-) diff --git a/BizHawk.Client.EmuHawk/MainForm.Designer.cs b/BizHawk.Client.EmuHawk/MainForm.Designer.cs index 0253047af9..2e9c379883 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Designer.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Designer.cs @@ -317,15 +317,6 @@ this.PSXDiscControlsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.PSXHashDiscsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SNESSubMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.SNESDisplayMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SnesBg1MenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SnesBg2MenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SnesBg3MenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SnesBg4MenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SnesObj1MenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SnesObj2MenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SnesObj3MenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.SnesObj4MenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SNESControllerConfigurationMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator18 = new System.Windows.Forms.ToolStripSeparator(); this.SnesGfxDebuggerMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -2869,7 +2860,6 @@ // SNESSubMenu // this.SNESSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.SNESDisplayMenuItem, this.SNESControllerConfigurationMenuItem, this.toolStripSeparator18, this.SnesGfxDebuggerMenuItem, @@ -2881,78 +2871,6 @@ this.SNESSubMenu.Text = "&SNES"; this.SNESSubMenu.DropDownOpened += new System.EventHandler(this.SNESSubMenu_DropDownOpened); // - // SNESDisplayMenuItem - // - this.SNESDisplayMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.SnesBg1MenuItem, - this.SnesBg2MenuItem, - this.SnesBg3MenuItem, - this.SnesBg4MenuItem, - this.SnesObj1MenuItem, - this.SnesObj2MenuItem, - this.SnesObj3MenuItem, - this.SnesObj4MenuItem}); - this.SNESDisplayMenuItem.Name = "SNESDisplayMenuItem"; - this.SNESDisplayMenuItem.Size = new System.Drawing.Size(233, 22); - this.SNESDisplayMenuItem.Text = "Display"; - this.SNESDisplayMenuItem.DropDownOpened += new System.EventHandler(this.SNESDisplayMenuItem_DropDownOpened); - // - // SnesBg1MenuItem - // - this.SnesBg1MenuItem.Name = "SnesBg1MenuItem"; - this.SnesBg1MenuItem.Size = new System.Drawing.Size(103, 22); - this.SnesBg1MenuItem.Text = "BG 1"; - this.SnesBg1MenuItem.Click += new System.EventHandler(this.SnesBg1MenuItem_Click); - // - // SnesBg2MenuItem - // - this.SnesBg2MenuItem.Name = "SnesBg2MenuItem"; - this.SnesBg2MenuItem.Size = new System.Drawing.Size(103, 22); - this.SnesBg2MenuItem.Text = "BG 2"; - this.SnesBg2MenuItem.Click += new System.EventHandler(this.SnesBg2MenuItem_Click); - // - // SnesBg3MenuItem - // - this.SnesBg3MenuItem.Name = "SnesBg3MenuItem"; - this.SnesBg3MenuItem.Size = new System.Drawing.Size(103, 22); - this.SnesBg3MenuItem.Text = "BG 3"; - this.SnesBg3MenuItem.Click += new System.EventHandler(this.SnesBg3MenuItem_Click); - // - // SnesBg4MenuItem - // - this.SnesBg4MenuItem.Name = "SnesBg4MenuItem"; - this.SnesBg4MenuItem.Size = new System.Drawing.Size(103, 22); - this.SnesBg4MenuItem.Text = "BG 4"; - this.SnesBg4MenuItem.Click += new System.EventHandler(this.SnesBg4MenuItem_Click); - // - // SnesObj1MenuItem - // - this.SnesObj1MenuItem.Name = "SnesObj1MenuItem"; - this.SnesObj1MenuItem.Size = new System.Drawing.Size(103, 22); - this.SnesObj1MenuItem.Text = "OBJ 1"; - this.SnesObj1MenuItem.Click += new System.EventHandler(this.SnesObj1MenuItem_Click); - // - // SnesObj2MenuItem - // - this.SnesObj2MenuItem.Name = "SnesObj2MenuItem"; - this.SnesObj2MenuItem.Size = new System.Drawing.Size(103, 22); - this.SnesObj2MenuItem.Text = "OBJ 2"; - this.SnesObj2MenuItem.Click += new System.EventHandler(this.SnesObj2MenuItem_Click); - // - // SnesObj3MenuItem - // - this.SnesObj3MenuItem.Name = "SnesObj3MenuItem"; - this.SnesObj3MenuItem.Size = new System.Drawing.Size(103, 22); - this.SnesObj3MenuItem.Text = "OBJ 3"; - this.SnesObj3MenuItem.Click += new System.EventHandler(this.SnesObj3MenuItem_Click); - // - // SnesObj4MenuItem - // - this.SnesObj4MenuItem.Name = "SnesObj4MenuItem"; - this.SnesObj4MenuItem.Size = new System.Drawing.Size(103, 22); - this.SnesObj4MenuItem.Text = "OBJ 4"; - this.SnesObj4MenuItem.Click += new System.EventHandler(this.SnesObj4MenuItem_Click); - // // SNESControllerConfigurationMenuItem // this.SNESControllerConfigurationMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.GameController; @@ -4184,15 +4102,6 @@ private System.Windows.Forms.ToolStripMenuItem SNESSubMenu; private System.Windows.Forms.ToolStripMenuItem SnesGfxDebuggerMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator18; - private System.Windows.Forms.ToolStripMenuItem SNESDisplayMenuItem; - private System.Windows.Forms.ToolStripMenuItem SnesBg1MenuItem; - private System.Windows.Forms.ToolStripMenuItem SnesBg2MenuItem; - private System.Windows.Forms.ToolStripMenuItem SnesBg3MenuItem; - private System.Windows.Forms.ToolStripMenuItem SnesBg4MenuItem; - private System.Windows.Forms.ToolStripMenuItem SnesObj1MenuItem; - private System.Windows.Forms.ToolStripMenuItem SnesObj2MenuItem; - private System.Windows.Forms.ToolStripMenuItem SnesObj3MenuItem; - private System.Windows.Forms.ToolStripMenuItem SnesObj4MenuItem; private System.Windows.Forms.ToolStripMenuItem HardResetMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator19; private System.Windows.Forms.ToolStripMenuItem CaptureOSDMenuItem; diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs index 0b63910e68..8e4042c5e5 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -2089,71 +2089,6 @@ namespace BizHawk.Client.EmuHawk SNESControllerConfigurationMenuItem.Enabled = !Global.MovieSession.Movie.IsActive; } - private void SNESDisplayMenuItem_DropDownOpened(object sender, EventArgs e) - { - var s = ((LibsnesCore)Emulator).GetSettings(); - - SnesBg1MenuItem.Checked = s.ShowBG1_1; - SnesBg2MenuItem.Checked = s.ShowBG2_1; - SnesBg3MenuItem.Checked = s.ShowBG3_1; - SnesBg4MenuItem.Checked = s.ShowBG4_1; - - SnesObj1MenuItem.Checked = s.ShowOBJ_0; - SnesObj2MenuItem.Checked = s.ShowOBJ_1; - SnesObj3MenuItem.Checked = s.ShowOBJ_2; - SnesObj4MenuItem.Checked = s.ShowOBJ_3; - - SnesBg1MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle BG 1"].Bindings; - SnesBg2MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle BG 2"].Bindings; - SnesBg3MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle BG 3"].Bindings; - SnesBg4MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle BG 4"].Bindings; - - SnesObj1MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle OBJ 1"].Bindings; - SnesObj2MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle OBJ 2"].Bindings; - SnesObj3MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle OBJ 3"].Bindings; - SnesObj4MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle OBJ 4"].Bindings; - } - - private void SnesBg1MenuItem_Click(object sender, EventArgs e) - { - SNES_ToggleBG1(); - } - - private void SnesBg2MenuItem_Click(object sender, EventArgs e) - { - SNES_ToggleBG2(); - } - - private void SnesBg3MenuItem_Click(object sender, EventArgs e) - { - SNES_ToggleBG3(); - } - - private void SnesBg4MenuItem_Click(object sender, EventArgs e) - { - SNES_ToggleBG4(); - } - - private void SnesObj1MenuItem_Click(object sender, EventArgs e) - { - SNES_ToggleObj1(); - } - - private void SnesObj2MenuItem_Click(object sender, EventArgs e) - { - SNES_ToggleObj2(); - } - - private void SnesObj3MenuItem_Click(object sender, EventArgs e) - { - SNES_ToggleOBJ3(); - } - - private void SnesObj4MenuItem_Click(object sender, EventArgs e) - { - SNES_ToggleOBJ4(); - } - private void SNESControllerConfigurationMenuItem_Click(object sender, EventArgs e) { new SNESControllerSettings().ShowDialog(); diff --git a/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.Designer.cs b/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.Designer.cs index 9f18560267..79aede5cc9 100644 --- a/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.Designer.cs +++ b/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.Designer.cs @@ -34,12 +34,22 @@ this.lblDoubleSize = new System.Windows.Forms.Label(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.cbCropSGBFrame = new System.Windows.Forms.CheckBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.Obj1Checkbox = new System.Windows.Forms.CheckBox(); + this.Obj2Checkbox = new System.Windows.Forms.CheckBox(); + this.Obj3Checkbox = new System.Windows.Forms.CheckBox(); + this.Obj4Checkbox = new System.Windows.Forms.CheckBox(); + this.Bg1Checkbox = new System.Windows.Forms.CheckBox(); + this.Bg2Checkbox = new System.Windows.Forms.CheckBox(); + this.Bg3Checkbox = new System.Windows.Forms.CheckBox(); + this.Bg4Checkbox = new System.Windows.Forms.CheckBox(); + this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // btnOk // this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnOk.Location = new System.Drawing.Point(136, 141); + this.btnOk.Location = new System.Drawing.Point(136, 288); this.btnOk.Name = "btnOk"; this.btnOk.Size = new System.Drawing.Size(75, 23); this.btnOk.TabIndex = 0; @@ -51,7 +61,7 @@ // this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnCancel.Location = new System.Drawing.Point(217, 141); + this.btnCancel.Location = new System.Drawing.Point(217, 288); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.TabIndex = 1; @@ -101,13 +111,114 @@ this.cbCropSGBFrame.Text = "Crop SGB Frame"; this.cbCropSGBFrame.UseVisualStyleBackColor = true; // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.Bg4Checkbox); + this.groupBox1.Controls.Add(this.Bg3Checkbox); + this.groupBox1.Controls.Add(this.Bg2Checkbox); + this.groupBox1.Controls.Add(this.Bg1Checkbox); + this.groupBox1.Controls.Add(this.Obj4Checkbox); + this.groupBox1.Controls.Add(this.Obj3Checkbox); + this.groupBox1.Controls.Add(this.Obj2Checkbox); + this.groupBox1.Controls.Add(this.Obj1Checkbox); + this.groupBox1.Location = new System.Drawing.Point(18, 142); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(274, 140); + this.groupBox1.TabIndex = 11; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Display"; + // + // Obj1Checkbox + // + this.Obj1Checkbox.AutoSize = true; + this.Obj1Checkbox.Location = new System.Drawing.Point(21, 29); + this.Obj1Checkbox.Name = "Obj1Checkbox"; + this.Obj1Checkbox.Size = new System.Drawing.Size(55, 17); + this.Obj1Checkbox.TabIndex = 0; + this.Obj1Checkbox.Text = "OBJ 1"; + this.Obj1Checkbox.UseVisualStyleBackColor = true; + // + // Obj2Checkbox + // + this.Obj2Checkbox.AutoSize = true; + this.Obj2Checkbox.Location = new System.Drawing.Point(22, 52); + this.Obj2Checkbox.Name = "Obj2Checkbox"; + this.Obj2Checkbox.Size = new System.Drawing.Size(55, 17); + this.Obj2Checkbox.TabIndex = 1; + this.Obj2Checkbox.Text = "OBJ 2"; + this.Obj2Checkbox.UseVisualStyleBackColor = true; + // + // Obj3Checkbox + // + this.Obj3Checkbox.AutoSize = true; + this.Obj3Checkbox.Location = new System.Drawing.Point(21, 75); + this.Obj3Checkbox.Name = "Obj3Checkbox"; + this.Obj3Checkbox.Size = new System.Drawing.Size(55, 17); + this.Obj3Checkbox.TabIndex = 2; + this.Obj3Checkbox.Text = "OBJ 3"; + this.Obj3Checkbox.UseVisualStyleBackColor = true; + // + // Obj4Checkbox + // + this.Obj4Checkbox.AutoSize = true; + this.Obj4Checkbox.Location = new System.Drawing.Point(21, 98); + this.Obj4Checkbox.Name = "Obj4Checkbox"; + this.Obj4Checkbox.Size = new System.Drawing.Size(55, 17); + this.Obj4Checkbox.TabIndex = 3; + this.Obj4Checkbox.Text = "OBJ 4"; + this.Obj4Checkbox.UseVisualStyleBackColor = true; + // + // Bg1Checkbox + // + this.Bg1Checkbox.AutoSize = true; + this.Bg1Checkbox.Location = new System.Drawing.Point(150, 29); + this.Bg1Checkbox.Name = "Bg1Checkbox"; + this.Bg1Checkbox.Size = new System.Drawing.Size(50, 17); + this.Bg1Checkbox.TabIndex = 4; + this.Bg1Checkbox.Text = "BG 1"; + this.Bg1Checkbox.UseVisualStyleBackColor = true; + // + // Bg2Checkbox + // + this.Bg2Checkbox.AutoSize = true; + this.Bg2Checkbox.Location = new System.Drawing.Point(150, 52); + this.Bg2Checkbox.Name = "Bg2Checkbox"; + this.Bg2Checkbox.Size = new System.Drawing.Size(50, 17); + this.Bg2Checkbox.TabIndex = 5; + this.Bg2Checkbox.Text = "BG 2"; + this.Bg2Checkbox.UseVisualStyleBackColor = true; + // + // Bg3Checkbox + // + this.Bg3Checkbox.AutoSize = true; + this.Bg3Checkbox.Location = new System.Drawing.Point(150, 75); + this.Bg3Checkbox.Name = "Bg3Checkbox"; + this.Bg3Checkbox.Size = new System.Drawing.Size(50, 17); + this.Bg3Checkbox.TabIndex = 6; + this.Bg3Checkbox.Text = "BG 3"; + this.Bg3Checkbox.UseVisualStyleBackColor = true; + // + // Bg4Checkbox + // + this.Bg4Checkbox.AutoSize = true; + this.Bg4Checkbox.Location = new System.Drawing.Point(150, 98); + this.Bg4Checkbox.Name = "Bg4Checkbox"; + this.Bg4Checkbox.Size = new System.Drawing.Size(50, 17); + this.Bg4Checkbox.TabIndex = 7; + this.Bg4Checkbox.Text = "BG 4"; + this.Bg4Checkbox.UseVisualStyleBackColor = true; + // // SNESOptions // this.AcceptButton = this.btnOk; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.btnCancel; - this.ClientSize = new System.Drawing.Size(304, 176); + this.ClientSize = new System.Drawing.Size(304, 323); + this.Controls.Add(this.groupBox1); this.Controls.Add(this.cbCropSGBFrame); this.Controls.Add(this.lblDoubleSize); this.Controls.Add(this.cbDoubleSize); @@ -120,6 +231,8 @@ this.ShowIcon = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "BSNES Options"; + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -133,5 +246,14 @@ private System.Windows.Forms.Label lblDoubleSize; private System.Windows.Forms.RadioButton radioButton1; private System.Windows.Forms.CheckBox cbCropSGBFrame; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.CheckBox Bg4Checkbox; + private System.Windows.Forms.CheckBox Bg3Checkbox; + private System.Windows.Forms.CheckBox Bg2Checkbox; + private System.Windows.Forms.CheckBox Bg1Checkbox; + private System.Windows.Forms.CheckBox Obj4Checkbox; + private System.Windows.Forms.CheckBox Obj3Checkbox; + private System.Windows.Forms.CheckBox Obj2Checkbox; + private System.Windows.Forms.CheckBox Obj1Checkbox; } } \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs b/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs index 23ce98d838..f9617c753f 100644 --- a/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs +++ b/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs @@ -22,7 +22,15 @@ namespace BizHawk.Client.EmuHawk var dlg = new SNESOptions { AlwaysDoubleSize = s.AlwaysDoubleSize, - CropSGBFrame = s.CropSGBFrame + CropSGBFrame = s.CropSGBFrame, + ShowObj1 = s.ShowOBJ_0, + ShowObj2 = s.ShowOBJ_1, + ShowObj3 = s.ShowOBJ_2, + ShowObj4 = s.ShowOBJ_3, + ShowBg1 = s.ShowBG1_0, + ShowBg2 = s.ShowBG2_0, + ShowBg3 = s.ShowBG3_0, + ShowBg4 = s.ShowBG4_0 }; var result = dlg.ShowDialog(owner); @@ -30,7 +38,15 @@ namespace BizHawk.Client.EmuHawk { s.AlwaysDoubleSize = dlg.AlwaysDoubleSize; s.CropSGBFrame = dlg.CropSGBFrame; - + s.ShowOBJ_0 = dlg.ShowObj1; + s.ShowOBJ_1 = dlg.ShowObj2; + s.ShowOBJ_2 = dlg.ShowObj3; + s.ShowOBJ_3 = dlg.ShowObj4; + s.ShowBG1_0 = s.ShowBG1_1 = dlg.ShowBg1; + s.ShowBG2_0 = s.ShowBG2_1 = dlg.ShowBg2; + s.ShowBG3_0 = s.ShowBG3_1 = dlg.ShowBg3; + s.ShowBG4_0 = s.ShowBG4_1 = dlg.ShowBg4; + GlobalWin.MainForm.PutCoreSettings(s); GlobalWin.MainForm.PutCoreSyncSettings(ss); } @@ -56,7 +72,17 @@ namespace BizHawk.Client.EmuHawk set { cbCropSGBFrame.Checked = value; } } - void RefreshDoubleSizeOption() + private bool ShowObj1 { get { return Obj1Checkbox.Checked; } set { Obj1Checkbox.Checked = value; } } + private bool ShowObj2 { get { return Obj2Checkbox.Checked; } set { Obj2Checkbox.Checked = value; } } + private bool ShowObj3 { get { return Obj3Checkbox.Checked; } set { Obj3Checkbox.Checked = value; } } + private bool ShowObj4 { get { return Obj4Checkbox.Checked; } set { Obj4Checkbox.Checked = value; } } + + private bool ShowBg1 { get { return Bg1Checkbox.Checked; } set { Bg1Checkbox.Checked = value; } } + private bool ShowBg2 { get { return Bg2Checkbox.Checked; } set { Bg2Checkbox.Checked = value; } } + private bool ShowBg3 { get { return Bg3Checkbox.Checked; } set { Bg3Checkbox.Checked = value; } } + private bool ShowBg4 { get { return Bg4Checkbox.Checked; } set { Bg4Checkbox.Checked = value; } } + + private void RefreshDoubleSizeOption() { _suppressDoubleSize = true; cbDoubleSize.Checked = !cbDoubleSize.Enabled || _userDoubleSizeOption;