1
0
mirror of https://github.com/fadden/6502bench.git synced 2026-01-22 23:16:20 +00:00

Tweak visualizer interface

Report visualization generation errors through an explicit
IApplication interface, instead of pulling messages out of the
DebugLog stream.

Declare that GetVisGenDescrs() is only called when the plugin is in
the "prepared" state, so that plugins can taylor the set based on
the contents of the file.  (This could be used to set min/max on
the "offset" entries, but I want special handling for offsets, so
we might as well set it later.)
This commit is contained in:
Andy McFadden
2019-12-05 10:21:07 -08:00
parent 4ef1d7e7c7
commit 4bf1ab2799
6 changed files with 48 additions and 22 deletions

View File

@@ -91,6 +91,10 @@ namespace SourceGen {
private class ScriptSupport : MarshalByRefObject, PluginCommon.IApplication {
public ScriptSupport() { }
public void ReportError(string msg) {
DebugLog(msg);
}
public void DebugLog(string msg) {
Debug.WriteLine("Vis plugin: " + msg);
}
@@ -130,22 +134,22 @@ namespace SourceGen {
}
Debug.WriteLine("Vis needs refresh: " + vis.Tag);
if (iapp == null) {
// Prep the plugins on first need.
iapp = new ScriptSupport();
project.PrepareScripts(iapp);
}
if (plugins == null) {
plugins = project.GetActivePlugins();
}
IPlugin_Visualizer vplug = FindPluginByVisGenIdent(plugins,
vis.VisGenIdent, out VisDescr visDescr);
if (vplug == null) {
Debug.WriteLine("Unable to referesh " + vis.Tag + ": plugin not found");
Debug.WriteLine("Unable to refresh " + vis.Tag + ": plugin not found");
continue;
}
if (iapp == null) {
// Prep the plugins on first need.
iapp = new ScriptSupport();
project.PrepareScripts(iapp);
}
IVisualization2d vis2d;
try {
vis2d = vplug.Generate2d(visDescr,