+ /**
+ * Draws sequence ids, and annotation labels if annotations are shown, in
+ * wrapped mode
+ *
+ * @param g
+ * @param alignViewport
+ * @param startSeq
+ */
+ void drawIdsWrapped(Graphics2D g, AlignViewport alignViewport,
+ int startSeq, int pageHeight)
+ {
+ int alignmentWidth = alignViewport.getAlignment().getWidth();
+ final int alheight = alignViewport.getAlignment().getHeight();
+
+
+// int annotationHeight = 0;
+
+ /* (former)
+ * assumption: SeqCanvas.calculateWrappedGeometry has been called
+ *
+ * was based on the fact that SeqCanvas was added as a child prior to IdCanvas,
+ * and children are processed in order of addition.
+ *
+ * It's probably fine. But...
+ *
+ */
+ SeqCanvas seqCanvas = alignViewport.getAlignPanel()
+ .getSeqPanel().seqCanvas;
+ // ...better: let's call it now
+ seqCanvas.calculateWrappedGeometry();
+
+ final int charHeight = alignViewport.getCharHeight();
+
+ AnnotationLabels labels = null;
+ if (alignViewport.isShowAnnotation())
+ {
+ // BH when was ap == null?
+ if (ap == null)
+ {
+ ap = new AnnotationPanel(alignViewport);
+ }
+// annotationHeight = ap.adjustPanelHeight();
+ labels = new AnnotationLabels(alignViewport);
+ }
+
+// int hgap = charHeight;
+// if (alignViewport.getScaleAboveWrapped())
+// {
+// hgap += charHeight;
+// }
+//
+// /*
+// * height of alignment + gap + annotations (if shown)
+// */
+// int cHeight = alheight * charHeight + hgap
+// + annotationHeight;
+//
+ ViewportRanges ranges = alignViewport.getRanges();
+
+ int rowSize = ranges.getViewportWidth();
+
+ /*
+ * draw repeating sequence ids until out of sequence data or
+ * out of visible space, whichever comes first
+ */
+ boolean hasHiddenRows = alignViewport.hasHiddenRows();
+ int ypos = seqCanvas.wrappedSpaceAboveAlignment;
+ int rowStartRes = ranges.getStartRes();
+ while ((ypos <= pageHeight) && (rowStartRes < alignmentWidth))
+ {
+ for (int i = startSeq; i < alheight; i++)
+ {
+ SequenceI s = alignViewport.getAlignment().getSequenceAt(i);
+ if (hasHiddenRows || alignViewport.isDisplayReferenceSeq())