// 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
{
// todo: make the ap scroll to the selection - not necessary, first
// click highlights/scrolls, second selects
ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null);
- ap.av.setSelectionGroup(// new SequenceGroup(
- aa[selectedRow].groupRef); // );
+ // 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();