Colours in viewport
[jalview.git] / src / jalview / appletgui / IdCanvas.java
index 013c7a1..d81552a 100755 (executable)
@@ -68,7 +68,7 @@ public class IdCanvas
     }\r
     else\r
     {\r
-      gg.setColor(s.getColor());\r
+      gg.setColor(av.getSequenceColour(s));\r
       gg.fillRect(0, ((i - starty) * charHeight) + ypos,\r
                   getSize().width, charHeight);\r
       gg.setColor(Color.black);\r
@@ -240,6 +240,7 @@ public class IdCanvas
       //Now draw the id strings\r
 \r
       //Now draw the id strings\r
+      SequenceI seq;\r
       for (int i = starty; i < endy; i++)\r
       {\r
         if (av.hasHiddenRows)\r
@@ -247,23 +248,24 @@ public class IdCanvas
           setHiddenFont(i);\r
         }\r
 \r
+        seq = av.alignment.getSequenceAt(i);\r
+\r
         // Selected sequence colours\r
         if ( (searchResults != null) &&\r
-            searchResults.contains(av.alignment.getSequenceAt(i)))\r
+            searchResults.contains(seq))\r
         {\r
           currentColor = Color.black;\r
           currentTextColor = Color.white;\r
         }\r
         else if ( (av.getSelectionGroup() != null) &&\r
-                 av.getSelectionGroup().getSequences(false).contains(\r
-                     av.alignment.getSequenceAt(i)))\r
+                 av.getSelectionGroup().getSequences(false).contains(seq))\r
         {\r
           currentColor = Color.lightGray;\r
           currentTextColor = Color.black;\r
         }\r
         else\r
         {\r
-          currentColor = av.alignment.getSequenceAt(i).getColor();\r
+          currentColor =  av.getSequenceColour(seq);\r
           currentTextColor = Color.black;\r
         }\r
 \r
@@ -274,10 +276,9 @@ public class IdCanvas
 \r
         gg.setColor(currentTextColor);\r
 \r
-        String string = av.alignment.getSequenceAt(i).getDisplayId(av.\r
-            getShowJVSuffix());\r
 \r
-        gg.drawString(string, 0,\r
+        gg.drawString(seq.getDisplayId(av.getShowJVSuffix()),\r
+                      0,\r
                       ( ( (i - starty) * av.charHeight) + av.charHeight) -\r
                       (av.charHeight / 5));\r
 \r
@@ -295,12 +296,32 @@ public class IdCanvas
 \r
   void drawMarker(int i, int starty, int yoffset)\r
   {\r
-    int hiddenIndex = av.adjustForHiddenSeqs(i);\r
-    int lastIndex = av.adjustForHiddenSeqs(i - 1);\r
-    int nextIndex = av.adjustForHiddenSeqs(i + 1);\r
+    SequenceI [] hseqs = av.alignment.getHiddenSequences().hiddenSequences;\r
+    //Use this method here instead of calling hiddenSeq adjust\r
+    //3 times.\r
+    int hSize = hseqs.length;\r
+\r
+    int hiddenIndex = i;\r
+    int lastIndex = i - 1;\r
+    int nextIndex = i + 1;\r
 \r
     boolean below = (hiddenIndex > lastIndex + 1);\r
-    boolean above = (nextIndex>hiddenIndex+1);\r
+    boolean above = (nextIndex > hiddenIndex + 1);\r
+\r
+\r
+\r
+    for(int j=0; j<hSize; j++)\r
+    {\r
+      if (hseqs[j] != null)\r
+      {\r
+        if(j-1<hiddenIndex)\r
+          hiddenIndex++;\r
+        if(j-1<lastIndex)\r
+          lastIndex++;\r
+        if(j-1<nextIndex)\r
+          nextIndex++;\r
+      }\r
+      }\r
 \r
       gg.setColor(Color.blue);\r
       if(below)\r