JAL-1557 partial implementation - need to think about how to do SHIFT+double click...
authorJim Procter <j.procter@dundee.ac.uk>
Tue, 7 Oct 2014 16:26:35 +0000 (17:26 +0100)
committerJim Procter <j.procter@dundee.ac.uk>
Tue, 7 Oct 2014 16:26:35 +0000 (17:26 +0100)
src/jalview/appletgui/AnnotationLabels.java
src/jalview/gui/AnnotationLabels.java

index b5ebbbe..ac62c6b 100755 (executable)
@@ -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);
index 7aa3ae3..fdb3975 100755 (executable)
@@ -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);