Toolbox Improvmeents - focus first icon to allow quick access via keyboard, close when user selects a tool, esc closes dialog, resize intelligently based on number and size of icons, minimize size of icons and flow horizontally with overflow, show selected icon tooltip text on dialog text property, also change hotkey to shift+T
This commit is contained in:
parent
eba245c171
commit
089f6bbd3d
|
@ -168,7 +168,7 @@ namespace BizHawk.Client.Common
|
|||
new Binding { DisplayName = "Lua Console", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 5 },
|
||||
new Binding { DisplayName = "Cheats", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 6 },
|
||||
new Binding { DisplayName = "TAStudio", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 7 },
|
||||
new Binding { DisplayName = "ToolBox", Bindings = "T", TabGroup = "Tools", DefaultBinding = "", Ordinal = 8 },
|
||||
new Binding { DisplayName = "ToolBox", Bindings = "Shift+T", TabGroup = "Tools", DefaultBinding = "", Ordinal = 8 },
|
||||
new Binding { DisplayName = "Virtual Pad", Bindings = "", TabGroup = "Tools", DefaultBinding = "", Ordinal = 9 },
|
||||
|
||||
new Binding { DisplayName = "New Search", Bindings = "", TabGroup = "Ram Search", DefaultBinding = "", Ordinal = 10 },
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ToolBox));
|
||||
this.CloseBtn = new System.Windows.Forms.Button();
|
||||
this.ToolBoxStrip = new ToolStripEx();
|
||||
this.CheatsToolBarItem = new System.Windows.Forms.ToolStripButton();
|
||||
this.RamWatchToolbarItem = new System.Windows.Forms.ToolStripButton();
|
||||
|
@ -46,15 +47,32 @@
|
|||
this.SNESGameGenieToolbarItem = new System.Windows.Forms.ToolStripButton();
|
||||
this.GGGameGenieToolbarItem = new System.Windows.Forms.ToolStripButton();
|
||||
this.GBGameGenieToolbarItem = new System.Windows.Forms.ToolStripButton();
|
||||
this.GameboyDebuggerTool = new System.Windows.Forms.ToolStripButton();
|
||||
this.ToolBoxStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// CloseBtn
|
||||
//
|
||||
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.Name = "CloseBtn";
|
||||
this.CloseBtn.Size = new System.Drawing.Size(0, 23);
|
||||
this.CloseBtn.TabIndex = 1;
|
||||
this.CloseBtn.TabStop = false;
|
||||
this.CloseBtn.UseVisualStyleBackColor = true;
|
||||
this.CloseBtn.Click += new System.EventHandler(this.CloseBtn_Click);
|
||||
this.CloseBtn.Enter += new System.EventHandler(this.CloseBtn_Enter);
|
||||
//
|
||||
// ToolBoxStrip
|
||||
//
|
||||
this.ToolBoxStrip.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.ToolBoxStrip.AutoSize = false;
|
||||
this.ToolBoxStrip.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.ToolBoxStrip.ClickThrough = true;
|
||||
this.ToolBoxStrip.Dock = System.Windows.Forms.DockStyle.None;
|
||||
this.ToolBoxStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
|
||||
this.ToolBoxStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.CheatsToolBarItem,
|
||||
this.RamWatchToolbarItem,
|
||||
|
@ -71,12 +89,13 @@
|
|||
this.SNESGraphicsDebuggerToolbarItem,
|
||||
this.SNESGameGenieToolbarItem,
|
||||
this.GGGameGenieToolbarItem,
|
||||
this.GBGameGenieToolbarItem,
|
||||
this.GameboyDebuggerTool});
|
||||
this.ToolBoxStrip.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Table;
|
||||
this.ToolBoxStrip.Location = new System.Drawing.Point(9, 11);
|
||||
this.GBGameGenieToolbarItem});
|
||||
this.ToolBoxStrip.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
|
||||
this.ToolBoxStrip.Location = new System.Drawing.Point(2, 2);
|
||||
this.ToolBoxStrip.Name = "ToolBoxStrip";
|
||||
this.ToolBoxStrip.Size = new System.Drawing.Size(100, 394);
|
||||
this.ToolBoxStrip.Padding = new System.Windows.Forms.Padding(0);
|
||||
this.ToolBoxStrip.Size = new System.Drawing.Size(239, 130);
|
||||
this.ToolBoxStrip.Stretch = true;
|
||||
this.ToolBoxStrip.TabIndex = 0;
|
||||
this.ToolBoxStrip.TabStop = true;
|
||||
//
|
||||
|
@ -85,8 +104,8 @@
|
|||
this.CheatsToolBarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Freeze;
|
||||
this.CheatsToolBarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.CheatsToolBarItem.Name = "CheatsToolBarItem";
|
||||
this.CheatsToolBarItem.Size = new System.Drawing.Size(63, 20);
|
||||
this.CheatsToolBarItem.Text = "Cheats";
|
||||
this.CheatsToolBarItem.Size = new System.Drawing.Size(23, 20);
|
||||
this.CheatsToolBarItem.ToolTipText = "Cheats";
|
||||
this.CheatsToolBarItem.Click += new System.EventHandler(this.CheatsToolBarItem_Click);
|
||||
//
|
||||
// RamWatchToolbarItem
|
||||
|
@ -94,8 +113,8 @@
|
|||
this.RamWatchToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.FindHS;
|
||||
this.RamWatchToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.RamWatchToolbarItem.Name = "RamWatchToolbarItem";
|
||||
this.RamWatchToolbarItem.Size = new System.Drawing.Size(88, 20);
|
||||
this.RamWatchToolbarItem.Text = "Ram Watch";
|
||||
this.RamWatchToolbarItem.Size = new System.Drawing.Size(23, 20);
|
||||
this.RamWatchToolbarItem.ToolTipText = "Ram Watch";
|
||||
this.RamWatchToolbarItem.Click += new System.EventHandler(this.RamWatchToolbarItem_Click);
|
||||
//
|
||||
// RamSearchToolbarItem
|
||||
|
@ -103,8 +122,8 @@
|
|||
this.RamSearchToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.search;
|
||||
this.RamSearchToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.RamSearchToolbarItem.Name = "RamSearchToolbarItem";
|
||||
this.RamSearchToolbarItem.Size = new System.Drawing.Size(89, 20);
|
||||
this.RamSearchToolbarItem.Text = "Ram Search";
|
||||
this.RamSearchToolbarItem.Size = new System.Drawing.Size(23, 20);
|
||||
this.RamSearchToolbarItem.ToolTipText = "Ram Search";
|
||||
this.RamSearchToolbarItem.Click += new System.EventHandler(this.RamSearchToolbarItem_Click);
|
||||
//
|
||||
// HexEditorToolbarItem
|
||||
|
@ -112,8 +131,8 @@
|
|||
this.HexEditorToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.poke;
|
||||
this.HexEditorToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.HexEditorToolbarItem.Name = "HexEditorToolbarItem";
|
||||
this.HexEditorToolbarItem.Size = new System.Drawing.Size(81, 20);
|
||||
this.HexEditorToolbarItem.Text = "Hex Editor";
|
||||
this.HexEditorToolbarItem.Size = new System.Drawing.Size(23, 20);
|
||||
this.HexEditorToolbarItem.ToolTipText = "Hex Editor";
|
||||
this.HexEditorToolbarItem.Click += new System.EventHandler(this.HexEditorToolbarItem_Click);
|
||||
//
|
||||
// LuaConsoleToolbarItem
|
||||
|
@ -121,8 +140,8 @@
|
|||
this.LuaConsoleToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.textdoc;
|
||||
this.LuaConsoleToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.LuaConsoleToolbarItem.Name = "LuaConsoleToolbarItem";
|
||||
this.LuaConsoleToolbarItem.Size = new System.Drawing.Size(92, 20);
|
||||
this.LuaConsoleToolbarItem.Text = "Lua Console";
|
||||
this.LuaConsoleToolbarItem.Size = new System.Drawing.Size(23, 20);
|
||||
this.LuaConsoleToolbarItem.ToolTipText = "Lua Console";
|
||||
this.LuaConsoleToolbarItem.Click += new System.EventHandler(this.LuaConsoleToolbarItem_Click);
|
||||
//
|
||||
// TAStudioToolbarItem
|
||||
|
@ -130,8 +149,8 @@
|
|||
this.TAStudioToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.TAStudio;
|
||||
this.TAStudioToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.TAStudioToolbarItem.Name = "TAStudioToolbarItem";
|
||||
this.TAStudioToolbarItem.Size = new System.Drawing.Size(76, 20);
|
||||
this.TAStudioToolbarItem.Text = "TAStudio";
|
||||
this.TAStudioToolbarItem.Size = new System.Drawing.Size(23, 20);
|
||||
this.TAStudioToolbarItem.ToolTipText = "TAStudio";
|
||||
this.TAStudioToolbarItem.Click += new System.EventHandler(this.TAStudioToolbarItem_Click);
|
||||
//
|
||||
// VirtualpadToolbarItem
|
||||
|
@ -139,8 +158,8 @@
|
|||
this.VirtualpadToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.GameController;
|
||||
this.VirtualpadToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.VirtualpadToolbarItem.Name = "VirtualpadToolbarItem";
|
||||
this.VirtualpadToolbarItem.Size = new System.Drawing.Size(86, 20);
|
||||
this.VirtualpadToolbarItem.Text = "VirtualPads";
|
||||
this.VirtualpadToolbarItem.Size = new System.Drawing.Size(23, 20);
|
||||
this.VirtualpadToolbarItem.ToolTipText = "Virtualpads";
|
||||
this.VirtualpadToolbarItem.Click += new System.EventHandler(this.VirtualpadToolbarItem_Click);
|
||||
//
|
||||
// NesDebuggerToolbarItem
|
||||
|
@ -148,8 +167,9 @@
|
|||
this.NesDebuggerToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.NESControllerIcon;
|
||||
this.NesDebuggerToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.NesDebuggerToolbarItem.Name = "NesDebuggerToolbarItem";
|
||||
this.NesDebuggerToolbarItem.Size = new System.Drawing.Size(79, 20);
|
||||
this.NesDebuggerToolbarItem.Text = "Debugger";
|
||||
this.NesDebuggerToolbarItem.Size = new System.Drawing.Size(49, 20);
|
||||
this.NesDebuggerToolbarItem.Text = "Dbg";
|
||||
this.NesDebuggerToolbarItem.ToolTipText = "Nes Debugger";
|
||||
this.NesDebuggerToolbarItem.Click += new System.EventHandler(this.NesDebuggerToolbarItem_Click);
|
||||
//
|
||||
// NesPPUToolbarItem
|
||||
|
@ -159,6 +179,7 @@
|
|||
this.NesPPUToolbarItem.Name = "NesPPUToolbarItem";
|
||||
this.NesPPUToolbarItem.Size = new System.Drawing.Size(49, 20);
|
||||
this.NesPPUToolbarItem.Text = "PPU";
|
||||
this.NesPPUToolbarItem.ToolTipText = "Nes PPU Viewer";
|
||||
this.NesPPUToolbarItem.Click += new System.EventHandler(this.NesPPUToolbarItem_Click);
|
||||
//
|
||||
// NesNameTableToolbarItem
|
||||
|
@ -166,8 +187,9 @@
|
|||
this.NesNameTableToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.NESControllerIcon;
|
||||
this.NesNameTableToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.NesNameTableToolbarItem.Name = "NesNameTableToolbarItem";
|
||||
this.NesNameTableToolbarItem.Size = new System.Drawing.Size(85, 20);
|
||||
this.NesNameTableToolbarItem.Text = "Nametable";
|
||||
this.NesNameTableToolbarItem.Size = new System.Drawing.Size(40, 20);
|
||||
this.NesNameTableToolbarItem.Text = "Nt";
|
||||
this.NesNameTableToolbarItem.ToolTipText = "Nes Nametable Viewer";
|
||||
this.NesNameTableToolbarItem.Click += new System.EventHandler(this.NesNameTableToolbarItem_Click);
|
||||
//
|
||||
// NesGameGenieToolbarItem
|
||||
|
@ -175,8 +197,9 @@
|
|||
this.NesGameGenieToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.NESControllerIcon;
|
||||
this.NesGameGenieToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.NesGameGenieToolbarItem.Name = "NesGameGenieToolbarItem";
|
||||
this.NesGameGenieToolbarItem.Size = new System.Drawing.Size(91, 20);
|
||||
this.NesGameGenieToolbarItem.Text = "Game Genie";
|
||||
this.NesGameGenieToolbarItem.Size = new System.Drawing.Size(43, 20);
|
||||
this.NesGameGenieToolbarItem.Text = "GG";
|
||||
this.NesGameGenieToolbarItem.ToolTipText = "NES Game Genie Encoder/Decoder";
|
||||
this.NesGameGenieToolbarItem.Click += new System.EventHandler(this.NesGameGenieToolbarItem_Click);
|
||||
//
|
||||
// TI83KeypadToolbarItem
|
||||
|
@ -184,8 +207,8 @@
|
|||
this.TI83KeypadToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.calculator;
|
||||
this.TI83KeypadToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.TI83KeypadToolbarItem.Name = "TI83KeypadToolbarItem";
|
||||
this.TI83KeypadToolbarItem.Size = new System.Drawing.Size(66, 20);
|
||||
this.TI83KeypadToolbarItem.Text = "Keypad";
|
||||
this.TI83KeypadToolbarItem.Size = new System.Drawing.Size(23, 20);
|
||||
this.TI83KeypadToolbarItem.ToolTipText = "TI83 Keypad";
|
||||
this.TI83KeypadToolbarItem.Click += new System.EventHandler(this.TI83KeypadToolbarItem_Click);
|
||||
//
|
||||
// SNESGraphicsDebuggerToolbarItem
|
||||
|
@ -193,8 +216,9 @@
|
|||
this.SNESGraphicsDebuggerToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SNESControllerIcon;
|
||||
this.SNESGraphicsDebuggerToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.SNESGraphicsDebuggerToolbarItem.Name = "SNESGraphicsDebuggerToolbarItem";
|
||||
this.SNESGraphicsDebuggerToolbarItem.Size = new System.Drawing.Size(99, 20);
|
||||
this.SNESGraphicsDebuggerToolbarItem.Text = "Gfx Debugger";
|
||||
this.SNESGraphicsDebuggerToolbarItem.Size = new System.Drawing.Size(44, 20);
|
||||
this.SNESGraphicsDebuggerToolbarItem.Text = "Gfx";
|
||||
this.SNESGraphicsDebuggerToolbarItem.ToolTipText = "SNES Gfx Debugger";
|
||||
this.SNESGraphicsDebuggerToolbarItem.Click += new System.EventHandler(this.SNESGraphicsDebuggerToolbarItem_Click);
|
||||
//
|
||||
// SNESGameGenieToolbarItem
|
||||
|
@ -202,8 +226,9 @@
|
|||
this.SNESGameGenieToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SNESControllerIcon;
|
||||
this.SNESGameGenieToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.SNESGameGenieToolbarItem.Name = "SNESGameGenieToolbarItem";
|
||||
this.SNESGameGenieToolbarItem.Size = new System.Drawing.Size(91, 20);
|
||||
this.SNESGameGenieToolbarItem.Text = "Game Genie";
|
||||
this.SNESGameGenieToolbarItem.Size = new System.Drawing.Size(43, 20);
|
||||
this.SNESGameGenieToolbarItem.Text = "GG";
|
||||
this.SNESGameGenieToolbarItem.ToolTipText = "SNES Game Genie Encoder/Decoder";
|
||||
this.SNESGameGenieToolbarItem.Click += new System.EventHandler(this.SNESGameGenieToolbarItem_Click);
|
||||
//
|
||||
// GGGameGenieToolbarItem
|
||||
|
@ -211,8 +236,9 @@
|
|||
this.GGGameGenieToolbarItem.Image = ((System.Drawing.Image)(resources.GetObject("GGGameGenieToolbarItem.Image")));
|
||||
this.GGGameGenieToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.GGGameGenieToolbarItem.Name = "GGGameGenieToolbarItem";
|
||||
this.GGGameGenieToolbarItem.Size = new System.Drawing.Size(91, 20);
|
||||
this.GGGameGenieToolbarItem.Text = "Game Genie";
|
||||
this.GGGameGenieToolbarItem.Size = new System.Drawing.Size(43, 20);
|
||||
this.GGGameGenieToolbarItem.Text = "GG";
|
||||
this.GGGameGenieToolbarItem.ToolTipText = "Game Gear Game Genie Encoder/Decoder";
|
||||
this.GGGameGenieToolbarItem.Click += new System.EventHandler(this.GGGameGenieToolbarItem_Click);
|
||||
//
|
||||
// GBGameGenieToolbarItem
|
||||
|
@ -220,31 +246,27 @@
|
|||
this.GBGameGenieToolbarItem.Image = ((System.Drawing.Image)(resources.GetObject("GBGameGenieToolbarItem.Image")));
|
||||
this.GBGameGenieToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.GBGameGenieToolbarItem.Name = "GBGameGenieToolbarItem";
|
||||
this.GBGameGenieToolbarItem.Size = new System.Drawing.Size(91, 20);
|
||||
this.GBGameGenieToolbarItem.Text = "Game Genie";
|
||||
this.GBGameGenieToolbarItem.Size = new System.Drawing.Size(43, 20);
|
||||
this.GBGameGenieToolbarItem.Text = "GG";
|
||||
this.GBGameGenieToolbarItem.ToolTipText = "Gameboy Game Genie Encoder/Decoder";
|
||||
this.GBGameGenieToolbarItem.Click += new System.EventHandler(this.GBGameGenieToolbarItem_Click);
|
||||
//
|
||||
// GameboyDebuggerTool
|
||||
//
|
||||
this.GameboyDebuggerTool.Name = "GameboyDebuggerTool";
|
||||
this.GameboyDebuggerTool.Size = new System.Drawing.Size(23, 4);
|
||||
//
|
||||
// ToolBox
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(171, 449);
|
||||
this.CancelButton = this.CloseBtn;
|
||||
this.ClientSize = new System.Drawing.Size(242, 134);
|
||||
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.Name = "ToolBox";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Tool Box";
|
||||
this.Load += new System.EventHandler(this.ToolBox_Load);
|
||||
this.ToolBoxStrip.ResumeLayout(false);
|
||||
this.ToolBoxStrip.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
|
@ -262,12 +284,12 @@
|
|||
private System.Windows.Forms.ToolStripButton NesNameTableToolbarItem;
|
||||
private System.Windows.Forms.ToolStripButton TI83KeypadToolbarItem;
|
||||
private System.Windows.Forms.ToolStripButton VirtualpadToolbarItem;
|
||||
private System.Windows.Forms.ToolStripButton GameboyDebuggerTool;
|
||||
private System.Windows.Forms.ToolStripButton SNESGraphicsDebuggerToolbarItem;
|
||||
private System.Windows.Forms.ToolStripButton SNESGameGenieToolbarItem;
|
||||
private System.Windows.Forms.ToolStripButton TAStudioToolbarItem;
|
||||
private System.Windows.Forms.ToolStripButton GGGameGenieToolbarItem;
|
||||
private System.Windows.Forms.ToolStripButton GBGameGenieToolbarItem;
|
||||
private System.Windows.Forms.Button CloseBtn;
|
||||
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
|
@ -23,7 +25,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.MainForm.Location.Y
|
||||
);
|
||||
|
||||
HideShowIcons();
|
||||
SetTools();
|
||||
ToolBoxStrip.Items[0].Select();
|
||||
SetText();
|
||||
}
|
||||
|
||||
public bool AskSave() { return true; }
|
||||
|
@ -32,10 +36,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void Restart()
|
||||
{
|
||||
HideShowIcons();
|
||||
SetTools();
|
||||
}
|
||||
|
||||
private void HideShowIcons()
|
||||
private void SetTools()
|
||||
{
|
||||
NesPPUToolbarItem.Visible =
|
||||
NesDebuggerToolbarItem.Visible =
|
||||
|
@ -54,9 +58,83 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
GBGameGenieToolbarItem.Visible = Global.Game.System == "GB";
|
||||
|
||||
Size = new Size(Size.Width, ToolBoxStrip.Size.Height + 50);
|
||||
foreach (var button in ToolBoxItems)
|
||||
{
|
||||
//if (button is ToolStripButton)
|
||||
//{
|
||||
var toolBtn = button as ToolStripButton;
|
||||
toolBtn.Click += (o, e) => Close();
|
||||
toolBtn.Paint += (o, e) => 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);
|
||||
}
|
||||
|
||||
private void SetText()
|
||||
{
|
||||
Text = SelectedButtonText;
|
||||
}
|
||||
|
||||
private string SelectedButtonText
|
||||
{
|
||||
get
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provide LINQ capabilities to an outdated form collection
|
||||
/// </summary>
|
||||
private IEnumerable<ToolStripItem> ToolBoxItems
|
||||
{
|
||||
get
|
||||
{
|
||||
return ToolBoxStrip.Items.Cast<ToolStripItem>();
|
||||
}
|
||||
}
|
||||
|
||||
private void CloseBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void CloseBtn_Enter(object sender, EventArgs e)
|
||||
{
|
||||
ToolBoxStrip.Focus();
|
||||
}
|
||||
|
||||
#region Icon Clicks
|
||||
|
||||
private void CheatsToolBarItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWin.Tools.Load<Cheats>();
|
||||
|
@ -142,5 +220,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
GlobalWin.MainForm.LoadGameGenieEc();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue