X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationPanel.java;h=86d5c6dacbec1fdb25a40cead49521e1ceb6d244;hb=266c4e2544701f88a8d21294b4a4f4cc42cf76cc;hp=895d1961daa58d379fea51acfa8db05bd4cdfdb5;hpb=7bc226b58110fa26d9dbd3f0c78095d06909ffc3;p=jalview.git diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 895d196..86d5c6d 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -200,6 +200,9 @@ public class AnnotationPanel { int index = av.getColumnSelection().columnAt(i); + if(!av.colSel.isVisible(index)) + continue; + if (anot[index] == null) { anot[index] = new Annotation(label, "", ' ', 0); @@ -218,6 +221,9 @@ public class AnnotationPanel { int index = av.getColumnSelection().columnAt(i); + if(!av.colSel.isVisible(index)) + continue; + if (anot[index] == null) { anot[index] = new Annotation("", "", ' ', 0); @@ -264,6 +270,9 @@ public class AnnotationPanel { int index = av.getColumnSelection().columnAt(i); + if(!av.colSel.isVisible(index)) + continue; + if (anot[index] == null) { anot[index] = new Annotation(label, "", type, 0); @@ -354,36 +363,7 @@ public class AnnotationPanel return; } - int res = (evt.getX() / av.getCharWidth()) + av.getStartRes(); - - if (av.hasHiddenColumns) - { - res = av.getColumnSelection().adjustForHiddenColumns(res); - } - - min = res; - max = res; - - if (av.getColumnSelection().contains(res)) - { - av.getColumnSelection().removeElement(res); - } - else - { - av.getColumnSelection().addElement(res); - SequenceGroup sg = new SequenceGroup(); - - for (int i = 0; i < av.alignment.getSequences().size(); i++) - { - sg.addSequence(av.alignment.getSequenceAt(i), false); - } - - sg.setStartRes(res); - sg.setEndRes(res); - av.setSelectionGroup(sg); - } - - ap.repaint(); + ap.scalePanel.mousePressed(evt); } @@ -397,6 +377,7 @@ public class AnnotationPanel graphStretch = -1; graphStretchY = -1; mouseDragging = false; + ap.scalePanel.mouseReleased(evt); } /** @@ -406,10 +387,7 @@ public class AnnotationPanel */ public void mouseEntered(MouseEvent evt) { - if (mouseDragging) - { - ap.seqPanel.scrollCanvas(null); - } + ap.scalePanel.mouseEntered(evt); } /** @@ -419,10 +397,7 @@ public class AnnotationPanel */ public void mouseExited(MouseEvent evt) { - if (mouseDragging) - { - ap.seqPanel.scrollCanvas(evt); - } + ap.scalePanel.mouseExited(evt); } /** @@ -442,62 +417,11 @@ public class AnnotationPanel } graphStretchY = evt.getY(); adjustPanelHeight(); - ap.repaint(); + ap.paintAlignment(true); } else { - mouseDragging = true; - - int res = (evt.getX() / av.getCharWidth()) + av.getStartRes(); - - if (av.hasHiddenColumns) - { - res = av.getColumnSelection().adjustForHiddenColumns(res); - } - - SequenceGroup sg = av.getSelectionGroup(); - - if (res < min) - { - min = res; - } - - if (res > max) - { - max = res; - } - - if (sg != null) - { - if (!av.getColumnSelection().contains(res)) - { - av.getColumnSelection().addElement(res); - } - - if (res > sg.getStartRes()) - { - sg.setEndRes(res); - } - else if (res < sg.getStartRes()) - { - sg.setStartRes(res); - } - - for (int i = min; i <= max; i++) - { - if ( (i < sg.getStartRes()) || (i > sg.getEndRes())) - { - av.getColumnSelection().removeElement(i); - } - else - { - av.getColumnSelection().addElement(i); - } - } - - ap.repaint(); - } - + ap.scalePanel.mouseDragged(evt); } } @@ -763,11 +687,11 @@ public class AnnotationPanel AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); - int x = 0, y = 0; + int x = 0, y=0; int column = 0; char lastSS; int lastSSX; - int iconOffset = av.charHeight / 2; + int iconOffset = 0; boolean validRes = false; boolean[] graphGroupDrawn = new boolean[aa.length]; @@ -797,9 +721,20 @@ public class AnnotationPanel if (row.hasText) { + iconOffset =av.charHeight -fm.getDescent(); y -= av.charHeight; } } + else if (row.hasText) + { + iconOffset = av.charHeight -fm.getDescent(); + + } + else + { + iconOffset = 0; + } + if (av.updatingConsensus && aa[i] == av.consensus) { @@ -839,14 +774,7 @@ public class AnnotationPanel continue; } - if (row.hasText) - { - iconOffset = av.charHeight / 2 + 4; - } - else - { - iconOffset = 0; - } + x = 0; while (x < endRes - startRes) @@ -893,15 +821,20 @@ public class AnnotationPanel } } - if (av.validCharWidth && validRes && - (row.annotations[column].displayCharacter.length() > 0)) + if (av.validCharWidth && validRes + && row.annotations[column].displayCharacter != null + && (row.annotations[column].displayCharacter.length() > 0)) { int charOffset = (av.charWidth - fm.charWidth(row.annotations[column]. displayCharacter.charAt( 0))) / 2; - g.setColor(row.annotations[column].colour); + + if (row.annotations[column].colour == null) + g.setColor(Color.black); + else + g.setColor(row.annotations[column].colour); if (column == 0 || row.graph > 0) { @@ -1215,7 +1148,11 @@ public class AnnotationPanel continue; } - g.setColor(aa.annotations[column].colour); + if (aa.annotations[column].colour == null) + g.setColor(Color.black); + else + g.setColor(aa.annotations[column].colour); + y1 = y - (int) ( ( (aa.annotations[column - 1].value - min) / range) * graphHeight); y2 = y - @@ -1289,7 +1226,11 @@ public class AnnotationPanel continue; } - g.setColor(aa.annotations[column].colour); + if (aa.annotations[column].colour == null) + g.setColor(Color.black); + else + g.setColor(aa.annotations[column].colour); + y1 = y - (int) ( ( (aa.annotations[column].value - min) / (range)) * aa.graphHeight); @@ -1336,7 +1277,10 @@ public class AnnotationPanel { if (aa.annotations[j] != null) { - g.setColor(aa.annotations[j].colour); + if (aa.annotations[j].colour == null) + g.setColor(Color.black); + else + g.setColor(aa.annotations[j].colour); height = (int) ( (aa.annotations[j].value / aa.graphMax) * y); if (height > y)