X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FIdCanvas.java;h=ef80616381f63a7c87f1c9e9c6bd388e2614e62c;hb=58735c979dbb573eb12d57e33ef7d6e3f3a82c8e;hp=991f3ea9c4c57cd7946d726cc11a7add0b6f87c2;hpb=838a66f363f856d499deb2eb5f05d78c2ea75f10;p=jalview.git diff --git a/src/jalview/appletgui/IdCanvas.java b/src/jalview/appletgui/IdCanvas.java index 991f3ea..ef80616 100755 --- a/src/jalview/appletgui/IdCanvas.java +++ b/src/jalview/appletgui/IdCanvas.java @@ -101,7 +101,7 @@ public class IdCanvas extends Panel implements ViewportListenerI public void fastPaint(int vertical) { - if (gg == null) + if (gg == null || av.getWrapAlignment()) { repaint(); return; @@ -118,7 +118,7 @@ public class IdCanvas extends Panel implements ViewportListenerI ss = es - vertical; if (ss < ranges.getStartSeq()) // ie scrolling too fast, more than a page // at a - // time + // time { ss = ranges.getStartSeq(); } @@ -183,8 +183,8 @@ public class IdCanvas extends Panel implements ViewportListenerI // Fill in the background gg.setColor(Color.white); - Font italic = new Font(av.getFont().getName(), Font.ITALIC, av - .getFont().getSize()); + Font italic = new Font(av.getFont().getName(), Font.ITALIC, + av.getFont().getSize()); gg.setFont(italic); gg.fillRect(0, 0, getSize().width, getSize().height); @@ -224,8 +224,8 @@ public class IdCanvas extends Panel implements ViewportListenerI continue; } // hardwired italic IDs in applet currently - Font italic = new Font(av.getFont().getName(), Font.ITALIC, av - .getFont().getSize()); + Font italic = new Font(av.getFont().getName(), Font.ITALIC, + av.getFont().getSize()); gg.setFont(italic); // boolean isrep=false; if (doHiddenCheck) @@ -280,15 +280,9 @@ public class IdCanvas extends Panel implements ViewportListenerI protected void drawIdsWrapped(int starty, final boolean doHiddenCheck, boolean hiddenRows) { - int maxwidth = av.getAlignment().getWidth(); + int maxwidth = av.getAlignment().getVisibleWidth(); int alheight = av.getAlignment().getHeight(); - if (av.hasHiddenColumns()) - { - maxwidth = av.getAlignment().getHiddenColumns() - .findColumnPosition(maxwidth) - 1; - } - int annotationHeight = 0; AnnotationLabels labels = null; @@ -306,20 +300,20 @@ public class IdCanvas extends Panel implements ViewportListenerI int cHeight = alheight * avcharHeight + hgap + annotationHeight; - int rowSize = av.getRanges().getEndRes() - - av.getRanges().getStartRes(); + int rowSize = av.getRanges().getViewportWidth(); // hardwired italic IDs in applet currently - Font italic = new Font(av.getFont().getName(), Font.ITALIC, av - .getFont().getSize()); + Font italic = new Font(av.getFont().getName(), Font.ITALIC, + av.getFont().getSize()); gg.setFont(italic); /* * draw repeating sequence ids until out of sequence data or * out of visible space, whichever comes first */ - for (int ypos = hgap, row = av.getRanges().getStartRes(); (ypos <= getSize().height) - && (row < maxwidth); ypos += cHeight, row += rowSize) + int ypos = hgap; + int row = av.getRanges().getStartRes(); + while ((ypos <= getHeight()) && (row < maxwidth)) { for (int i = starty; i < alheight; i++) { @@ -339,6 +333,8 @@ public class IdCanvas extends Panel implements ViewportListenerI labels.drawComponent(gg, getSize().width); gg.translate(0, -ypos - (alheight * avcharHeight)); } + ypos += cHeight; + row += rowSize; } } @@ -350,7 +346,8 @@ public class IdCanvas extends Panel implements ViewportListenerI void drawMarker(int i, int starty, int yoffset) { - SequenceI[] hseqs = av.getAlignment().getHiddenSequences().hiddenSequences; + SequenceI[] hseqs = av.getAlignment() + .getHiddenSequences().hiddenSequences; // Use this method here instead of calling hiddenSeq adjust // 3 times. int hSize = hseqs.length; @@ -384,27 +381,36 @@ public class IdCanvas extends Panel implements ViewportListenerI gg.setColor(Color.blue); if (below) { - gg.fillPolygon(new int[] { getSize().width - avcharHeight, - getSize().width - avcharHeight, getSize().width }, new int[] { - (i - starty) * avcharHeight + yoffset, - (i - starty) * avcharHeight + yoffset + avcharHeight / 4, - (i - starty) * avcharHeight + yoffset }, 3); + gg.fillPolygon( + new int[] + { getSize().width - avcharHeight, + getSize().width - avcharHeight, getSize().width }, + new int[] + { (i - starty) * avcharHeight + yoffset, + (i - starty) * avcharHeight + yoffset + avcharHeight / 4, + (i - starty) * avcharHeight + yoffset }, + 3); } if (above) { - gg.fillPolygon(new int[] { getSize().width - avcharHeight, - getSize().width - avcharHeight, getSize().width }, new int[] { - (i - starty + 1) * avcharHeight + yoffset, - (i - starty + 1) * avcharHeight + yoffset - avcharHeight / 4, - (i - starty + 1) * avcharHeight + yoffset }, 3); + gg.fillPolygon( + new int[] + { getSize().width - avcharHeight, + getSize().width - avcharHeight, getSize().width }, + new int[] + { (i - starty + 1) * avcharHeight + yoffset, + (i - starty + 1) * avcharHeight + yoffset + - avcharHeight / 4, + (i - starty + 1) * avcharHeight + yoffset }, + 3); } } boolean setHiddenFont(SequenceI seq) { - Font bold = new Font(av.getFont().getName(), Font.BOLD, av.getFont() - .getSize()); + Font bold = new Font(av.getFont().getName(), Font.BOLD, + av.getFont().getSize()); if (av.isReferenceSeq(seq) || av.isHiddenRepSequence(seq)) { @@ -431,10 +437,19 @@ public class IdCanvas extends Panel implements ViewportListenerI { String propertyName = evt.getPropertyName(); if (propertyName.equals(ViewportRanges.STARTSEQ) - || (av.getWrapAlignment() && propertyName - .equals(ViewportRanges.STARTRES))) + || (av.getWrapAlignment() + && propertyName.equals(ViewportRanges.STARTRES))) { fastPaint((int) evt.getNewValue() - (int) evt.getOldValue()); } + else if (propertyName.equals(ViewportRanges.STARTRESANDSEQ)) + { + fastPaint(((int[]) evt.getNewValue())[1] + - ((int[]) evt.getOldValue())[1]); + } + else if (propertyName.equals(ViewportRanges.MOVE_VIEWPORT)) + { + repaint(); + } } }