From: amwaterhouse Date: Wed, 9 Aug 2006 15:55:43 +0000 (+0000) Subject: Icon drawing updated X-Git-Tag: Release_2_1~130 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7e8fe40091b8d1dfe20dc52d2ac3e2ec78a6c3cf;p=jalview.git Icon drawing updated --- diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 0f025b5..549d531 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -797,52 +797,50 @@ public class AnnotationPanel extends JPanel implements MouseListener, switch (lastSS) { 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*av.charWidth - lastSSX, 7, 8, 8); - break; - } - - int sCol = (lastSSX / av.charWidth) + startRes; - int x1 = lastSSX; - int x2 = x*av.charWidth; - - if(sCol==0 || - row.annotations[sCol-1]==null || - row.annotations[sCol-1].secondaryStructure!='H') - { - 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-av.charWidth, - y+4+iconOffset, - av.charWidth, - 7, 270,180); - x2 -= av.charWidth/2; - } - - g.fillRect(x1, y+4+iconOffset, x2-x1+1, 7); + 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*av.charWidth) - lastSSX, 7, 8, 8); break; + } + + int sCol = (lastSSX / av.charWidth) + startRes; + int x1 = lastSSX; + int x2 = (x*av.charWidth); + + 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) ; + x1 += av.charWidth/2; + } + + if(row.annotations[column]==null || + row.annotations[column].secondaryStructure!='H') + { + g.fillArc((x*av.charWidth)-av.charWidth, + y+4+iconOffset, av.charWidth, 8, 270,180); + x2 -= av.charWidth/2; + } + + g.fillRect(x1, y+4+iconOffset, x2-x1, 8); + break; case 'E': g.setColor(SHEET_COLOUR); g.fillRect(lastSSX, y + 4 + iconOffset, - x*av.charWidth - lastSSX - 4, 7); - g.fillPolygon(new int[] { x*av.charWidth - 5, - x*av.charWidth - 5, - x*av.charWidth }, + (x*av.charWidth) - lastSSX - 4, 7); + g.fillPolygon(new int[] { (x*av.charWidth) - 4, + (x*av.charWidth) - 4, + (x*av.charWidth) }, new int[] { y + iconOffset, y + 14 + iconOffset, - y + 7 + iconOffset + y + 8 + iconOffset }, 3); break; @@ -851,7 +849,7 @@ public class AnnotationPanel extends JPanel implements MouseListener, default: g.setColor(Color.gray); g.fillRect(lastSSX, y + 6 + iconOffset, - x*av.charWidth - lastSSX, 2); + (x*av.charWidth) - lastSSX, 2); break; } @@ -865,22 +863,24 @@ public class AnnotationPanel extends JPanel implements MouseListener, lastSS = ' '; } - lastSSX = x*av.charWidth; + lastSSX = (x*av.charWidth); } } - column++; - x++; + + + column++; + x++; } if(column>=row.annotations.length) - column = row.annotations.length-1; + column = row.annotations.length-1; - x ++; + // x ++; if (row.hasIcons) { - switch (lastSS) - { + switch (lastSS) + { case 'H': g.setColor(HELIX_COLOUR); if (MAC) @@ -888,68 +888,69 @@ public class AnnotationPanel extends JPanel implements MouseListener, //Off by 1 offset when drawing rects and ovals //to offscreen image on the MAC g.fillRoundRect(lastSSX, y + 4 + iconOffset, - x*av.charWidth - lastSSX, 7, 8, 8); + (x*av.charWidth) - lastSSX, 7, 8, 8); break; } - int sCol = (lastSSX / av.charWidth) + startRes; int x1 = lastSSX; - int x2 = x; - - if(sCol==0 || - row.annotations[sCol-1]==null || - row.annotations[sCol-1].secondaryStructure!='H') - { - 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') + int x2 = (x*av.charWidth); + + if (sCol == 0 || + row.annotations[sCol - 1] == null || + row.annotations[sCol - 1].secondaryStructure != 'H') { - g.fillArc(x-av.charWidth, y+4+iconOffset, av.charWidth, 7, 270,180); - x2 -= av.charWidth/2; + g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90, 180); + x1 += av.charWidth / 2; } - g.fillRect(x1, y+4+iconOffset, x2-x1+1, 7); - - break; + if (row.annotations[column] == null || + row.annotations[column].secondaryStructure != 'H') + { + g.fillArc((x*av.charWidth) - av.charWidth, + y + 4 + iconOffset, av.charWidth, 8, 270, + 180); + x2 -= av.charWidth / 2; + } - case 'E': - g.setColor(SHEET_COLOUR); + g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8); - if (row.annotations[endRes] ==null - || row.annotations[endRes].secondaryStructure != 'E') - { - g.fillRect(lastSSX, y + 4 + iconOffset, - x*av.charWidth - lastSSX - 4, 7); - g.fillPolygon(new int[] - {x*av.charWidth - 5, - x*av.charWidth - 5, - x*av.charWidth}, - new int[] - { - y + iconOffset, y + 14 + iconOffset, - y + 7 + iconOffset - }, 3); - } - else - g.fillRect(lastSSX, y + 4 + iconOffset, - x*av.charWidth - lastSSX, 7); + break; - break; + case 'E': + g.setColor(SHEET_COLOUR); + if (row.annotations[endRes] == null + || row.annotations[endRes].secondaryStructure != 'E') + { + g.fillRect(lastSSX, y + 4 + iconOffset, + (x*av.charWidth) - lastSSX - 4, 7); + g.fillPolygon(new int[] + {(x*av.charWidth) - 4, + (x*av.charWidth) - 4, + (x*av.charWidth)}, + new int[] + { + y + iconOffset, y + 14 + iconOffset, + y + 7 + iconOffset + }, 3); + } + else + { + g.fillRect(lastSSX, y + 4 + iconOffset, + (x+1) * av.charWidth - lastSSX, 7); + } + break; default: - g.setColor(Color.gray); - if(!av.wrapAlignment || endRes==av.endRes) - g.fillRect(lastSSX, y + 6 + iconOffset, - x*av.charWidth - lastSSX, 2); + g.setColor(Color.gray); + if(!av.wrapAlignment || endRes==av.endRes) + g.fillRect(lastSSX, y + 6 + iconOffset, + (x*av.charWidth) - lastSSX, 2); - break; - } - } + break; + } + } if (row.graph>0) {