Revision: 5129
Author: hansonr
Date: 2006-05-17 06:22:16 -0700 (Wed, 17 May 2006)
ViewCVS: http://svn.sourceforge.net/jmol/?rev=5129&view=rev
Log Message:
-----------
bob200603 adds "set defaultLoadScript"
Modified Paths:
--------------
branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java
branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java 2006-05-17
13:17:27 UTC (rev 5128)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java 2006-05-17
13:22:16 UTC (rev 5129)
@@ -721,9 +721,13 @@
}
void stringExpected() throws ScriptException {
- evalError("string or identifier expected");
+ evalError("quoted string expected");
}
+ void stringOrIdentifierExpected() throws ScriptException {
+ evalError("quoted string or identifier expected");
+ }
+
void propertyNameExpected() throws ScriptException {
evalError("property name expected");
}
@@ -1679,9 +1683,19 @@
evalError(errMsg);
if (logMessages)
viewer.scriptStatus("Successfully loaded:" + filename);
+ String defaultScript = viewer.getDefaultLoadScript();
+ String msg = "";
+ if (defaultScript.length() > 0)
+ msg += "\nUsing defaultLoadScript: "+defaultScript;
String script = viewer.getModelSetProperty("jmolscript");
- if (script != null)
- runScript(script);
+ if (script != null) {
+ msg += "\nAdding embedded #jmolscript: "+script;
+ defaultScript+=";"+script;
+ }
+ if (msg.length() > 0)
+ System.out.println(msg);
+ if (defaultScript.length() > 0)
+ runScript(defaultScript);
}
void monitor() throws ScriptException {
@@ -2922,6 +2936,11 @@
pt = getCoordinate(2);
}
viewer.setDefaultLattice(pt);
+ } else if
(((String)statement[1].value).equalsIgnoreCase("defaultLoadScript")) {
+ checkLength3();
+ if (statement[2].tok != Token.string)
+ stringExpected();
+ viewer.setDefaultLoadScript((String) statement[2].value);
} else {
viewer.setBooleanProperty((String) statement[1].value,
getSetBoolean());
}
@@ -3536,15 +3555,15 @@
data = viewer.simpleReplace(data, " ", "\n");
propertyName = "bufferedReaderOnePerLine";
}
- data = viewer.simpleReplace(data, "[", " ");
+ data = viewer.simpleReplace(data, "{", " ");
data = viewer.simpleReplace(data, ",", " ");
- data = viewer.simpleReplace(data, "]", " ");
+ data = viewer.simpleReplace(data, "}", " ");
data = viewer.simpleReplace(data, "|", "\n");
data = viewer.simpleReplace(data, "\n\n", "\n");
System.out.println("pmesh inline data:\n" + data);
t = viewer.getBufferedReaderForString(data);
} else {
- stringExpected();
+ stringOrIdentifierExpected();
break;
}
} else {
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java 2006-05-17
13:17:27 UTC (rev 5128)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java 2006-05-17
13:22:16 UTC (rev 5129)
@@ -2044,6 +2044,15 @@
eval.haltExecution();
}
+ String defaultLoadScript = "";
+ void setDefaultLoadScript(String script) {
+ defaultLoadScript = script;
+ }
+
+ String getDefaultLoadScript() {
+ return defaultLoadScript;
+ }
+
boolean chainCaseSensitive = false;
boolean getChainCaseSensitive() {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jmol-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-commits