From: <ha...@us...> - 2010-04-29 19:45:06
|
Revision: 12984 http://jmol.svn.sourceforge.net/jmol/?rev=12984&view=rev Author: hansonr Date: 2010-04-29 19:45:00 +0000 (Thu, 29 Apr 2010) Log Message: ----------- 12.0.RC9 VERSION #bug fix: drag drop embedded states Modified Paths: -------------- trunk/Jmol/src/org/jmol/script/ScriptCompiler.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/script/ScriptCompiler.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptCompiler.java 2010-04-29 19:37:07 UTC (rev 12983) +++ trunk/Jmol/src/org/jmol/script/ScriptCompiler.java 2010-04-29 19:45:00 UTC (rev 12984) @@ -191,15 +191,23 @@ script = script.substring(0, pt); } haveComments = (script.indexOf("#") >= 0); // speeds processing - pt = script.indexOf(JmolConstants.EMBEDDED_SCRIPT_TAG); + return getEmbeddedScript(script); + } + + public static String getEmbeddedScript(String script) { + if (script == null) + return script; + int pt = script.indexOf(JmolConstants.EMBEDDED_SCRIPT_TAG); if (pt < 0) return script; int pt1 = script.lastIndexOf("/*", pt); - int pt2 = script.indexOf((script.charAt(pt1 + 2) == '*' ? "*" : "") + "*/", pt); - return (pt1 < 0 || pt2 < pt ? script - : script.substring(pt + JmolConstants.EMBEDDED_SCRIPT_TAG.length(), pt2)) + "\n"; + int pt2 = script.indexOf((script.charAt(pt1 + 2) == '*' ? "*" : "") + "*/", + pt); + return (pt1 < 0 || pt2 < pt ? script : script.substring(pt + + JmolConstants.EMBEDDED_SCRIPT_TAG.length(), pt2)) + + "\n"; } - + private ScriptFlowContext flowContext; private Vector ltoken; private Vector lltoken; Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2010-04-29 19:37:07 UTC (rev 12983) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2010-04-29 19:45:00 UTC (rev 12984) @@ -6874,7 +6874,7 @@ "DATA_API", "getScriptEditor", Boolean.TRUE); if (msg != null) { scriptEditor.setFilename(filename); - scriptEditor.output(msg); + scriptEditor.output(ScriptCompiler.getEmbeddedScript(msg)); } scriptEditor.setVisible(true); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |