GPL license added
[jalview.git] / src / jalview / gui / Preferences.java
index 1553de5..4708ced 100755 (executable)
@@ -1,3 +1,22 @@
+/*\r
+* Jalview - A Sequence Alignment Editor and Viewer\r
+* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+*\r
+* This program is free software; you can redistribute it and/or\r
+* modify it under the terms of the GNU General Public License\r
+* as published by the Free Software Foundation; either version 2\r
+* of the License, or (at your option) any later version.\r
+*\r
+* This program is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with this program; if not, write to the Free Software\r
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+*/\r
+\r
 package jalview.gui;\r
 \r
 import jalview.jbgui.*;\r
@@ -20,13 +39,13 @@ public class Preferences extends GPreferences
   public static boolean showConservation=true;\r
   public static boolean showQuality=true;\r
   public static boolean showIdentity=true;\r
-  public static String fontName;\r
-  public static String fontSize;\r
-  public static String fontStyle;\r
+  public static String fontName="SansSerif";\r
+  public static String fontSize="10";\r
+  public static String fontStyle=Font.PLAIN+"";\r
   public static char gapSymbol='-';\r
   public static String defaultColour=null;\r
   public static boolean showStartupFile=true;\r
-  public static String startupFile = "http://www.compbio.dundee.ac.uk/~andrew/jalviewTEST/fasta";\r
+  public static String startupFile = "http://www.jalview.org/examples/exampleFile.jar";\r
 \r
   JInternalFrame frame;\r
 \r
@@ -62,9 +81,18 @@ public class Preferences extends GPreferences
     if(string!=null)\r
       showFullId = Boolean.valueOf(string).booleanValue();\r
 \r
-  fontName = Cache.getProperty("FONT_NAME");\r
-  fontStyle = Cache.getProperty("FONT_STYLE");\r
-  fontSize = Cache.getProperty("FONT_SIZE");\r
+    string = Cache.getProperty("FONT_NAME");\r
+    if (string != null)\r
+      fontName = string;\r
+\r
+    string = Cache.getProperty("FONT_STYLE");\r
+    if (string != null)\r
+      fontStyle = string;\r
+\r
+    string = Cache.getProperty("FONT_SIZE");\r
+    if (string != null)\r
+      fontSize = string;\r
+\r
 \r
   string = Cache.getProperty("DEFAULT_COLOUR");\r
   if(string!=null)\r
@@ -83,8 +111,7 @@ public class Preferences extends GPreferences
 \r
   public Preferences()\r
   {\r
-    if(!preferencesLoaded)\r
-      initPreferences();\r
+    initPreferences();\r
 \r
     frame = new JInternalFrame();\r
     frame.setContentPane(this);\r
@@ -188,12 +215,13 @@ public class Preferences extends GPreferences
     JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty("LAST_DIRECTORY"),\r
         new String[]{"fa, fasta, fastq", "aln",  "pfam", "msf", "pir","blc","jar"},\r
         new String[]{"Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview"}\r
-       ,null);\r
+       ,jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));\r
    chooser.setFileView(new JalviewFileView());\r
    chooser.setDialogTitle("Select startup file");\r
    int value = chooser.showOpenDialog(this);\r
    if(value == JalviewFileChooser.APPROVE_OPTION)\r
    {\r
+     jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT", chooser.getSelectedFormat());\r
      startupFileTextfield.setText( chooser.getSelectedFile().getAbsolutePath() );\r
    }\r
   }\r