sequence is char []
[jalview.git] / src / jalview / appletgui / SequenceRenderer.java
index 9103c1d..04defb7 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
@@ -76,7 +76,7 @@ public class SequenceRenderer
   {\r
     if (cs != null)\r
     {\r
-      resBoxColour = cs.findColour(seq.getSequence(i, i + 1), i);\r
+      resBoxColour = cs.findColour(seq.getCharAt(i), i);\r
     }\r
     else if(forOverview && !jalview.util.Comparison.isGap(seq.getCharAt(i)))\r
     {\r
@@ -99,6 +99,9 @@ public class SequenceRenderer
   public void drawSequence(SequenceI seq, SequenceGroup[] sg,\r
                            int start, int end,  int y1)\r
   {\r
+    if(seq==null)\r
+      return;\r
+\r
     allGroups = sg;\r
 \r
     drawBoxes(seq, start, end,  y1);\r
@@ -164,6 +167,14 @@ public class SequenceRenderer
 \r
   public void drawText(SequenceI seq, int start, int end, int y1)\r
   {\r
+   Font boldFont = null;\r
+   boolean bold = false;\r
+   if(av.upperCasebold)\r
+   {\r
+     boldFont = new Font(av.getFont().getName(), Font.BOLD, av.charHeight);\r
+\r
+     graphics.setFont(av.getFont());\r
+   }\r
 \r
     y1 += av.charHeight - av.charHeight / 5;  // height/5 replaces pady\r
 \r
@@ -219,6 +230,26 @@ public class SequenceRenderer
         }\r
       }\r
 \r
+      if (av.upperCasebold)\r
+      {\r
+        fm = graphics.getFontMetrics();\r
+        if ('A' <= s && s <= 'Z')\r
+        {\r
+          if(!bold)\r
+          {\r
+\r
+            graphics.setFont(boldFont);\r
+          }\r
+          bold = true;\r
+        }\r
+        else if(bold)\r
+        {\r
+          graphics.setFont(av.font);\r
+          bold = false;\r
+        }\r
+\r
+      }\r
+\r
       charOffset = (av.charWidth - fm.charWidth(s)) / 2;\r
       graphics.drawString(String.valueOf(s),\r
                          charOffset + av.charWidth * (i - start),\r
@@ -262,7 +293,7 @@ public class SequenceRenderer
       {\r
         if (i < seq.getLength())\r
         {\r
-          s = seq.getSequence().charAt(i);\r
+          s = seq.getCharAt(i);\r
         }\r
 \r
         charOffset = (av.charWidth - fm.charWidth(s)) / 2;\r