From: hansonr Date: Thu, 18 Apr 2019 17:55:55 +0000 (-0500) Subject: Adds check for gap padding to disallow fast paint upon pasting if X-Git-Tag: Release_2_11_4_0~45^2~18^2~141 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b1f1dafab890809e47d9b3e7b54aa300ebe6d7a1;p=jalview.git Adds check for gap padding to disallow fast paint upon pasting if alignment has been modified. --- diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index d1046f8..c99041b 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -287,6 +287,7 @@ public class SeqCanvas extends JPanel implements ViewportListenerI */ public void fastPaint(int horizontal, int vertical) { + // System.err.println("<>SeqCanvas paintComponent " + fastPaint + "\n" // + getVisibleRect() + "\n" + g.getClipBounds()); @@ -412,12 +417,11 @@ public class SeqCanvas extends JPanel implements ViewportListenerI drawSelectionGroup((Graphics2D) g, startRes, endRes, startSeq, endSeq); fastPaint = false; - //System.out.println("SeqCanvas fast paint"); + // System.out.println("SeqCanvas fast paint"); } else { - - System.out.println("SeqCanvas full paint"); + // System.out.println("SeqCanvas full paint"); /* * img is a cached version of the last view we drew. * If we have no img or the size has changed, make a new one @@ -2160,18 +2164,4 @@ public class SeqCanvas extends JPanel implements ViewportListenerI return labelWidthWest; } - /** - * Ensure that a full paint is done next, for whatever reason. This was - * necessary for JavaScript; apparently in Java the timing is just right on - * multiple threads (EventQueue-0, Consensus, Conservation) that we can get - * away with one fast paint before the others, but this ensures that in the - * end we get a full paint. Problem arose in relation to copy/paste, where the - * paste was not finalized with a full paint. - * - * @author hansonr 2019.04.17 - */ - public void clearFastPaint() - { - fastPaint = false; - } } diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 5a99c3d..f2ab8a6 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -1323,6 +1323,21 @@ public abstract class AlignmentViewport */ private boolean followHighlight = true; + private boolean disableFastPaint; // BH 2019.04.18 + + /** + * BH 2019.04.18 When gap filling is on and a modification is made to fill + * those, we need to disallow fast painting for paste just once + * + * @return + */ + public boolean isFastPaintDisabled() + { + boolean ret = disableFastPaint; + disableFastPaint = false; + return ret; + } + /** * Property change listener for changes in alignment * @@ -1857,7 +1872,11 @@ public abstract class AlignmentViewport { if (isPadGaps()) { - alignment.padGaps(); + if (alignment.padGaps()) + { + // the new alignment has been modified -- can't fast paint + disableFastPaint = true; + } } if (autoCalculateConsensus) {