git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Must be 1.1 compliant
[jalview.git]
/
src
/
jalview
/
appletgui
/
AnnotationPanel.java
diff --git
a/src/jalview/appletgui/AnnotationPanel.java
b/src/jalview/appletgui/AnnotationPanel.java
index
d9b8dd3
..
614498c
100755
(executable)
--- a/
src/jalview/appletgui/AnnotationPanel.java
+++ b/
src/jalview/appletgui/AnnotationPanel.java
@@
-51,11
+51,16
@@
public class AnnotationPanel
\r
public static int GRAPH_HEIGHT = 40;
\r
\r
\r
public static int GRAPH_HEIGHT = 40;
\r
\r
+ boolean MAC = false;
\r
+
\r
public AnnotationPanel(AlignmentPanel ap)
\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.ap = ap;
\r
av = ap.av;
\r
- this.setLayout(null);
\r
+ setLayout(null);
\r
adjustPanelHeight();
\r
\r
addMouseMotionListener(new MouseMotionAdapter()
\r
adjustPanelHeight();
\r
\r
addMouseMotionListener(new MouseMotionAdapter()
\r
@@
-126,9
+131,6
@@
public class AnnotationPanel
}
\r
\r
this.setSize(getSize().width, height);
\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
repaint();
\r
\r
@@
-206,6
+208,8
@@
public class AnnotationPanel
\r
public void paint(Graphics g)
\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
imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;
\r
\r
if (image == null || imgWidth != image.getWidth(this))
\r
@@
-225,6
+229,8
@@
public class AnnotationPanel
}
\r
\r
drawComponent(gg, av.startRes, av.endRes + 1);
\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.drawImage(image, 0, 0, this);
\r
}
\r
\r
@@
-286,14
+292,14
@@
public class AnnotationPanel
g.setColor(Color.white);
\r
g.fillRect(0, 0, getSize().width, getSize().height);
\r
g.setColor(Color.black);
\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
\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
int x = 0;
\r
int y = 0;
\r
char lastSS;
\r
@@
-356,8
+362,8
@@
public class AnnotationPanel
x = (column - startRes) * av.charWidth;
\r
\r
\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
int charOffset = (av.charWidth -
\r
fm.charWidth(row.annotations[column].displayCharacter.charAt(
\r
@@
-391,11
+397,21
@@
public class AnnotationPanel
{
\r
case 'H':
\r
g.setColor(HELIX_COLOUR);
\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
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
row.annotations[sCol-1].secondaryStructure!='H')
\r
{
\r
g.fillArc(lastSSX, y+4+iconOffset, av.charWidth, 8, 90,180) ;
\r
@@
-451,6
+467,9
@@
public class AnnotationPanel
column++;
\r
}
\r
\r
column++;
\r
}
\r
\r
+ if(column>=row.annotations.length)
\r
+ column = row.annotations.length-1;
\r
+
\r
x += av.charWidth;
\r
\r
if (row.hasIcons)
\r
x += av.charWidth;
\r
\r
if (row.hasIcons)
\r
@@
-459,12
+478,22
@@
public class AnnotationPanel
{
\r
case 'H':
\r
g.setColor(HELIX_COLOUR);
\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
\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
row.annotations[sCol-1].secondaryStructure!='H')
\r
{
\r
g.fillArc(lastSSX, y+4+iconOffset, av.charWidth, 8, 90,180) ;
\r
@@
-485,8
+514,8
@@
public class AnnotationPanel
case 'E':
\r
g.setColor(SHEET_COLOUR);
\r
\r
case 'E':
\r
g.setColor(SHEET_COLOUR);
\r
\r
- if (row.annotations.length > endRes
\r
- && row.annotations[endRes].secondaryStructure != 'E')
\r
+ if (row.annotations[endRes] ==null
\r
+ || row.annotations[endRes].secondaryStructure != 'E')
\r
{
\r
g.fillRect(lastSSX, y + 4 + iconOffset,
\r
x - lastSSX - 4, 7);
\r
{
\r
g.fillRect(lastSSX, y + 4 + iconOffset,
\r
x - lastSSX - 4, 7);
\r
@@
-577,7
+606,6
@@
public class AnnotationPanel
return;
\r
\r
\r
return;
\r
\r
\r
- eRes = Math.min(eRes, aa.annotations.length);
\r
\r
int x = 0;
\r
\r
\r
int x = 0;
\r
\r
@@
-585,6
+613,9
@@
public class AnnotationPanel
if(eRes<av.endRes)
\r
eRes++;
\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
if(sRes==0)
\r
{
\r
sRes++;
\r
@@
-596,7
+627,7
@@
public class AnnotationPanel
\r
////Draw origin
\r
if(min<0)
\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
\r
g.setColor(Color.gray);
\r
g.drawLine(x-av.charWidth,y2,(eRes-sRes)*av.charWidth,y2);
\r
@@
-644,7
+675,7
@@
public class AnnotationPanel
y1 = y2 = y;
\r
\r
if(min<0)
\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
\r
g.setColor(Color.gray);
\r
\r