Enable lower case colours
[jalview.git] / src / jalview / bin / Jalview.java
index 50faf67..1116fe4 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2006 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
@@ -137,6 +137,7 @@ public class Jalview
 \r
           if(file!=null)\r
           {\r
+            System.out.println("Opening file: " + file);\r
 \r
             if (!file.startsWith("http://"))\r
             {\r
@@ -150,20 +151,50 @@ public class Jalview
 \r
             protocol = "File";\r
 \r
-            if (file.indexOf("http:") > -1)\r
+            if (file.indexOf("http:") > -1 || file.indexOf("file:") >-1)\r
             {\r
               protocol = "URL";\r
             }\r
 \r
+\r
+\r
             if (file.endsWith(".jar"))\r
               format = "Jalview";\r
             else\r
               format = new jalview.io.IdentifyFile().Identify(file, protocol);\r
 \r
-            System.out.println("Opening: " + format + " file " + file);\r
+\r
 \r
             AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol, format);\r
 \r
+            if(af==null)\r
+            {\r
+              System.out.println("error");\r
+              return;\r
+            }\r
+\r
+            data = aparser.getValue("colour");\r
+            if(data!=null)\r
+            {\r
+              data.replaceAll("%20", " ");\r
+\r
+              jalview.schemes.ColourSchemeI cs =\r
+                  jalview.schemes.ColourSchemeProperty.getColour(af.getViewport().\r
+                  getAlignment(), data);\r
+\r
+              if(cs == null)\r
+              {\r
+                jalview.schemes.UserColourScheme ucs\r
+                    = new jalview.schemes.UserColourScheme("white");\r
+                ucs.parseAppletParameter(data);\r
+                cs = ucs;\r
+              }\r
+\r
+              System.out.println("colour is " + data);\r
+              af.changeColour( cs );\r
+            }\r
+\r
+\r
             // Must maintain ability to use the groups flag\r
             data = aparser.getValue("groups");\r
             if (data != null)\r
@@ -228,9 +259,11 @@ public class Jalview
           }\r
 \r
         // We'll only open the default file if the desktop is visible.\r
+        // And the user\r
         //////////////////////\r
           if (\r
               !headless\r
+          && file==null\r
           && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true)\r
                     )\r
           {\r
@@ -247,13 +280,15 @@ public class Jalview
 \r
             if (file.endsWith(".jar"))\r
             {\r
-              new Jalview2XML().LoadJalviewAlign(file);\r
+              format = "Jalview";\r
             }\r
             else\r
             {\r
               format = new jalview.io.IdentifyFile().Identify(file, protocol);\r
-              new jalview.io.FileLoader().LoadFile(file, protocol, format);\r
             }\r
+\r
+            fileLoader.LoadFile(file, protocol, format);\r
+\r
           }\r
     }\r
 }\r