JAL-1695 parameter controls whether SplitFrame is enabled
[jalview.git] / src / jalview / gui / AlignViewport.java
index 5e477c7..c59d201 100644 (file)
@@ -243,7 +243,7 @@ public class AlignViewport extends AlignmentViewport implements
     showAutocalculatedAbove = Cache.getDefault(
             Preferences.SHOW_AUTOCALC_ABOVE, false);
     viewStyle.setScaleProteinAsCdna(Cache.getDefault(
-            Preferences.SCALE_PROTEIN_TO_CDNA, false));
+            Preferences.SCALE_PROTEIN_TO_CDNA, true));
   }
 
   void init()
@@ -798,16 +798,23 @@ public class AlignViewport extends AlignmentViewport implements
     // TODO: create undo object for this JAL-1101
 
     /*
-     * If one alignment is protein and one nucleotide, with at least one
-     * sequence name in common, offer to open a linked alignment.
+     * If any cDNA/protein mappings can be made between the alignments, offer to
+     * open a linked alignment with split frame option.
      */
-    if (AlignmentUtils.isMappable(al, getAlignment()))
+    if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, false))
     {
-      if (openLinkedAlignment(al, title))
+      if (AlignmentUtils.isMappable(al, getAlignment()))
       {
-        return;
+        if (openLinkedAlignment(al, title))
+        {
+          return;
+        }
       }
     }
+
+    /*
+     * No mappings, or offer declined - add sequences to this alignment
+     */
     // TODO: JAL-407 regardless of above - identical sequences (based on ID and
     // provenance) should share the same dataset sequence
 
@@ -815,19 +822,18 @@ public class AlignViewport extends AlignmentViewport implements
     {
       getAlignment().addSequence(al.getSequenceAt(i));
     }
-    // TODO this call was done by SequenceFetcher but not FileLoader or
-    // CutAndPasteTransfer. Is it needed?
-    // JBPComment: this repositions the view to show the new sequences
-    // JBPComment: so it is needed for UX
+
     setEndSeq(getAlignment().getHeight());
     firePropertyChange("alignment", null, getAlignment().getSequences());
   }
 
   /**
    * Show a dialog with the option to open and link (cDNA <-> protein) as a new
-   * alignment. Returns true if the new alignment was opened, false if not,
-   * because the user declined the offer.
+   * alignment, either as a standalone alignment or in a split frame. Returns
+   * true if the new alignment was opened, false if not, because the user
+   * declined the offer.
    * 
+   * @param al
    * @param title
    */
   protected boolean openLinkedAlignment(AlignmentI al, String title)