X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FIdCanvas.java;h=973f8bce56d87ad1cbf6706a8ced73224aba5096;hb=5f7d80cd8b01e051a6175b0ce8db0ad94d73df2f;hp=67c3dca37b3d0036ae6e73bcad7406d9f5598bc1;hpb=51605ff0b3c81ba5894348745596b5038d905ffb;p=jalview.git diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java index 67c3dca..973f8bc 100755 --- a/src/jalview/gui/IdCanvas.java +++ b/src/jalview/gui/IdCanvas.java @@ -27,7 +27,7 @@ public class IdCanvas extends JPanel int charHeight = av.getCharHeight(); if (av.getSelection().contains(ds)) { - gg.setColor(Color.gray); + gg.setColor(Color.lightGray); gg.fillRect(0,AlignmentUtil.getPixelHeight(starty,i,charHeight)+ ypos,getWidth(),charHeight); gg.setColor(Color.white); } else { @@ -56,70 +56,25 @@ public class IdCanvas extends JPanel //Which ids are we printing int starty = av.getStartSeq(); - int endy = av.getEndSeq(); + int endy = av.endSeq; if (av.getWrapAlignment()) { - starty = starty%av.getChunkHeight(); + // Draw the rest of the panels + int chunkHeight = (da.getHeight() + 2)*av.charHeight; + int row = av.getStartRes() / av.chunkWidth ; + for(int ypos=2*av.charHeight; + ypos <= getHeight() && row*av.chunkWidth da.getHeight()) { - endy = da.getHeight(); - } - - for (int i = starty; i < endy; i++) { - SequenceI s = da.getSequenceAt(i); - drawIdString(gg,s,i,starty,ypos); - } - if (rowstart == 0) { - ypos = ypos + av.getChunkHeight(); - } else if (rowstart == 1) { - ypos = ypos + av.getChunkHeight(); - } else { - ypos = ypos + av.getChunkHeight() - rowstart*charHeight; - } - - starty = 0; - - int chunkwidth = av.getChunkWidth(); - int startx = (int)(av.getEndSeq()/chunkwidth)*chunkwidth; - int endx = startx + chunkwidth; - - - while (ypos <= getHeight() && endx < da.getWidth()) { - - for (int i = starty; i < endy; i++) { - SequenceI s = da.getSequenceAt(i); - drawIdString(gg,s,i,starty,ypos); - } - - ypos += av.getChunkHeight(); - startx += chunkwidth; - endx = startx + chunkwidth; - - if (endx > da.getWidth()) { - endx = da.getWidth(); - } - - starty = 0; - - if (endy > da.getHeight()) { - endy = da.getHeight(); - } - - } } else { @@ -129,7 +84,7 @@ public class IdCanvas extends JPanel // Selected sequence colours if (av.getSelection().contains(da.getSequenceAt(i))) { - currentColor = Color.gray; + currentColor = Color.lightGray; currentTextColor = Color.black; } else @@ -158,6 +113,8 @@ public class IdCanvas extends JPanel public Dimension getLabelWidth() { + if(getGraphics()==null) + return null; FontMetrics fm = this.getGraphics().getFontMetrics(av.font); AlignmentI al = av.getAlignment();