From: <ha...@us...> - 2007-03-03 19:21:04
|
Revision: 7026 http://svn.sourceforge.net/jmol/?rev=7026&view=rev Author: hansonr Date: 2007-03-03 11:20:58 -0800 (Sat, 03 Mar 2007) Log Message: ----------- 11.1.17 deprecation of set Modified Paths: -------------- trunk/Jmol/src/org/jmol/util/TextFormat.java trunk/Jmol/src/org/jmol/viewer/Axes.java trunk/Jmol/src/org/jmol/viewer/Compiler.java trunk/Jmol/src/org/jmol/viewer/Dipoles.java trunk/Jmol/src/org/jmol/viewer/Eval.java trunk/Jmol/src/org/jmol/viewer/FileManager.java trunk/Jmol/src/org/jmol/viewer/Frame.java trunk/Jmol/src/org/jmol/viewer/Hover.java trunk/Jmol/src/org/jmol/viewer/Labels.java trunk/Jmol/src/org/jmol/viewer/Measurement.java trunk/Jmol/src/org/jmol/viewer/Measures.java trunk/Jmol/src/org/jmol/viewer/PickingManager.java trunk/Jmol/src/org/jmol/viewer/StateManager.java trunk/Jmol/src/org/jmol/viewer/Strands.java trunk/Jmol/src/org/jmol/viewer/Text.java trunk/Jmol/src/org/jmol/viewer/Token.java trunk/Jmol/src/org/jmol/viewer/TransformManager.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/util/TextFormat.java =================================================================== --- trunk/Jmol/src/org/jmol/util/TextFormat.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/util/TextFormat.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -126,8 +126,10 @@ public static String formatString(String strFormat, String key, String strT, float floatT) { - if (strFormat == null || strFormat.length() == 0) + if (strFormat == null) return null; + if (strFormat == "") + return ""; int len = key.length(); if (strFormat.indexOf("%") < 0 || len == 0 || strFormat.indexOf(key) < 0) return strFormat; Modified: trunk/Jmol/src/org/jmol/viewer/Axes.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Axes.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/viewer/Axes.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -85,6 +85,7 @@ Point3f axisPoint = axisPoints[i]; axisPoint.set(unitAxisPoints[i]); // we have just set the axisPoint to be a unit on a single axis + // therefore only one of these values (x, y, or z) will be nonzero // it will have value 1 or -1 if (corner.x < MIN_AXIS_LEN) @@ -107,7 +108,7 @@ } String getShapeState() { - return super.getShapeState() + "set axes scale " + scale + ";\n"; + return super.getShapeState() + "axisScale = " + scale + ";\n"; } } Modified: trunk/Jmol/src/org/jmol/viewer/Compiler.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Compiler.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/viewer/Compiler.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -163,7 +163,7 @@ ltoken.addElement(token); lastToken = token; } - + private boolean compile0() { cchScript = script.length(); ichToken = 0; @@ -179,17 +179,17 @@ ltoken = new Vector(); int tokCommand = Token.nada; isNewSet = false; - for (int nTokens = 0; true; ichToken += cchToken) { + for (; true; ichToken += cchToken) { + int nTokens = ltoken.size(); if (lookingAtLeadingWhitespace()) continue; - nTokens++; - if (tokCommand == Token.nada) + if (nTokens == 0) ichCurrentCommand = ichToken; if (lookingAtComment()) continue; boolean endOfLine = lookingAtEndOfLine(); if (endOfLine || lookingAtEndOfStatement()) { - if (tokCommand != Token.nada) { + if (nTokens > 0) { if (!compileCommand()) return false; iCommand = lltoken.size(); @@ -206,9 +206,9 @@ lineIndices[iCommand] = ichCurrentCommand; lltoken.addElement(atokenInfix); ltoken.setSize(0); + nTokens = 0; tokCommand = Token.nada; iHaveQuotedString = false; - nTokens = 0; } if (ichToken < cchScript) { if (endOfLine) @@ -217,9 +217,16 @@ } break; } - if (tokCommand == Token.nada) { + if (nTokens == 0) { isNewSet = false; } else { + if (nTokens == 1 && script.charAt(ichToken) == '=' && tokAttr(tokCommand, Token.setparam)) { + tokenCommand = Token.getTokenFromName("set"); + tokCommand = Token.set; + ltoken.add(0, tokenCommand); + cchToken = 1; + continue; + } if (lookingAtString()) { if (cchToken < 0) return endOfCommandUnexpected(); @@ -366,27 +373,28 @@ tokCommand = tok; if (tokAttr(tokCommand, Token.command)) break; - if (!tokAttr(tok, Token.identifier)) + if (!tokAttr(tok, Token.identifier) && !tokAttr(tok, Token.setparam)) return commandExpected(); tokCommand = Token.set; isNewSet = true; break; case Token.set: - if (ltoken.size() == 1) { + if (nTokens == 1) { + // set x or x = if (tok == Token.opEQ) { token = (Token) ltoken.get(0); ltoken.remove(0); - ltoken.add(new Token(Token.set, Token.varArgCount, "set")); + ltoken.add(Token.getTokenFromName("set")); tok = token.tok; tokCommand = Token.set; } - if (tok != Token.identifier && !tokAttr(tok, Token.setparam)) + if (tok != Token.identifier && (!tokAttr(tok, Token.setparam))) return isNewSet ? commandExpected() : unrecognizedParameter( "SET", ident); } break; case Token.define: - if (ltoken.size() == 1) { + if (nTokens == 1) { // we are looking at the variable name if (tok != Token.identifier) { if (preDefining) { @@ -403,10 +411,10 @@ Token.map.put(ident, token); } } - } else if (ltoken.size() == 2 && tok == Token.opEQ) { + } else if (nTokens == 2 && tok == Token.opEQ) { // we are looking at @x =.... just insert a SET command // and ignore the =. It's the same as set @x ... - ltoken.add(0, new Token(Token.set, Token.varArgCount, "set")); + ltoken.add(0, Token.getTokenFromName("set")); continue; } else { // we are looking at the expression @@ -431,7 +439,7 @@ addTokenToPrefix(token); continue; } - if (ltoken.size() == 0 || isNewSet && ltoken.size() == 1) + if (nTokens == 0 || isNewSet && nTokens == 1) return commandExpected(); return unrecognizedToken(script); } Modified: trunk/Jmol/src/org/jmol/viewer/Dipoles.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Dipoles.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/viewer/Dipoles.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -519,7 +519,7 @@ appendCmd(s, getColorCommand("dipole", dipole.colix)); } } - appendCmd(s, "set dipoleScale " + dipoleVectorScale); + appendCmd(s, "dipoleScale = " + dipoleVectorScale); return s.toString(); } } Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Eval.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -747,7 +747,7 @@ define(); break; case Token.echo: - echo(); + echo(1); break; case Token.message: message(); @@ -764,7 +764,7 @@ : Boolean.FALSE); break; case Token.label: - label(); + label(1); break; case Token.hover: hover(); @@ -1713,9 +1713,7 @@ } boolean isFloatParameter(int index) { - if (index >= statementLength) - return false; - switch (statement[index].tok) { + switch (tokAt(index)) { case Token.integer: case Token.decimal: return true; @@ -3283,10 +3281,10 @@ } } - void echo() throws ScriptException { + void echo(int index) throws ScriptException { if (isSyntaxCheck) return; - String text = optParameterAsString(1); + String text = optParameterAsString(index); if (viewer.getEchoStateActive()) setShapeProperty(JmolConstants.SHAPE_ECHO, "text", text); showString(viewer.formatText(text)); @@ -3312,10 +3310,10 @@ viewer.scriptStatus("script execution paused" + msg); } - void label() throws ScriptException { + void label(int index) throws ScriptException { if (isSyntaxCheck) return; - String strLabel = parameterAsString(1); + String strLabel = parameterAsString(index); if (strLabel.equalsIgnoreCase("on")) { strLabel = viewer.getStandardLabelFormat(); } else if (strLabel.equalsIgnoreCase("off")) @@ -5252,6 +5250,9 @@ case Token.bondmode: setBondmode(); return; + case Token.label: + label(2); + return; case Token.boundbox: setBoundbox(2); return; @@ -5288,7 +5289,8 @@ setStrands(); return; case Token.spin: - setSpin(); + checkLength4(); + setSpin(parameterAsString(2), (int)floatParameter(3)); return; case Token.frank: setFrank(2); @@ -5372,13 +5374,20 @@ if (key.toLowerCase().indexOf("label") == 0) { setLabel(key.substring(5)); return; - } else if (key.equalsIgnoreCase("defaultColorScheme")) { + } + if (key.equalsIgnoreCase("defaultColorScheme")) { setDefaultColors(); return; - } else if (key.equalsIgnoreCase("measurementNumbers")) { + } + if (key.equalsIgnoreCase("measurementNumbers") || key.equalsIgnoreCase("measurementLabels")) { setMonitor(2); return; - } else if (key.equalsIgnoreCase("defaultLattice")) { + } + if (key.equalsIgnoreCase("axisScale")) { + setAxisScale(2); + return; + } + if (key.equalsIgnoreCase("defaultLattice")) { Point3f pt; if (getToken(2).tok == Token.integer) { int i = intParameter(2); @@ -5389,12 +5398,14 @@ if (!isSyntaxCheck) viewer.setDefaultLattice(pt); return; - } else if (key.equalsIgnoreCase("toggleLabel")) { //from PickingManager + } + if (key.equalsIgnoreCase("toggleLabel")) { //from PickingManager BitSet bs = expression(2); if (!isSyntaxCheck) viewer.togglePickingLabel(bs); return; - } else if (key.equalsIgnoreCase("logLevel")) { + } + if (key.equalsIgnoreCase("logLevel")) { // set logLevel n // we have 5 levels 0 - 4 debug -- error // n = 0 -- no messages -- turn all off @@ -5408,12 +5419,18 @@ Viewer.setLogLevel(ilevel); Logger.info("logging level set to " + ilevel); return; - } else if (key.equalsIgnoreCase("backgroundModel")) { + } + if (key.equalsIgnoreCase("backgroundModel")) { checkLength3(); if (!isSyntaxCheck) viewer.setBackgroundModel(statement[2].intValue); return; } + if (Compiler.isOneOf(key.toLowerCase(), "spinx;spiny;spinz;spinfps")) { + checkLength3(); + setSpin(key.substring(4), (int) floatParameter(2)); + return; + } // deprecated: @@ -5971,17 +5988,26 @@ setShapeSize(JmolConstants.SHAPE_AXES, 1); return; } - // set axes scale x.xxx - if (statementLength == index + 2 - && statement[index].tok == Token.identifier - && ((String) statement[index].value).equalsIgnoreCase("scale")) { - setShapeProperty(JmolConstants.SHAPE_AXES, "scale", new Float( - floatParameter(index + 1))); + String type = optParameterAsString(index).toLowerCase(); + if (statementLength == index + 1 + && Compiler.isOneOf(type, "window;unitcell;molecular")) { + viewer.setAxesMode("axes" + type, true); return; } + // axes = scale x.xxx + if (statementLength == index + 2 && type.equals("scale")) { + setAxisScale(++index); + return; + } setShapeSize(JmolConstants.SHAPE_AXES, getSetAxesTypeMad(index)); } + void setAxisScale(int index) throws ScriptException { + setShapeProperty(JmolConstants.SHAPE_AXES, "scale", new Float( + floatParameter(index))); + + } + void setBoundbox(int index) throws ScriptException { setShapeSize(JmolConstants.SHAPE_BBCAGE, getSetAxesTypeMad(index)); } @@ -6079,6 +6105,9 @@ case Token.identifier: propertyValue = statement[2].value; break; + case Token.string: + echo(2); + return; default: invalidArgument(); } @@ -6223,7 +6252,7 @@ //index will be 2 here. boolean showMeasurementNumbers = false; checkLength3(); - switch (statement[index].tok) { + switch (tokAt(index)) { case Token.on: showMeasurementNumbers = true; case Token.off: @@ -6231,9 +6260,9 @@ showMeasurementNumbers ? Boolean.TRUE : Boolean.FALSE); return; case Token.identifier: - String units = (String) statement[index].value; + String units = parameterAsString(index); if (!StateManager.isMeasurementUnit(units)) - unrecognizedParameter("SET MEASUREMENTS", units); + unrecognizedParameter("MEASURE ", units); if (!isSyntaxCheck) viewer.setMeasureDistanceUnits(units); return; @@ -6280,30 +6309,26 @@ strandCount)); } - void setSpin() throws ScriptException { - checkLength4(); - int value = (int) floatParameter(3); - if (getToken(2).tok == Token.identifier) { - String str = parameterAsString(2).toLowerCase(); - int pt = "x y z f fp fps".indexOf(str); - // 0 2 4 11 - if (pt >= 0) - switch (pt) { - case 0: - viewer.setSpinX(value); - return; - case 2: - viewer.setSpinY(value); - return; - case 4: - viewer.setSpinZ(value); - return; - case 11: - viewer.setSpinFps(value); - return; - } + void setSpin(String key, int value) throws ScriptException { + if (Compiler.isOneOf(key, "x;y;z;fps")) { + if (isSyntaxCheck) + return; + switch ("x;y;z".indexOf(key)) { + case 0: + viewer.setSpinX(value); + return; + case 2: + viewer.setSpinY(value); + return; + case 4: + viewer.setSpinZ(value); + return; + default: + viewer.setSpinFps(value); + return; + } } - unrecognizedParameter("SET SPIN", parameterAsString(2)); + unrecognizedParameter("SPIN =", parameterAsString(2)); } void setSsbond() throws ScriptException { Modified: trunk/Jmol/src/org/jmol/viewer/FileManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/FileManager.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/viewer/FileManager.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -180,7 +180,7 @@ } void openStringInline(String[] arrayModels, int[] params) { - loadScript = "set dataSeparator \"~~~next file~~~\";\ndata \"model inline\""; + loadScript = "dataSeparator = \"~~~next file~~~\";\ndata \"model inline\""; for (int i = 0; i < arrayModels.length; i++) { if (i > 0) loadScript += "~~~next file~~~"; Modified: trunk/Jmol/src/org/jmol/viewer/Frame.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Frame.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/viewer/Frame.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -3478,7 +3478,7 @@ commands.append("\n# charges;\n"); Hashtable ht = new Hashtable(); for (int i = 0; i < atomCount; i++) - StateManager.setStateInfo(ht, i, i, "set formalCharge " + StateManager.setStateInfo(ht, i, i, "formalCharge = " + atoms[i].getFormalCharge()); commands.append(StateManager.getCommands(ht)); } @@ -3512,7 +3512,7 @@ commands.append(fs.get(i) + "\n"); viewer.loadShape(JmolConstants.SHAPE_LABELS); - ((Labels) shapes[JmolConstants.SHAPE_LABELS]).getShapeState(commands); + ((Labels) shapes[JmolConstants.SHAPE_LABELS]).getDefaultState(commands); commands.append("\n# model state;\n"); // shape construction Modified: trunk/Jmol/src/org/jmol/viewer/Hover.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Hover.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/viewer/Hover.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -111,7 +111,7 @@ if (atomFormats != null) for (int i = atomCount; --i >= 0;) if (atomFormats[i] != null) - setStateInfo(temp, i, "set hover " + setStateInfo(temp, i, "hover = " + StateManager.escape(atomFormats[i])); return getShapeCommands(temp, null, atomCount); } Modified: trunk/Jmol/src/org/jmol/viewer/Labels.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Labels.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/viewer/Labels.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -377,22 +377,22 @@ } } - void getShapeState(StringBuffer s) { + void getDefaultState(StringBuffer s) { appendCmd(s, "\n# label defaults;\nselect none"); appendCmd(s, getColorCommand("label", defaultPaletteID, defaultColix)); appendCmd(s, "background label " + encodeColor(defaultBgcolix)); - appendCmd(s, "set labelOffset " + Text.getXOffset(defaultOffset) + " " + appendCmd(s, "labelOffset = " + Text.getXOffset(defaultOffset) + " " + (-Text.getYOffset(defaultOffset))); String align = Text.getAlignment(defaultAlignment); - appendCmd(s, "set labelAlignment " + (align.length() < 5 ? "left" : align)); + appendCmd(s, "labelAlignment = " + (align.length() < 5 ? "left" : align)); String pointer = Text.getPointer(defaultPointer); - appendCmd(s, "set labelPointer " + appendCmd(s, "labelPointer = " + (pointer.length() == 0 ? "off" : pointer)); if ((defaultOffset & FRONT_FLAG) != 0) - appendCmd(s, "set labelFront"); + appendCmd(s, "labelFront = true"); if ((defaultOffset & GROUP_FLAG) != 0) - appendCmd(s, "set labelGroup"); + appendCmd(s, "labelGroup = "); appendCmd(s, getFontCommand("label", Font3D.getFont3D(defaultFontId))); } @@ -412,19 +412,19 @@ setStateInfo(temp2, i, "background label " + encodeColor(bgcolixes[i])); if (offsets != null && offsets.length > i) { int offset = offsets[i]; - setStateInfo(temp2, i, "set labelOffset " + setStateInfo(temp2, i, "labelOffset = " + Text.getXOffset(offset >> 6) + " " + (-Text.getYOffset(offset >> 6))); String align = Text.getAlignment(offset >> 2); if (align.length() >= 5) // disallows "left" - setStateInfo(temp2, i, "set labelAlignment " + align); + setStateInfo(temp2, i, "labelAlignment = " + align); String pointer = Text.getPointer(offset); if (pointer.length() > 0) - setStateInfo(temp2, i, "set labelPointer " + pointer); + setStateInfo(temp2, i, "labelPointer = " + pointer); if ((offset & FRONT_FLAG) != 0) - setStateInfo(temp2, i, "set labelFront"); + setStateInfo(temp2, i, "labelFront = "); if ((offset & GROUP_FLAG) != 0) - setStateInfo(temp2, i, "set labelGroup"); + setStateInfo(temp2, i, "labelGroup = "); } if (bsFontSet != null && bsFontSet.get(i)) setStateInfo(temp2, i, getFontCommand("label", Font3D Modified: trunk/Jmol/src/org/jmol/viewer/Measurement.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Measurement.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/viewer/Measurement.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -245,7 +245,7 @@ } String formatString(float value, String units) { - String s = countPlusIndices[0]+":"; + String s = countPlusIndices[0]+":" + ""; String label = (strFormat != null && strFormat.indexOf(s)==0? strFormat : viewer .getDefaultMeasurementLabel(countPlusIndices[0])); if (label.indexOf(s)==0) Modified: trunk/Jmol/src/org/jmol/viewer/Measures.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Measures.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/viewer/Measures.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -449,8 +449,8 @@ for (int i = 0; i < measurementCount; i++) commands.append(getState(i)); if (!showMeasurementNumbers) - commands.append("set measures off; # numbers off\n"); - appendCmd(commands, "set measures " + viewer.getMeasureDistanceUnits()); + commands.append("measures off; # numbers off\n"); + appendCmd(commands, "measures = " + viewer.getMeasureDistanceUnits()); appendCmd(commands, getFontCommand("measures", font3d)); int n = 0; Hashtable temp = new Hashtable(); Modified: trunk/Jmol/src/org/jmol/viewer/PickingManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/PickingManager.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/viewer/PickingManager.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -121,7 +121,7 @@ toggleMeasurement(4); break; case JmolConstants.PICKING_LABEL: - viewer.script("set toggleLabel (atomindex="+atomIndex+")"); + viewer.script("toggleLabel = (atomindex="+atomIndex+")"); break; case JmolConstants.PICKING_CENTER: viewer.script("zoomTo (atomindex=" + atomIndex+")"); Modified: trunk/Jmol/src/org/jmol/viewer/StateManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/StateManager.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/viewer/StateManager.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -347,32 +347,31 @@ * @return script command */ String getLoadState() { - StringBuffer str = new StringBuffer(); - if (defaultDirectory != null) - appendCmd(str, "set defaultDirectory " + escape(defaultDirectory)); - appendCmd(str, "set autoBond " + autoBond); - appendCmd(str, "set forceAutoBond " + forceAutoBond); - appendCmd(str, "set percentVdwAtom " + percentVdwAtom); - appendCmd(str, "set bondRadiusMilliAngstroms " + marBond); - appendCmd(str, "set minBondDistance " + minBondDistance); - appendCmd(str, "set bondTolerance " + bondTolerance); - appendCmd(str, "set defaultLattice " + escape(ptDefaultLattice)); - appendCmd(str, "set allowEmbeddedScripts false"); - appendCmd(str, "set defaultLoadScript \"\""); - if (viewer.getAxesOrientationRasmol()) - appendCmd(str, "set axesOrientationRasmol"); - if (zeroBasedXyzRasmol) - appendCmd(str, "set zeroBasedXyzRasmol"); - - // this next commands register flags so that they will be + // some commands register flags so that they will be // restored in a saved state definition, but will not execute // now so that there is no chance any embedded scripts or // default load scripts will run and slow things down. + StringBuffer str = new StringBuffer(); + appendCmd(str, "allowEmbeddedScripts = false"); if (allowEmbeddedScripts) setParameterValue("allowEmbeddedScripts", true); + appendCmd(str, "autoBond = " + autoBond); + if (viewer.getAxesOrientationRasmol()) + appendCmd(str, "axesOrientationRasmol = true"); + appendCmd(str, "bondRadiusMilliAngstroms = " + marBond); + appendCmd(str, "bondTolerance = " + bondTolerance); + if (defaultDirectory != null) + appendCmd(str, "defaultDirectory = " + escape(defaultDirectory)); + appendCmd(str, "defaultLattice = " + escape(ptDefaultLattice)); + appendCmd(str, "defaultLoadScript = \"\""); if (defaultLoadScript.length() > 0) setParameterValue("defaultLoadScript", defaultLoadScript); - + + appendCmd(str, "forceAutoBond = " + forceAutoBond); + appendCmd(str, "minBondDistance = " + minBondDistance); + appendCmd(str, "percentVdwAtom = " + percentVdwAtom); + if (zeroBasedXyzRasmol) + appendCmd(str, "zeroBasedXyzRasmol = true"); return str + "\n"; } @@ -489,8 +488,8 @@ StringBuffer str = new StringBuffer("# window state;\n# height " + viewer.getScreenHeight() + ";\n# width " + viewer.getScreenWidth() + ";\n"); appendCmd(str, "initialize"); - appendCmd(str, "set refreshing false"); - appendCmd(str, "background " + escapeColor(argbBackground)); + appendCmd(str, "refreshing = false"); + appendCmd(str, "background = " + escapeColor(argbBackground)); str.append(getSpecularState()); if (stereoState != null) appendCmd(str, "stereo" + stereoState); @@ -499,12 +498,12 @@ String getSpecularState() { StringBuffer str = new StringBuffer(""); - appendCmd(str, "set ambientPercent " + ambientPercent); - appendCmd(str, "set diffusePercent " + diffusePercent); - appendCmd(str, "set specular " + specular); - appendCmd(str, "set specularPercent " + specularPercent); - appendCmd(str, "set specularPower " + specularPower); - appendCmd(str, "set specularExponent " + specularExponent); + appendCmd(str, "ambientPercent = " + ambientPercent); + appendCmd(str, "diffusePercent = " + diffusePercent); + appendCmd(str, "specular = " + specular); + appendCmd(str, "specularPercent = " + specularPercent); + appendCmd(str, "specularPower = " + specularPower); + appendCmd(str, "specularExponent = " + specularExponent); return str.toString(); } @@ -701,7 +700,7 @@ String getState() { StringBuffer commands = new StringBuffer("# settings;\n"); - appendCmd(commands, "set refreshing false"); + appendCmd(commands, "refreshing = false"); Enumeration e; //two rounds here because default settings //must be declared first @@ -715,7 +714,7 @@ Object value = htParameterValues.get(key); if (value instanceof String) value = escape((String) value); - appendCmd(commands, "set " + key + " " + value); + appendCmd(commands, key + " = " + value); } } //booleans @@ -723,7 +722,7 @@ while (e.hasMoreElements()) { key = (String) e.nextElement(); if (doRegister(key)) - appendCmd(commands, "set " + key + " " + htPropertyFlags.get(key)); + appendCmd(commands, key + " = " + htPropertyFlags.get(key)); } //nondefault, nonvariables //save as _xxxx if you don't want "set" to be there first @@ -736,7 +735,7 @@ if (key.charAt(0) == '_') { key = key.substring(1); } else { - key = "set " + key; + key += " = "; if (value instanceof String) value = escape((String) value); } @@ -745,13 +744,13 @@ } switch (axesMode) { case JmolConstants.AXES_MODE_UNITCELL: - appendCmd(commands, "set axesUnitcell"); + appendCmd(commands, "axes = unitcell"); break; case JmolConstants.AXES_MODE_BOUNDBOX: - appendCmd(commands, "set axesWindow"); + appendCmd(commands, "axes = window"); break; default: - appendCmd(commands, "set axesMolecular"); + appendCmd(commands, "axes = molecular"); } //variables only: e = htParameterValues.keys(); Modified: trunk/Jmol/src/org/jmol/viewer/Strands.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Strands.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/viewer/Strands.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -62,7 +62,7 @@ } String getShapeState() { - return "set strandCount " + strandCount + ";\n" + return "strandCount = " + strandCount + ";\n" + super.getShapeState(); } } Modified: trunk/Jmol/src/org/jmol/viewer/Text.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Text.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/viewer/Text.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -559,12 +559,12 @@ case XYZ: if (strOff == null) strOff = StateManager.escape(xyz); - s.append("set echo " + target + " " + strOff); + s.append("echo = " + target + " " + strOff); if (align != LEFT) - s.append("set echo " + target + " " + hAlignNames[align]); + s.append("echo = " + target + " " + hAlignNames[align]); break; default: - s.append("set echo " + vAlignNames[valign] + " " + hAlignNames[align]); + s.append("echo = " + vAlignNames[valign] + " " + hAlignNames[align]); } s.append(";echo " + StateManager.escape(textUnformatted) + ";\n"); } Modified: trunk/Jmol/src/org/jmol/viewer/Token.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Token.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/viewer/Token.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -152,7 +152,7 @@ final static int trace = command | 41; final static int translate = command | 42 | negnums; final static int wireframe = command | 44; - final static int write = command | 45 | setparam; + final static int write = command | 45; final static int zap = command | 46; final static int zoom = command | 47 | negnums | embeddedExpression; final static int zoomTo = command | 48 | negnums | embeddedExpression; @@ -318,7 +318,7 @@ final static int join = 2 | mathfunc | 0 << 3; final static int trim = 3 | mathfunc | 0 << 3; - final static int label = 1 | mathfunc | 1 << 3 | command | specialstring; + final static int label = 1 | mathfunc | 1 << 3 | command | specialstring | setparam; final static int find = 2 | mathfunc | 1 << 3; final static int load = 3 | mathfunc | 1 << 3 | command | negnums; final static int substructure = 4 | mathfunc | 1 << 3; @@ -1101,6 +1101,10 @@ } } + public static Token getTokenFromName(String name) { + return (Token) map.get(name); + } + public static String nameOf(int tok) { Enumeration e = map.elements(); while (e.hasMoreElements()) { Modified: trunk/Jmol/src/org/jmol/viewer/TransformManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/TransformManager.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/viewer/TransformManager.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -142,10 +142,10 @@ StringBuffer commands = new StringBuffer( "# orientation/center/spin state;\nset refreshing false;\n"); if (!isWindowCentered()) - commands.append("set windowCentered false;\n"); - commands.append("set cameraDepth " + cameraDepth + ";\n"); + commands.append("windowCentered = false;\n"); + commands.append("cameraDepth = " + cameraDepth + ";\n"); if (isNavigationMode) - commands.append("set navigationMode;\n"); + commands.append("navigationMode = true;\n"); commands.append("center " + StateManager.escape(fixedRotationCenter) + ";\n"); commands.append(getMoveToText(0) + ";\n"); @@ -175,11 +175,11 @@ } String getSpinState(boolean isAll) { - String s = "set spin X " + (int) spinX + ";set spin Y " + (int) spinY - + ";set spin Z " + (int) spinZ + ";set spin fps " + (int) spinFps + ";"; + String s = "spinX = " + (int) spinX + ";spinY = " + (int) spinY + + ";spinZ = " + (int) spinZ + ";spinFps = " + (int) spinFps + ";"; if (spinOn) { if (isAll) - s += "set refreshing true;refresh;"; + s += "refreshing = true;refresh;"; if (isSpinInternal) { Point3f pt = new Point3f(internalRotationCenter); pt.add(rotationAxis); @@ -1670,7 +1670,7 @@ sb.append(";"); } if (modelRadius != rotationRadiusDefault) { - sb.append("set rotationRadius"); + sb.append(" rotationRadius ="); truncate2(sb, modelRadius); sb.append(";"); } Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2007-03-03 16:10:01 UTC (rev 7025) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2007-03-03 19:20:58 UTC (rev 7026) @@ -1983,7 +1983,7 @@ s.append(transformManager.getState()); // display and selections s.append(selectionManager.getState()); - s.append("set refreshing true;\n"); + s.append("refreshing = true;\n"); return s.toString(); } @@ -2064,14 +2064,14 @@ int modelIndex = getCurrentModelIndex(); if (modelManager.setUnitCellOffset(modelIndex, offset)) global.setParameterValue("_frame " + getModelNumber(modelIndex) - + "; set unitcell", offset); + + "; unitcell = ", offset); } void setCurrentUnitCellOffset(Point3f pt) { int modelIndex = getCurrentModelIndex(); if (modelManager.setUnitCellOffset(modelIndex, pt)) global.setParameterValue("_frame " + getModelNumber(modelIndex) - + "; set unitcell", StateManager.escape(pt)); + + "; unitcell = ", StateManager.escape(pt)); } /* **************************************************************************** @@ -3595,7 +3595,7 @@ } if (defineNew) { if (global.htPropertyFlags.containsKey(key)) { - scriptStatus(GT._("ERROR: Cannot set value of a boolean to another type. use \"{0}\" first.", "SET "+ key + " NONE")); + scriptStatus(GT._("ERROR: Cannot set value of a boolean to another type. use \"{0}\" first.", key + " = NONE")); return; // don't allow setting boolean of a numeric } global.setParameterValue(key, value); @@ -3803,18 +3803,6 @@ setAdjustCamera(value); break; } - if (key.equalsIgnoreCase("axesWindow")) { - setAxesModeMolecular(!value); - break; - } - if (key.equalsIgnoreCase("axesMolecular")) { - setAxesModeMolecular(value); - break; - } - if (key.equalsIgnoreCase("axesUnitCell")) { - setAxesModeUnitCell(value); - break; - } if (key.equalsIgnoreCase("displayCellParameters")) { setDisplayCellParameters(value); break; @@ -3847,6 +3835,9 @@ setGreyscaleRendering(value); break; } + if (setAxesMode(key, value)) + break; + //these next are deprecated because they don't //give much indication what they really do: @@ -3923,7 +3914,7 @@ if (notFound) { key = key.toLowerCase(); if (global.htParameterValues.containsKey(key)) { - scriptStatus(GT._("ERROR: Cannot set value of this variable to a boolean. use \"{0}\" first.", "SET "+ key + " NONE")); + scriptStatus(GT._("ERROR: Cannot set value of this variable to a boolean. use \"{0}\" first.", key + " = NONE")); return true; // don't allow setting boolean of a numeric } if (!value && !global.htPropertyFlags.containsKey(key)) { @@ -4122,8 +4113,24 @@ return transformManager.axesOrientationRasmol; } + boolean setAxesMode(String key, boolean value) { + if (key.equalsIgnoreCase("axesWindow")) { + setAxesModeMolecular(!value); + return true; + } + if (key.equalsIgnoreCase("axesMolecular")) { + setAxesModeMolecular(value); + return true; + } + if (key.equalsIgnoreCase("axesUnitCell")) { + setAxesModeUnitCell(value); + return true; + } + return false; + } + private void setAxesModeMolecular(boolean TF) { - global.axesMode = (TF ? JmolConstants.AXES_MODE_MOLECULAR + global.axesMode = (TF ? JmolConstants.AXES_MODE_MOLECULAR : JmolConstants.AXES_MODE_BOUNDBOX); axesAreTainted = true; global.removeParameter("axesunitcell"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |