X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FSeqCanvas.java;h=a052ae3db1f4b968fc6eb81a97779aeaf397daf8;hb=81c9c8d460d5e2261111f7bdced2a75f1af64f9a;hp=d4b8f779fec533357201b4d2a3e3b98b3707bd19;hpb=abb4c1cc7383a54df59066186eb282588bb884e8;p=jalview.git diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index d4b8f77..a052ae3 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -144,9 +144,9 @@ public class SeqCanvas extends JComponent implements ViewportListenerI { g.drawString(mstring, mpos * charWidth, ypos - (charHeight / 2)); } - g.drawLine((mpos * charWidth) + (charWidth / 2), (ypos + 2) - - (charHeight / 2), (mpos * charWidth) + (charWidth / 2), - ypos - 2); + g.drawLine((mpos * charWidth) + (charWidth / 2), + (ypos + 2) - (charHeight / 2), + (mpos * charWidth) + (charWidth / 2), ypos - 2); } } } @@ -208,8 +208,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI { int x = LABEL_WEST - fm.stringWidth(String.valueOf(value)) - charWidth / 2; - g.drawString(value + "", x, (ypos + (i * charHeight)) - - (charHeight / 5)); + g.drawString(value + "", x, + (ypos + (i * charHeight)) - (charHeight / 5)); } } } @@ -260,8 +260,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI if (value != -1) { - g.drawString(String.valueOf(value), 0, (ypos + (i * charHeight)) - - (charHeight / 5)); + g.drawString(String.valueOf(value), 0, + (ypos + (i * charHeight)) - (charHeight / 5)); } } } @@ -356,10 +356,9 @@ public class SeqCanvas extends JComponent implements ViewportListenerI // img and call later. super.paintComponent(g); - if (lcimg != null - && (fastPaint - || (getVisibleRect().width != g.getClipBounds().width) || (getVisibleRect().height != g - .getClipBounds().height))) + if (lcimg != null && (fastPaint + || (getVisibleRect().width != g.getClipBounds().width) + || (getVisibleRect().height != g.getClipBounds().height))) { g.drawImage(lcimg, 0, 0, this); fastPaint = false; @@ -495,6 +494,9 @@ public class SeqCanvas extends JComponent implements ViewportListenerI FontMetrics fm = getFontMetrics(av.getFont()); + LABEL_EAST = 0; + LABEL_WEST = 0; + if (av.getScaleRightWrapped()) { LABEL_EAST = fm.stringWidth(getMask()); @@ -520,12 +522,12 @@ public class SeqCanvas extends JComponent implements ViewportListenerI int endx; int ypos = hgap; - int maxwidth = av.getAlignment().getWidth() - 1; + int maxwidth = av.getAlignment().getWidth(); if (av.hasHiddenColumns()) { maxwidth = av.getAlignment().getHiddenColumns() - .findColumnPosition(maxwidth) - 1; + .findColumnPosition(maxwidth); } while ((ypos <= canvasHeight) && (startRes < maxwidth)) @@ -575,10 +577,12 @@ public class SeqCanvas extends JComponent implements ViewportListenerI } gg.fillPolygon( - new int[] { res * charWidth - charHeight / 4, + new int[] + { res * charWidth - charHeight / 4, res * charWidth + charHeight / 4, res * charWidth }, - new int[] { ypos - (charHeight / 2), - ypos - (charHeight / 2), ypos - (charHeight / 2) + 8 }, + new int[] + { ypos - (charHeight / 2), ypos - (charHeight / 2), + ypos - (charHeight / 2) + 8 }, 3); } @@ -608,8 +612,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI annotations = new AnnotationPanel(av); } - annotations.renderer.drawComponent(annotations, av, g, -1, - startRes, endx + 1); + annotations.renderer.drawComponent(annotations, av, g, -1, startRes, + endx + 1); g.translate(0, -cHeight - ypos - 3); } g.setClip(clip); @@ -654,8 +658,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI * @param offset * DOCUMENT ME! */ - public void drawPanel(Graphics g1, int startRes, int endRes, - int startSeq, int endSeq, int offset) + public void drawPanel(Graphics g1, int startRes, int endRes, int startSeq, + int endSeq, int offset) { updateViewport(); if (!av.hasHiddenColumns()) @@ -745,8 +749,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI if (av.isShowSequenceFeatures()) { - fr.drawSequence(g, nextSeq, startRes, endRes, offset - + ((i - startSeq) * charHeight), false); + fr.drawSequence(g, nextSeq, startRes, endRes, + offset + ((i - startSeq) * charHeight), false); } // / Highlight search Results once all sequences have been drawn @@ -760,9 +764,9 @@ public class SeqCanvas extends JComponent implements ViewportListenerI for (int r = 0; r < visibleResults.length; r += 2) { sr.drawHighlightedText(nextSeq, visibleResults[r], - visibleResults[r + 1], (visibleResults[r] - startRes) - * charWidth, offset - + ((i - startSeq) * charHeight)); + visibleResults[r + 1], + (visibleResults[r] - startRes) * charWidth, + offset + ((i - startSeq) * charHeight)); } } } @@ -819,7 +823,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI { sx = (group.getStartRes() - startRes) * charWidth; sy = offset + ((i - startSeq) * charHeight); - ex = (((group.getEndRes() + 1) - group.getStartRes()) * charWidth) - 1; + ex = (((group.getEndRes() + 1) - group.getStartRes()) * charWidth) + - 1; if (sx + ex < 0 || sx > visWidth) { @@ -827,21 +832,19 @@ public class SeqCanvas extends JComponent implements ViewportListenerI } if ((sx <= (endRes - startRes) * charWidth) - && group.getSequences(null).contains( - av.getAlignment().getSequenceAt(i))) + && group.getSequences(null) + .contains(av.getAlignment().getSequenceAt(i))) { - if ((bottom == -1) - && !group.getSequences(null).contains( - av.getAlignment().getSequenceAt(i + 1))) + if ((bottom == -1) && !group.getSequences(null) + .contains(av.getAlignment().getSequenceAt(i + 1))) { bottom = sy + charHeight; } if (!inGroup) { - if (((top == -1) && (i == 0)) - || !group.getSequences(null).contains( - av.getAlignment().getSequenceAt(i - 1))) + if (((top == -1) && (i == 0)) || !group.getSequences(null) + .contains(av.getAlignment().getSequenceAt(i - 1))) { top = sy; } @@ -852,8 +855,8 @@ public class SeqCanvas extends JComponent implements ViewportListenerI if (group == av.getSelectionGroup()) { g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, - BasicStroke.JOIN_ROUND, 3f, new float[] { 5f, 3f }, - 0f)); + BasicStroke.JOIN_ROUND, 3f, new float[] + { 5f, 3f }, 0f)); g.setColor(Color.RED); } else