JAL-2527 Added default setting/resetting and first pass at Spanish
[jalview.git] / src / jalview / gui / Preferences.java
index e8dc07c..3c0faab 100755 (executable)
@@ -117,6 +117,13 @@ public class Preferences extends GPreferences
 
   private static final int MAX_FONT_SIZE = 30;
 
+  private static final Color OVERVIEW_DEFAULT_GAP = Color.lightGray;
+
+  private static final Color OVERVIEW_DEFAULT_LEGACY_GAP = Color.white;
+
+  private static final Color OVERVIEW_DEFAULT_HIDDEN = Color.darkGray
+          .darker();
+
   /**
    * Holds name and link separated with | character. Sequence ID must be
    * $SEQUENCE_ID$ or $SEQUENCE_ID=/.possible | chars ./=$
@@ -316,9 +323,10 @@ public class Preferences extends GPreferences
      * Set overview panel defaults
      */
     gapColour.setBackground(
-            Cache.getDefaultColour("GAP_COLOUR", Color.lightGray));
+            Cache.getDefaultColour("GAP_COLOUR", OVERVIEW_DEFAULT_GAP));
     hiddenColour.setBackground(
-            Cache.getDefaultColour("HIDDEN_COLOUR", Color.darkGray));
+            Cache.getDefaultColour("HIDDEN_COLOUR",
+                    OVERVIEW_DEFAULT_HIDDEN));
     useLegacyGap.setSelected(Cache.getDefault("USE_LEGACY_GAP", false));
     gapLabel.setEnabled(!useLegacyGap.isSelected());
     gapColour.setEnabled(!useLegacyGap.isSelected());
@@ -1091,6 +1099,31 @@ public class Preferences extends GPreferences
   }
 
   @Override
+  protected void useLegacyGaps_actionPerformed(ActionEvent e)
+  {
+    boolean enabled = useLegacyGap.isSelected();
+    if (enabled)
+    {
+      gapColour.setBackground(OVERVIEW_DEFAULT_LEGACY_GAP);
+    }
+    else
+    {
+      gapColour.setBackground(OVERVIEW_DEFAULT_GAP);
+    }
+    gapColour.setEnabled(!enabled);
+    gapLabel.setEnabled(!enabled);
+  }
+
+  @Override
+  protected void resetOvDefaults_actionPerformed(ActionEvent e)
+  {
+    useLegacyGap.setSelected(false);
+    useLegacyGaps_actionPerformed(null);
+    showHiddenAtStart.setSelected(true);
+    hiddenColour.setBackground(OVERVIEW_DEFAULT_HIDDEN);
+  }
+
+  @Override
   protected void userIdWidth_actionPerformed()
   {
     try