From 96778d8a7b55f8d46a184b4afe9f855e75691380 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Sat, 19 Feb 2022 16:56:29 -0500 Subject: [PATCH] Store sketch renderer in PreprocessorResult --- .../java/preproc/PdeParseTreeListener.java | 1 + .../mode/java/preproc/PreprocessorResult.java | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/java/src/processing/mode/java/preproc/PdeParseTreeListener.java b/java/src/processing/mode/java/preproc/PdeParseTreeListener.java index 93fd7bc6d..375f26133 100644 --- a/java/src/processing/mode/java/preproc/PdeParseTreeListener.java +++ b/java/src/processing/mode/java/preproc/PdeParseTreeListener.java @@ -290,6 +290,7 @@ public class PdeParseTreeListener extends ProcessingBaseListener { allEdits, sketchWidth, sketchHeight, + sketchRenderer, issues ); } diff --git a/java/src/processing/mode/java/preproc/PreprocessorResult.java b/java/src/processing/mode/java/preproc/PreprocessorResult.java index 680f75bbf..972abf1ac 100644 --- a/java/src/processing/mode/java/preproc/PreprocessorResult.java +++ b/java/src/processing/mode/java/preproc/PreprocessorResult.java @@ -42,6 +42,7 @@ public class PreprocessorResult { private final List preprocessIssues; private final String sketchWidth; private final String sketchHeight; + private final String sketchRenderer; /** * Create a new PreprocessorResult indicating that there were issues in preprocessing. @@ -67,10 +68,11 @@ public class PreprocessorResult { * @param newEdits The edits made during preprocessing. * @param newSketchWidth The width of the sketch in pixels or special value like displayWidth; * @param newSketchHeight The height of the sketch in pixels or special value like displayWidth; + * @param newSketchRenderer The renderer of the sketch. */ public PreprocessorResult(PdePreprocessor.Mode newProgramType, int newHeaderOffset, String newClassName, List newImportStatements, - List newEdits, String newSketchWidth, String newSketchHeight) { + List newEdits, String newSketchWidth, String newSketchHeight, String newSketchRenderer) { if (newClassName == null) { throw new RuntimeException("Could not find main class"); @@ -85,6 +87,7 @@ public class PreprocessorResult { sketchWidth = newSketchWidth; sketchHeight = newSketchHeight; + sketchRenderer = newSketchRenderer; } /** @@ -98,10 +101,11 @@ public class PreprocessorResult { * @param newEdits The edits made during preprocessing. * @param newSketchWidth The width of the sketch in pixels or special value like displayWidth; * @param newSketchHeight The height of the sketch in pixels or special value like displayWidth; + * @param newSketchRenderer The renderer of the sketch. */ public PreprocessorResult(PdePreprocessor.Mode newProgramType, int newHeaderOffset, String newClassName, List newImportStatements, - List newEdits, String newSketchWidth, String newSketchHeight, + List newEdits, String newSketchWidth, String newSketchHeight, String newSketchRenderer, List newPreprocessIssues) { if (newClassName == null) { @@ -117,6 +121,7 @@ public class PreprocessorResult { sketchWidth = newSketchWidth; sketchHeight = newSketchHeight; + sketchRenderer = newSketchRenderer; } /** @@ -134,6 +139,7 @@ public class PreprocessorResult { sketchWidth = null; sketchHeight = null; + sketchRenderer = null; } /** @@ -210,4 +216,14 @@ public class PreprocessorResult { public String getSketchHeight() { return sketchHeight; } + + /** + * Get the user provided renderer of this sketch. + * + * @return The renderer of the sketch or null if none + * given. + */ + public String getSketchRenderer() { + return sketchRenderer; + } }