From b482f8156c38c7b5ea498eec33f312375441c352 Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 8 Jun 2010 14:30:37 +0000 Subject: [PATCH 1/1] better test for when to update column selection when receiving a selection message * JAL-574 --- src/jalview/gui/SeqPanel.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index f3502a6..640b7e4 100755 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -1883,7 +1883,8 @@ public class SeqPanel extends JPanel implements MouseListener, } // do we want to thread this ? (contention with seqsel and colsel locks, I // suspect) - boolean repaint = false; + // rules are: colsel is copied if there is a real intersection between sequence selection + boolean repaint = false,copycolsel=true; if (av.selectionGroup == null || !av.isSelectionGroupChanged()) { SequenceGroup sgroup = null; @@ -1898,6 +1899,11 @@ public class SeqPanel extends JPanel implements MouseListener, } sgroup = seqsel.intersect(av.alignment, (av.hasHiddenRows) ? av.hiddenRepSequences : null); + if ((sgroup==null || sgroup.getSize()==0) && (colsel==null || colsel.size()==0)) + { + // don't copy columns if the region didn't intersect. + copycolsel=false; + } } if (sgroup != null && sgroup.getSize() > 0) { @@ -1909,7 +1915,7 @@ public class SeqPanel extends JPanel implements MouseListener, } repaint = av.isSelectionGroupChanged(); } - if (av.colSel == null || !av.isColSelChanged()) + if (copycolsel && (av.colSel == null || !av.isColSelChanged())) { // the current selection is unset or from a previous message // so import the new colsel. @@ -1922,6 +1928,7 @@ public class SeqPanel extends JPanel implements MouseListener, } else { + // TODO: shift colSel according to the intersecting sequences if (av.colSel == null) { av.colSel = new ColumnSelection(colsel); @@ -1933,7 +1940,7 @@ public class SeqPanel extends JPanel implements MouseListener, } repaint |= av.isColSelChanged(); } - if (av.hasHiddenColumns + if (copycolsel && av.hasHiddenColumns && (av.colSel == null || av.colSel.getHiddenColumns() == null)) { System.err.println("Bad things"); -- 1.7.10.2