X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FSequenceRenderer.java;h=6c7fb37cd615f5a85e52eab5f2be52076f20c43d;hb=b69e028fe41a867e72cda2a6d69182ff0c6bd90e;hp=739187bcd53af277812f6ee524abb06452a3fadf;hpb=174230b4233d9ce80f94527768d2cd2f76da11ab;p=jalview.git diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index 739187b..6c7fb37 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -104,7 +104,7 @@ public class SequenceRenderer { if (cs != null) { - resBoxColour = cs.findColour(seq.getSequence(i, i + 1), i); + resBoxColour = cs.findColour(seq.getCharAt(i), i); } else if(forOverview && !jalview.util.Comparison.isGap(seq.getCharAt(i))) { @@ -227,24 +227,30 @@ public class SequenceRenderer if(end+1>=seq.getLength()) end = seq.getLength()-1; - graphics.setColor(Color.black); + graphics.setColor(av.textColour); - if(monospacedFont && av.showText && allGroups.length==0 && !av.getColourText()) + if(monospacedFont + && av.showText + && allGroups.length==0 + && !av.getColourText() + && av.thresholdTextColour==0) { - if(av.renderGaps) - graphics.drawString(seq.getSequence(start, end + 1), 0, y1); - else + if (av.renderGaps) + graphics.drawString(seq.getSequenceAsString(start, end + 1), 0, y1); + else { char gap = av.getGapCharacter(); - graphics.drawString( seq.getSequence(start, end+1).replace(gap, ' '), 0, y1); + graphics.drawString( seq.getSequenceAsString(start, end+1).replace(gap, ' '), 0, y1); } } else { + boolean getboxColour = false; for (int i = start; i <= end; i++) { - graphics.setColor(Color.black); + graphics.setColor(av.textColour); + getboxColour = false; s = seq.getCharAt(i); if (!renderGaps && jalview.util.Comparison.isGap(s)) { @@ -258,11 +264,26 @@ public class SequenceRenderer continue; } - if (currentSequenceGroup.getColourText()) + if (currentSequenceGroup.thresholdTextColour > 0 + || currentSequenceGroup.getColourText()) { + getboxColour = true; getBoxColour(currentSequenceGroup.cs, seq, i); - graphics.setColor(resBoxColour.darker()); + + if (currentSequenceGroup.getColourText()) + graphics.setColor(resBoxColour.darker()); + + if (currentSequenceGroup.thresholdTextColour > 0) + { + if (resBoxColour.getRed() + + resBoxColour.getBlue() + + resBoxColour.getGreen() < currentSequenceGroup.thresholdTextColour) + graphics.setColor(currentSequenceGroup.textColour2); + } } + else + graphics.setColor(currentSequenceGroup.textColour); + } else { @@ -273,6 +294,7 @@ public class SequenceRenderer if (av.getColourText()) { + getboxColour = true; getBoxColour(av.globalColourScheme, seq, i); if (av.getShowBoxes()) @@ -284,17 +306,28 @@ public class SequenceRenderer graphics.setColor(resBoxColour); } } + + if (av.thresholdTextColour > 0) + { + if (!getboxColour) + getBoxColour(av.globalColourScheme, seq, i); + + if (resBoxColour.getRed() + + resBoxColour.getBlue() + + resBoxColour.getGreen() < av.thresholdTextColour) + graphics.setColor(av.textColour2); + } + } - charOffset = (av.charWidth - fm.charWidth(s)) / 2; - // System.out.print(s); - graphics.drawString(String.valueOf(s), - charOffset + av.charWidth * (i - start), - y1); + + charOffset = (av.charWidth - fm.charWidth(s)) / 2; + graphics.drawString(String.valueOf(s), + charOffset + av.charWidth * (i - start), + y1); } - // System.out.println("\n"); } } @@ -354,7 +387,7 @@ public class SequenceRenderer { if (i < seq.getLength()) { - s = seq.getSequence().charAt(i); + s = seq.getCharAt(i); } charOffset = (av.charWidth - fm.charWidth(s)) / 2;