X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FAnnotationPanel.java;h=ed899b1c31b825a524e2a9f62f91a16af6f58d60;hb=11528cae3c2e759a2a55ae1f9e748b13b32f4f75;hp=ffb8e4e8c0988665f194fdd7b85e71e8873de2a4;hpb=b57a02c25e335d033c97f8a6bacd6b54f62bd2b6;p=jalview.git diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index ffb8e4e..ed899b1 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -1,18 +1,18 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) - * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle - * + * 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 + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * 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 . */ package jalview.gui; @@ -376,10 +376,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 +699,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 +755,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 +795,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 +807,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 +815,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 +837,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 +904,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 +952,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; + } }