From: amwaterhouse Date: Fri, 24 Mar 2006 15:36:04 +0000 (+0000) Subject: Cursor added X-Git-Tag: Root_VamJalview_2_07b+~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=c77ccc33971183dba9cb66b40886a6b61fe8eaa0;p=jalview.git Cursor added --- diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index 0e4312a..ab6c1ab 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -57,9 +57,12 @@ public class SequenceRenderer * * @param b DOCUMENT ME! */ - public void renderGaps(boolean b) + public void prepare(Graphics g, boolean renderGaps) { - renderGaps = b; + graphics = g; + fm = g.getFontMetrics(); + monospacedFont = fm.getStringBounds("M",g).getWidth()==fm.getStringBounds("|",g).getWidth(); + this.renderGaps = renderGaps; } @@ -119,19 +122,13 @@ public class SequenceRenderer * @param width DOCUMENT ME! * @param height DOCUMENT ME! */ - public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg, + public void drawSequence(SequenceI seq, SequenceGroup[] sg, int start, int end, int y1) { allGroups = sg; - graphics = g; - drawBoxes(seq, start, end, y1); - fm = g.getFontMetrics(); - - monospacedFont = fm.getStringBounds("M",g).getWidth()==fm.getStringBounds("|",g).getWidth(); - drawText(seq, start, end, y1); } @@ -326,13 +323,12 @@ public class SequenceRenderer * @param width DOCUMENT ME! * @param height DOCUMENT ME! */ - public void drawHighlightedText(SequenceI seq, int start, int end, int x1, - int y1, int width, int height) + public void drawHighlightedText(SequenceI seq, int start, int end, int x1, int y1) { - int pady = height / 5; + int pady = av.charHeight / 5; int charOffset = 0; graphics.setColor(Color.BLACK); - graphics.fillRect(x1, y1, width * (end - start + 1), height); + graphics.fillRect(x1, y1, av.charWidth * (end - start + 1), av.charHeight); graphics.setColor(Color.white); char s = '~'; @@ -345,9 +341,30 @@ public class SequenceRenderer s = seq.getSequence().charAt(i); } - charOffset = (width - fm.charWidth(s)) / 2; + charOffset = (av.charWidth - fm.charWidth(s)) / 2; graphics.drawString(String.valueOf(s), - charOffset + x1 + (width * (i - start)), (y1 + height) - pady); + charOffset + x1 + (av.charWidth * (i - start)), + (y1 + av.charHeight) - pady); } } + + public void drawCursor(SequenceI seq, int res, int x1, int y1) + { + int pady = av.charHeight / 5; + int charOffset = 0; + graphics.setColor(Color.lightGray); + graphics.fillRect(x1, y1, av.charWidth, av.charHeight); + graphics.setColor(Color.white); + + graphics.setColor(Color.white); + + char s = seq.getCharAt(res); + + charOffset = (av.charWidth - fm.charWidth(s)) / 2; + graphics.drawString(String.valueOf(s), + charOffset + x1, + (y1 + av.charHeight) - pady); + + + } }