From: jprocter Date: Tue, 8 Jun 2010 14:30:37 +0000 (+0000) Subject: better test for when to update column selection when receiving a selection message... X-Git-Tag: Release_2_5_1~20 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b482f8156c38c7b5ea498eec33f312375441c352;hp=6ef8b014737c1dac4f2e566e27cf4b34b68af9c0;p=jalview.git better test for when to update column selection when receiving a selection message * JAL-574 --- 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");