From: <ha...@us...> - 2006-09-17 18:27:22
|
Revision: 5583 http://svn.sourceforge.net/jmol/?rev=5583&view=rev Author: hansonr Date: 2006-09-17 11:27:15 -0700 (Sun, 17 Sep 2006) Log Message: ----------- set pickingStyle measure Modified Paths: -------------- trunk/Jmol/src/org/jmol/viewer/Eval.java trunk/Jmol/src/org/jmol/viewer/JmolConstants.java trunk/Jmol/src/org/jmol/viewer/PickingManager.java trunk/Jmol/src/org/jmol/viewer/Token.java Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Eval.java 2006-09-17 17:55:34 UTC (rev 5582) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java 2006-09-17 18:27:15 UTC (rev 5583) @@ -4029,6 +4029,7 @@ String style = ""; checkLength3(); switch (statement[2].tok) { + case Token.monitor: case Token.identifier: style = (String) statement[2].value; case Token.none: Modified: trunk/Jmol/src/org/jmol/viewer/JmolConstants.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/JmolConstants.java 2006-09-17 17:55:34 UTC (rev 5582) +++ trunk/Jmol/src/org/jmol/viewer/JmolConstants.java 2006-09-17 18:27:15 UTC (rev 5583) @@ -100,7 +100,7 @@ public final static int PICKING_DRAW = 17; public final static String[] pickingModeNames = { - "off", "ident", "distance", "monitor", "angle", "torsion", "label", + "off", "ident", "distance", "measure", "angle", "torsion", "label", "center", "coord", "bond", "atom", "group", "chain", "spin", "molecule", "site", "element","draw"}; @@ -111,9 +111,10 @@ public final static int PICKINGSTYLE_CHIME = 0; public final static int PICKINGSTYLE_RASMOL = 1; public final static int PICKINGSTYLE_PFAAT = 2; + public final static int PICKINGSTYLE_MEASURE = 3; public final static String[] pickingStyleNames = { - "toggle", "selectOrToggle", "extendedSelect" + "toggle", "selectOrToggle", "extendedSelect", "measure" }; /** Modified: trunk/Jmol/src/org/jmol/viewer/PickingManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/PickingManager.java 2006-09-17 17:55:34 UTC (rev 5582) +++ trunk/Jmol/src/org/jmol/viewer/PickingManager.java 2006-09-17 18:27:15 UTC (rev 5583) @@ -48,11 +48,14 @@ boolean shiftKey = ((modifiers & MouseManager.SHIFT) != 0); boolean alternateKey = ((modifiers & MouseManager.ALT) != 0); if (atomIndex == -1) { - if (pickingStyle == JmolConstants.PICKINGSTYLE_PFAAT && !shiftKey - && !alternateKey) { + if (pickingStyle == JmolConstants.PICKINGSTYLE_PFAAT + && !shiftKey && !alternateKey) { viewer.clearSelection(); reportSelection(); } + if (pickingMode == JmolConstants.PICKING_MONITOR + || pickingStyle == JmolConstants.PICKINGSTYLE_MEASURE) + queuedAtomCount = 0; return; } @@ -64,6 +67,7 @@ case JmolConstants.PICKING_IDENT: viewer.setStatusAtomPicked(atomIndex, viewer.getAtomInfoXYZ(atomIndex)); break; + case JmolConstants.PICKING_MONITOR: case JmolConstants.PICKING_DISTANCE: if (queuedAtomCount >= 2) queuedAtomCount = 0; @@ -74,6 +78,9 @@ value = "Distance " + viewer.getAtomInfo(queuedAtomIndexes[0]) + " - " + viewer.getAtomInfo(queuedAtomIndexes[1]) + " : " + distance; viewer.setStatusNewPickingModeMeasurement(2, value); + if (pickingMode == JmolConstants.PICKING_MONITOR + || pickingStyle == JmolConstants.PICKINGSTYLE_MEASURE) + toggleMeasurement(2); break; case JmolConstants.PICKING_ANGLE: if (queuedAtomCount >= 3) @@ -87,6 +94,8 @@ + viewer.getAtomInfo(queuedAtomIndexes[1]) + " - " + viewer.getAtomInfo(queuedAtomIndexes[2]) + " : " + angle; viewer.setStatusNewPickingModeMeasurement(3, value); + if (pickingStyle == JmolConstants.PICKINGSTYLE_MEASURE) + toggleMeasurement(3); break; case JmolConstants.PICKING_TORSION: if (queuedAtomCount >= 4) @@ -101,18 +110,9 @@ + viewer.getAtomInfo(queuedAtomIndexes[2]) + " - " + viewer.getAtomInfo(queuedAtomIndexes[3]) + " : " + torsion; viewer.setStatusNewPickingModeMeasurement(4, value); + if (pickingStyle == JmolConstants.PICKINGSTYLE_MEASURE) + toggleMeasurement(4); break; - case JmolConstants.PICKING_MONITOR: - if (queuedAtomCount >= 2) - queuedAtomCount = 0; - queueAtom(atomIndex); - if (queuedAtomCount < 2) - break; - countPlusIndexes[0] = 2; - countPlusIndexes[1] = queuedAtomIndexes[0]; - countPlusIndexes[2] = queuedAtomIndexes[1]; - viewer.toggleMeasurement(countPlusIndexes); - break; case JmolConstants.PICKING_LABEL: viewer.togglePickingLabel(atomIndex); break; @@ -172,6 +172,13 @@ } } + void toggleMeasurement(int nAtoms) { + countPlusIndexes[0] = nAtoms; + for (int i = 0; i < nAtoms; i++) + countPlusIndexes[i + 1] = queuedAtomIndexes[i]; + viewer.toggleMeasurement(countPlusIndexes); + } + void applyMouseStyle(int atomIndex, boolean shiftKey, boolean alternateKey) { if (pickingStyle == JmolConstants.PICKINGSTYLE_PFAAT) { if (shiftKey && alternateKey) Modified: trunk/Jmol/src/org/jmol/viewer/Token.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Token.java 2006-09-17 17:55:34 UTC (rev 5582) +++ trunk/Jmol/src/org/jmol/viewer/Token.java 2006-09-17 18:27:15 UTC (rev 5583) @@ -482,7 +482,7 @@ "altlocs", null, "insertion", new Token(insertion, "insertion"), "insertions", null, - "monitor", new Token(monitor, varArgCount, "monitor"), + "monitor", new Token(monitor, varArgCount, "measure"), "monitors", null, "measure", null, "measures", null, @@ -506,7 +506,7 @@ "set", new Token(set, varArgCount, "set"), "show", new Token(show, varArgCount, "show"), "slab", new Token(slab, onDefault1, "slab"), - "cpk", new Token(cpk, varArgCount, "cpk"), + "cpk", new Token(cpk, varArgCount, "spacefill"), "spacefill", null, "ssbond", new Token(ssbond, onDefault1, "ssbond"), "ssbonds", null, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |