X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPreferences.java;h=7ceb04e8fa2ee8277041782c31c94a2497914733;hb=e04bcd38992def511190a30f98cb3db3a720e0fc;hp=c3c92394de76dbc917e8e156716eb48aa459607f;hpb=3d0101179759ef157b088ea135423cd909512d9f;p=jalview.git diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index c3c9239..7ceb04e 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -109,10 +109,25 @@ public class Preferences extends GPreferences public static final String SHOW_OCCUPANCY = "SHOW_OCCUPANCY"; + public static final String SHOW_OV_HIDDEN_AT_START = "SHOW_OV_HIDDEN_AT_START"; + + public static final String USE_LEGACY_GAP = "USE_LEGACY_GAP"; + + public static final String GAP_COLOUR = "GAP_COLOUR"; + + public static final String HIDDEN_COLOUR = "HIDDEN_COLOUR"; + private static final int MIN_FONT_SIZE = 1; private static final int MAX_FONT_SIZE = 30; + public static final Color OVERVIEW_DEFAULT_GAP = Color.lightGray; + + public static final Color OVERVIEW_DEFAULT_LEGACY_GAP = Color.white; + + public 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 ./=$ @@ -155,7 +170,7 @@ public class Preferences extends GPreferences * .properties file as '|' separated strings */ - groupURLLinks = new ArrayList(); + groupURLLinks = new ArrayList<>(); } JInternalFrame frame; @@ -309,6 +324,20 @@ public class Preferences extends GPreferences Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", Color.red)); /* + * Set overview panel defaults + */ + gapColour.setBackground( + Cache.getDefaultColour(GAP_COLOUR, OVERVIEW_DEFAULT_GAP)); + hiddenColour.setBackground( + Cache.getDefaultColour(HIDDEN_COLOUR, + OVERVIEW_DEFAULT_HIDDEN)); + useLegacyGap.setSelected(Cache.getDefault(USE_LEGACY_GAP, false)); + gapLabel.setEnabled(!useLegacyGap.isSelected()); + gapColour.setEnabled(!useLegacyGap.isSelected()); + showHiddenAtStart + .setSelected(Cache.getDefault(SHOW_OV_HIDDEN_AT_START, true)); + + /* * Set Structure tab defaults. */ final boolean structSelected = Cache.getDefault(STRUCT_FROM_PDB, false); @@ -631,6 +660,16 @@ public class Preferences extends GPreferences maxColour.getBackground()); /* + * Save Overview settings + */ + Cache.setColourProperty(GAP_COLOUR, gapColour.getBackground()); + Cache.setColourProperty(HIDDEN_COLOUR, hiddenColour.getBackground()); + Cache.applicationProperties.setProperty(USE_LEGACY_GAP, + Boolean.toString(useLegacyGap.isSelected())); + Cache.applicationProperties.setProperty(SHOW_OV_HIDDEN_AT_START, + Boolean.toString(showHiddenAtStart.isSelected())); + + /* * Save Structure settings */ Cache.applicationProperties.setProperty(ADD_TEMPFACT_ANN, @@ -1035,6 +1074,60 @@ public class Preferences extends GPreferences } @Override + public void gapColour_actionPerformed(JPanel gap) + { + if (!useLegacyGap.isSelected()) + { + Color col = JColorChooser.showDialog(this, + MessageManager.getString("label.select_gap_colour"), + gapColour.getBackground()); + if (col != null) + { + gap.setBackground(col); + } + gap.repaint(); + } + } + + @Override + public void hiddenColour_actionPerformed(JPanel hidden) + { + Color col = JColorChooser.showDialog(this, + MessageManager.getString("label.select_hidden_colour"), + hiddenColour.getBackground()); + if (col != null) + { + hidden.setBackground(col); + } + hidden.repaint(); + } + + @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