\r
public static int GRAPH_HEIGHT = 40;\r
\r
+ boolean MAC = false;\r
+\r
public AnnotationPanel(AlignmentPanel ap)\r
{\r
+ if (System.getProperty("os.name").startsWith("Mac"))\r
+ MAC = true;\r
+\r
this.ap = ap;\r
av = ap.av;\r
- this.setLayout(null);\r
+ setLayout(null);\r
adjustPanelHeight();\r
\r
addMouseMotionListener(new MouseMotionAdapter()\r
}\r
\r
this.setSize(getSize().width, height);\r
- if(ap!=null)\r
- ap.annotationScroller.setSize(getSize().width, height);\r
-\r
\r
repaint();\r
\r
\r
public void paint(Graphics g)\r
{\r
+\r
+\r
imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;\r
\r
if (image == null || imgWidth != image.getWidth(this))\r
}\r
\r
drawComponent(gg, av.startRes, av.endRes + 1);\r
+ g.setColor(Color.white);\r
+ g.fillRect(0, 0, getSize().width, getSize().height);\r
g.drawImage(image, 0, 0, this);\r
}\r
\r
g.setColor(Color.white);\r
g.fillRect(0, 0, getSize().width, getSize().height);\r
g.setColor(Color.black);\r
- g.drawString("Alignment has no annotations", 20, 15);\r
+ if(av.validCharWidth)\r
+ g.drawString("Alignment has no annotations", 20, 15);\r
\r
return;\r
}\r
\r
AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
\r
- int j;\r
int x = 0;\r
int y = 0;\r
char lastSS;\r
x = (column - startRes) * av.charWidth;\r
\r
\r
- if (validRes &&\r
- (row.annotations[column].displayCharacter.length() > 0))\r
+ if (av.validCharWidth && validRes &&\r
+ (row.annotations[column].displayCharacter.length() > 0))\r
{\r
int charOffset = (av.charWidth -\r
fm.charWidth(row.annotations[column].displayCharacter.charAt(\r
{\r
case 'H':\r
g.setColor(HELIX_COLOUR);\r
+ if (MAC)\r
+ {\r
+ //Off by 1 offset when drawing rects and ovals\r
+ //to offscreen image on the MAC\r
+ g.fillRoundRect(lastSSX, y + 4 + iconOffset,\r
+ x - lastSSX, 7, 8, 8);\r
+ break;\r
+ }\r
+\r
int sCol = (lastSSX / av.charWidth) + startRes;\r
int x1 = lastSSX;\r
int x2 = x;\r
\r
- if(row.annotations[sCol-1]==null ||\r
+ if(sCol==0 ||\r
+ row.annotations[sCol-1]==null ||\r
row.annotations[sCol-1].secondaryStructure!='H')\r
{\r
g.fillArc(lastSSX, y+4+iconOffset, av.charWidth, 8, 90,180) ;\r
{\r
case 'H':\r
g.setColor(HELIX_COLOUR);\r
+ if (MAC)\r
+ {\r
+ //Off by 1 offset when drawing rects and ovals\r
+ //to offscreen image on the MAC\r
+ g.fillRoundRect(lastSSX, y + 4 + iconOffset,\r
+ x - lastSSX, 7, 8, 8);\r
+ break;\r
+ }\r
+\r
\r
int sCol = (lastSSX / av.charWidth) + startRes;\r
int x1 = lastSSX;\r
int x2 = x;\r
\r
- if(row.annotations[sCol-1]==null ||\r
+ if(sCol==0 ||\r
+ row.annotations[sCol-1]==null ||\r
row.annotations[sCol-1].secondaryStructure!='H')\r
{\r
g.fillArc(lastSSX, y+4+iconOffset, av.charWidth, 8, 90,180) ;\r
return;\r
\r
\r
- eRes = Math.min(eRes, aa.annotations.length);\r
\r
int x = 0;\r
\r
if(eRes<av.endRes)\r
eRes++;\r
\r
+ eRes = Math.min(eRes, aa.annotations.length);\r
+\r
+\r
if(sRes==0)\r
{\r
sRes++;\r
\r
////Draw origin\r
if(min<0)\r
- y2 = (int)(y - (0-min / range)*graphHeight);\r
+ y2 = y - (int)((0-min / range)*graphHeight);\r
\r
g.setColor(Color.gray);\r
g.drawLine(x-av.charWidth,y2,(eRes-sRes)*av.charWidth,y2);\r
y1 = y2 = y;\r
\r
if(min<0)\r
- y2 = (int)(y - (0-min / (range))*aa.graphHeight);\r
+ y2 = y -(int)( (0-min / (range))*aa.graphHeight);\r
\r
g.setColor(Color.gray);\r
\r