JAL-1645 Version-Rel Version 2.9 Year-Rel 2015 Licensing glob
[jalview.git] / src / jalview / gui / Preferences.java
index 2a24491..78a21c8 100755 (executable)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -61,6 +61,9 @@ import ext.edu.ucsf.rbvi.strucviz2.StructureManager;
  */
 public class Preferences extends GPreferences
 {
+  public static final String ENABLE_SPLIT_FRAME = "ENABLE_SPLIT_FRAME";
+
+  public static final String SCALE_PROTEIN_TO_CDNA = "SCALE_PROTEIN_TO_CDNA";
 
   public static final String DEFAULT_COLOUR = "DEFAULT_COLOUR";
 
@@ -171,11 +174,11 @@ public class Preferences extends GPreferences
     dasTab.add(dasSource, BorderLayout.CENTER);
     wsPrefs = new WsPreferences();
     wsTab.add(wsPrefs, BorderLayout.CENTER);
-    int width = 500, height = 420;
+    int width = 500, height = 450;
     if (new jalview.util.Platform().isAMac())
     {
       width = 570;
-      height = 460;
+      height = 480;
     }
 
     Desktop.addInternalFrame(frame,
@@ -231,6 +234,8 @@ public class Preferences extends GPreferences
             + ""));
 
     smoothFont.setSelected(Cache.getDefault("ANTI_ALIAS", false));
+    scaleProteinToCdna.setSelected(Cache.getDefault(SCALE_PROTEIN_TO_CDNA,
+            false));
 
     idItalics.setSelected(Cache.getDefault("ID_ITALICS", true));
 
@@ -258,8 +263,7 @@ public class Preferences extends GPreferences
 
     sortAutocalc.addItem("Autocalculated first");
     sortAutocalc.addItem("Autocalculated last");
-    final boolean showAbove = Cache.getDefault(SHOW_AUTOCALC_ABOVE,
-            true);
+    final boolean showAbove = Cache.getDefault(SHOW_AUTOCALC_ABOVE, true);
     sortAutocalc.setSelectedItem(showAbove ? sortAutocalc.getItemAt(0)
             : sortAutocalc.getItemAt(1));
     startupCheckbox
@@ -293,8 +297,7 @@ public class Preferences extends GPreferences
     structFromPdb.setSelected(structSelected);
     useRnaView.setSelected(Cache.getDefault(USE_RNAVIEW, false));
     useRnaView.setEnabled(structSelected);
-    addSecondaryStructure
-            .setSelected(Cache.getDefault(ADD_SS_ANN, false));
+    addSecondaryStructure.setSelected(Cache.getDefault(ADD_SS_ANN, false));
     addSecondaryStructure.setEnabled(structSelected);
     addTempFactor.setSelected(Cache.getDefault(ADD_TEMPFACT_ANN, false));
     addTempFactor.setEnabled(structSelected);
@@ -348,8 +351,8 @@ public class Preferences extends GPreferences
     epsRendering.setSelectedItem(Cache.getDefault("EPS_RENDERING",
             "Prompt each time"));
     autoIdWidth.setSelected(Cache.getDefault("FIGURE_AUTOIDWIDTH", false));
-    userIdWidth.setEnabled(autoIdWidth.isSelected());
-    userIdWidthlabel.setEnabled(autoIdWidth.isSelected());
+    userIdWidth.setEnabled(!autoIdWidth.isSelected());
+    userIdWidthlabel.setEnabled(!autoIdWidth.isSelected());
     Integer wi = Cache.getIntegerProperty("FIGURE_USERIDWIDTH");
     userIdWidth.setText(wi == null ? "" : wi.toString());
     blcjv.setSelected(Cache.getDefault("BLC_JVSUFFIX", true));
@@ -360,6 +363,8 @@ public class Preferences extends GPreferences
     pileupjv.setSelected(Cache.getDefault("PILEUP_JVSUFFIX", true));
     pirjv.setSelected(Cache.getDefault("PIR_JVSUFFIX", true));
     modellerOutput.setSelected(Cache.getDefault("PIR_MODELLER", false));
+    embbedBioJSON.setSelected(Cache.getDefault("EXPORT_EMBBED_BIOJSON",
+            true));
 
     /*
      * Set Editing tab defaults
@@ -430,6 +435,8 @@ public class Preferences extends GPreferences
             Boolean.toString(showConsensLogo.isSelected()));
     Cache.applicationProperties.setProperty("ANTI_ALIAS",
             Boolean.toString(smoothFont.isSelected()));
+    Cache.applicationProperties.setProperty(SCALE_PROTEIN_TO_CDNA,
+            Boolean.toString(scaleProteinToCdna.isSelected()));
     Cache.applicationProperties.setProperty("SHOW_NPFEATS_TOOLTIP",
             Boolean.toString(showNpTooltip.isSelected()));
     Cache.applicationProperties.setProperty("SHOW_DBREFS_TOOLTIP",
@@ -456,8 +463,8 @@ public class Preferences extends GPreferences
     }
 
     final boolean showAutocalcFirst = sortAutocalc.getSelectedIndex() == 0;
-    Cache.applicationProperties.setProperty(SHOW_AUTOCALC_ABOVE,
-            Boolean.valueOf(showAutocalcFirst).toString());
+    Cache.applicationProperties.setProperty(SHOW_AUTOCALC_ABOVE, Boolean
+            .valueOf(showAutocalcFirst).toString());
 
     /*
      * Save Colours settings
@@ -582,6 +589,8 @@ public class Preferences extends GPreferences
             Boolean.toString(pirjv.isSelected()));
     Cache.applicationProperties.setProperty("PIR_MODELLER",
             Boolean.toString(modellerOutput.isSelected()));
+    Cache.applicationProperties.setProperty("EXPORT_EMBBED_BIOJSON",
+            Boolean.toString(embbedBioJSON.isSelected()));
     jalview.io.PIRFile.useModellerOutput = modellerOutput.isSelected();
 
     Cache.applicationProperties.setProperty("FIGURE_AUTOIDWIDTH",
@@ -634,20 +643,21 @@ public class Preferences extends GPreferences
     return validateChimeraPath();
 
   }
+
   /**
    * DOCUMENT ME!
    */
   public void startupFileTextfield_mouseClicked()
   {
     JalviewFileChooser chooser = new JalviewFileChooser(
-            jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
-            new String[]
-            { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc", "jar" },
-            new String[]
-            { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview" },
+            jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] {
+                "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc",
+                "jar" }, new String[] { "Fasta", "Clustal", "PFAM", "MSF",
+                "PIR", "BLC", "Jalview" },
             jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));
     chooser.setFileView(new JalviewFileView());
-    chooser.setDialogTitle(MessageManager.getString("label.select_startup_file"));
+    chooser.setDialogTitle(MessageManager
+            .getString("label.select_startup_file"));
 
     int value = chooser.showOpenDialog(this);
 
@@ -789,7 +799,8 @@ public class Preferences extends GPreferences
   public void defaultBrowser_mouseClicked(MouseEvent e)
   {
     JFileChooser chooser = new JFileChooser(".");
-    chooser.setDialogTitle(MessageManager.getString("label.select_default_browser"));
+    chooser.setDialogTitle(MessageManager
+            .getString("label.select_default_browser"));
 
     int value = chooser.showOpenDialog(this);
 
@@ -822,7 +833,8 @@ public class Preferences extends GPreferences
   public void minColour_actionPerformed(JPanel panel)
   {
     Color col = JColorChooser.showDialog(this,
-            MessageManager.getString("label.select_colour_minimum_value"), minColour.getBackground());
+            MessageManager.getString("label.select_colour_minimum_value"),
+            minColour.getBackground());
     if (col != null)
     {
       panel.setBackground(col);
@@ -834,7 +846,8 @@ public class Preferences extends GPreferences
   public void maxColour_actionPerformed(JPanel panel)
   {
     Color col = JColorChooser.showDialog(this,
-            MessageManager.getString("label.select_colour_maximum_value"), maxColour.getBackground());
+            MessageManager.getString("label.select_colour_maximum_value"),
+            maxColour.getBackground());
     if (col != null)
     {
       panel.setBackground(col);
@@ -859,12 +872,10 @@ public class Preferences extends GPreferences
       }
     } catch (NumberFormatException x)
     {
-      JOptionPane
-              .showInternalMessageDialog(
-                      Desktop.desktop,
-                      MessageManager.getString("warn.user_defined_width_requirements"),
-                      MessageManager.getString("label.invalid_id_column_width"),
-                      JOptionPane.WARNING_MESSAGE);
+      JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager
+              .getString("warn.user_defined_width_requirements"),
+              MessageManager.getString("label.invalid_id_column_width"),
+              JOptionPane.WARNING_MESSAGE);
       userIdWidth.setText("");
     }
   }
@@ -925,14 +936,13 @@ public class Preferences extends GPreferences
     }
     if (!found)
     {
-      String[] options =
-      { "OK", "Help" };
+      String[] options = { "OK", "Help" };
       int showHelp = JOptionPane.showInternalOptionDialog(
               Desktop.desktop,
               JvSwingUtils.wrapTooltip(true,
                       MessageManager.getString("label.chimera_missing")),
-              "", JOptionPane.YES_NO_OPTION,
-              JOptionPane.WARNING_MESSAGE, null, options, options[0]);
+              "", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE,
+              null, options, options[0]);
       if (showHelp == JOptionPane.NO_OPTION)
       {
         try