From: Michael T H. <mic...@us...> - 2003-10-01 09:43:47
|
Update of /cvsroot/jmol/Jmol/src In directory sc8-pr-cvs1:/tmp/cvs-serv30115/src Modified Files: JmolApplet.java JmolAppletControl.java JmolAppletRegistry.java Log Message: mouse and registry stuff for MacOS 9 Index: JmolApplet.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/JmolApplet.java,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- JmolApplet.java 30 Sep 2003 22:14:50 -0000 1.44 +++ JmolApplet.java 1 Oct 2003 09:42:12 -0000 1.45 @@ -43,6 +43,7 @@ JmolViewer viewer; boolean jvm12orGreater; + String emulate; Jvm12 jvm12; JmolPopup jmolpopup; String htmlName; @@ -50,7 +51,7 @@ JSObject jsoWindow; - String mayscript; + boolean mayScript; String animFrameCallback; String loadStructCallback; String messageCallback; @@ -92,7 +93,8 @@ public void init() { htmlName = getParameter("name"); - appletRegistry = new JmolAppletRegistry(htmlName, this); + mayScript = getParameter("mayscript") != null; + appletRegistry = new JmolAppletRegistry(htmlName, mayScript, this); loadProperties(); initWindows(); @@ -117,8 +119,7 @@ if (jvm12orGreater) jvm12 = new Jvm12(this); - mayscript = getParameter("mayscript"); - if (mayscript != null) { + if (mayScript) { try { jsoWindow = JSObject.getWindow(this); } catch (Exception e) { @@ -175,27 +176,36 @@ return defaultValue; } + private String getValueLowerCase(String paramName, String defaultValue) { + String value = getValue(paramName, defaultValue); + if (value != null) { + value = value.trim().toLowerCase(); + if (value.length() == 0) + value = null; + } + return value; + } + public void initApplication() { viewer.pushHoldRepaint(); { - /* - viewer.setPercentVdwAtom(getValue("vdwPercent", 20)); - viewer.zoomToPercent(100); - // viewer.zoomToPercent(getValue("zoom", 100)); - viewer.setStyleBond(JmolViewer.SHADED); - viewer.setStyleAtom(JmolViewer.SHADED); - setStyle(getValue("style", "shaded")); - setLabelStyle(getValue("label", "none")); - viewer.setColorBackground(getValue("bgcolor", "white")); - String wfr = getValue("wireframeRotation", "false"); - setWireframeRotation(wfr.equalsIgnoreCase("on") || - wfr.equalsIgnoreCase("true")); - - String pd = getValue("perspectiveDepth", "true"); - setPerspectiveDepth(pd.equalsIgnoreCase("on") || - pd.equalsIgnoreCase("true")); - */ - viewer.setRasmolDefaults(); + emulate = getValueLowerCase("emulate", "jmol"); + if (emulate.equals("chime")) { + viewer.setRasmolDefaults(); + } else { + viewer.setJmolDefaults(); + viewer.setPercentVdwAtom(getValue("vdwPercent", 20)); + setStyle(getValue("style", "shaded")); + setLabelStyle(getValue("label", "none")); + viewer.setColorBackground(getValue("bgcolor", "white")); + String wfr = getValue("wireframeRotation", "false"); + setWireframeRotation(wfr.equalsIgnoreCase("on") || + wfr.equalsIgnoreCase("true")); + + String pd = getValue("perspectiveDepth", "true"); + setPerspectiveDepth(pd.equalsIgnoreCase("on") || + pd.equalsIgnoreCase("true")); + } load(getValue("load", null)); loadInline(getValue("loadInline", null)); @@ -206,7 +216,7 @@ messageCallback = getValue("MessageCallback", null); pauseCallback = getValue("PauseCallback", null); pickCallback = getValue("PickCallback", null); - if (mayscript == null && + if (! mayScript && (animFrameCallback != null || loadStructCallback != null || messageCallback != null || @@ -260,7 +270,8 @@ } public void handlePopupMenu(int x, int y) { - jmolpopup.show(x, y); + if (jmolpopup != null) + jmolpopup.show(x, y); } public void measureSelection(int atomIndex) { Index: JmolAppletControl.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/JmolAppletControl.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- JmolAppletControl.java 29 Sep 2003 22:57:22 -0000 1.9 +++ JmolAppletControl.java 1 Oct 2003 09:42:12 -0000 1.10 @@ -58,6 +58,7 @@ {"chimepush", "chimetoggle", "chimeradio", "button", "checkbox"}; String myName; + boolean mayScript; JmolAppletRegistry appletRegistry; AppletContext context; String targetName; @@ -103,7 +104,8 @@ public void init() { context = getAppletContext(); myName = getParam("name"); - appletRegistry = new JmolAppletRegistry(myName, this); + mayScript = getParam("mayscript") != null; + appletRegistry = new JmolAppletRegistry(myName, mayScript, this); targetName = getParam("target"); typeName = getParamLowerCase("type"); Index: JmolAppletRegistry.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/JmolAppletRegistry.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- JmolAppletRegistry.java 29 Sep 2003 22:57:22 -0000 1.2 +++ JmolAppletRegistry.java 1 Oct 2003 09:42:12 -0000 1.3 @@ -31,26 +31,31 @@ public class JmolAppletRegistry { String name; + boolean mayScript; Applet applet; String strJavaVendor, strJavaVersion, strOSName; boolean ns4; JSObject jsoWindow; JSObject jsoTop; - public JmolAppletRegistry(String name, Applet applet) { + public JmolAppletRegistry(String name, boolean mayScript, Applet applet) { if (name == null || name.length() == 0) name = null; this.name = name; + this.mayScript = mayScript; this.applet = applet; strJavaVendor = System.getProperty("java.vendor"); strJavaVersion = System.getProperty("java.version"); strOSName = System.getProperty("os.name"); jsoWindow = JSObject.getWindow(applet); - ns4 = strJavaVendor.startsWith("Netscape") & strJavaVersion.startsWith("1.1"); - if (ns4) - checkInJavascript(name,applet); - else + ns4 = (strJavaVendor.startsWith("Netscape") & + strJavaVersion.startsWith("1.1")); + if (! ns4) checkIn(name, applet); + else if (mayScript) + checkInJavascript(name, applet); + else + System.out.println("WARNING!! mayscript not specified"); } public void scriptButton(String targetName, String script, String buttonCallback) { @@ -71,8 +76,12 @@ JmolApplet targetJmolApplet = (JmolApplet)target; targetJmolApplet.scriptButton(jsoWindow, name, script, buttonCallback); } else { - jsoTop.call("runJmolAppletScript", - new Object[] { targetName, jsoWindow, name, script, buttonCallback }); + if (mayScript) + jsoTop.call("runJmolAppletScript", + new Object[] { targetName, jsoWindow, name, + script, buttonCallback }); + else + System.out.println("WARNING!! mayscript not specified"); } } |