X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAnnotationLabels.java;h=b28ccc7f9afd45b61b509f3db213e1bd038df2ed;hb=e60cacff9260c47c12cf34a7e191678cfc97d265;hp=c9632028398029137ef667164fc5dcd4520159d3;hpb=0ff10fddf3364f8a3c657355cfb4bc45ab5485a8;p=jalview.git diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java index c963202..b28ccc7 100755 --- a/src/jalview/appletgui/AnnotationLabels.java +++ b/src/jalview/appletgui/AnnotationLabels.java @@ -712,11 +712,47 @@ public class AnnotationLabels extends Panel implements ActionListener, // todo: make the ap scroll to the selection - not necessary, first // click highlights/scrolls, second selects ap.seqPanel.ap.idPanel.highlightSearchResults(null); - ap.av.setSelectionGroup(// new SequenceGroup( - aa[selectedRow].groupRef); // ); - ap.av.sendSelection(); + // process modifiers + SequenceGroup sg = ap.av.getSelectionGroup(); + if (sg == null + || sg == aa[selectedRow].groupRef + || !(jalview.util.Platform.isControlDown(evt) || evt + .isShiftDown())) + { + if (jalview.util.Platform.isControlDown(evt) + || evt.isShiftDown()) + { + // clone a new selection group from the associated group + ap.av.setSelectionGroup(new SequenceGroup( + aa[selectedRow].groupRef)); + } + else + { + // set selection to the associated group so it can be edited + ap.av.setSelectionGroup(aa[selectedRow].groupRef); + } + } + else + { + // modify current selection with associated group + int remainToAdd = aa[selectedRow].groupRef.getSize(); + for (SequenceI sgs : aa[selectedRow].groupRef.getSequences()) + { + if (jalview.util.Platform.isControlDown(evt)) + { + sg.addOrRemove(sgs, --remainToAdd == 0); + } + else + { + // notionally, we should also add intermediate sequences from + // last added sequence ? + sg.addSequence(sgs, --remainToAdd == 0); + } + } + } ap.paintAlignment(false); PaintRefresher.Refresh(ap, ap.av.getSequenceSetId()); + ap.av.sendSelection(); } else { @@ -743,7 +779,8 @@ public class AnnotationLabels extends Panel implements ActionListener, // we make a copy rather than edit the current selection if no // modifiers pressed // see Enhancement JAL-1557 - if (!(evt.isControlDown() || evt.isShiftDown())) + if (!(jalview.util.Platform.isControlDown(evt) || evt + .isShiftDown())) { sg = new SequenceGroup(sg); sg.clear(); @@ -751,7 +788,7 @@ public class AnnotationLabels extends Panel implements ActionListener, } else { - if (evt.isControlDown()) + if (jalview.util.Platform.isControlDown(evt)) { sg.addOrRemove(aa[selectedRow].sequenceRef, true); }