X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FIdCanvas.java;h=7686e8ab549b82217600e3b8ddb89488d8423e76;hb=a28c9340eeadfdaa551a21b9dea1d0f1530126e3;hp=8b6939e4e53605be6bbeb4ae26a05b714b1f209a;hpb=6e71f42b0a3713ddbc3054e7ea9d8f5088130ec9;p=jalview.git diff --git a/src/jalview/appletgui/IdCanvas.java b/src/jalview/appletgui/IdCanvas.java index 8b6939e..7686e8a 100755 --- a/src/jalview/appletgui/IdCanvas.java +++ b/src/jalview/appletgui/IdCanvas.java @@ -21,7 +21,6 @@ package jalview.appletgui; import java.awt.*; -import jalview.analysis.*; import jalview.datamodel.*; public class IdCanvas @@ -55,7 +54,7 @@ public class IdCanvas if (searchResults != null && searchResults.contains(s)) { gg.setColor(Color.black); - gg.fillRect(0, AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos, + gg.fillRect(0, ((i - starty) * charHeight) + ypos, getSize().width, charHeight); gg.setColor(Color.white); } @@ -63,26 +62,22 @@ public class IdCanvas av.getSelectionGroup().sequences.contains(s)) { gg.setColor(Color.lightGray); - gg.fillRect(0, AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos, + gg.fillRect(0, ((i - starty) * charHeight) + ypos, getSize().width, charHeight); gg.setColor(Color.white); } else { gg.setColor(s.getColor()); - gg.fillRect(0, AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos, + gg.fillRect(0, ((i - starty) * charHeight) + ypos, getSize().width, charHeight); gg.setColor(Color.black); } - String string = s.getName(); - if (av.getShowFullId()) - { - string = s.getDisplayId(); - } + String string = s.getDisplayId(av.getShowDBPrefix(), av.getShowJVSuffix()); gg.drawString(string, 0, - AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos + + ((i - starty) * charHeight) + ypos + charHeight - (charHeight / 5)); } @@ -162,6 +157,12 @@ public class IdCanvas gg.setFont(av.getFont()); } + if(!jalview.bin.JalviewLite.AWT1) + { + MyGraphics.AntiAlias(gg); + } + + //Fill in the background gg.setColor(Color.white); Font italic = new Font(av.getFont().getName(), Font.ITALIC, @@ -177,23 +178,51 @@ public class IdCanvas { Color currentColor = Color.white; Color currentTextColor = Color.black; + Font italic = new Font(av.getFont().getName(), Font.ITALIC, + av.getFont().getSize()); if (av.getWrapAlignment()) { + int annotationHeight = 0; + AnnotationLabels labels = null; - int rowSize = av.getEndRes() - av.getStartRes(); - // Draw the rest of the panels - - for (int ypos = 2 * av.charHeight, row = av.startRes; - ypos <= getSize().height && row < av.alignment.getWidth(); - ypos += av.chunkHeight, row += rowSize) + if(av.showAnnotation) { - for (int i = starty; i < av.alignment.getHeight(); i++) + AnnotationPanel ap = new AnnotationPanel(av); + annotationHeight = ap.adjustPanelHeight(); + labels = new AnnotationLabels(av); + } + + int hgap = av.charHeight; + if (av.scaleAboveWrapped) + hgap += av.charHeight; + + int cHeight = av.getAlignment().getHeight() * av.charHeight + + hgap + + annotationHeight; + + int rowSize = av.getEndRes() - av.getStartRes(); + + // Draw the rest of the panels + for (int ypos = hgap, row = av.startRes; + (ypos <= getSize().height) && (row < av.alignment.getWidth()); + ypos += cHeight, row += rowSize) { - SequenceI s = av.alignment.getSequenceAt(i); - drawIdString(gg, s, i, 0, ypos); + for (int i = starty; i < av.alignment.getHeight(); i++) + { + SequenceI s = av.alignment.getSequenceAt(i); + drawIdString(gg, s, i, 0, ypos); + } + + if(labels!=null) + { + gg.setFont(av.getFont()); + gg.translate(0, ypos+(av.getAlignment().getHeight() * av.charHeight)); + labels.drawComponent(gg, getSize().width); + gg.translate(0, -ypos-(av.getAlignment().getHeight() * av.charHeight)); + gg.setFont(italic); + } } - } } else @@ -228,18 +257,16 @@ public class IdCanvas gg.setColor(currentColor); gg.fillRect(0, - AlignmentUtil.getPixelHeight(starty, i, av.charHeight), + ((i - starty) * av.charHeight), getSize().width, av.charHeight); gg.setColor(currentTextColor); - String string = av.alignment.getSequenceAt(i).getName(); - if (av.getShowFullId()) - { - string = av.alignment.getSequenceAt(i).getDisplayId(); - } + String string = av.alignment.getSequenceAt(i) + .getDisplayId(av.getShowDBPrefix(), av.getShowJVSuffix()); + gg.drawString(string, 0, - AlignmentUtil.getPixelHeight(starty, i, av.charHeight) + + ((i - starty) * av.charHeight) + av.charHeight - (av.charHeight / 5)); }