Revision: 5200
Author: hansonr
Date: 2006-06-03 11:16:30 -0700 (Sat, 03 Jun 2006)
ViewCVS: http://svn.sourceforge.net/jmol/?rev=5200&view=rev
Log Message:
-----------
bob200603 adds
show url "[optional url or filename]"
Modified Paths:
--------------
branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java
branches/bob200603/Jmol/src/org/jmol/viewer/FileManager.java
branches/bob200603/Jmol/src/org/jmol/viewer/Token.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-06-03
09:52:23 UTC (rev 5199)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java 2006-06-03
18:16:30 UTC (rev 5200)
@@ -3463,7 +3463,7 @@
case Token.file:
showFile();
break;
- case Token.boundbox:
+ case Token.boundbox:
showBoundbox();
break;
case Token.zoom:
@@ -3478,6 +3478,9 @@
case Token.isosurface:
showIsosurface();
break;
+ case Token.url:
+ showUrl();
+ break;
// not implemented
case Token.spin:
case Token.list:
@@ -3529,20 +3532,31 @@
}
void showFile() throws ScriptException {
- System.out.println("showFile && statementLength=" + statementLength);
if (statementLength == 2) {
showString(viewer.getCurrentFileAsString());
return;
}
if (statementLength == 3 && statement[2].tok == Token.string) {
String fileName = (String) statement[2].value;
- System.out.println("fileName=" + fileName);
showString(viewer.getFileAsString(fileName));
return;
}
invalidArgument();
}
+ void showUrl() throws ScriptException {
+ if (statementLength == 2) {
+ viewer.showUrl(viewer.getFullPathName());
+ return;
+ }
+ if (statementLength == 3 && statement[2].tok == Token.string) {
+ String fileName = (String) statement[2].value;
+ viewer.showUrl(fileName);
+ return;
+ }
+ invalidArgument();
+ }
+
void showAnimation() {
showString("show animation information goes here");
}
@@ -3980,11 +3994,30 @@
propertyValue = getPoint4f(i);
i = pcLastExpressionInstruction;
break;
- case Token.identifier:
+ case Token.background:
+ propertyName = "background";
+ propertyValue = Boolean.TRUE;
+ break;
+ case Token.identifier:
if (((String) token.value).equalsIgnoreCase("fileIndex")) {
fileIndexPt = i + 1;
break;
}
+ if (((String) token.value).equalsIgnoreCase("noBackground")) {
+ propertyName = "background";
+ propertyValue = Boolean.FALSE;
+ break;
+ }
+ if (((String) token.value).equalsIgnoreCase("debug")) {
+ propertyName = "debug";
+ propertyValue = Boolean.TRUE;
+ break;
+ }
+ if (((String) token.value).equalsIgnoreCase("noDebug")) {
+ propertyName = "debug";
+ propertyValue = Boolean.FALSE;
+ break;
+ }
if (((String) token.value).equalsIgnoreCase("gridPoints")) {
propertyName = "gridPoints";
break;
@@ -4037,7 +4070,7 @@
}
if (colorRangeStage == 0 || colorRangeStage >= 3)
invalidArgument();
- propertyName = colorRangeStage == 1 ? "rangeMin" : "rangeMax";
+ propertyName = colorRangeStage == 1 ? "red" : "blue";
propertyValue = new Float(floatParameter(i));
++colorRangeStage;
break;
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/FileManager.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/FileManager.java
2006-06-03 09:52:23 UTC (rev 5199)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/FileManager.java
2006-06-03 18:16:30 UTC (rev 5200)
@@ -235,6 +235,12 @@
return fileName != null ? fileName : nameAsGiven;
}
+ String getAppletDocumentBase() {
+ if (appletDocumentBase == null)
+ return "";
+ return appletDocumentBase.toString();
+ }
+
void setAppletContext(URL documentBase, URL codeBase,
String jmolAppletProxy) {
appletDocumentBase = documentBase;
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Token.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Token.java 2006-06-03
09:52:23 UTC (rev 5199)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Token.java 2006-06-03
18:16:30 UTC (rev 5200)
@@ -254,6 +254,7 @@
final static int translation = showparam | 9;
// chime show parameters
final static int residue = showparam | 10;
+ final static int url = showparam | 11;
// mlp
// list
// spin
@@ -614,6 +615,7 @@
"transform", new Token(transform, "transform"),
"orientation", new Token(orientation, "orientation"),
"file", new Token(file, "file"),
+ "url", new Token(url, "url"),
// atom expressions
"(", new Token(leftparen, "("),
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java 2006-06-03
09:52:23 UTC (rev 5199)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java 2006-06-03
18:16:30 UTC (rev 5200)
@@ -2397,6 +2397,18 @@
}
public void showUrl(String urlString) {
+ if (urlString.indexOf(":") < 0) {
+ String base = fileManager.getAppletDocumentBase();
+ if (base == "")
+ base = fileManager.getFullPathName();
+ if (base.indexOf("/") >=0) {
+ base = base.substring(0, base.lastIndexOf("/") + 1);
+ } else if (base.indexOf("\\") >=0) {
+ base = base.substring(0, base.lastIndexOf("\\") + 1);
+ }
+ urlString = base + urlString;
+ }
+ System.out.println("showUrl:" + urlString);
statusManager.showUrl(urlString);
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Jmol-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-commits