If mac, use the fillRoundRect
authoramwaterhouse <Andrew Waterhouse>
Mon, 1 May 2006 13:22:22 +0000 (13:22 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 1 May 2006 13:22:22 +0000 (13:22 +0000)
src/jalview/appletgui/AnnotationPanel.java

index d9b8dd3..daa68d1 100755 (executable)
@@ -51,8 +51,13 @@ public class AnnotationPanel
 \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
@@ -391,11 +396,21 @@ public class AnnotationPanel
                       {\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
@@ -459,12 +474,22 @@ public class AnnotationPanel
               {\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
@@ -577,7 +602,6 @@ public class AnnotationPanel
       return;\r
 \r
 \r
-    eRes = Math.min(eRes, aa.annotations.length);\r
 \r
     int x = 0;\r
 \r
@@ -585,6 +609,9 @@ public class AnnotationPanel
     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