srecord noeq JGazelleVScriptRunner(SimpleLiveValue lvScript) { GazelleVScript parsedScript; O result; SingleComponentPanel scpScriptResult = singleComponentPanel(); new WeakVar isScriptResult; JComponent scriptAndResultPanel() { ret northAndCenter( scriptInputField(), scpScriptResult = singleComponentPanel() ); } JComponent scriptInputField() { ret withMargin(centerAndEastWithMargin( withLabel("Gazelle V Script:", jLiveTextField(lvScript)), jPopDownButton_noText( "Show Scripting Help", rThread { showText(GazelleVScript.helpText) }) )); } void showScriptOutput { //print(result := className(result)); if (result cast BWImage) { var c = scpScriptResult.getComponent(); if (isShowing(isScriptResult!)) { isScriptResult->setImage(result); } else { var is = stdImageSurface(); is.setImage(result); scpScriptResult.set(jscroll_centered(is)); isScriptResult.set(is); } } else scpScriptResult.set(jcenteredlabel(shorten(1000, str(result)))); } ImageSurface stdImageSurface() { ret pixelatedImageSurface().setAutoZoomToDisplay(true).repaintInThread(false); } void parse { parsedScript = new GazelleVScript(lvScript!); } void runOn(IBWIntegralImage ii) { var run = parsedScript.new Run(); run.setIntegralImage(ii); run.run(); result = run.result(); } void parseAndRunOn(IBWIntegralImage ii) { try { parse(); runOn(ii); } catch e { result = exceptionToStringShort(e); printStackTrace(e); } showScriptOutput(); } }