X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationPanel.java;h=8a222884824b30fa14c8d586e0fa664fb9f7e8da;hb=865a855a4ca87eadb3e5ff284ed32ed307d9c34b;hp=d0af0a549fc101d7b048addd9e50e9893f495dd2;hpb=59d682209891099d46b960509907c79e3fb276fe;p=jalview.git diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index d0af0a5..8a22288 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) - * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1) + * Copyright (C) 2014 The Jalview Authors * * This file is part of Jalview. * @@ -14,6 +14,7 @@ * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.gui; @@ -376,10 +377,10 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, anot[index].displayCharacter = label; } } - aa[activeRow].validateRangeAndDisplay(); - - adjustPanelHeight(); + av.getAlignment().validateAnnotation(aa[activeRow]); ap.alignmentChanged(); + + adjustPanelHeight(); repaint(); return; @@ -699,16 +700,11 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, @Override public void mouseClicked(MouseEvent evt) { - if (activeRow != -1) - { - AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation(); - AlignmentAnnotation anot = aa[activeRow]; - - if (anot.description.equals("secondary structure")) - { - // System.out.println(anot.description+" "+anot.getRNAStruc()); - } - } +// if (activeRow != -1) +// { +// AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation(); +// AlignmentAnnotation anot = aa[activeRow]; +// } } // TODO mouseClicked-content and drawCursor are quite experimental! @@ -760,7 +756,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, imgWidth = (av.endRes - av.startRes + 1) * av.charWidth; if (imgWidth < 1) return; - if (image == null || imgWidth != image.getWidth() + if (image == null || imgWidth != image.getWidth(this) || image.getHeight(this) != getHeight()) { try @@ -800,7 +796,10 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, imageFresh = false; g.drawImage(image, 0, 0, this); } - + /** + * set true to enable redraw timing debug output on stderr + */ + private final boolean debugRedraw = false; /** * non-Thread safe repaint * @@ -809,7 +808,6 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, */ public void fastPaint(int horizontal) { - if ((horizontal == 0) || gg == null || av.getAlignment().getAlignmentAnnotation() == null || av.getAlignment().getAlignmentAnnotation().length < 1 @@ -818,8 +816,9 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, repaint(); return; } + long stime=System.currentTimeMillis(); gg.copyArea(0, 0, imgWidth, getHeight(), -horizontal * av.charWidth, 0); - + long mtime=System.currentTimeMillis(); int sr = av.startRes; int er = av.endRes + 1; int transX = 0; @@ -839,9 +838,13 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, drawComponent(gg, sr, er); gg.translate(-transX, 0); - + long dtime=System.currentTimeMillis(); fastPaint = true; repaint(); + long rtime=System.currentTimeMillis(); + if (debugRedraw) { + System.err.println("Scroll:\t"+horizontal+"\tCopyArea:\t"+(mtime-stime)+"\tDraw component:\t"+(dtime-mtime)+"\tRepaint call:\t"+(rtime-dtime)); + } } @@ -902,7 +905,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, } fadedImage = null; } - + g.setColor(Color.white); g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight()); @@ -950,4 +953,16 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, { return imgWidth; } + private int[] bounds = new int[2]; + @Override + public int[] getVisibleVRange() + { + if (ap!=null && ap.alabels!=null) + { + int sOffset=-ap.alabels.scrollOffset; + int visHeight = sOffset+ap.annotationSpaceFillerHolder.getHeight(); + bounds[0] = sOffset; bounds[1]=visHeight; + return bounds; + } else return null; + } }