merge from develop
[jalview.git] / src / jalview / ext / jmol / JalviewJmolBinding.java
index c7496df..729780c 100644 (file)
@@ -63,11 +63,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
         implements JmolStatusListener, JmolSelectionListener,
         ComponentListener
 {
-  /*
-   * state flag used to check if the Jmol viewer's paint method can be called
-   */
-  private boolean finishedInit = false;
-
   boolean allChainsSelected = false;
 
   /*
@@ -259,8 +254,17 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
   public void superposeStructures(AlignmentI[] _alignment,
           int[] _refStructure, ColumnSelection[] _hiddenCols)
   {
+    while (viewer.isScriptExecuting())
+    {
+      try
+      {
+        Thread.sleep(10);
+      } catch (InterruptedException i)
+      {
+      }
+      ;
+    }
     String[] files = getPdbFile();
-
     if (!waitForFileLoad(files))
     {
       return;
@@ -272,7 +276,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
     String nSeconds = " ";
     if (files.length > 10)
     {
-      nSeconds = " 0.00001 ";
+      nSeconds = " 0.005 ";
     }
     else
     {
@@ -281,7 +285,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
     }
     // see JAL-1345 - should really automatically turn off the animation for
     // large numbers of structures, but Jmol doesn't seem to allow that.
-    nSeconds = " ";
+    // nSeconds = " ";
     // union of all aligned positions are collected together.
     for (int a = 0; a < _alignment.length; a++)
     {
@@ -667,6 +671,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
           // applet path with docroot - discard as format won't match pdbfile
           mset[0] = m;
         }
+        _modelFileNameMap[0] = 0; // filename index for first model is always 0.
       }
       int j = 1;
       for (int i = 1; i < mset.length; i++)
@@ -942,7 +947,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
     String mdlString = "";
     if ((p = strInfo.indexOf(":")) > -1)
     {
-      picked += strInfo.substring(p + 1, strInfo.indexOf("."));
+      picked += strInfo.substring(p, strInfo.indexOf("."));
     }
 
     if ((p = strInfo.indexOf("/")) > -1)
@@ -1216,7 +1221,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
     // }
     if (!isLoadingFromArchive())
     {
-      viewer.evalStringQuiet("model 0; select backbone;restrict;cartoon;wireframe off;spacefill off");
+      viewer.evalStringQuiet("model *; select backbone;restrict;cartoon;wireframe off;spacefill off");
     }
     // register ourselves as a listener and notify the gui that it needs to
     // update itself.
@@ -1401,16 +1406,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
     return null;
   }
 
-  public boolean isFinishedInit()
-  {
-    return finishedInit;
-  }
-
-  public void setFinishedInit(boolean finishedInit)
-  {
-    this.finishedInit = finishedInit;
-  }
-
   /**
    * 
    */