diff --git a/BizHawk.Client.EmuHawk/tools/ToolBox.Designer.cs b/BizHawk.Client.EmuHawk/tools/ToolBox.Designer.cs index 34e97e4123..0b11a0f2c3 100644 --- a/BizHawk.Client.EmuHawk/tools/ToolBox.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/ToolBox.Designer.cs @@ -46,6 +46,7 @@ this.SNESGraphicsDebuggerToolbarItem = new System.Windows.Forms.ToolStripButton(); this.SNESGameGenieToolbarItem = new System.Windows.Forms.ToolStripButton(); this.GGGameGenieToolbarItem = new System.Windows.Forms.ToolStripButton(); + this.GbGpuViewerToolBarItem = new System.Windows.Forms.ToolStripButton(); this.GBGameGenieToolbarItem = new System.Windows.Forms.ToolStripButton(); this.PceBgViewerToolbarItem = new System.Windows.Forms.ToolStripButton(); this.ToolBoxStrip.SuspendLayout(); @@ -55,7 +56,7 @@ // this.CloseBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.CloseBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.CloseBtn.Location = new System.Drawing.Point(254, 99); + this.CloseBtn.Location = new System.Drawing.Point(152, 135); this.CloseBtn.Name = "CloseBtn"; this.CloseBtn.Size = new System.Drawing.Size(0, 23); this.CloseBtn.TabIndex = 1; @@ -90,13 +91,14 @@ this.SNESGraphicsDebuggerToolbarItem, this.SNESGameGenieToolbarItem, this.GGGameGenieToolbarItem, + this.GbGpuViewerToolBarItem, this.GBGameGenieToolbarItem, this.PceBgViewerToolbarItem}); this.ToolBoxStrip.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow; this.ToolBoxStrip.Location = new System.Drawing.Point(2, 2); this.ToolBoxStrip.Name = "ToolBoxStrip"; this.ToolBoxStrip.Padding = new System.Windows.Forms.Padding(0); - this.ToolBoxStrip.Size = new System.Drawing.Size(239, 130); + this.ToolBoxStrip.Size = new System.Drawing.Size(137, 166); this.ToolBoxStrip.Stretch = true; this.ToolBoxStrip.TabIndex = 0; this.ToolBoxStrip.TabStop = true; @@ -243,6 +245,16 @@ this.GGGameGenieToolbarItem.ToolTipText = "Game Gear Game Genie Encoder/Decoder"; this.GGGameGenieToolbarItem.Click += new System.EventHandler(this.GGGameGenieToolbarItem_Click); // + // GbGpuViewerToolBarItem + // + this.GbGpuViewerToolBarItem.Image = ((System.Drawing.Image)(resources.GetObject("GbGpuViewerToolBarItem.Image"))); + this.GbGpuViewerToolBarItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.GbGpuViewerToolBarItem.Name = "GbGpuViewerToolBarItem"; + this.GbGpuViewerToolBarItem.Size = new System.Drawing.Size(49, 20); + this.GbGpuViewerToolBarItem.Text = "Gpu"; + this.GbGpuViewerToolBarItem.ToolTipText = "Gameboy Game Genie Encoder/Decoder"; + this.GbGpuViewerToolBarItem.Click += new System.EventHandler(this.GbGpuViewerToolBarItem_Click); + // // GBGameGenieToolbarItem // this.GBGameGenieToolbarItem.Image = ((System.Drawing.Image)(resources.GetObject("GBGameGenieToolbarItem.Image"))); @@ -258,8 +270,8 @@ this.PceBgViewerToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.pcejin1; this.PceBgViewerToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.PceBgViewerToolbarItem.Name = "PceBgViewerToolbarItem"; - this.PceBgViewerToolbarItem.Size = new System.Drawing.Size(42, 20); - this.PceBgViewerToolbarItem.Text = "BG"; + this.PceBgViewerToolbarItem.Size = new System.Drawing.Size(41, 20); + this.PceBgViewerToolbarItem.Text = "Bg"; this.PceBgViewerToolbarItem.ToolTipText = "PC Engine Background Viewer"; this.PceBgViewerToolbarItem.Click += new System.EventHandler(this.PceBgViewerToolbarItem_Click); // @@ -268,11 +280,12 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.CloseBtn; - this.ClientSize = new System.Drawing.Size(242, 134); + this.ClientSize = new System.Drawing.Size(140, 170); this.Controls.Add(this.CloseBtn); this.Controls.Add(this.ToolBoxStrip); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MinimumSize = new System.Drawing.Size(129, 62); + this.MaximumSize = new System.Drawing.Size(270, 600); + this.MinimumSize = new System.Drawing.Size(135, 38); this.Name = "ToolBox"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Load += new System.EventHandler(this.ToolBox_Load); @@ -303,6 +316,7 @@ private System.Windows.Forms.ToolStripButton PceBgViewerToolbarItem; private System.Windows.Forms.Button CloseBtn; private System.Windows.Forms.ToolStripButton GBGameGenieToolbarItem; + private System.Windows.Forms.ToolStripButton GbGpuViewerToolBarItem; } } \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/tools/ToolBox.cs b/BizHawk.Client.EmuHawk/tools/ToolBox.cs index bfce1ec48b..e2fe3ef2a2 100644 --- a/BizHawk.Client.EmuHawk/tools/ToolBox.cs +++ b/BizHawk.Client.EmuHawk/tools/ToolBox.cs @@ -27,8 +27,11 @@ namespace BizHawk.Client.EmuHawk ); SetTools(); - ToolBoxStrip.Items[0].Select(); + ToolBoxItems.First().Select(); SetText(); + SetSize(); + + ToolBoxItems.First().Select(); } public bool AskSave() { return true; } @@ -59,56 +62,40 @@ namespace BizHawk.Client.EmuHawk PceBgViewerToolbarItem.Visible = Global.Emulator is PCEngine; - GBGameGenieToolbarItem.Visible = Global.Game.System == "GB"; + GBGameGenieToolbarItem.Visible = + GbGpuViewerToolBarItem.Visible = + Global.Game.System == "GB"; foreach (var button in ToolBoxItems) { var toolBtn = button as ToolStripButton; toolBtn.Click += (o, e) => Close(); - toolBtn.Paint += (o, e) => SetText(); + toolBtn.Paint += (o, e) => + { + if (ToolBoxItems.Any(x => x.Selected)) + { + SetText(); + } + }; } - - SetSize(); } private void SetSize() { - var tools = ToolBoxItems.ToList(); - - int iconWidth = tools.Where(i => i.Visible).Max(i => i.Width); - int iconheight = tools.Where(i => i.Visible).Max(i => i.Height); - - int total = tools.Count; - bool isOdd = total % 4 != 0; - - int padding = 5; - int width = iconWidth * 4; - int height = iconheight * (tools.Count / 4) + (isOdd ? iconheight : 0); - Size = new Size(width + padding, height + padding); + var rows = (int)(Math.Ceiling(ToolBoxItems.Count() / 4.0)); + this.Height = 30 + (rows * 30); } private void SetText() { - Text = SelectedButtonText; - } - - private string SelectedButtonText - { - get + var items = ToolBoxItems.ToList(); + if (items.Any(x => x.Selected)) { - foreach (var button in ToolBoxStrip.Items) - { - if (button is ToolStripButton) - { - var toolBtn = button as ToolStripButton; - if (toolBtn.Selected && toolBtn.Visible) - { - return toolBtn.ToolTipText; - } - } - } - - return String.Empty; + Text = items.FirstOrDefault(x => x.Selected).ToolTipText; + } + else + { + Text = String.Empty; } } @@ -119,7 +106,7 @@ namespace BizHawk.Client.EmuHawk { get { - return ToolBoxStrip.Items.Cast(); + return ToolBoxStrip.Items.Cast().Where(x => x.Visible); } } @@ -182,10 +169,7 @@ namespace BizHawk.Client.EmuHawk private void TI83KeypadToolbarItem_Click(object sender, EventArgs e) { - if (Global.Emulator is TI83) - { - GlobalWin.Tools.Load(); - } + GlobalWin.Tools.Load(); } private void TAStudioToolbarItem_Click(object sender, EventArgs e) @@ -195,10 +179,7 @@ namespace BizHawk.Client.EmuHawk private void SNESGraphicsDebuggerToolbarItem_Click(object sender, EventArgs e) { - if (Global.Emulator is LibsnesCore) - { - GlobalWin.Tools.Load(); - } + GlobalWin.Tools.Load(); } private void VirtualpadToolbarItem_Click(object sender, EventArgs e) @@ -221,19 +202,16 @@ namespace BizHawk.Client.EmuHawk GlobalWin.MainForm.LoadGameGenieEc(); } + private void GbGpuViewerToolBarItem_Click(object sender, EventArgs e) + { + GlobalWin.Tools.Load(); + } + private void PceBgViewerToolbarItem_Click(object sender, EventArgs e) { - if (Global.Emulator is PCEngine) - { - GlobalWin.Tools.Load(); - } + GlobalWin.Tools.Load(); } #endregion - - private void toolStripButton1_Click(object sender, EventArgs e) - { - - } } } diff --git a/BizHawk.Client.EmuHawk/tools/ToolBox.resx b/BizHawk.Client.EmuHawk/tools/ToolBox.resx index 5f49d39ae5..a0bdbfd8e6 100644 --- a/BizHawk.Client.EmuHawk/tools/ToolBox.resx +++ b/BizHawk.Client.EmuHawk/tools/ToolBox.resx @@ -135,6 +135,17 @@ rAFLfvHbkLhtHd5w8nxL86Ji4fQcGTPkteLWRM5ATBwAWa1WCxj7eEEOPlXkYLONL4r1SqrHGiAP16zn DLABwzYDQ8N3PF6+nvcZ/3BYM/OcsJyWG8gaQISmrLg1gY/qb3BecUSqOSYO8APthE7itgbNRPo0fNE2 WXFLks3nAXUgWBS2qRsoo4wyTDj3B3uOB2ePDD1gAAAAAElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEQSURBVFhH7ZXRDYMwDEQzC7OwArMwS2dhBXZKdQ4XOZAQ + UMDpR096KgTse1/U/Xr8BsJfs/hpmgRcz/NMGRMRvyxLFCCQsBKRIkj0EoklvURk8TAMsQSciWAmjD6T + KECuiGBuozlRwK0f4YqIvP+GwMevVRGeYzasaMtBgJREzARyIl0EyF/ARADJlYPXBQhjKrCXAIyZQE0E + 1yYChEUafY7ZsKItSSG+87zX50TfY3b7Y2pKsjQnQEoCJKy7n6SgJgFKAiSsvZ5kMRboMg2fnwmElfeS + LdOwmJQEwrr7kUW5Qt6zQD/fC8imxlRF9LkWkOkHcxDZg/JxHOU9mXgpRRGLcp1ExLpch8Vdyh+Ic19s + EmBku+z2SQAAAABJRU5ErkJggg==