Hide debug tools from Tool Box and add ext. tools
This commit is contained in:
parent
8b7cba96bb
commit
e7884f6796
|
@ -1019,7 +1019,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private readonly IGL GL;
|
||||
|
||||
private readonly ExternalToolManager ExtToolManager;
|
||||
internal readonly ExternalToolManager ExtToolManager;
|
||||
|
||||
public readonly ToolManager Tools;
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue