Add GB GPU viewer to toolbox, and clean up some toolbox behavior

This commit is contained in:
adelikat 2013-12-22 03:15:53 +00:00
parent 0b8adc6113
commit 928e14f110
3 changed files with 63 additions and 60 deletions

View File

@ -46,6 +46,7 @@
this.SNESGraphicsDebuggerToolbarItem = new System.Windows.Forms.ToolStripButton(); this.SNESGraphicsDebuggerToolbarItem = new System.Windows.Forms.ToolStripButton();
this.SNESGameGenieToolbarItem = new System.Windows.Forms.ToolStripButton(); this.SNESGameGenieToolbarItem = new System.Windows.Forms.ToolStripButton();
this.GGGameGenieToolbarItem = 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.GBGameGenieToolbarItem = new System.Windows.Forms.ToolStripButton();
this.PceBgViewerToolbarItem = new System.Windows.Forms.ToolStripButton(); this.PceBgViewerToolbarItem = new System.Windows.Forms.ToolStripButton();
this.ToolBoxStrip.SuspendLayout(); 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.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.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.Name = "CloseBtn";
this.CloseBtn.Size = new System.Drawing.Size(0, 23); this.CloseBtn.Size = new System.Drawing.Size(0, 23);
this.CloseBtn.TabIndex = 1; this.CloseBtn.TabIndex = 1;
@ -90,13 +91,14 @@
this.SNESGraphicsDebuggerToolbarItem, this.SNESGraphicsDebuggerToolbarItem,
this.SNESGameGenieToolbarItem, this.SNESGameGenieToolbarItem,
this.GGGameGenieToolbarItem, this.GGGameGenieToolbarItem,
this.GbGpuViewerToolBarItem,
this.GBGameGenieToolbarItem, this.GBGameGenieToolbarItem,
this.PceBgViewerToolbarItem}); this.PceBgViewerToolbarItem});
this.ToolBoxStrip.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow; this.ToolBoxStrip.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
this.ToolBoxStrip.Location = new System.Drawing.Point(2, 2); this.ToolBoxStrip.Location = new System.Drawing.Point(2, 2);
this.ToolBoxStrip.Name = "ToolBoxStrip"; this.ToolBoxStrip.Name = "ToolBoxStrip";
this.ToolBoxStrip.Padding = new System.Windows.Forms.Padding(0); 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.Stretch = true;
this.ToolBoxStrip.TabIndex = 0; this.ToolBoxStrip.TabIndex = 0;
this.ToolBoxStrip.TabStop = true; this.ToolBoxStrip.TabStop = true;
@ -243,6 +245,16 @@
this.GGGameGenieToolbarItem.ToolTipText = "Game Gear Game Genie Encoder/Decoder"; this.GGGameGenieToolbarItem.ToolTipText = "Game Gear Game Genie Encoder/Decoder";
this.GGGameGenieToolbarItem.Click += new System.EventHandler(this.GGGameGenieToolbarItem_Click); 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 // GBGameGenieToolbarItem
// //
this.GBGameGenieToolbarItem.Image = ((System.Drawing.Image)(resources.GetObject("GBGameGenieToolbarItem.Image"))); 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.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.pcejin1;
this.PceBgViewerToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.PceBgViewerToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
this.PceBgViewerToolbarItem.Name = "PceBgViewerToolbarItem"; this.PceBgViewerToolbarItem.Name = "PceBgViewerToolbarItem";
this.PceBgViewerToolbarItem.Size = new System.Drawing.Size(42, 20); this.PceBgViewerToolbarItem.Size = new System.Drawing.Size(41, 20);
this.PceBgViewerToolbarItem.Text = "BG"; this.PceBgViewerToolbarItem.Text = "Bg";
this.PceBgViewerToolbarItem.ToolTipText = "PC Engine Background Viewer"; this.PceBgViewerToolbarItem.ToolTipText = "PC Engine Background Viewer";
this.PceBgViewerToolbarItem.Click += new System.EventHandler(this.PceBgViewerToolbarItem_Click); this.PceBgViewerToolbarItem.Click += new System.EventHandler(this.PceBgViewerToolbarItem_Click);
// //
@ -268,11 +280,12 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.CloseBtn; 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.CloseBtn);
this.Controls.Add(this.ToolBoxStrip); this.Controls.Add(this.ToolBoxStrip);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 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.Name = "ToolBox";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Load += new System.EventHandler(this.ToolBox_Load); this.Load += new System.EventHandler(this.ToolBox_Load);
@ -303,6 +316,7 @@
private System.Windows.Forms.ToolStripButton PceBgViewerToolbarItem; private System.Windows.Forms.ToolStripButton PceBgViewerToolbarItem;
private System.Windows.Forms.Button CloseBtn; private System.Windows.Forms.Button CloseBtn;
private System.Windows.Forms.ToolStripButton GBGameGenieToolbarItem; private System.Windows.Forms.ToolStripButton GBGameGenieToolbarItem;
private System.Windows.Forms.ToolStripButton GbGpuViewerToolBarItem;
} }
} }

View File

@ -27,8 +27,11 @@ namespace BizHawk.Client.EmuHawk
); );
SetTools(); SetTools();
ToolBoxStrip.Items[0].Select(); ToolBoxItems.First().Select();
SetText(); SetText();
SetSize();
ToolBoxItems.First().Select();
} }
public bool AskSave() { return true; } public bool AskSave() { return true; }
@ -59,56 +62,40 @@ namespace BizHawk.Client.EmuHawk
PceBgViewerToolbarItem.Visible = Global.Emulator is PCEngine; 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) foreach (var button in ToolBoxItems)
{ {
var toolBtn = button as ToolStripButton; var toolBtn = button as ToolStripButton;
toolBtn.Click += (o, e) => Close(); 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() private void SetSize()
{ {
var tools = ToolBoxItems.ToList(); var rows = (int)(Math.Ceiling(ToolBoxItems.Count() / 4.0));
this.Height = 30 + (rows * 30);
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);
} }
private void SetText() private void SetText()
{ {
Text = SelectedButtonText; var items = ToolBoxItems.ToList();
} if (items.Any(x => x.Selected))
private string SelectedButtonText
{
get
{ {
foreach (var button in ToolBoxStrip.Items) Text = items.FirstOrDefault(x => x.Selected).ToolTipText;
{ }
if (button is ToolStripButton) else
{ {
var toolBtn = button as ToolStripButton; Text = String.Empty;
if (toolBtn.Selected && toolBtn.Visible)
{
return toolBtn.ToolTipText;
}
}
}
return String.Empty;
} }
} }
@ -119,7 +106,7 @@ namespace BizHawk.Client.EmuHawk
{ {
get get
{ {
return ToolBoxStrip.Items.Cast<ToolStripItem>(); return ToolBoxStrip.Items.Cast<ToolStripItem>().Where(x => x.Visible);
} }
} }
@ -182,10 +169,7 @@ namespace BizHawk.Client.EmuHawk
private void TI83KeypadToolbarItem_Click(object sender, EventArgs e) private void TI83KeypadToolbarItem_Click(object sender, EventArgs e)
{ {
if (Global.Emulator is TI83) GlobalWin.Tools.Load<TI83KeyPad>();
{
GlobalWin.Tools.Load<TI83KeyPad>();
}
} }
private void TAStudioToolbarItem_Click(object sender, EventArgs e) private void TAStudioToolbarItem_Click(object sender, EventArgs e)
@ -195,10 +179,7 @@ namespace BizHawk.Client.EmuHawk
private void SNESGraphicsDebuggerToolbarItem_Click(object sender, EventArgs e) private void SNESGraphicsDebuggerToolbarItem_Click(object sender, EventArgs e)
{ {
if (Global.Emulator is LibsnesCore) GlobalWin.Tools.Load<SNESGraphicsDebugger>();
{
GlobalWin.Tools.Load<SNESGraphicsDebugger>();
}
} }
private void VirtualpadToolbarItem_Click(object sender, EventArgs e) private void VirtualpadToolbarItem_Click(object sender, EventArgs e)
@ -221,19 +202,16 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.MainForm.LoadGameGenieEc(); GlobalWin.MainForm.LoadGameGenieEc();
} }
private void GbGpuViewerToolBarItem_Click(object sender, EventArgs e)
{
GlobalWin.Tools.Load<GBGPUView>();
}
private void PceBgViewerToolbarItem_Click(object sender, EventArgs e) private void PceBgViewerToolbarItem_Click(object sender, EventArgs e)
{ {
if (Global.Emulator is PCEngine) GlobalWin.Tools.Load<PCEBGViewer>();
{
GlobalWin.Tools.Load<PCEBGViewer>();
}
} }
#endregion #endregion
private void toolStripButton1_Click(object sender, EventArgs e)
{
}
} }
} }

View File

@ -135,6 +135,17 @@
rAFLfvHbkLhtHd5w8nxL86Ji4fQcGTPkteLWRM5ATBwAWa1WCxj7eEEOPlXkYLONL4r1SqrHGiAP16zn rAFLfvHbkLhtHd5w8nxL86Ji4fQcGTPkteLWRM5ATBwAWa1WCxj7eEEOPlXkYLONL4r1SqrHGiAP16zn
DLABwzYDQ8N3PF6+nvcZ/3BYM/OcsJyWG8gaQISmrLg1gY/qb3BecUSqOSYO8APthE7itgbNRPo0fNE2 DLABwzYDQ8N3PF6+nvcZ/3BYM/OcsJyWG8gaQISmrLg1gY/qb3BecUSqOSYO8APthE7itgbNRPo0fNE2
WXFLks3nAXUgWBS2qRsoo4wyTDj3B3uOB2ePDD1gAAAAAElFTkSuQmCC WXFLks3nAXUgWBS2qRsoo4wyTDj3B3uOB2ePDD1gAAAAAElFTkSuQmCC
</value>
</data>
<data name="GbGpuViewerToolBarItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEQSURBVFhH7ZXRDYMwDEQzC7OwArMwS2dhBXZKdQ4XOZAQ
UMDpR096KgTse1/U/Xr8BsJfs/hpmgRcz/NMGRMRvyxLFCCQsBKRIkj0EoklvURk8TAMsQSciWAmjD6T
KECuiGBuozlRwK0f4YqIvP+GwMevVRGeYzasaMtBgJREzARyIl0EyF/ARADJlYPXBQhjKrCXAIyZQE0E
1yYChEUafY7ZsKItSSG+87zX50TfY3b7Y2pKsjQnQEoCJKy7n6SgJgFKAiSsvZ5kMRboMg2fnwmElfeS
LdOwmJQEwrr7kUW5Qt6zQD/fC8imxlRF9LkWkOkHcxDZg/JxHOU9mXgpRRGLcp1ExLpch8Vdyh+Ic19s
EmBku+z2SQAAAABJRU5ErkJggg==
</value> </value>
</data> </data>
<data name="GBGameGenieToolbarItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="GBGameGenieToolbarItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">