X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAnnotationPanel.java;h=71f51eaa1c165af833eab70fa4428d47383b1bb2;hb=e30c8f0736f711e2dc7c32680ac57a28c77d567d;hp=d9b8dd3ce3ada5ca36d901a1abaf006658a709a0;hpb=4e37dfef4e89b0f123a60dea64cf088cb80c5d89;p=jalview.git diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index d9b8dd3..71f51ea 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -51,11 +51,16 @@ public class AnnotationPanel public static int GRAPH_HEIGHT = 40; + boolean MAC = false; + public AnnotationPanel(AlignmentPanel ap) { + if (System.getProperty("os.name").startsWith("Mac")) + MAC = true; + this.ap = ap; av = ap.av; - this.setLayout(null); + setLayout(null); adjustPanelHeight(); addMouseMotionListener(new MouseMotionAdapter() @@ -126,9 +131,6 @@ public class AnnotationPanel } this.setSize(getSize().width, height); - if(ap!=null) - ap.annotationScroller.setSize(getSize().width, height); - repaint(); @@ -206,6 +208,8 @@ public class AnnotationPanel public void paint(Graphics g) { + + imgWidth = (av.endRes - av.startRes + 1) * av.charWidth; if (image == null || imgWidth != image.getWidth(this)) @@ -225,6 +229,8 @@ public class AnnotationPanel } drawComponent(gg, av.startRes, av.endRes + 1); + g.setColor(Color.white); + g.fillRect(0, 0, getSize().width, getSize().height); g.drawImage(image, 0, 0, this); } @@ -286,14 +292,14 @@ public class AnnotationPanel g.setColor(Color.white); g.fillRect(0, 0, getSize().width, getSize().height); g.setColor(Color.black); - g.drawString("Alignment has no annotations", 20, 15); + if(av.validCharWidth) + g.drawString("Alignment has no annotations", 20, 15); return; } AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); - int j; int x = 0; int y = 0; char lastSS; @@ -356,8 +362,8 @@ public class AnnotationPanel x = (column - startRes) * av.charWidth; - if (validRes && - (row.annotations[column].displayCharacter.length() > 0)) + if (av.validCharWidth && validRes && + (row.annotations[column].displayCharacter.length() > 0)) { int charOffset = (av.charWidth - fm.charWidth(row.annotations[column].displayCharacter.charAt( @@ -391,11 +397,21 @@ public class AnnotationPanel { case 'H': g.setColor(HELIX_COLOUR); + if (MAC) + { + //Off by 1 offset when drawing rects and ovals + //to offscreen image on the MAC + g.fillRoundRect(lastSSX, y + 4 + iconOffset, + x - lastSSX, 7, 8, 8); + break; + } + int sCol = (lastSSX / av.charWidth) + startRes; int x1 = lastSSX; int x2 = x; - if(row.annotations[sCol-1]==null || + if(sCol==0 || + row.annotations[sCol-1]==null || row.annotations[sCol-1].secondaryStructure!='H') { g.fillArc(lastSSX, y+4+iconOffset, av.charWidth, 8, 90,180) ; @@ -459,12 +475,22 @@ public class AnnotationPanel { case 'H': g.setColor(HELIX_COLOUR); + if (MAC) + { + //Off by 1 offset when drawing rects and ovals + //to offscreen image on the MAC + g.fillRoundRect(lastSSX, y + 4 + iconOffset, + x - lastSSX, 7, 8, 8); + break; + } + int sCol = (lastSSX / av.charWidth) + startRes; int x1 = lastSSX; int x2 = x; - if(row.annotations[sCol-1]==null || + if(sCol==0 || + row.annotations[sCol-1]==null || row.annotations[sCol-1].secondaryStructure!='H') { g.fillArc(lastSSX, y+4+iconOffset, av.charWidth, 8, 90,180) ; @@ -577,7 +603,6 @@ public class AnnotationPanel return; - eRes = Math.min(eRes, aa.annotations.length); int x = 0; @@ -585,6 +610,9 @@ public class AnnotationPanel if(eRes