Hide debug tools from Tool Box and add ext. tools

This commit is contained in:
YoshiRulz 2023-02-08 06:19:05 +10:00
parent 8b7cba96bb
commit e7884f6796
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 16 additions and 1 deletions

View File

@ -1019,7 +1019,7 @@ namespace BizHawk.Client.EmuHawk
private readonly IGL GL;
private readonly ExternalToolManager ExtToolManager;
internal readonly ExternalToolManager ExtToolManager;
public readonly ToolManager Tools;

View File

@ -19,6 +19,9 @@ namespace BizHawk.Client.EmuHawk
private static readonly Lazy<IReadOnlyCollection<Type>> ToolTypes = new(() => EmuHawk.ReflectionCache.Types
.Where(static t => typeof(IToolForm).IsAssignableFrom(t) && typeof(Form).IsAssignableFrom(t))
#if DEBUG
.Where(static t => t.Namespace is not "BizHawk.Client.EmuHawk.ForDebugging")
#endif
.Where(VersionInfo.DeveloperBuild
? static t => true
: static t => !t.GetCustomAttributes(false).OfType<ToolAttribute>().Any(static a => !a.Released))
@ -67,6 +70,18 @@ namespace BizHawk.Client.EmuHawk
tsb.Click += (_, _) => Tools.Load(t);
ToolBoxStrip.Items.Add(tsb);
}
foreach (var tsi in ((MainForm) MainForm).ExtToolManager.ToolStripItems) //TODO nicer encapsulation
{
if (!tsi.Enabled) continue;
ToolStripButton tsb = new() {
DisplayStyle = ToolStripItemDisplayStyle.Image,
Image = tsi.Image ?? IconMissingIcon.Value,
Text = tsi.Text,
};
var info = (ExternalToolManager.MenuItemInfo) tsi.Tag;
tsb.Click += (_, _) => info.TryLoad();
ToolBoxStrip.Items.Add(tsb);
}
}
private void SetSize()