JAL-1690 show 'scale protein' in protein _and_ dna menus; default true
[jalview.git] / src / jalview / gui / FontChooser.java
index 72b7bd6..5e13781 100755 (executable)
@@ -91,11 +91,10 @@ public class FontChooser extends GFontChooser
     smoothFont.setSelected(ap.av.antiAlias);
 
     /*
-     * Enable 'scale protein as cDNA' in protein half of a SplitFrame view. The
-     * selection is stored in the ViewStyle of the Viewport
+     * Enable 'scale protein as cDNA' in a SplitFrame view. The selection is
+     * stored in the ViewStyle of both dna and protein Viewport
      */
-    if (ap.av.getCodingComplement() != null
-            && !ap.av.getAlignment().isNucleotide())
+    if (ap.av.getCodingComplement() != null)
     {
       scaleAsCdna.setVisible(true);
       scaleAsCdna.setSelected(ap.av.isScaleProteinAsCdna());
@@ -189,6 +188,11 @@ public class FontChooser extends GFontChooser
       ap.av.setFont(oldFont, true);
       ap.av.setScaleProteinAsCdna(oldProteinScale);
       ap.paintAlignment(true);
+      if (scaleAsCdna.isEnabled())
+      {
+        ap.av.setScaleProteinAsCdna(oldProteinScale);
+        ap.av.getCodingComplement().setScaleProteinAsCdna(oldProteinScale);
+      }
     }
     else if (tp != null)
     {
@@ -314,10 +318,10 @@ public class FontChooser extends GFontChooser
   }
 
   /**
-   * DOCUMENT ME!
+   * Make selected settings the defaults by storing them (via Cache class) in
+   * the .jalview_properties file (the file is only written when Jalview exits)
    * 
    * @param e
-   *          DOCUMENT ME!
    */
   public void defaultButton_actionPerformed(ActionEvent e)
   {
@@ -326,6 +330,8 @@ public class FontChooser extends GFontChooser
     Cache.setProperty("FONT_SIZE", fontSize.getSelectedItem().toString());
     Cache.setProperty("ANTI_ALIAS",
             Boolean.toString(smoothFont.isSelected()));
+    Cache.setProperty(Preferences.SCALE_PROTEIN_TO_CDNA,
+            Boolean.toString(scaleAsCdna.isSelected()));
   }
 
   /**
@@ -336,7 +342,13 @@ public class FontChooser extends GFontChooser
   protected void scaleAsCdna_actionPerformed(ActionEvent e)
   {
     ap.av.setScaleProteinAsCdna(scaleAsCdna.isSelected());
-    ((SplitFrame) ap.alignFrame.getSplitViewContainer()).adjustLayout();
-    ap.paintAlignment(true);
+    ap.av.getCodingComplement().setScaleProteinAsCdna(
+            scaleAsCdna.isSelected());
+    final SplitFrame splitFrame = (SplitFrame) ap.alignFrame
+            .getSplitViewContainer();
+    splitFrame.adjustLayout();
+    splitFrame.repaint();
+    // ap.paintAlignment(true);
+    // TODO would like to repaint
   }
 }