X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FSequenceRenderer.java;h=0e4312a65654d8b3da25235002743ee329c0ae1b;hb=9807ea8cc4e867378c52d51b832168d4bc611d29;hp=0c41152638ca4da5394e697852497b66ee4a7927;hpb=9c2efb07ecb9e429c4adeff76e388c12f0062a8b;p=jalview.git diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index 0c41152..0e4312a 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -40,6 +40,7 @@ public class SequenceRenderer Color resBoxColour; Graphics graphics; boolean monospacedFont; + boolean forOverview = false; /** * Creates a new SequenceRenderer object. @@ -95,9 +96,13 @@ public class SequenceRenderer { resBoxColour = cs.findColour(seq.getSequence(i, i + 1), i); } + else if(forOverview && !jalview.util.Comparison.isGap(seq.getCharAt(i))) + { + resBoxColour = Color.lightGray; + } else { - resBoxColour = Color.white; + resBoxColour = Color.white; } } @@ -115,19 +120,19 @@ public class SequenceRenderer * @param height DOCUMENT ME! */ public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg, - int start, int end, int x1, int y1, int width, int height) + int start, int end, int y1) { allGroups = sg; graphics = g; - drawBoxes(seq, start, end, x1, y1, (int) width, height); + drawBoxes(seq, start, end, y1); fm = g.getFontMetrics(); monospacedFont = fm.getStringBounds("M",g).getWidth()==fm.getStringBounds("|",g).getWidth(); - drawText(seq, start, end, x1, y1, (int) width, height); + drawText(seq, start, end, y1); } /** @@ -141,14 +146,13 @@ public class SequenceRenderer * @param width DOCUMENT ME! * @param height DOCUMENT ME! */ - public synchronized void drawBoxes(SequenceI seq, int start, int end, int x1, int y1, - int width, int height) + public synchronized void drawBoxes(SequenceI seq, int start, int end, int y1) { int i = start; int length = seq.getLength(); int curStart = -1; - int curWidth = width; + int curWidth = av.charWidth; Color tempColour = null; @@ -176,26 +180,26 @@ public class SequenceRenderer { if (tempColour != null) { - graphics.fillRect(x1 + (width * (curStart - start)), y1, - curWidth, height); + graphics.fillRect( av.charWidth * (curStart - start), y1, + curWidth, av.charHeight); } graphics.setColor(resBoxColour); curStart = i; - curWidth = width; + curWidth = av.charWidth; tempColour = resBoxColour; } else { - curWidth += width; + curWidth += av.charWidth; } i++; } - graphics.fillRect(x1 + (width * (curStart - start)), y1, curWidth, - height); + graphics.fillRect( av.charWidth * (curStart - start), y1, curWidth, + av.charHeight); } @@ -210,10 +214,9 @@ public class SequenceRenderer * @param width DOCUMENT ME! * @param height DOCUMENT ME! */ - public void drawText(SequenceI seq, int start, int end, int x1, int y1, - int width, int height) + public void drawText(SequenceI seq, int start, int end, int y1) { - y1 += height - height / 5; // height/5 replaces pady + y1 += av.charHeight - av.charHeight / 5; // height/5 replaces pady int charOffset = 0; char s; @@ -224,7 +227,7 @@ public class SequenceRenderer if(monospacedFont && av.showText && allGroups.length==0 && !av.getColourText()) { - graphics.drawString(seq.getSequence(start, end + 1), x1, y1); + graphics.drawString(seq.getSequence(start, end + 1), 0, y1); } else { @@ -272,12 +275,15 @@ public class SequenceRenderer } } - charOffset = (width - fm.charWidth(s)) / 2; + charOffset = (av.charWidth - fm.charWidth(s)) / 2; + + // System.out.print(s); graphics.drawString(String.valueOf(s), - charOffset + x1 + width * (i - start), + charOffset + av.charWidth * (i - start), y1); } + // System.out.println("\n"); } }