Icon drawing updated
authoramwaterhouse <Andrew Waterhouse>
Wed, 9 Aug 2006 15:55:43 +0000 (15:55 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 9 Aug 2006 15:55:43 +0000 (15:55 +0000)
src/jalview/gui/AnnotationPanel.java

index 0f025b5..549d531 100755 (executable)
@@ -797,52 +797,50 @@ public class AnnotationPanel extends JPanel implements MouseListener,
                         switch (lastSS)\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*av.charWidth - lastSSX, 7, 8, 8);\r
-                              break;\r
-                            }\r
-\r
-                            int sCol = (lastSSX / av.charWidth) + startRes;\r
-                            int x1 = lastSSX;\r
-                            int x2 = x*av.charWidth;\r
-\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+1, 7, 90,180) ;\r
-                             x1 += av.charWidth/2;\r
-                           }\r
-\r
-                            if(row.annotations[column]==null ||\r
-                               row.annotations[column].secondaryStructure!='H')\r
-                            {\r
-                              g.fillArc(x*av.charWidth-av.charWidth,\r
-                                        y+4+iconOffset,\r
-                                        av.charWidth,\r
-                                        7, 270,180);\r
-                              x2 -= av.charWidth/2;\r
-                            }\r
-\r
-                            g.fillRect(x1, y+4+iconOffset, x2-x1+1, 7);\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*av.charWidth) - lastSSX, 7, 8, 8);\r
                             break;\r
+                          }\r
+\r
+                          int sCol = (lastSSX / av.charWidth) + startRes;\r
+                          int x1 = lastSSX;\r
+                          int x2 = (x*av.charWidth);\r
+\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
+                           x1 += av.charWidth/2;\r
+                         }\r
+\r
+                          if(row.annotations[column]==null ||\r
+                             row.annotations[column].secondaryStructure!='H')\r
+                          {\r
+                            g.fillArc((x*av.charWidth)-av.charWidth,\r
+                                      y+4+iconOffset, av.charWidth, 8, 270,180);\r
+                            x2 -= av.charWidth/2;\r
+                          }\r
+\r
+                          g.fillRect(x1, y+4+iconOffset, x2-x1, 8);\r
+                              break;\r
 \r
                         case 'E':\r
                             g.setColor(SHEET_COLOUR);\r
                             g.fillRect(lastSSX, y + 4 + iconOffset,\r
-                                x*av.charWidth - lastSSX - 4, 7);\r
-                            g.fillPolygon(new int[] { x*av.charWidth - 5,\r
-                                          x*av.charWidth - 5,\r
-                                          x*av.charWidth },\r
+                                (x*av.charWidth) - lastSSX - 4, 7);\r
+                            g.fillPolygon(new int[] { (x*av.charWidth) - 4,\r
+                                          (x*av.charWidth) - 4,\r
+                                          (x*av.charWidth) },\r
                                 new int[]\r
                                 {\r
                                     y + iconOffset, y + 14 + iconOffset,\r
-                                    y + 7 + iconOffset\r
+                                    y + 8 + iconOffset\r
                                 }, 3);\r
 \r
                             break;\r
@@ -851,7 +849,7 @@ public class AnnotationPanel extends JPanel implements MouseListener,
                         default:\r
                             g.setColor(Color.gray);\r
                             g.fillRect(lastSSX, y + 6 + iconOffset,\r
-                                x*av.charWidth - lastSSX, 2);\r
+                                (x*av.charWidth) - lastSSX, 2);\r
 \r
                             break;\r
                         }\r
@@ -865,22 +863,24 @@ public class AnnotationPanel extends JPanel implements MouseListener,
                             lastSS = ' ';\r
                         }\r
 \r
-                        lastSSX = x*av.charWidth;\r
+                        lastSSX = (x*av.charWidth);\r
                     }\r
                 }\r
-                column++;\r
-                x++;\r
+\r
+\r
+            column++;\r
+            x++;\r
             }\r
 \r
             if(column>=row.annotations.length)\r
-              column = row.annotations.length-1;\r
+                column = row.annotations.length-1;\r
 \r
-            x ++;\r
+          //  x ++;\r
 \r
             if (row.hasIcons)\r
             {\r
-                switch (lastSS)\r
-                {\r
+              switch (lastSS)\r
+              {\r
                 case 'H':\r
                   g.setColor(HELIX_COLOUR);\r
                   if (MAC)\r
@@ -888,68 +888,69 @@ public class AnnotationPanel extends JPanel implements MouseListener,
                     //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*av.charWidth - lastSSX, 7, 8, 8);\r
+                                    (x*av.charWidth) - 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(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+1, 7, 90,180) ;\r
-                   x1 += av.charWidth/2;\r
-                 }\r
-\r
-                  if(row.annotations[column]==null ||\r
-                     row.annotations[column].secondaryStructure!='H')\r
+                  int x2 = (x*av.charWidth);\r
+\r
+                  if (sCol == 0 ||\r
+                      row.annotations[sCol - 1] == null ||\r
+                      row.annotations[sCol - 1].secondaryStructure != 'H')\r
                   {\r
-                    g.fillArc(x-av.charWidth, y+4+iconOffset, av.charWidth, 7, 270,180);\r
-                    x2 -= av.charWidth/2;\r
+                    g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90, 180);\r
+                    x1 += av.charWidth / 2;\r
                   }\r
 \r
-                  g.fillRect(x1, y+4+iconOffset, x2-x1+1, 7);\r
-\r
-                    break;\r
+                  if (row.annotations[column] == null ||\r
+                      row.annotations[column].secondaryStructure != 'H')\r
+                  {\r
+                    g.fillArc((x*av.charWidth) - av.charWidth,\r
+                              y + 4 + iconOffset, av.charWidth, 8, 270,\r
+                              180);\r
+                    x2 -= av.charWidth / 2;\r
+                  }\r
 \r
-                case 'E':\r
-                    g.setColor(SHEET_COLOUR);\r
+                  g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);\r
 \r
-                    if (row.annotations[endRes] ==null\r
-                        || row.annotations[endRes].secondaryStructure != 'E')\r
-                    {\r
-                      g.fillRect(lastSSX, y + 4 + iconOffset,\r
-                                 x*av.charWidth - lastSSX - 4, 7);\r
-                      g.fillPolygon(new int[]\r
-                                    {x*av.charWidth - 5,\r
-                                    x*av.charWidth - 5,\r
-                                    x*av.charWidth},\r
-                                    new int[]\r
-                                    {\r
-                                    y + iconOffset, y + 14 + iconOffset,\r
-                                    y + 7 + iconOffset\r
-                      }, 3);\r
-                    }\r
-                    else\r
-                      g.fillRect(lastSSX, y + 4 + iconOffset,\r
-                                 x*av.charWidth - lastSSX, 7);\r
+                  break;\r
 \r
-                    break;\r
+                case 'E':\r
+                  g.setColor(SHEET_COLOUR);\r
 \r
+                  if (row.annotations[endRes] == null\r
+                      || row.annotations[endRes].secondaryStructure != 'E')\r
+                  {\r
+                    g.fillRect(lastSSX, y + 4 + iconOffset,\r
+                               (x*av.charWidth) - lastSSX - 4, 7);\r
+                    g.fillPolygon(new int[]\r
+                                  {(x*av.charWidth) - 4,\r
+                                  (x*av.charWidth) - 4,\r
+                                 (x*av.charWidth)},\r
+                                  new int[]\r
+                                  {\r
+                                  y + iconOffset, y + 14 + iconOffset,\r
+                                  y + 7 + iconOffset\r
+                    }, 3);\r
+                  }\r
+                  else\r
+                   {\r
+                     g.fillRect(lastSSX, y + 4 + iconOffset,\r
+                                (x+1) * av.charWidth - lastSSX, 7);\r
+                   }\r
+                  break;\r
 \r
                 default:\r
-                    g.setColor(Color.gray);\r
-                    if(!av.wrapAlignment || endRes==av.endRes)\r
-                      g.fillRect(lastSSX, y + 6 + iconOffset,\r
-                                 x*av.charWidth - lastSSX, 2);\r
+                  g.setColor(Color.gray);\r
+                  if(!av.wrapAlignment || endRes==av.endRes)\r
+                  g.fillRect(lastSSX, y + 6 + iconOffset,\r
+                             (x*av.charWidth) - lastSSX, 2);\r
 \r
-                    break;\r
-                }\r
-            }\r
+                  break;\r
+              }\r
+          }\r
 \r
             if (row.graph>0)\r
             {\r