From 526094d494484bfa89f9659fccf83a37b8c19829 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 16 Nov 2004 15:23:45 +0000 Subject: [PATCH] Remove viewport from constructor --- src/jalview/gui/SequenceRenderer.java | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index 7df9149..7a52bcc 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -9,30 +9,25 @@ import java.util.*; public class SequenceRenderer implements RendererI { FontMetrics fm; - AlignViewport av; public Color getResidueBoxColour(ColourSchemeI cs, SequenceI seq, int i) { - Color c = Color.WHITE; - - try{ - if (cs != null) - c = cs.findColour(seq, seq.getSequence(i, i + 1), i, null); - }catch(Exception ex) - { } + Color c = cs.findColour(seq, seq.getSequence(i, i + 1), i, null); return c; + } - public void drawSequence(Graphics g,ColourSchemeI cs,SequenceI seq,int start, int end, int x1, int y1, double width, int height,boolean showScores, boolean displayBoxes, boolean displayText,Vector freq, int seqnum,AlignViewport av) { - this.av = av; + public void drawSequence(Graphics g,ColourSchemeI cs,SequenceI seq,int start, int end, int x1, int y1, double width, int height,boolean showScores, boolean displayBoxes, boolean displayText, boolean colourText,Vector freq, int seqnum) { - if (displayBoxes == true) { + + if (displayBoxes) drawBoxes(g,cs,seq,start,end,x1,y1,(int)width, height,freq); - } - if (displayText == true) { + + if (displayText) + { fm = g.getFontMetrics(); - drawText(g,cs,seq,start,end,x1,y1,(int)width,height); + drawText(g,cs,colourText,seq,start,end,x1,y1,(int)width,height); } } @@ -96,13 +91,12 @@ public class SequenceRenderer implements RendererI g.fillRect(x1+width*(curStart-start),y1,curWidth,height); } - public void drawText(Graphics g, ColourSchemeI cs, SequenceI seq,int start, int end, int x1, int y1, int width, int height) + public void drawText(Graphics g, ColourSchemeI cs, boolean colText, SequenceI seq,int start, int end, int x1, int y1, int width, int height) { int pady = height/5; int charOffset=0; g.setColor(Color.black); - boolean colourText = av.getColourText(); - Color c; + char s; // Need to find the sequence position here. for (int i = start; i <= end; i++) @@ -114,9 +108,9 @@ public class SequenceRenderer implements RendererI else s = ' '; - if (colourText) + if (colText) { - c = getResidueBoxColour(cs, seq, i); + Color c = getResidueBoxColour(cs, seq, i); g.setColor(c.darker()); } -- 1.7.10.2