X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FSeqPanel.java;h=f476d419dc11cb34f3b6a467c44ac3973e0d0e19;hb=3ed5c0f91614bb7a3620ec3a968a54bafdbd74ad;hp=1f1dd2f30bf072a6fcebfdc51a5a22a98fd0f9e9;hpb=2672f9a72ffb8ffaf4b48a08e64de7f3d83ce061;p=jalview.git diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 1f1dd2f..f476d41 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -825,6 +825,20 @@ public class SeqPanel extends JPanel implements MouseListener, String lastTooltip; /** + * set when the current UI interaction has resulted in a change that requires + * overview shading to be recalculated. this could be changed to something + * more expressive that indicates what actually has changed, so selective + * redraws can be applied + */ + private boolean needOverviewUpdate = false; // TODO: refactor to avcontroller + + /** + * set if av.getSelectionGroup() refers to a group that is defined on the + * alignment view, rather than a transient selection + */ + private boolean editingDefinedGroup = false; // TODO: refactor to avcontroller or viewModel + + /** * Set status message in alignment panel * * @param sequence @@ -843,7 +857,8 @@ public class SeqPanel extends JPanel implements MouseListener, * Sequence number (if known), and sequence name. */ String seqno = seq == -1 ? "" : " " + (seq + 1); - text.append("Sequence" + seqno + " ID: " + sequence.getName()); + text.append("Sequence").append(seqno).append(" ID: ") + .append(sequence.getName()); String residue = null; /* @@ -1568,10 +1583,12 @@ public class SeqPanel extends JPanel implements MouseListener, && (res < stretchGroup.getEndRes())) { av.setSelectionGroup(stretchGroup); + editingDefinedGroup = true; } else { stretchGroup = null; + editingDefinedGroup = false; } } else if (!stretchGroup.getSequences(null).contains(sequence) @@ -1590,6 +1607,7 @@ public class SeqPanel extends JPanel implements MouseListener, && (allGroups[i].getEndRes() >= res)) { stretchGroup = allGroups[i]; + editingDefinedGroup = true; break; } } @@ -1599,7 +1617,7 @@ public class SeqPanel extends JPanel implements MouseListener, } - if (SwingUtilities.isRightMouseButton(evt)) + if (evt.isPopupTrigger()) { List allFeatures = ap.getFeatureRenderer() .findFeaturesAtRes(sequence.getDatasetSequence(), @@ -1639,7 +1657,7 @@ public class SeqPanel extends JPanel implements MouseListener, sg.setEndRes(res); sg.addSequence(sequence, false); av.setSelectionGroup(sg); - + editingDefinedGroup = false; stretchGroup = sg; if (av.getConservationSelected()) @@ -1682,9 +1700,10 @@ public class SeqPanel extends JPanel implements MouseListener, { return; } - - stretchGroup.recalcConservation(); // always do this - annotation has own - // state + // always do this - annotation has own state + // but defer colourscheme update until hidden sequences are passed in + boolean vischange = stretchGroup.recalcConservation(true); + needOverviewUpdate |= vischange && editingDefinedGroup; if (stretchGroup.cs != null) { stretchGroup.cs.alignmentChanged(stretchGroup, @@ -1702,8 +1721,9 @@ public class SeqPanel extends JPanel implements MouseListener, } } PaintRefresher.Refresh(this, av.getSequenceSetId()); - ap.paintAlignment(true); - + ap.paintAlignment(needOverviewUpdate); + needOverviewUpdate =false; + editingDefinedGroup = false; changeEndRes = false; changeStartRes = false; stretchGroup = null; @@ -1757,6 +1777,7 @@ public class SeqPanel extends JPanel implements MouseListener, if (res > (stretchGroup.getStartRes() - 1)) { stretchGroup.setEndRes(res); + needOverviewUpdate |= editingDefinedGroup; } } else if (changeStartRes) @@ -1764,6 +1785,7 @@ public class SeqPanel extends JPanel implements MouseListener, if (res < (stretchGroup.getEndRes() + 1)) { stretchGroup.setStartRes(res); + needOverviewUpdate |= editingDefinedGroup; } } @@ -1797,6 +1819,7 @@ public class SeqPanel extends JPanel implements MouseListener, if (stretchGroup.getSequences(null).contains(nextSeq)) { stretchGroup.deleteSequence(seq, false); + needOverviewUpdate |= editingDefinedGroup; } else { @@ -1806,6 +1829,7 @@ public class SeqPanel extends JPanel implements MouseListener, } stretchGroup.addSequence(nextSeq, false); + needOverviewUpdate |= editingDefinedGroup; } } @@ -1947,10 +1971,12 @@ public class SeqPanel extends JPanel implements MouseListener, // do we want to thread this ? (contention with seqsel and colsel locks, I // suspect) - // rules are: colsel is copied if there is a real intersection between - // sequence selection + /* + * only copy colsel if there is a real intersection between + * sequence selection and this panel's alignment + */ boolean repaint = false; - boolean copycolsel = true; + boolean copycolsel = false; SequenceGroup sgroup = null; if (seqsel != null && seqsel.getSize() > 0) @@ -1964,11 +1990,9 @@ public class SeqPanel extends JPanel implements MouseListener, } sgroup = seqsel.intersect(av.getAlignment(), (av.hasHiddenRows()) ? av.getHiddenRepSequences() : null); - if ((sgroup == null || sgroup.getSize() == 0) - || (colsel == null || colsel.isEmpty())) + if ((sgroup != null && sgroup.getSize() > 0)) { - // don't copy columns if the region didn't intersect. - copycolsel = false; + copycolsel = true; } } if (sgroup != null && sgroup.getSize() > 0) @@ -2061,7 +2085,6 @@ public class SeqPanel extends JPanel implements MouseListener, ColumnSelection cs = MappingUtils.mapColumnSelection(colsel, sourceAv, av); av.setColumnSelection(cs); - av.isColSelChanged(true); PaintRefresher.Refresh(this, av.getSequenceSetId());