X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FSequenceRenderer.java;h=8d7755cf2d96da99f89c053de76d0233ee334653;hb=d587f1aa61946dc14f6f089cf1dc2a3116cfb773;hp=02ea4b5ee1da24ae7b40254ffa004b88f0d61c90;hpb=bd56b8fb21d730b15bb759c529990d244cafbe37;p=jalview.git diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index 02ea4b5..8d7755c 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -61,7 +61,14 @@ public class SequenceRenderer { graphics = g; fm = g.getFontMetrics(); - monospacedFont = fm.getStringBounds("M",g).getWidth()==fm.getStringBounds("|",g).getWidth(); + + // If EPS graphics, stringWidth will be a double, not an int + double dwidth = fm.getStringBounds("M", g).getWidth(); + + monospacedFont = + (dwidth == fm.getStringBounds("|",g).getWidth() + && (float)av.charWidth == dwidth); + this.renderGaps = renderGaps; } @@ -220,10 +227,14 @@ 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); @@ -235,9 +246,11 @@ public class SequenceRenderer } 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)) { @@ -251,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 { @@ -266,6 +294,7 @@ public class SequenceRenderer if (av.getColourText()) { + getboxColour = true; getBoxColour(av.globalColourScheme, seq, i); if (av.getShowBoxes()) @@ -277,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"); } }