preferences held statically
[jalview.git] / src / jalview / gui / AlignViewport.java
index a135620..98fd229 100755 (executable)
@@ -71,49 +71,36 @@ public class AlignViewport
 \r
   public void updateFromPreferences()\r
   {\r
-    String string = Cache.getProperty("SHOW_FULL_ID");\r
-    if(string!=null)\r
-      showFullId = Boolean.valueOf(string).booleanValue();\r
-\r
-    string = Cache.getProperty("SHOW_ANNOTATIONS");\r
-        if(string!=null)\r
-      showAnnotation = Boolean.valueOf(string).booleanValue();\r
-\r
-    string = Cache.getProperty("SHOW_CONSERVATION");\r
-        if(string!=null)\r
-      showConservation = Boolean.valueOf(string).booleanValue();\r
-    string = Cache.getProperty("SHOW_QUALITY");\r
-        if(string!=null)\r
-      showQuality = Boolean.valueOf(string).booleanValue();\r
-    string = Cache.getProperty("SHOW_IDENTITY");\r
-        if(string!=null)\r
-      showIdentity = Boolean.valueOf(string).booleanValue();\r
-\r
-    string = Cache.getProperty("SHOW_FULL_ID");\r
-      if(string!=null)\r
-        showFullId = Boolean.valueOf(string).booleanValue();\r
-\r
-  String fontName = Cache.getProperty("FONT_NAME");\r
-  String fontStyle= Cache.getProperty("FONT_STYLE");\r
-  String fontSize = Cache.getProperty("FONT_SIZE");\r
-  if(fontName!=null && fontStyle!=null && fontSize!=null)\r
-      setFont( new Font(fontName,Integer.parseInt(fontStyle),Integer.parseInt(fontSize)) );\r
-  else\r
-      setFont( font );\r
-\r
-    string = Cache.getProperty("GAP_SYMBOL");\r
-    if(string!=null)\r
-      alignment.setGapCharacter( string.charAt(0) );\r
+    showFullId = Preferences.showFullId;\r
+    showAnnotation = Preferences.showAnnotation;\r
+    showConservation = Preferences.showConservation;\r
+    showQuality = Preferences.showQuality;\r
+    showIdentity = Preferences.showIdentity;\r
+    showFullId = Preferences.showFullId;\r
+    String fontName = Preferences.fontName;\r
+    String fontStyle = Preferences.fontStyle;\r
+    String fontSize = Cache.getProperty("FONT_SIZE");\r
+    if (fontName != null && fontStyle != null && fontSize != null)\r
+    {\r
+      int style = 0;\r
+      if(fontStyle.equals("bold"))\r
+        style = 1;\r
+      else if(fontStyle.equals("italic"))\r
+        style = 2;\r
+      setFont(new Font(fontName, style, Integer.parseInt(fontSize)));\r
+    }\r
+    else\r
+      setFont(font);\r
 \r
+    alignment.setGapCharacter(Preferences.gapSymbol);\r
 \r
     // We must set conservation and consensus before setting colour,\r
     // as Blosum and Clustal require this to be done\r
     updateConservation();\r
     updateConsensus();\r
-    string = Cache.getProperty("DEFAULT_COLOUR");\r
-    if(string!=null)\r
+    if(Preferences.defaultColour!=null)\r
     {\r
-      globalColourScheme = ColourSchemeProperty.getColour(alignment, string);\r
+      globalColourScheme = ColourSchemeProperty.getColour(alignment, Preferences.defaultColour);\r
       if(globalColourScheme!=null)\r
         globalColourScheme.setConsensus( vconsensus );\r
    }\r