From: <ha...@us...> - 2010-05-26 18:04:52
|
Revision: 13220 http://jmol.svn.sourceforge.net/jmol/?rev=13220&view=rev Author: hansonr Date: 2010-05-26 18:04:42 +0000 (Wed, 26 May 2010) Log Message: ----------- Modified Paths: -------------- trunk/Jmol/src/org/jmol/viewer/DataManager.java trunk/Jmol/src/org/jmol/viewer/MouseManager14.java trunk/Jmol/src/org/jmol/viewer/StateManager.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/viewer/DataManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/DataManager.java 2010-05-26 17:49:26 UTC (rev 13219) +++ trunk/Jmol/src/org/jmol/viewer/DataManager.java 2010-05-26 18:04:42 UTC (rev 13220) @@ -206,7 +206,7 @@ return (float[][][]) data[1]; } - protected void deleteModelAtoms(int firstAtomIndex, int nAtoms, BitSet bsDeleted) { + void deleteModelAtoms(int firstAtomIndex, int nAtoms, BitSet bsDeleted) { if (dataValues == null) return; Enumeration e = (dataValues.keys()); @@ -278,12 +278,12 @@ } } + private float[] userVdws; int[] userVdwMars; - float[] userVdws; int defaultVdw = JmolConstants.VDW_JMOL; BitSet bsUserVdws; - public void setUserVdw(int iMode) { + private void setUserVdw(int iMode) { userVdwMars = new int[Elements.elementNumberMax]; userVdws = new float[Elements.elementNumberMax]; bsUserVdws = new BitSet(); @@ -295,7 +295,7 @@ } } - public void setDefaultVdw(int iType) { + void setDefaultVdw(int iType) { // only allowed types here are VDW_JMOL, VDW_BABEL, VDW_RASMOL, VDW_USER, VDW_AUTO switch (iType) { case JmolConstants.VDW_JMOL: @@ -347,7 +347,7 @@ + sb.append(" end \"element_vdw\";\n\n").toString()); } - public static void getInlineData(StringBuffer loadScript, String strModel, boolean isAppend) { + static void getInlineData(StringBuffer loadScript, String strModel, boolean isAppend) { String tag = (isAppend ? "append" : "model"); loadScript.append("data \"").append(tag).append(" inline\"\n") .append(strModel).append("end \"").append(tag).append(" inline\";"); Modified: trunk/Jmol/src/org/jmol/viewer/MouseManager14.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/MouseManager14.java 2010-05-26 17:49:26 UTC (rev 13219) +++ trunk/Jmol/src/org/jmol/viewer/MouseManager14.java 2010-05-26 18:04:42 UTC (rev 13220) @@ -142,16 +142,22 @@ String ret = viewer.loadInline(ImageCreator.getClipboardTextStatic(), false); if (ret != null) Logger.error(ret); - break; } + break; case 26: case 'z': // undo switch (modifiers) { case Binding.CTRL: viewer.undoAction(false, 0, 0); - break; } - + break; + case 25: + case 'y': // undo + switch (modifiers) { + case Binding.CTRL: + viewer.undoAction(false, 0, -1); + } + break; } return; } Modified: trunk/Jmol/src/org/jmol/viewer/StateManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/StateManager.java 2010-05-26 17:49:26 UTC (rev 13219) +++ trunk/Jmol/src/org/jmol/viewer/StateManager.java 2010-05-26 18:04:42 UTC (rev 13220) @@ -600,7 +600,7 @@ + ";picking;pickingstyle;propertycolorschemeoverload;radius;rgbblue;rgbgreen;rgbred" + ";scaleangstromsperinch;selectionhalos;showscript;showselections;solvent;strandcount" + ";spinx;spiny;spinz;spinfps;navx;navy;navz;navfps;" + JmolConstants.getCallbackName(-1) - + ";undo;bondpicking;modelkitmode;"; + + ";undo;bondpicking;modelkitmode;allowgestures;allowkeystrokes;allowmultitouch;allowmodelkit;"; protected static int getJmolVersionInt() { // 11.9.999 --> 1109999 @@ -695,6 +695,7 @@ messageStyleChime = g.messageStyleChime; defaultDirectory = g.defaultDirectory; allowGestures = g.allowGestures; + allowModelkit = g.allowModelkit; allowMultiTouch = g.allowMultiTouch; allowKeyStrokes = g.allowKeyStrokes; useScriptQueue = g.useScriptQueue; @@ -790,6 +791,7 @@ setParameterValue("allowEmbeddedScripts", allowEmbeddedScripts); setParameterValue("allowGestures", allowGestures); setParameterValue("allowKeyStrokes", allowKeyStrokes); + setParameterValue("allowModelkit", allowModelkit); setParameterValue("allowMultiTouch", allowMultiTouch); setParameterValue("allowRotateSelected", allowRotateSelected); setParameterValue("ambientPercent", ambientPercent); @@ -1147,6 +1149,7 @@ //misc boolean allowGestures = false; + boolean allowModelkit = true; boolean allowMultiTouch = true; // but you still need to set the parameter multiTouchSparshUI=true boolean allowKeyStrokes = false; int animationFps = 10; Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2010-05-26 17:49:26 UTC (rev 13219) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2010-05-26 18:04:42 UTC (rev 13220) @@ -2374,8 +2374,10 @@ clearAllMeasurements(); clearMinimization(); modelSet = modelManager.zap(); - if (resetUndo) + if (resetUndo) { actionStates.clear(); + actionStatesRedo.clear(); + } if (haveDisplay) { mouseManager.clear(); actionManager.clear(); @@ -4208,7 +4210,7 @@ return points; } - public BitSet addHydrogens(BitSet bsAtoms, boolean asScript) { + public BitSet addHydrogens(BitSet bsAtoms, boolean asScript, boolean isSilent) { boolean doAll = (bsAtoms == null); if (bsAtoms == null) bsAtoms = getModelUndeletedAtomsBitSet(getVisibleFramesBitSet().length() - 1); @@ -4233,7 +4235,8 @@ if (wasAppendNew) setAppendNew(true); } - scriptStatus(GT._("{0} hydrogens added", pts.length)); + if (!isSilent) + scriptStatus(GT._("{0} hydrogens added", pts.length)); return bsB; } @@ -5600,6 +5603,10 @@ boolean found = true; boolean doRepaint = true; switch (tok) { + case Token.allowmodelkit: + // 11.12.RC15 + global.allowModelkit = value; + break; case Token.modelkitmode: setModelKitMode(value); break; @@ -8475,7 +8482,7 @@ if (bsSelected == null) bsSelected = getModelUndeletedAtomsBitSet(getVisibleFramesBitSet().length() - 1); if (addHydrogen) - bsSelected.or(addHydrogens(bsSelected, asScript)); + bsSelected.or(addHydrogens(bsSelected, asScript, isSilent)); try { getMinimizer(true).minimize(steps, crit, bsSelected, isSilent); } catch (Exception e) { @@ -8689,27 +8696,40 @@ return shapeManager.transformAtoms(firstPass); } - public void setAtomPickingOption(String option) { + private void setAtomPickingOption(String option) { if (haveDisplay) actionManager.setAtomPickingOption(option); } - public void setBondPickingOption(String option) { + private void setBondPickingOption(String option) { if (haveDisplay) actionManager.setBondPickingOption(option); } - private Vector actionStates = new Vector(); private final static int MAX_ACTION_UNDO = 25; + private final Vector actionStates = new Vector(); + private final Vector actionStatesRedo = new Vector(); void undoAction(boolean isSave, int taintedAtom, int type) { + //System.out.println("REDO:" + actionStatesRedo.size()); + //System.out.println("UNDO:" + actionStates.size()); + if (!isSave) { - int n = actionStates.size(); - if (n > 0) - evalStringQuiet((String) actionStates.remove(n - 1)); + String s; + if (type == -1) { + if (actionStatesRedo.size() == 0) + return; + s = (String) actionStatesRedo.remove(0); + } else if (actionStates.size()== 0) { + return; + } else { + s = (String) actionStates.remove(0); + actionStatesRedo.add(0, s); + } + evalStringQuiet(s); return; } - System.out.println(taintedAtom + " " + type); + actionStatesRedo.clear(); BitSet bs; StringBuffer sb = new StringBuffer(); if (taintedAtom >= 0) { @@ -8723,27 +8743,19 @@ DataManager.getInlineData(sb, modelSet.getModelExtract(bs, false), true); sb.append(actionManager.getPickingState()).append( transformManager.getMoveToText(0, false)); - System.out.println(sb); } - actionStates.add(sb.toString()); + actionStates.add(0, sb.toString()); if (actionStates.size() == MAX_ACTION_UNDO) - actionStates.removeElementAt(0); + actionStates.removeElementAt(MAX_ACTION_UNDO - 1); } - void assignAtom(int atomIndex, String type) { - modelSet.assignAtom(atomIndex, type, true); - refresh(3, "assignAtom"); - } - - int test = 0; - public void assignBond(int bondIndex, char type) { try { BitSet bsAtoms = modelSet.setBondOrder(bondIndex, type); if (bsAtoms == null) refresh(3, "setBondOrder"); else - addHydrogens(bsAtoms, false); + addHydrogens(bsAtoms, false, true); } catch (Exception e) { Logger.error("assignBond failed"); } @@ -8775,7 +8787,7 @@ } } - public void moveAtomWithHydrogens(int atomIndex, int deltaX, int deltaY, + void moveAtomWithHydrogens(int atomIndex, int deltaX, int deltaY, boolean wholeMolecule) { clearModelDependentObjects(); Atom atom = modelSet.atoms[atomIndex]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |