refactor to allow distinct StructureSelectionManager instances for
[jalview.git] / src / jalview / gui / Jalview2XML.java
old mode 100755 (executable)
new mode 100644 (file)
index 2df51b1..e639844
@@ -48,7 +48,7 @@ import jalview.util.jarInputStreamProvider;
  * will be :)
  * 
  * @author $author$
- * @version $Revision$
+ * @version $Revision: 1.134 $
  */
 public class Jalview2XML
 {
@@ -624,6 +624,7 @@ public class Jalview2XML
                     state.setAlignwithAlignPanel(jmol.isUsedforaligment(ap));
                     state.setColourwithAlignPanel(jmol
                             .isUsedforcolourby(ap));
+                    state.setColourByJmol(jmol.isColouredByJmol());
                     if (!jmolViewIds.contains(state.getViewId()))
                     {
                       // Make sure we only store a Jmol state once in each XML
@@ -2573,7 +2574,7 @@ public class Jalview2XML
                 { new int[]
                 { x, y, width, height }, "",
                     new Hashtable<String, Object[]>(), new boolean[]
-                    { false, false } });
+                    { false, false, true } });
                 // Legacy pre-2.7 conversion JAL-823 : 
                 // do not assume any view has to be linked for colour by sequence
               }
@@ -2591,6 +2592,8 @@ public class Jalview2XML
                       .hasColourwithAlignPanel() ? ids[p]
                       .getStructureState(s).getColourwithAlignPanel()
                       : false;
+              // default for pre-2.7 projects is that Jmol colouring is enabled
+              ((boolean[])jmoldat[3])[2] &=ids[p].getStructureState(s).hasColourByJmol() ? ids[p].getStructureState(s).getColourByJmol() : true;
 
               if (((String) jmoldat[1]).length() < ids[p]
                       .getStructureState(s).getContent().length())
@@ -2630,7 +2633,7 @@ public class Jalview2XML
           int[] geom = (int[]) svattrib[0];
           String state = (String) svattrib[1];
           Hashtable<String, Object[]> oldFiles = (Hashtable<String, Object[]>) svattrib[2];
-          final boolean useinJmolsuperpos = ((boolean[]) svattrib[3])[0], usetoColourbyseq = ((boolean[]) svattrib[3])[1];
+          final boolean useinJmolsuperpos = ((boolean[]) svattrib[3])[0], usetoColourbyseq = ((boolean[]) svattrib[3])[1], jmolColouring=((boolean[])svattrib[3])[2];
           int x = geom[0], y = geom[1], width = geom[2], height = geom[3];
           // collate the pdbfile -> sequence mappings from this view
           Vector<String> pdbfilenames = new Vector<String>();
@@ -2786,7 +2789,7 @@ public class Jalview2XML
                     try
                     {
                       sview = new AppJmol(pdbf, id, sq, alf.alignPanel,
-                              useinJmolsuperpos, usetoColourbyseq, fileloc,
+                              useinJmolsuperpos, usetoColourbyseq, jmolColouring, fileloc,
                               rect, vid);
                     } catch (OutOfMemoryError ex)
                     {
@@ -2828,8 +2831,7 @@ public class Jalview2XML
               String pdbFile = (String) filedat[0];
               SequenceI[] seq = (SequenceI[]) ((Vector<SequenceI>) filedat[2])
                       .toArray(new SequenceI[0]);
-              StructureSelectionManager.getStructureSelectionManager()
-                      .setMapping(seq, null, pdbFile,
+              ((AppJmol) comp).jmb.ssm.setMapping(seq, null, pdbFile,
                               jalview.io.AppletFormatAdapter.FILE);
               ((AppJmol) comp).jmb.addSequenceForStructFile(pdbFile, seq);
             }
@@ -2845,7 +2847,7 @@ public class Jalview2XML
             }
             if (usetoColourbyseq)
             {
-              ((AppJmol) comp).useAlignmentPanelForColourbyseq(ap);
+              ((AppJmol) comp).useAlignmentPanelForColourbyseq(ap, !jmolColouring);
             }
             else
             {