From 9ce64cb890f97849c5d30cd994cc682465fd7db1 Mon Sep 17 00:00:00 2001 From: kiramt Date: Wed, 3 May 2017 09:14:01 +0100 Subject: [PATCH] JAL-2491 sort of working overview/find interaction with split panels --- src/jalview/gui/AlignmentPanel.java | 12 ++++--- src/jalview/viewmodel/ViewportRanges.java | 49 +++++++++++++++++++---------- 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 4863659..4e5158d 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -745,8 +745,8 @@ public class AlignmentPanel extends GAlignmentPanel implements } // update endRes after x has (possibly) been adjusted - vpRanges.setEndRes((x + (getSeqPanel().seqCanvas.getWidth() / av - .getCharWidth())) - 1); + // vpRanges.setEndRes((x + (getSeqPanel().seqCanvas.getWidth() / av + // .getCharWidth())) - 1); /* * each scroll adjustment triggers adjustmentValueChanged, which resets the @@ -757,6 +757,7 @@ public class AlignmentPanel extends GAlignmentPanel implements hscroll.setValues(x, hextent, 0, width); // setDontScrollComplement(flag); vscroll.setValues(y, vextent, 0, height); + } /** @@ -771,7 +772,10 @@ public class AlignmentPanel extends GAlignmentPanel implements int oldX = vpRanges.getStartRes(); int oldY = vpRanges.getStartSeq(); - if (evt.getSource() == hscroll) + // check for horizontal scroll with wrapped alignment + // as this can happen via triggered events (and we don't want to hscroll + // when wrapped) + if (evt.getSource() == hscroll && !av.getWrapAlignment()) { int x = hscroll.getValue(); if (x == oldX) @@ -1940,6 +1944,6 @@ public class AlignmentPanel extends GAlignmentPanel implements int x = vpRanges.getStartRes(); int y = vpRanges.getStartSeq(); setScrollValues(x, y); - + av.scrollComplementaryAlignment(); } } diff --git a/src/jalview/viewmodel/ViewportRanges.java b/src/jalview/viewmodel/ViewportRanges.java index bbdaa9e..a14fc26 100644 --- a/src/jalview/viewmodel/ViewportRanges.java +++ b/src/jalview/viewmodel/ViewportRanges.java @@ -86,6 +86,13 @@ public class ViewportRanges extends ViewportProperties */ public void setStartRes(int res) { + int oldres = this.startRes; + setStartResInternal(res); + changeSupport.firePropertyChange("startres", oldres, res); + } + + private void setStartResInternal(int res) + { if (res > al.getWidth() - 1) { res = al.getWidth() - 1; @@ -94,17 +101,14 @@ public class ViewportRanges extends ViewportProperties { res = 0; } - - int oldres = this.startRes; this.startRes = res; - // changeSupport.firePropertyChange("startres", oldres, res); } public void setStartEndRes(int startres, int endres) { int oldres = this.startRes; - setStartRes(startres); - setEndRes(endres); + setStartResInternal(startres); + setEndResInternal(endres); changeSupport.firePropertyChange("startres", oldres, startres); } @@ -116,6 +120,14 @@ public class ViewportRanges extends ViewportProperties */ public void setEndRes(int res) { + int oldres = this.endRes; + setEndResInternal(res); + + changeSupport.firePropertyChange("endres", oldres, res); + } + + private void setEndResInternal(int res) + { if (res >= al.getWidth()) { res = al.getWidth() - 1; @@ -124,10 +136,7 @@ public class ViewportRanges extends ViewportProperties { res = 0; } - int oldres = this.endRes; this.endRes = res; - - // changeSupport.firePropertyChange("endres", oldres, res); } /** @@ -138,6 +147,13 @@ public class ViewportRanges extends ViewportProperties */ public void setStartSeq(int seq) { + int oldseq = this.startSeq; + setStartSeqInternal(seq); + changeSupport.firePropertyChange("startseq", oldseq, seq); + } + + private void setStartSeqInternal(int seq) + { if (seq > al.getHeight() - 1) { seq = al.getHeight() - 1; @@ -146,17 +162,14 @@ public class ViewportRanges extends ViewportProperties { seq = 0; } - - int oldseq = this.startSeq; this.startSeq = seq; - // changeSupport.firePropertyChange("startseq", oldseq, seq); } public void setStartEndSeq(int startseq, int endseq) { int oldseq = this.startSeq; - setStartSeq(startseq); - setEndSeq(endseq); + setStartSeqInternal(startseq); + setEndSeqInternal(endseq); changeSupport.firePropertyChange("startseq", oldseq, startseq); } @@ -168,6 +181,13 @@ public class ViewportRanges extends ViewportProperties */ public void setEndSeq(int seq) { + int oldseq = this.endSeq; + setEndSeqInternal(seq); + changeSupport.firePropertyChange("endseq", oldseq, seq); + } + + private void setEndSeqInternal(int seq) + { if (seq >= al.getHeight()) { seq = al.getHeight() - 1; @@ -176,10 +196,7 @@ public class ViewportRanges extends ViewportProperties { seq = 0; } - int oldseq = this.endSeq; this.endSeq = seq; - - // changeSupport.firePropertyChange("endseq", oldseq, seq); } /** -- 1.7.10.2