JAL-4086 commented out attempt to create measurement lines between aligned residues...
[jalview.git] / src / jalview / ext / jmol / JalviewJmolBinding.java
index a40da35..21a19ae 100644 (file)
@@ -83,8 +83,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
 
   public Viewer jmolViewer;
 
-  private boolean globalUseScriptWait = false;
-
   public JalviewJmolBinding(StructureSelectionManager ssm,
           PDBEntry[] pdbentry, SequenceI[][] sequenceIs,
           DataSourceType protocol)
@@ -131,7 +129,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
   {
     Console.debug(">>Jmol>> " + script);
     String s;
-    if (globalUseScriptWait || useScriptWait)
+    if (useScriptWait)
     {
       s = jmolViewer.scriptWait(script);
     }
@@ -270,10 +268,9 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
     if (atoms != null)
     {
       boolean useScriptWait = atoms.size() > 1;
-      boolean prevUseScriptWait = setGlobalUseScriptWait(useScriptWait);
       if (resetLastRes.length() > 0)
       {
-        jmolScript(resetLastRes.toString());
+        jmolScript(resetLastRes.toString(), useScriptWait);
         resetLastRes.setLength(0);
       }
       for (AtomSpec atom : atoms)
@@ -281,8 +278,31 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
         highlightAtom(atom.getAtomIndex(), atom.getPdbResNum(),
                 atom.getChain(), atom.getPdbFile(), useScriptWait);
       }
-      setGlobalUseScriptWait(prevUseScriptWait);
+      // Highlight distances between atoms with a 'measure' command - not yet
+      // working
+      // if (atoms.size() >= 2)
+      // {
+      // StringBuilder sb = new StringBuilder();
+      // for (int a = 0; a < atoms.size(); a++)
+      // {
+      // AtomSpec speca = atoms.get(a);
+      // String a_model = getModelIdForFile(speca.getPdbFile());
+      // for (int b = a + 1; b < atoms.size(); b++)
+      // {
+      // AtomSpec specb = atoms.get(b);
+      // String b_model = getModelIdForFile(speca.getPdbFile());
+      // sb.append("measure ALL (" + speca.getAtomIndex() + " and */"
+      // + a_model + ") (" + specb.getAtomIndex() + " and */"
+      // + b_model + ");");
+      // }
+      // }
+      // jmolHistory(false, useScriptWait);
+      // jmolScript(sb.toString(), useScriptWait);
+      // jmolHistory(true, useScriptWait);
+      // }
+
     }
+
   }
 
   // jmol/ssm only
@@ -295,7 +315,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
       return;
     }
 
-    jmolHistory(false);
+    jmolHistory(false, useScriptWait);
 
     StringBuilder selection = new StringBuilder(32);
     StringBuilder cmd = new StringBuilder(64);
@@ -314,14 +334,20 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
             .append(" and not hetero; spacefill 0;");
 
     jmolScript(cmd.toString(), useScriptWait);
-    jmolHistory(true);
+    jmolHistory(true, useScriptWait);
   }
 
   private boolean debug = true;
 
   private void jmolHistory(boolean enable)
   {
-    jmolScript("History " + ((debug || enable) ? "on" : "off"));
+    jmolHistory(enable, false);
+  }
+
+  private void jmolHistory(boolean enable, boolean useScriptWait)
+  {
+    jmolScript("History " + ((debug || enable) ? "on" : "off"),
+            useScriptWait);
   }
 
   public void loadInline(String string)
@@ -1070,11 +1096,4 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
   {
     return "http://wiki.jmol.org"; // BH 2018
   }
-
-  private boolean setGlobalUseScriptWait(boolean b)
-  {
-    boolean prev = globalUseScriptWait;
-    globalUseScriptWait = b;
-    return prev;
-  }
 }