From: <ha...@us...> - 2007-03-04 23:10:29
|
Revision: 7027 http://svn.sourceforge.net/jmol/?rev=7027&view=rev Author: hansonr Date: 2007-03-04 15:10:26 -0800 (Sun, 04 Mar 2007) Log Message: ----------- 11.1.17 deprecation of SET; registration of global variables Modified Paths: -------------- trunk/Jmol/src/org/jmol/viewer/Atom.java trunk/Jmol/src/org/jmol/viewer/Axes.java trunk/Jmol/src/org/jmol/viewer/AxesRenderer.java trunk/Jmol/src/org/jmol/viewer/Balls.java trunk/Jmol/src/org/jmol/viewer/Eval.java trunk/Jmol/src/org/jmol/viewer/Frame.java trunk/Jmol/src/org/jmol/viewer/JmolConstants.java trunk/Jmol/src/org/jmol/viewer/Labels.java trunk/Jmol/src/org/jmol/viewer/StateManager.java trunk/Jmol/src/org/jmol/viewer/Token.java trunk/Jmol/src/org/jmol/viewer/TransformManager.java trunk/Jmol/src/org/jmol/viewer/VectorsRenderer.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/viewer/Atom.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Atom.java 2007-03-03 19:20:58 UTC (rev 7026) +++ trunk/Jmol/src/org/jmol/viewer/Atom.java 2007-03-04 23:10:26 UTC (rev 7027) @@ -296,7 +296,6 @@ */ void setMadAtom(short madAtom) { - if (this.madAtom == JmolConstants.MAR_DELETED) return; this.madAtom = convertEncodedMad(madAtom); } @@ -328,8 +327,6 @@ } int getRasMolRadius() { - if (madAtom == JmolConstants.MAR_DELETED) - return 0; return madAtom / (4 * 2); } @@ -483,8 +480,6 @@ } float getRadius() { - if (madAtom == JmolConstants.MAR_DELETED) - return 0; return madAtom / (1000f * 2); } @@ -660,10 +655,6 @@ propertyName))); } - boolean isDeleted() { - return madAtom == JmolConstants.MAR_DELETED; - } - byte getSpecialAtomID() { byte[] specialAtomIDs = group.chain.frame.specialAtomIDs; return specialAtomIDs == null ? 0 : specialAtomIDs[atomIndex]; Modified: trunk/Jmol/src/org/jmol/viewer/Axes.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Axes.java 2007-03-03 19:20:58 UTC (rev 7026) +++ trunk/Jmol/src/org/jmol/viewer/Axes.java 2007-03-04 23:10:26 UTC (rev 7027) @@ -103,7 +103,6 @@ } void setScale(float angstroms) { - scale = angstroms; initShape(); } Modified: trunk/Jmol/src/org/jmol/viewer/AxesRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/AxesRenderer.java 2007-03-03 19:20:58 UTC (rev 7026) +++ trunk/Jmol/src/org/jmol/viewer/AxesRenderer.java 2007-03-04 23:10:26 UTC (rev 7027) @@ -62,7 +62,6 @@ viewer.transformPoint(axes.originPoint, originScreen); for (int i = nPoints; --i >= 0;) viewer.transformPoint(axes.axisPoints[i], axisScreens[i]); - int widthPixels = mad; if (mad >= 20) widthPixels = viewer.scaleToScreen(originScreen.z, mad); Modified: trunk/Jmol/src/org/jmol/viewer/Balls.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Balls.java 2007-03-03 19:20:58 UTC (rev 7026) +++ trunk/Jmol/src/org/jmol/viewer/Balls.java 2007-03-04 23:10:26 UTC (rev 7027) @@ -99,8 +99,7 @@ atom.shapeVisibilityFlags &= ( ~JmolConstants.ATOM_IN_MODEL & ~myVisibilityFlag); - if (atom.madAtom == JmolConstants.MAR_DELETED - || ! showHydrogens && atom.getElementNumber() == 1) + if (! showHydrogens && atom.getElementNumber() == 1) continue; if (! isOneFrame && bs.get(atom.modelIndex) || atom.modelIndex == displayModelIndex) { Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Eval.java 2007-03-03 19:20:58 UTC (rev 7026) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java 2007-03-04 23:10:26 UTC (rev 7027) @@ -2146,6 +2146,8 @@ int getArgbParam(int index, boolean allowNone) throws ScriptException { if (checkToken(index)) { switch (getToken(index).tok) { + case Token.string: + return Graphics3D.getArgbFromString(parameterAsString(index)); case Token.leftsquare: return getColorTriad(++index); case Token.colorRGB: @@ -2740,10 +2742,12 @@ switch (getToken(i).tok) { case Token.on: checkLength2(); + iToken = 1; state = " on"; break; case Token.off: checkLength2(); + iToken = 1; stereoMode = JmolConstants.STEREO_NONE; state = " off"; break; @@ -2788,6 +2792,7 @@ } } setFloatProperty("stereoDegrees", degrees); + checkStatementLength(iToken + 1); if (isSyntaxCheck) return; if (colorpt > 0) { @@ -2795,7 +2800,6 @@ } else { viewer.setStereoMode(stereoMode, state); } - checkStatementLength(iToken + 1); } void connect() throws ScriptException { @@ -4614,12 +4618,11 @@ } break; case 3: - if (getToken(1).tok == Token.identifier - && parameterAsString(1).equalsIgnoreCase("scale")) { + if (parameterAsString(1).equalsIgnoreCase("scale")) { float scale = floatParameter(2); if (scale < -10 || scale > 10) numberOutOfRange(-10f, 10f); - viewer.setVectorScale(scale); + setFloatProperty("vectorScale", scale); return; } invalidArgument(); @@ -4773,16 +4776,13 @@ switch (getToken(1).tok) { case Token.on: checkLength2(); - period = viewer.getDefaultVibrationPeriod(); + period = viewer.getVibrationPeriod(); break; case Token.off: checkLength2(); period = 0; break; case Token.integer: - checkLength2(); - period = intParameter(1); - break; case Token.decimal: checkLength2(); period = floatParameter(1); @@ -4797,7 +4797,7 @@ return; } else if (cmd.equalsIgnoreCase("period")) { period = floatParameter(2); - setFloatProperty("vibrationPeriod", -period); + setFloatProperty("vibrationPeriod", period); return; } else { invalidArgument(); @@ -4807,7 +4807,13 @@ } if (period < 0) invalidArgument(); - setFloatProperty("vibrationPeriod", period); + if (isSyntaxCheck) + return; + if (period == 0) { + viewer.setVibrationOff(); + return; + } + viewer.setVibrationPeriod(-period); } void animationDirection() throws ScriptException { @@ -5285,9 +5291,6 @@ case Token.scale3d: setScale3d(); return; - case Token.strands: - setStrands(); - return; case Token.spin: checkLength4(); setSpin(parameterAsString(2), (int)floatParameter(3)); @@ -5352,11 +5355,18 @@ case Token.bonds: key = "showMultipleBonds"; break; + case Token.strands: + checkLength3(); + int strandCount = intParameter(2); + if (strandCount < 0 || strandCount > 20) + numberOutOfRange(0, 20); + key = "strandCount"; + break; case Token.hetero: - key = "defaultSelectHetero"; + key = "selectHetero"; break; case Token.hydrogen: - key = "defaultSelectHydrogen"; + key = "selectHydrogen"; break; case Token.radius: key = "solventProbeRadius"; @@ -5383,10 +5393,6 @@ setMonitor(2); return; } - if (key.equalsIgnoreCase("axisScale")) { - setAxisScale(2); - return; - } if (key.equalsIgnoreCase("defaultLattice")) { Point3f pt; if (getToken(2).tok == Token.integer) { @@ -5996,24 +6002,23 @@ } // axes = scale x.xxx if (statementLength == index + 2 && type.equals("scale")) { - setAxisScale(++index); + setFloatProperty("axesScale", floatParameter(++index)); return; } - setShapeSize(JmolConstants.SHAPE_AXES, getSetAxesTypeMad(index)); + short mad = getSetAxesTypeMad(index); + setBooleanProperty("showAxes", mad != 0); + setShapeSize(JmolConstants.SHAPE_AXES, mad); } - 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)); + short mad = getSetAxesTypeMad(index); + setBooleanProperty("showBoundBox", mad != 0); + setShapeSize(JmolConstants.SHAPE_BBCAGE, mad); } void setUnitcell(int index) throws ScriptException { if (statementLength == 1) { + setBooleanProperty("showUnitcell", true); setShapeSize(JmolConstants.SHAPE_UCCAGE, 1); return; } @@ -6022,7 +6027,9 @@ if (!isSyntaxCheck) viewer.setCurrentUnitCellOffset(intParameter(index)); } else { - setShapeSize(JmolConstants.SHAPE_UCCAGE, getSetAxesTypeMad(index)); + short mad = getSetAxesTypeMad(index); + setBooleanProperty("showUnitcell", mad != 0); + setShapeSize(JmolConstants.SHAPE_UCCAGE, mad); } return; } @@ -6038,7 +6045,7 @@ void setDefaultColors() throws ScriptException { checkLength3(); - String type = "" + statement[2].value; + String type = parameterAsString(2); if (!type.equalsIgnoreCase("rasmol") && !type.equalsIgnoreCase("jmol")) invalidArgument(); setStringProperty("defaultColorScheme", type); @@ -6300,15 +6307,6 @@ } } - void setStrands() throws ScriptException { - int strandCount = 5; - if (statementLength == 3) - if ((strandCount = intParameter(2)) < 0 || strandCount > 20) - numberOutOfRange(0, 20); - setShapeProperty(JmolConstants.SHAPE_STRANDS, "strandCount", new Integer( - strandCount)); - } - void setSpin(String key, int value) throws ScriptException { if (Compiler.isOneOf(key, "x;y;z;fps")) { if (isSyntaxCheck) @@ -6746,7 +6744,7 @@ break; case Token.display://deprecated case Token.selectionHalo: - msg = "selectionHalosEnabled = " + viewer.getSelectionHaloEnabled(); + msg = "selectionHalos = " + viewer.getSelectionHaloEnabled(); break; case Token.hetero: msg = "defaultSelectHetero = " + viewer.getRasmolHeteroSetting(); Modified: trunk/Jmol/src/org/jmol/viewer/Frame.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Frame.java 2007-03-03 19:20:58 UTC (rev 7026) +++ trunk/Jmol/src/org/jmol/viewer/Frame.java 2007-03-04 23:10:26 UTC (rev 7027) @@ -1419,15 +1419,13 @@ if (k >= atomCount) continue; Atom atom = atoms[k]; - if (!atom.isDeleted()) - bspf.addTuple(atom.modelIndex, atom); + bspf.addTuple(atom.modelIndex, atom); } } else { Logger.debug("sequential bspt order"); for (int i = atomCount; --i >= 0;) { Atom atom = atoms[i]; - if (!atom.isDeleted()) - bspf.addTuple(atom.modelIndex, atom); + bspf.addTuple(atom.modelIndex, atom); } } if (showRebondTimes) { Modified: trunk/Jmol/src/org/jmol/viewer/JmolConstants.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/JmolConstants.java 2007-03-03 19:20:58 UTC (rev 7026) +++ trunk/Jmol/src/org/jmol/viewer/JmolConstants.java 2007-03-04 23:10:26 UTC (rev 7027) @@ -34,7 +34,7 @@ // for now, just update this by hand // perhaps use ant filter later ... but mth doesn't like it :-( public final static String copyright = "(C) 2006 Jmol Development"; - public final static String version = "11.1.16"; + public final static String version = "11.1.17"; /* * @@ -43,6 +43,26 @@ * 11.1.17 + deprecation of SET + ------------------ + + The "SET" command is no longer necessary. Anything that could have + been set using "SET x .... " can now be set using + + x = .... + + This allows for a much cleaner interface because we simply make + settings in a normal sort of way: + + axes on + axes = molecular + + measures = angstroms + + It will take a bit more to make it all consistent, but the idea + is that there are then some special reserved variables that + mean something special when set, like "bondmode" + This build allows for the applet to be "bare-bones" -- only the essential classes included in the Jar file; others never included or possibly in accompanying jar files, such as, perhaps, JmolPopupMenu.jar, @@ -570,8 +590,6 @@ return connectOperationStrings[i]; } - public final static short MAR_DELETED = Short.MIN_VALUE; - public static final int MOUSE_NONE = -1; public static final int MOUSE_ROTATE = 0; public static final int MOUSE_ZOOM = 1; Modified: trunk/Jmol/src/org/jmol/viewer/Labels.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Labels.java 2007-03-03 19:20:58 UTC (rev 7026) +++ trunk/Jmol/src/org/jmol/viewer/Labels.java 2007-03-04 23:10:26 UTC (rev 7027) @@ -248,6 +248,8 @@ for (int atomIndex = atomCount; --atomIndex >= 0;) if (bsSelected.get(atomIndex)) { Atom atom = atoms[atomIndex]; + if (formats == null || atomIndex >= formats.length) + formats = ArrayUtil.ensureLength(formats, atomIndex + 1); if (strings != null && strings.length > atomIndex && strings[atomIndex] != null) { strings[atomIndex] = null; Modified: trunk/Jmol/src/org/jmol/viewer/StateManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/StateManager.java 2007-03-03 19:20:58 UTC (rev 7026) +++ trunk/Jmol/src/org/jmol/viewer/StateManager.java 2007-03-04 23:10:26 UTC (rev 7027) @@ -52,7 +52,9 @@ } GlobalSettings getGlobalSettings() { - return new GlobalSettings(); + GlobalSettings g = new GlobalSettings(); + g.registerAllValues(); + return g; } void clear(GlobalSettings global) { @@ -62,8 +64,10 @@ void setCrystallographicDefaults() { //axes on and mode unitCell; unitCell on; perspective depth off; + viewer.setShowAxes(true); viewer.setShapeSize(JmolConstants.SHAPE_AXES, 200); viewer.setShapeSize(JmolConstants.SHAPE_UCCAGE, -1); + viewer.setShowUnitCell(true); viewer.setAxesModeUnitCell(true); viewer.setBooleanProperty("perspectiveDepth", false); } @@ -333,7 +337,7 @@ boolean autoBond = true; boolean allowEmbeddedScripts = true; int percentVdwAtom = JmolConstants.DEFAULT_PERCENT_VDW_ATOM; - short marBond = JmolConstants.DEFAULT_BOND_MILLIANGSTROM_RADIUS; + short bondRadiusMilliAngstroms = JmolConstants.DEFAULT_BOND_MILLIANGSTROM_RADIUS; float bondTolerance = JmolConstants.DEFAULT_BOND_TOLERANCE; float minBondDistance = JmolConstants.DEFAULT_MIN_BOND_DISTANCE; String defaultLoadScript = ""; @@ -358,7 +362,7 @@ appendCmd(str, "autoBond = " + autoBond); if (viewer.getAxesOrientationRasmol()) appendCmd(str, "axesOrientationRasmol = true"); - appendCmd(str, "bondRadiusMilliAngstroms = " + marBond); + appendCmd(str, "bondRadiusMilliAngstroms = " + bondRadiusMilliAngstroms); appendCmd(str, "bondTolerance = " + bondTolerance); if (defaultDirectory != null) appendCmd(str, "defaultDirectory = " + escape(defaultDirectory)); @@ -404,14 +408,11 @@ //centering and perspective - boolean allowCameraMoveFlag = true; - boolean adjustCameraFlag = true; boolean allowRotateSelected = false; //solvent boolean solventOn = false; - float solventProbeRadius = 1.2f; //measurements @@ -426,19 +427,18 @@ boolean enableFullSceneAntialiasing = false; boolean greyscaleRendering = false; boolean zoomLarge = true; //false would be like Chime - boolean dotsSelectedOnlyFlag = false; - boolean dotSurfaceFlag = true; + boolean dotsSelectedOnly = false; + boolean dotSurface = true; boolean displayCellParameters = true; boolean showHiddenSelectionHalos = false; boolean showMeasurements = true; boolean frankOn = false; - boolean centerPointer = true; boolean zShade = false; boolean dynamicMeasurements = false; //atoms and bonds - boolean bondSelectionModeOr = false; + boolean bondModeOr = false; boolean showMultipleBonds = true; boolean showHydrogens = true; boolean ssbondsBackbone = false; @@ -446,13 +446,12 @@ boolean hbondsSolid = false; byte modeMultipleBond = JmolConstants.MULTIBOND_NOTSMALL; - int defaultVectorMad = 0; //secondary structure + Rasmol boolean rasmolHydrogenSetting = true; boolean rasmolHeteroSetting = true; - boolean cartoonRocketFlag = false; + boolean cartoonRockets = false; boolean ribbonBorder = false; boolean chainCaseSensitive = false; boolean rangeSelected = false; @@ -460,6 +459,7 @@ boolean traceAlpha = true; boolean highResolutionFlag = false; int ribbonAspectRatio = 16; + int strandCount = 5; int hermiteLevel = 0; float sheetSmoothing = 1; // 0: traceAlpha on alphas for helix, 1 on midpoints @@ -467,9 +467,11 @@ boolean hideNameInPopup = false; boolean disablePopupMenu = false; - float defaultVibrationScale = 1f; - float defaultVibrationPeriod = 1f; - float defaultVectorScale = 1f; + float vibrationScale = 1f; + float vibrationPeriod = 1f; + float vectorScale = 1f; + float cameraDepth = 3.0f; + float solventProbeRadius = 1.2f; int scriptDelay = 0; int hoverDelayMs = 500; boolean hideNavigationPoint = false; @@ -488,8 +490,9 @@ StringBuffer str = new StringBuffer("# window state;\n# height " + viewer.getScreenHeight() + ";\n# width " + viewer.getScreenWidth() + ";\n"); appendCmd(str, "initialize"); + appendCmd(str, "_version = " + getParameter("_version")); appendCmd(str, "refreshing = false"); - appendCmd(str, "background = " + escapeColor(argbBackground)); + appendCmd(str, "backgroundColor = " + escapeColor(argbBackground)); str.append(getSpecularState()); if (stereoState != null) appendCmd(str, "stereo" + stereoState); @@ -508,6 +511,7 @@ } int axesMode = JmolConstants.AXES_MODE_BOUNDBOX; + float axesScale = 1; int pickingSpinRate = 10; String helpPath = null; @@ -516,7 +520,6 @@ //testing - boolean debugCommand = false; boolean debugScript = false; boolean testFlag1 = false; boolean testFlag2 = false; @@ -546,8 +549,8 @@ return measureDistanceUnits; } - Hashtable htParameterValues = new Hashtable(); - Hashtable htPropertyFlags = new Hashtable(); + Hashtable htParameterValues; + Hashtable htPropertyFlags; final static String volatileProperties = //indicate all properties here in lower case @@ -565,7 +568,6 @@ + ";ambientpercent;diffusepercent;specular;specularexponent;specularpower;specularpercent;" + ";debugscript;frank;showaxes;showunitcell;showboundbox;" + ";slabEnabled;zoomEnabled;axeswindow;axesunitcell;axesmolecular;windowcentered;" - + ";vibrationscale;vibrationperiod;" + ";cameradepth;navigationmode;rotationradius;" + ";zerobasedxyzrasmol;axesorientationrasmol;" + ";_modelnumber;_modelname;_currentmodelnumberinfile;_currentfilenumber;_version;_memory;" @@ -623,10 +625,10 @@ } void setParameterValue(String name, String value) { - if (htPropertyFlags.containsKey(name)) + if (value == null || htPropertyFlags.containsKey(name)) return; // don't allow setting string of a boolean name = name.toLowerCase(); - htParameterValues.put(name, value); + htParameterValues.put(name, value); } boolean doRegister(String name) { @@ -699,38 +701,24 @@ } String getState() { + int n = 0; + String[] list = new String[htPropertyFlags.size() + htParameterValues.size()]; StringBuffer commands = new StringBuffer("# settings;\n"); appendCmd(commands, "refreshing = false"); Enumeration e; - //two rounds here because default settings - //must be declared first String key; - //defaults - e = htParameterValues.keys(); - while (e.hasMoreElements()) { - key = (String) e.nextElement(); - if (key.indexOf("default") >= 0 && key.charAt(0) != '@' - && doRegister(key)) { - Object value = htParameterValues.get(key); - if (value instanceof String) - value = escape((String) value); - appendCmd(commands, key + " = " + value); - } - } //booleans e = htPropertyFlags.keys(); while (e.hasMoreElements()) { key = (String) e.nextElement(); if (doRegister(key)) - appendCmd(commands, key + " = " + htPropertyFlags.get(key)); + list[n++] = key + " = " + htPropertyFlags.get(key); } - //nondefault, nonvariables //save as _xxxx if you don't want "set" to be there first e = htParameterValues.keys(); while (e.hasMoreElements()) { key = (String) e.nextElement(); - if (key.indexOf("default") < 0 && key.charAt(0) != '@' - && doRegister(key)) { + if (key.charAt(0) != '@' && doRegister(key)) { Object value = htParameterValues.get(key); if (key.charAt(0) == '_') { key = key.substring(1); @@ -739,28 +727,117 @@ if (value instanceof String) value = escape((String) value); } - appendCmd(commands, key + " " + value); + list[n++] = key + value; } } switch (axesMode) { case JmolConstants.AXES_MODE_UNITCELL: - appendCmd(commands, "axes = unitcell"); + list[n++] = "axes = unitcell"; break; case JmolConstants.AXES_MODE_BOUNDBOX: - appendCmd(commands, "axes = window"); + list[n++] = "axes = window"; break; default: - appendCmd(commands, "axes = molecular"); + list[n++] = "axes = molecular"; } //variables only: e = htParameterValues.keys(); while (e.hasMoreElements()) { key = (String) e.nextElement(); if (key.charAt(0) == '@') - appendCmd(commands, key + " " + htParameterValues.get(key)); + list[n++] = key + " " + htParameterValues.get(key); } + Arrays.sort(list, 0, n); + for (int i = 0; i < n; i++) + if (list[i] != null) + appendCmd(commands, list[i]); return commands + "\n"; } + + void registerAllValues() { + htParameterValues = new Hashtable(); + htPropertyFlags = new Hashtable(); + setParameterValue("allowEmbeddedScripts",allowEmbeddedScripts); + setParameterValue("allowRotateSelected",allowRotateSelected); + setParameterValue("ambientPercent",ambientPercent); +// setParameterValue("argbBackground",argbBackground); + setParameterValue("autoBond",autoBond); + setParameterValue("axesMode",axesMode); + setParameterValue("axesScale",axesScale); + setParameterValue("bondRadiusMilliAngstroms",bondRadiusMilliAngstroms); + setParameterValue("bondModeOr",bondModeOr); + setParameterValue("bondTolerance",bondTolerance); + setParameterValue("cameraDepth",cameraDepth); + setParameterValue("cartoonRockets",cartoonRockets); + setParameterValue("chainCaseSensitive",chainCaseSensitive); + setParameterValue("debugScript",debugScript); + setParameterValue("defaultAngleLabel",defaultAngleLabel); + setParameterValue("defaultDirectory",defaultDirectory); + setParameterValue("defaultDistanceLabel",defaultDistanceLabel); + setParameterValue("helpPath",defaultHelpPath); + setParameterValue("defaultLoadScript",defaultLoadScript); + setParameterValue("defaultTorsionLabel",defaultTorsionLabel); + setParameterValue("vectorScale",vectorScale); + setParameterValue("vibrationPeriod",vibrationPeriod); + setParameterValue("vibrationScale",vibrationScale); + setParameterValue("diffusePercent",diffusePercent); + setParameterValue("disablePopupMenu",disablePopupMenu); + setParameterValue("displayCellParameters",displayCellParameters); + setParameterValue("dotsSelectedOnly",dotsSelectedOnly); + setParameterValue("dotSurface",dotSurface); + setParameterValue("dynamicMeasurements",dynamicMeasurements); +//nah setParameterValue("enableFullSceneAntialiasing",enableFullSceneAntialiasing); + setParameterValue("forceAutoBond",forceAutoBond); + setParameterValue("frank",frankOn); + setParameterValue("greyscaleRendering",greyscaleRendering); + setParameterValue("hbondsBackbone",hbondsBackbone); + setParameterValue("hbondsSolid",hbondsSolid); + setParameterValue("helpPath",helpPath); + setParameterValue("hermiteLevel",hermiteLevel); + setParameterValue("hideNameInPopup",hideNameInPopup); + setParameterValue("hideNavigationPoint",hideNavigationPoint); + setParameterValue("highResolutionFlag",highResolutionFlag); + setParameterValue("hoverDelay",hoverDelayMs/1000f); + setParameterValue("justifyMeasurements",justifyMeasurements); + setParameterValue("measureAllModels",measureAllModels); + setParameterValue("minBondDistance",minBondDistance); + setParameterValue("navigationCentered",navigationCentered); + setParameterValue("navigationMode",navigationMode); + setParameterValue("navigationPeriodic",navigationPeriodic); + setParameterValue("navigationSpeed",navigationSpeed); + setParameterValue("percentVdwAtom",percentVdwAtom); + setParameterValue("pickingSpinRate",pickingSpinRate); + setParameterValue("propertyStyleString",propertyStyleString); + setParameterValue("rangeSelected",rangeSelected); + setParameterValue("selectHetero",rasmolHeteroSetting); + setParameterValue("selectHydrogen",rasmolHydrogenSetting); + setParameterValue("ribbonAspectRatio",ribbonAspectRatio); + setParameterValue("ribbonBorder",ribbonBorder); + setParameterValue("scriptDelay",scriptDelay); + setParameterValue("sheetSmoothing",sheetSmoothing); + setParameterValue("showHiddenSelectionHalos",showHiddenSelectionHalos); + setParameterValue("showHydrogens",showHydrogens); + setParameterValue("showMeasurements",showMeasurements); + setParameterValue("showMultipleBonds",showMultipleBonds); + setParameterValue("showNavigationPointAlways",showNavigationPointAlways); + setParameterValue("solvent",solventOn); + setParameterValue("solventProbeRadius",solventProbeRadius); + setParameterValue("specular",specular); + setParameterValue("specularExponent",specularExponent); + setParameterValue("specularPercent",specularPercent); + setParameterValue("specularPower",specularPower); + setParameterValue("ssbondsBackbone",ssbondsBackbone); + setParameterValue("stereoState",stereoState); + setParameterValue("strandCount",strandCount); + setParameterValue("testFlag1",testFlag1); + setParameterValue("testFlag2",testFlag2); + setParameterValue("testFlag3",testFlag3); + setParameterValue("testFlag4",testFlag4); + setParameterValue("traceAlpha",traceAlpha); +//nah setParameterValue("zeroBasedXyzRasmol",zeroBasedXyzRasmol); + setParameterValue("zoomLarge",zoomLarge); + setParameterValue("zShade",zShade); + } } ///////// state serialization Modified: trunk/Jmol/src/org/jmol/viewer/Token.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Token.java 2007-03-03 19:20:58 UTC (rev 7026) +++ trunk/Jmol/src/org/jmol/viewer/Token.java 2007-03-04 23:10:26 UTC (rev 7027) @@ -118,8 +118,8 @@ // rasmol commands final static int backbone = command | 0 | predefinedset; final static int background = command | 1 | colorparam | setparam; - final static int cartoon = command | 3 | setparam; - final static int center = command | 4 | setparam | expressionCommand; + final static int cartoon = command | 3; + final static int center = command | 4 | expressionCommand; final static int color = command | 6 | colorparam | setparam | embeddedExpression; final static int connect = command | 7 | embeddedExpression | colorparam; //final static int data = command | 8; with mathfunc @@ -128,7 +128,7 @@ final static int echo = command | 11 | setparam | specialstring; final static int exit = command | 12; final static int hbond = command | 13 | setparam | expression; - final static int help = command | 14 | setparam | specialstring; + final static int help = command | 14 | specialstring; //final static int label = command | 15 | specialstring; with mathfunc //final static int load = command | 16 | negnums; with mathfunc final static int monitor = command | 18 | setparam | embeddedExpression | expression; @@ -145,7 +145,7 @@ final static int set = command | 31 | negnums | embeddedExpression | colorparam; final static int show = command | 32; final static int slab = command | 33 | negnums | embeddedExpression; - final static int spacefill = command | 35 | setparam | negnums; + final static int spacefill = command | 35 | negnums; final static int ssbond = command | 36 | setparam; final static int stereo = command | 38 | colorparam | negnums; final static int strands = command | 39 | setparam; @@ -231,7 +231,7 @@ final static int comma = expression | 11; final static int coord = expression | 12; final static int none = expression | 13; - final static int bonds = expression | 14; + final static int bonds = expression | 14 | setparam; final static int all = expression | 15; // generated by compiler: @@ -611,37 +611,31 @@ final static int ambient = setparam | 0; final static int bondmode = setparam | 1; final static int fontsize = setparam | 2; - final static int mouse = setparam | 3; final static int picking = setparam | 4; - final static int shadow = setparam | 5; - final static int slabmode = setparam | 6; final static int specular = setparam | 7; final static int specpercent = setparam | 8; final static int specpower = setparam | 9; final static int specexponent = setparam | 10; final static int transparent = setparam | 11; final static int defaultColors = setparam | 12; - - // chime set parameters - final static int clear = setparam | 23; // load - final static int mep = setparam | 25; - final static int mlp = setparam | 26; final static int scale3d = setparam | 29; // jmol extensions final static int property = setparam | 30; final static int diffuse = setparam | 31; final static int pickingStyle = setparam | 33; - final static int spacegroup = setparam | 34; // misc final static int off = misc | 0; final static int on = misc | 1; final static int clipboard = misc | 2; + final static int spacegroup = misc | 3; final static int normal = misc | 4; final static int rasmol = misc | 5; final static int axisangle = misc | 6; final static int atom = misc | 7; + final static int clear = misc | 8; + final static int mep = misc | 9; final static int torsion = misc | 10; final static int shapely = misc | 14; final static int colorRGB = misc | 20 | colorparam; @@ -857,19 +851,15 @@ "bond", null, "display", new Token(display, varArgCount), "fontsize", new Token(fontsize), - "mouse", new Token(mouse), "picking", new Token(picking), "pickingStyle", new Token(pickingStyle), "radius", new Token(radius), - "shadow", new Token(shadow), - "slabmode", new Token(slabmode), // solvent "transparent", new Token(transparent), "cell", new Token(cell), // chime setparams "clear", new Token(clear), "mep", new Token(mep), - "mlp", new Token(mlp), "scale3D", new Token(scale3d), // jmol extensions @@ -1161,4 +1151,17 @@ } return cmds; } +/* + public static String getSetParameters() { + String cmds = ""; + Enumeration e = map.keys(); + while (e.hasMoreElements()) { + String name = (String) e.nextElement(); + Token token = (Token) map.get(name); + if ((token.tok & Token.setparam) != 0) + cmds +=name + "\n"; + } + return cmds; + } + */ } Modified: trunk/Jmol/src/org/jmol/viewer/TransformManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/TransformManager.java 2007-03-03 19:20:58 UTC (rev 7026) +++ trunk/Jmol/src/org/jmol/viewer/TransformManager.java 2007-03-04 23:10:26 UTC (rev 7027) @@ -161,7 +161,7 @@ commands.append("slab reference "+StateManager.escape(slabRef)+ (slabEnabled || isNavigationMode? ";slab on" : "")+";\n"); commands.append(getSpinState(true) + "\n"); if (viewer.modelSetHasVibrationVectors()) { - commands.append("vibration scale " + vibrationScale + ";\n"); + commands.append("vibration scale " + viewer.getVibrationScale() + ";\n"); if (vibrationOn) commands.append("vibration " + vibrationPeriod + ";\n"); else @@ -1899,11 +1899,12 @@ } else if (period == 0) { vibrationPeriod = 0; vibrationPeriodMs = 0; - } else if (period != 0) { + } else { vibrationPeriod = Math.abs(period); vibrationPeriodMs = (int) (vibrationPeriod * 1000); - if (period < 0) + if (period > 0) return; + period = -period; } setVibrationOn(period > 0 && viewer.modelHasVibrationVectors(viewer.getCurrentModelIndex())); @@ -1912,7 +1913,7 @@ protected void setVibrationT(float t) { vibrationRadians = t * twoPI; if (vibrationScale == 0) - vibrationScale = viewer.getDefaultVibrationScale(); + vibrationScale = viewer.getVibrationScale(); vibrationAmplitude = (float) Math.cos(vibrationRadians) * vibrationScale; } Modified: trunk/Jmol/src/org/jmol/viewer/VectorsRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/VectorsRenderer.java 2007-03-03 19:20:58 UTC (rev 7026) +++ trunk/Jmol/src/org/jmol/viewer/VectorsRenderer.java 2007-03-04 23:10:26 UTC (rev 7027) @@ -48,10 +48,7 @@ Vector3f vibrationVector = atom.getVibrationVector(); if (vibrationVector == null) continue; - vectorScale = vectors.scale; - if (Float.isNaN(vectorScale)) { - vectorScale = vectors.scale = viewer.getDefaultVectorScale(); - } + vectorScale = viewer.getVectorScale(); if (transform(mads[i], atom, vibrationVector)) renderVector((colixes == null ? Graphics3D.INHERIT : colixes[i]), atom); } @@ -72,9 +69,6 @@ boolean transform(short mad, Atom atom, Vector3f vibrationVector) { - if (atom.madAtom == JmolConstants.MAR_DELETED) - return false; - float len = vibrationVector.length(); // to have the vectors move when vibration is turned on if (Math.abs(len * vectorScale) < 0.01) @@ -90,7 +84,7 @@ pointArrowHead.add(headOffsetVector); screenArrowHead.set(viewer.transformPoint(pointArrowHead, vibrationVector)); screenVectorEnd.set(viewer.transformPoint(pointVectorEnd, vibrationVector)); - diameter = (mad < 5 ? 5 : mad <= 20 ? mad : viewer.scaleToScreen(screenVectorEnd.z, mad)); + diameter = (mad < 1 ? 1 : mad <= 20 ? mad : viewer.scaleToScreen(screenVectorEnd.z, mad)); headWidthPixels = (int)(diameter * 1.5f); if (headWidthPixels < diameter + 2) headWidthPixels = diameter + 2; Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2007-03-03 19:20:58 UTC (rev 7026) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2007-03-04 23:10:26 UTC (rev 7027) @@ -879,51 +879,51 @@ colorManager.setElementArgb(elementNumber, argb); } - float getDefaultVectorScale() { - return global.defaultVectorScale; + float getVectorScale() { + return global.vectorScale; } - private void setDefaultVectorScale(float scale) { - global.defaultVectorScale = scale; + public void setVectorScale(float scale) { + global.setParameterValue("vectorScale", scale); + global.vectorScale = scale; + refresh(0, "set vectorScale"); } - float getDefaultVibrationScale() { - return global.defaultVibrationScale; + float getVibrationScale() { + return global.vibrationScale; } - private void setDefaultVibrationScale(float scale) { - global.defaultVibrationScale = scale; + float getVibrationPeriod() { + return global.vibrationPeriod; } - float getDefaultVibrationPeriod() { - return global.defaultVibrationPeriod; - } - - private void setDefaultVibrationPeriod(float period) { - global.defaultVibrationPeriod = period; - } - public void setVibrationScale(float scale) { //Eval - global.setParameterValue("vibrationScale", scale); + transformManager.setVibrationScale(scale); + global.vibrationScale = scale; + //because this is public: + global.setParameterValue("vibrationScale", scale); } + void setVibrationOff() { + transformManager.setVibrationPeriod(0); + } + public void setVibrationPeriod(float period) { //Eval - global.setParameterValue("vibrationPeriod", period); transformManager.setVibrationPeriod(period); + period = Math.abs(period); + global.vibrationPeriod = period; + //because this is public: + global.setParameterValue("vibrationPeriod", period); } - public void setVectorScale(float scale) { - loadShape(JmolConstants.SHAPE_VECTORS); - setShapeProperty(JmolConstants.SHAPE_VECTORS, "scale", new Float(scale)); - } - void setBackgroundArgb(int argb) { // Eval global.argbBackground = argb; g3d.setBackgroundArgb(argb); + global.setParameterValue("backgroundColor", StateManager.escapeColor(argb)); colorManager.setColixBackgroundContrast(argb); } @@ -1460,6 +1460,7 @@ + " " + bTotal + " " + bFree + " " + bMax); if (notify) setStatusFileLoaded(0, null, null, null, null, null); + // System.out.println(Token.getSetParameters()); } private void zap(String msg) { @@ -1500,8 +1501,7 @@ if (eval != null) eval.clearDefinitionsAndLoadPredefined(); // there probably needs to be a better startup mechanism for shapes - if (modelSetHasVibrationVectors()) - setShapeSize(JmolConstants.SHAPE_VECTORS, global.defaultVectorMad); + repaintManager.initializePointers(1); setCurrentModelIndex(0); setBackgroundModelIndex(-1); @@ -2844,7 +2844,7 @@ } public void setMarBond(short marBond) { - global.marBond = marBond; + global.bondRadiusMilliAngstroms = marBond; global.setParameterValue("bondRadiusMilliAngstroms", marBond); setShapeSize(JmolConstants.SHAPE_STICKS, marBond * 2); } @@ -3034,14 +3034,6 @@ //Logger.setActiveLevel(Logger.LEVEL_DEBUG, debugScript); } - boolean getDebugCommand() { - return global.debugCommand; - } - - void setDebugCommand(boolean TF) { - global.debugScript = TF; - } - void atomPicked(int atomIndex, int modifiers) { if (!isInSelectionSubset(atomIndex)) return; @@ -3341,7 +3333,7 @@ setDefaultDirectory(value); break; } - if (key.equalsIgnoreCase("help")) { + if (key.equalsIgnoreCase("helpPath")) { setHelpPath(value); break; } @@ -3398,7 +3390,12 @@ private boolean setFloatProperty(String key, float value, boolean isInt) { //Eval while (true) { + ///11.1/// + if (key.equalsIgnoreCase("axesScale")) { + setAxesScale(value); + break; + } if (key.equalsIgnoreCase("visualRange")) { setVisualRange(value); break; @@ -3440,25 +3437,20 @@ setStereoDegrees(value); break; } - if (key.equalsIgnoreCase("defaultVectorScale")) { - setDefaultVectorScale(value); - break; + if (key.equalsIgnoreCase("vectorScale")) { + //public -- no need to set + setVectorScale(value); + return true; } - if (key.equalsIgnoreCase("defaultVibrationPeriod")) { - setDefaultVibrationPeriod(value); - break; - } - if (key.equalsIgnoreCase("defaultVibrationScale")) { - setDefaultVibrationScale(value); - break; - } if (key.equalsIgnoreCase("vibrationPeriod")) { + //public -- no need to set setVibrationPeriod(value); - break; + return true; } if (key.equalsIgnoreCase("vibrationScale")) { + //public -- no need to set setVibrationScale(value); - break; + return true; } if (key.equalsIgnoreCase("bondTolerance")) { setBondTolerance(value); @@ -3508,6 +3500,12 @@ private void setIntProperty(String key, int value, boolean defineNew) { while (true) { ///11.1/// + + if (key.equalsIgnoreCase("strandCount")) { + setShapeProperty(JmolConstants.SHAPE_STRANDS, "strandCount", + new Integer(value >= 0 && value <= 20 ? value : 5)); + break; + } if (key.equalsIgnoreCase("perspectiveModel")) { setPerspectiveModel(value); break; @@ -3567,7 +3565,8 @@ } if (key.equalsIgnoreCase("bondRadiusMilliAngstroms")) { setMarBond((short) value); - break; + //public method -- no need to set + return; } if (key.equalsIgnoreCase("hermiteLevel")) { setHermiteLevel(value); @@ -3595,7 +3594,10 @@ } if (defineNew) { if (global.htPropertyFlags.containsKey(key)) { - scriptStatus(GT._("ERROR: Cannot set value of a boolean to another type. use \"{0}\" first.", 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); @@ -3736,20 +3738,20 @@ break; } if (key.equalsIgnoreCase("dotsSelectedOnly")) { - setDotsSelectedOnlyFlag(value); + setDotsSelectedOnly(value); break; } - if (key.equalsIgnoreCase("showAxes")) { //deprecated -- see "axes" command + if (key.equalsIgnoreCase("showAxes")) { setShowAxes(value); - break; + return true; } - if (key.equalsIgnoreCase("showBoundBox")) { //deprecated -- see "boundBox" + if (key.equalsIgnoreCase("showBoundBox")) { setShowBbcage(value); - break; + return true; } - if (key.equalsIgnoreCase("showUnitcell")) { //deprecated -- see "unitcell" - setShapeShow(JmolConstants.SHAPE_UCCAGE, value); - break; + if (key.equalsIgnoreCase("showUnitcell")) { + setShowUnitCell(value); + return true; } if (key.equalsIgnoreCase("selectionHalos")) { setSelectionHalos(value); //volatile @@ -3759,10 +3761,6 @@ setDebugScript(value); break; } - if (key.equalsIgnoreCase("debugCommand")) { - setDebugCommand(value); - break; - } if (key.equalsIgnoreCase("frank")) { setFrankOn(value); break; @@ -3771,11 +3769,11 @@ setShowHydrogens(value); break; } - if (key.equalsIgnoreCase("defaultSelectHydrogen")) { + if (key.equalsIgnoreCase("selectHydrogen")) { setRasmolHydrogenSetting(value); break; } - if (key.equalsIgnoreCase("defaultSelectHetero")) { + if (key.equalsIgnoreCase("selectHetero")) { setRasmolHeteroSetting(value); break; } @@ -3799,10 +3797,6 @@ setWindowCentered(value); break; } - if (key.equalsIgnoreCase("adjustCamera")) { - setAdjustCamera(value); - break; - } if (key.equalsIgnoreCase("displayCellParameters")) { setDisplayCellParameters(value); break; @@ -3846,9 +3840,9 @@ if (key.equalsIgnoreCase("bonds")) return setBooleanProperty("showMultipleBonds", value, true); if (key.equalsIgnoreCase("hydrogen")) //deprecated - return setBooleanProperty("defaultSelectHydrogen", value, true); + return setBooleanProperty("selectHydrogen", value, true); if (key.equalsIgnoreCase("hetero")) //deprecated - return setBooleanProperty("defaultSelectHetero", value, true); + return setBooleanProperty("selectHetero", value, true); if (key.equalsIgnoreCase("showSelections")) //deprecated -- see "selectionHalos" return setBooleanProperty("selectionHalos", value, true); // these next return, because there is no need to repaint @@ -3865,10 +3859,6 @@ setRangeSelected(value); break; } - if (key.equalsIgnoreCase("cameraMove")) { - setAllowCameraMove(value); - break; - } if (key.equalsIgnoreCase("measureAllModels")) { setMeasureAllModels(value); break; @@ -3948,19 +3938,19 @@ //////// flags and settings //////// boolean getDotSurfaceFlag() { - return global.dotSurfaceFlag; + return global.dotSurface; } private void setDotSurfaceFlag(boolean TF) { - global.dotSurfaceFlag = TF; + global.dotSurface = TF; } boolean getDotsSelectedOnlyFlag() { - return global.dotsSelectedOnlyFlag; + return global.dotsSelectedOnly; } - private void setDotsSelectedOnlyFlag(boolean TF) { - global.dotsSelectedOnlyFlag = TF; + private void setDotsSelectedOnly(boolean TF) { + global.dotsSelectedOnly = TF; } boolean isRangeSelected() { @@ -4018,22 +4008,6 @@ refresh(1, "set visualRange"); } - boolean isCameraAdjustable() { - return global.adjustCameraFlag; - } - - private void setAdjustCamera(boolean TF) { - global.adjustCameraFlag = TF; - } - - boolean allowCameraMove() { - return global.allowCameraMoveFlag; - } - - private void setAllowCameraMove(boolean TF) { - global.allowCameraMoveFlag = TF; - } - private void setSolventProbeRadius(float radius) { //Eval global.solventProbeRadius = radius; @@ -4112,6 +4086,15 @@ public boolean getAxesOrientationRasmol() { return transformManager.axesOrientationRasmol; } + + void setAxesScale(float scale) { + global.axesScale = scale; + refresh(0, "set axesScale"); + } + + float getAxesScale() { + return global.axesScale; + } boolean setAxesMode(String key, boolean value) { if (key.equalsIgnoreCase("axesWindow")) { @@ -4178,12 +4161,12 @@ private void setBondSelectionModeOr(boolean bondSelectionModeOr) { //Eval - global.bondSelectionModeOr = bondSelectionModeOr; + global.bondModeOr = bondSelectionModeOr; refresh(0, "Viewer:setBondSelectionModeOr()"); } boolean getBondSelectionModeOr() { - return global.bondSelectionModeOr; + return global.bondModeOr; } boolean getChainCaseSensitive() { @@ -4203,11 +4186,11 @@ } boolean getCartoonRocketFlag() { - return global.cartoonRocketFlag; + return global.cartoonRockets; } private void setCartoonRocketFlag(boolean TF) { - global.cartoonRocketFlag = TF; + global.cartoonRockets = TF; } boolean getHideNameInPopup() { @@ -4229,7 +4212,7 @@ private void setNavigationMode(boolean TF) { global.navigationMode = TF; if (TF && !transformManager.canNavigate()) { - setVibrationPeriod(0); + setVibrationOff(); transformManager = transformManager.getNavigationManager(this, dimScreen.width, dimScreen.height); reset(); @@ -4247,7 +4230,7 @@ } private void setPerspectiveModel(int mode) { - setVibrationPeriod(0); + setVibrationOff(); switch (mode) { case 10: transformManager = new TransformManager10(this, dimScreen.width, @@ -4379,11 +4362,11 @@ } public short getMadBond() { - return (short) (global.marBond * 2); + return (short) (global.bondRadiusMilliAngstroms * 2); } public short getMarBond() { - return global.marBond; + return global.bondRadiusMilliAngstroms; } /* @@ -4437,14 +4420,21 @@ } public void setShowBbcage(boolean value) { + global.setParameterValue("showBoundBox",value); setShapeShow(JmolConstants.SHAPE_BBCAGE, value); } + public void setShowUnitCell(boolean value) { + global.setParameterValue("showUnitCell",value); + setShapeShow(JmolConstants.SHAPE_UCCAGE, value); + } + public boolean getShowAxes() { return getShapeShow(JmolConstants.SHAPE_AXES); } public void setShowAxes(boolean value) { + global.setParameterValue("showAxes",value); setShapeShow(JmolConstants.SHAPE_AXES, value); } @@ -4937,8 +4927,6 @@ } void getHelp(String what) { - if (global.helpPath == null) - global.helpPath = global.defaultHelpPath; showUrl(global.helpPath + what); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |