JAL-2383 restore PID colour threshold from project; enable/disable
[jalview.git] / src / jalview / appletgui / IdCanvas.java
index 7f9eba9..d72e91f 100755 (executable)
@@ -56,8 +56,8 @@ public class IdCanvas extends Panel
     PaintRefresher.Register(this, av.getSequenceSetId());
   }
 
-  public void drawIdString(Graphics gg, SequenceI s, int i, int starty,
-          int ypos)
+  public void drawIdString(Graphics gg, boolean hiddenRows, SequenceI s,
+          int i, int starty, int ypos)
   {
     int charHeight = av.getCharHeight();
 
@@ -88,7 +88,7 @@ public class IdCanvas extends Panel
             ((i - starty) * charHeight) + ypos + charHeight
                     - (charHeight / 5));
 
-    if (av.hasHiddenRows() && av.getShowHiddenMarkers())
+    if (hiddenRows)
     {
       drawMarker(i, starty, ypos);
     }
@@ -138,11 +138,13 @@ public class IdCanvas extends Panel
     repaint();
   }
 
+  @Override
   public void update(Graphics g)
   {
     paint(g);
   }
 
+  @Override
   public void paint(Graphics g)
   {
     if (getSize().height < 0 || getSize().width < 0)
@@ -186,6 +188,7 @@ public class IdCanvas extends Panel
    * local copy of av.getCharHeight set at top of drawIds
    */
   private int avcharHeight;
+
   void drawIds(int starty, int endy)
   {
     // hardwired italic IDs in applet currently
@@ -199,6 +202,10 @@ public class IdCanvas extends Panel
     Color currentColor = Color.white;
     Color currentTextColor = Color.black;
 
+    final boolean doHiddenCheck = av.isDisplayReferenceSeq()
+            || av.hasHiddenRows(), hiddenRows = av.hasHiddenRows()
+            && av.getShowHiddenMarkers();
+
     if (av.getWrapAlignment())
     {
       int maxwidth = av.getAlignment().getWidth();
@@ -227,7 +234,6 @@ public class IdCanvas extends Panel
       int cHeight = alheight * avcharHeight + hgap + annotationHeight;
 
       int rowSize = av.getEndRes() - av.getStartRes();
-
       // Draw the rest of the panels
       for (int ypos = hgap, row = av.startRes; (ypos <= getSize().height)
               && (row < maxwidth); ypos += cHeight, row += rowSize)
@@ -237,11 +243,11 @@ public class IdCanvas extends Panel
 
           SequenceI s = av.getAlignment().getSequenceAt(i);
           gg.setFont(italic);
-          if (av.isDisplayReferenceSeq() || av.hasHiddenRows())
+          if (doHiddenCheck)
           {
             setHiddenFont(s);
           }
-          drawIdString(gg, s, i, 0, ypos);
+          drawIdString(gg, hiddenRows, s, i, 0, ypos);
         }
 
         if (labels != null)
@@ -267,7 +273,7 @@ public class IdCanvas extends Panel
         }
         gg.setFont(italic);
         // boolean isrep=false;
-        if (av.isDisplayReferenceSeq() || av.hasHiddenRows())
+        if (doHiddenCheck)
         {
           // isrep =
           setHiddenFont(seq);
@@ -302,7 +308,7 @@ public class IdCanvas extends Panel
                 (((i - starty) * avcharHeight) + avcharHeight)
                         - (avcharHeight / 5));
 
-        if (av.hasHiddenRows() && av.getShowHiddenMarkers())
+        if (hiddenRows)
         {
           drawMarker(i, starty, 0);
         }
@@ -352,19 +358,17 @@ public class IdCanvas extends Panel
     gg.setColor(Color.blue);
     if (below)
     {
-      gg.fillPolygon(new int[]
-      { getSize().width - avcharHeight, getSize().width - avcharHeight,
-          getSize().width }, new int[]
-      { (i - starty) * avcharHeight + yoffset,
+      gg.fillPolygon(new int[] { getSize().width - avcharHeight,
+          getSize().width - avcharHeight, getSize().width }, new int[] {
+          (i - starty) * avcharHeight + yoffset,
           (i - starty) * avcharHeight + yoffset + avcharHeight / 4,
           (i - starty) * avcharHeight + yoffset }, 3);
     }
     if (above)
     {
-      gg.fillPolygon(new int[]
-      { getSize().width - avcharHeight, getSize().width - avcharHeight,
-          getSize().width }, new int[]
-      { (i - starty + 1) * avcharHeight + yoffset,
+      gg.fillPolygon(new int[] { getSize().width - avcharHeight,
+          getSize().width - avcharHeight, getSize().width }, new int[] {
+          (i - starty + 1) * avcharHeight + yoffset,
           (i - starty + 1) * avcharHeight + yoffset - avcharHeight / 4,
           (i - starty + 1) * avcharHeight + yoffset }, 3);
 
@@ -376,7 +380,7 @@ public class IdCanvas extends Panel
     Font bold = new Font(av.getFont().getName(), Font.BOLD, av.getFont()
             .getSize());
 
-    if (av.isHiddenRepSequence(seq))
+    if (av.isReferenceSeq(seq) || av.isHiddenRepSequence(seq))
     {
       gg.setFont(bold);
       return true;