X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FAnnotationPanel.java;h=ecd9370f6e1151508177fe5a8b9929223334a599;hb=f441357783f32298b738d32d5c87000ac0e33768;hp=232a60c14ab05425c511f8858165c751de84f38c;hpb=8dea1b9fa230ed6570f38a756b38c21af0e874c2;p=jalview.git diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 232a60c..ecd9370 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -51,7 +51,6 @@ public class AnnotationPanel extends JPanel implements MouseListener, BufferedImage image; Graphics2D gg; FontMetrics fm; - boolean validCharWidth; int imgWidth = 0; boolean fastPaint = false; @@ -62,6 +61,8 @@ public class AnnotationPanel extends JPanel implements MouseListener, int max; //used by mouseDragged to see if user boolean mouseDragging = false; + boolean MAC = false; + /** * Creates a new AnnotationPanel object. * @@ -69,6 +70,10 @@ public class AnnotationPanel extends JPanel implements MouseListener, */ public AnnotationPanel(AlignmentPanel ap) { + + if(System.getProperty("os.name").startsWith("Mac")) + MAC = true; + ToolTipManager.sharedInstance().registerComponent(this); ToolTipManager.sharedInstance().setInitialDelay(0); ToolTipManager.sharedInstance().setDismissDelay(10000); @@ -643,7 +648,6 @@ public class AnnotationPanel extends JPanel implements MouseListener, if (fm == null) fm = g.getFontMetrics(); - validCharWidth = fm.charWidth('M') <= av.charWidth; g.setColor(Color.white); g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight()); @@ -654,8 +658,8 @@ public class AnnotationPanel extends JPanel implements MouseListener, g.setColor(Color.white); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(Color.black); - if(validCharWidth) - g.drawString("Alignment has no annotations", 20, 15); + if(av.validCharWidth) + g.drawString("Alignment has no annotations", 20, 15); return; } @@ -753,7 +757,7 @@ public class AnnotationPanel extends JPanel implements MouseListener, } } - if (validCharWidth && validRes && + if (av.validCharWidth && validRes && (row.annotations[column].displayCharacter.length() > 0)) { @@ -789,36 +793,46 @@ public class AnnotationPanel extends JPanel implements MouseListener, { 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) ; + g.fillArc(lastSSX, y+4+iconOffset, av.charWidth+1, 7, 90,180) ; x1 += av.charWidth/2; } if(row.annotations[column]==null || row.annotations[column].secondaryStructure!='H') { - g.fillArc(x-av.charWidth, y+4+iconOffset, av.charWidth, 8, 270,180); + g.fillArc(x-av.charWidth, y+4+iconOffset, av.charWidth, 7, 270,180); x2 -= av.charWidth/2; } - g.fillRect(x1, y+4+iconOffset, x2-x1, 8); + g.fillRect(x1, y+4+iconOffset, x2-x1+1, 7); break; case 'E': g.setColor(SHEET_COLOUR); g.fillRect(lastSSX, y + 4 + iconOffset, x - lastSSX - 4, 7); - g.fillPolygon(new int[] { x - 4, x - 4, x }, + g.fillPolygon(new int[] { x - 5, x - 5, x }, new int[] { y + iconOffset, y + 14 + iconOffset, - y + 8 + iconOffset + y + 7 + iconOffset }, 3); break; @@ -856,39 +870,49 @@ public class AnnotationPanel extends JPanel implements MouseListener, { 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) ; + g.fillArc(lastSSX, y+4+iconOffset, av.charWidth+1, 7, 90,180) ; x1 += av.charWidth/2; } if(row.annotations[column]==null || row.annotations[column].secondaryStructure!='H') { - g.fillArc(x-av.charWidth, y+4+iconOffset, av.charWidth, 8, 270,180); + g.fillArc(x-av.charWidth, y+4+iconOffset, av.charWidth, 7, 270,180); x2 -= av.charWidth/2; } - g.fillRect(x1, y+4+iconOffset, x2-x1, 8); + g.fillRect(x1, y+4+iconOffset, x2-x1+1, 7); break; case 'E': g.setColor(SHEET_COLOUR); - if (row.annotations[endRes] !=null - && row.annotations[endRes].secondaryStructure != 'E') + if (row.annotations[endRes] ==null + || row.annotations[endRes].secondaryStructure != 'E') { g.fillRect(lastSSX, y + 4 + iconOffset, x - lastSSX - 4, 7); g.fillPolygon(new int[] - {x - 4, x - 4, x}, + {x - 5, x - 5, x}, new int[] { y + iconOffset, y + 14 + iconOffset, @@ -903,7 +927,7 @@ public class AnnotationPanel extends JPanel implements MouseListener, default: - g.setColor(Color.ORANGE); + g.setColor(Color.gray); if(!av.wrapAlignment || endRes==av.endRes) g.fillRect(lastSSX, y + 6 + iconOffset, x - lastSSX, 2); @@ -974,7 +998,6 @@ public class AnnotationPanel extends JPanel implements MouseListener, if(sRes>aa.annotations.length) return; - eRes = Math.min(eRes, aa.annotations.length); int x = 0; @@ -982,6 +1005,8 @@ public class AnnotationPanel extends JPanel implements MouseListener, if(eRes