From 7e8241cdc284ef2586e36a3abbe3bd385dad10dc Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 7 Oct 2014 17:26:35 +0100 Subject: [PATCH] JAL-1557 partial implementation - need to think about how to do SHIFT+double click type range selections --- src/jalview/appletgui/AnnotationLabels.java | 13 +++++++++++++ src/jalview/gui/AnnotationLabels.java | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java index b5ebbbe..ac62c6b 100755 --- a/src/jalview/appletgui/AnnotationLabels.java +++ b/src/jalview/appletgui/AnnotationLabels.java @@ -660,9 +660,22 @@ public class AnnotationLabels extends Panel implements ActionListener, SequenceGroup sg = ap.av.getSelectionGroup(); if (sg!=null) { + // we make a copy rather than edit the current selection if no modifiers pressed + // see Enhancement JAL-1557 + if (!(evt.isControlDown() || evt.isShiftDown())) + { sg = new SequenceGroup(sg); sg.clear(); sg.addSequence(aa[selectedRow].sequenceRef, false); + } else { + if (evt.isControlDown()) + { + sg.addOrRemove(aa[selectedRow].sequenceRef, true); + } else { + // notionally, we should also add intermediate sequences from last added sequence ? + sg.addSequence(aa[selectedRow].sequenceRef, true); + } + } } else { sg = new SequenceGroup(); sg.setStartRes(0); diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 7aa3ae3..fdb3975 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -521,9 +521,22 @@ public class AnnotationLabels extends JPanel implements MouseListener, SequenceGroup sg = ap.av.getSelectionGroup(); if (sg!=null) { + // we make a copy rather than edit the current selection if no modifiers pressed + // see Enhancement JAL-1557 + if (!(evt.isControlDown() || evt.isShiftDown())) + { sg = new SequenceGroup(sg); sg.clear(); sg.addSequence(aa[selectedRow].sequenceRef, false); + } else { + if (evt.isControlDown()) + { + sg.addOrRemove(aa[selectedRow].sequenceRef, true); + } else { + // notionally, we should also add intermediate sequences from last added sequence ? + sg.addSequence(aa[selectedRow].sequenceRef, true); + } + } } else { sg = new SequenceGroup(); sg.setStartRes(0); -- 1.7.10.2