X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPreferences.java;h=398c5bed6d1ee1201fcfae0b5e65bc2e9792f068;hb=fe5db5e87fc726b1560d21f97f19b0e04963b72c;hp=6c07d23623c6e83307ca91f0619bc3ea6b2839ae;hpb=aee942d972498d3e51334fc890221b1827e0b255;p=jalview.git diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 6c07d23..398c5be 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -2,40 +2,118 @@ package jalview.gui; import jalview.jbgui.*; import jalview.schemes.*; +import jalview.io.*; import jalview.bin.Cache; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.*; + public class Preferences extends GPreferences { - AlignViewport av; + static boolean preferencesLoaded=false; + + public static boolean showFullscreen=false; + public static boolean showFullId=true; + public static boolean showAnnotation=true; + public static boolean showConservation=true; + public static boolean showQuality=true; + public static boolean showIdentity=true; + public static String fontName="SansSerif"; + public static String fontSize="10"; + public static String fontStyle=Font.PLAIN+""; + public static char gapSymbol='-'; + public static String defaultColour=null; + public static boolean showStartupFile=true; + public static String startupFile = "http://www.compbio.dundee.ac.uk/~andrew/jalviewTEST/fasta"; + JInternalFrame frame; - public Preferences(AlignViewport av) + + public static void initPreferences() { - this.av = av; + String string = Cache.getProperty("SHOW_FULL_ID"); + if(string!=null) + showFullId = Boolean.valueOf(string).booleanValue(); + + string = Cache.getProperty("SHOW_FULLSCREEN"); + if(string!=null) + showFullscreen = Boolean.valueOf(string).booleanValue(); + + string = Cache.getProperty("SHOW_ANNOTATIONS"); + if(string!=null) + showAnnotation = Boolean.valueOf(string).booleanValue(); + + string = Cache.getProperty("SHOW_CONSERVATION"); + if(string!=null) + showConservation = Boolean.valueOf(string).booleanValue(); + string = Cache.getProperty("SHOW_QUALITY"); + if(string!=null) + showQuality = Boolean.valueOf(string).booleanValue(); + string = Cache.getProperty("SHOW_IDENTITY"); + if(string!=null) + showIdentity = Boolean.valueOf(string).booleanValue(); + + string = Cache.getProperty("GAP_SYMBOL"); + if(string!=null) + gapSymbol = string.charAt(0); + + string = Cache.getProperty("SHOW_FULL_ID"); + if(string!=null) + showFullId = Boolean.valueOf(string).booleanValue(); + + string = Cache.getProperty("FONT_NAME"); + if (string != null) + fontName = string; + + string = Cache.getProperty("FONT_STYLE"); + if (string != null) + fontStyle = string; + + string = Cache.getProperty("FONT_SIZE"); + if (string != null) + fontSize = string; + + + string = Cache.getProperty("DEFAULT_COLOUR"); + if(string!=null) + defaultColour = string; + + string = Cache.getProperty("STARTUP_FILE"); + if(string!=null) + startupFile = string; + + string = Cache.getProperty("SHOW_STARTUP_FILE"); + if(string!=null) + showStartupFile = Boolean.valueOf(string).booleanValue(); + + preferencesLoaded = true; + } + + public Preferences() + { + initPreferences(); + frame = new JInternalFrame(); frame.setContentPane(this); - Desktop.addInternalFrame(frame, "Preferences", 480,350 ); - + Desktop.addInternalFrame(frame, "Preferences", 480,390 ); - fullID.setSelected(av.getShowFullId()); + fullID.setSelected(showFullId); String string = Cache.getProperty("SHOW_FULLSCREEN"); boolean value = false; if(string!=null) value = Boolean.valueOf(string).booleanValue(); fullScreen.setSelected(value); - annotations.setSelected(av.getShowAnnotation()); + annotations.setSelected(showAnnotation); - conservation.setEnabled(av.getShowAnnotation()); - quality.setEnabled(av.getShowAnnotation()); - identity.setEnabled(av.getShowAnnotation()); + conservation.setEnabled(showAnnotation); + quality.setEnabled(showAnnotation); + identity.setEnabled(showAnnotation); - conservation.setSelected(av.showConservation); - quality.setSelected(av.showQuality); - identity.setSelected(av.showIdentity); + conservation.setSelected(showConservation); + quality.setSelected(showQuality); + identity.setSelected(showIdentity); for(int i=0; i<12; i++) colour.addItem( ColourSchemeProperty.getColourName(i) ); @@ -48,54 +126,88 @@ public class Preferences extends GPreferences String fonts[] = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); for(int i=0; i