From 51a84706dad8971096828b855b275adf07dc808b Mon Sep 17 00:00:00 2001 From: fjenett Date: Sun, 22 Jan 2012 11:00:08 +0000 Subject: [PATCH] fixed #971 - js mode - warn about size on export only once per session --- .../mode/javascript/JavaScriptBuild.java | 22 +++++++++++-------- .../mode/javascript/JavaScriptMode.java | 2 ++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/app/src/processing/mode/javascript/JavaScriptBuild.java b/app/src/processing/mode/javascript/JavaScriptBuild.java index 30a9f08bc..b4ed512f5 100644 --- a/app/src/processing/mode/javascript/JavaScriptBuild.java +++ b/app/src/processing/mode/javascript/JavaScriptBuild.java @@ -104,7 +104,7 @@ public class JavaScriptBuild * you have more than one sketch each will need a separate builder. */ protected Sketch sketch; - + protected Mode mode; protected File binFolder; @@ -208,14 +208,18 @@ public class JavaScriptBuild // renderer } catch (NumberFormatException e) { - // found a reference to size, but it didn't seem to contain numbers - final String message = - "The size of this applet could not automatically be\n" + - "determined from your code. You'll have to edit the\n" + - "HTML file to set the size of the applet.\n" + - "Use only numeric values (not variables) for the size()\n" + - "command. See the size() reference for an explanation."; - Base.showWarning("Could not find applet size", message, null); + if ( ((JavaScriptMode)mode).showSizeWarning ) { + // found a reference to size, but it didn't seem to contain numbers + final String message = + "The size of this applet could not automatically be\n" + + "determined from your code. You'll have to edit the\n" + + "HTML file to set the size of the applet.\n" + + "Use only numeric values (not variables) for the size()\n" + + "command. See the size() reference for an explanation."; + Base.showWarning("Could not find applet size", message, null); + // warn only once .. + ((JavaScriptMode)mode).showSizeWarning = false; + } } } // else no size() command found, defaults will be used diff --git a/app/src/processing/mode/javascript/JavaScriptMode.java b/app/src/processing/mode/javascript/JavaScriptMode.java index d1ee43957..4c830286c 100644 --- a/app/src/processing/mode/javascript/JavaScriptMode.java +++ b/app/src/processing/mode/javascript/JavaScriptMode.java @@ -22,6 +22,8 @@ import processing.mode.java.JavaMode; */ public class JavaScriptMode extends Mode { + public boolean showSizeWarning = true; + private JavaScriptEditor jsEditor; // create a new editor with the mode