sequence selection modified
authoramwaterhouse <Andrew Waterhouse>
Fri, 10 Dec 2004 14:35:18 +0000 (14:35 +0000)
committeramwaterhouse <Andrew Waterhouse>
Fri, 10 Dec 2004 14:35:18 +0000 (14:35 +0000)
src/jalview/gui/IdPanel.java

index 4509ab3..14f60d5 100755 (executable)
@@ -17,6 +17,7 @@ public class IdPanel extends JPanel implements MouseListener, MouseMotionListene
   public    int            width;\r
   public    int            lastid;\r
 \r
+  SequenceGroup selectedSequenceGroup;\r
 \r
   public IdPanel(AlignViewport av, AlignmentPanel parent)\r
   {\r
@@ -41,14 +42,29 @@ public class IdPanel extends JPanel implements MouseListener, MouseMotionListene
      for (int i = start; i <= end; i++)\r
      {\r
        SequenceI pickedSeq = av.getAlignment().getSequenceAt(i);\r
-\r
        if (av.getSelection().contains(pickedSeq))\r
+       {\r
          av.getSelection().removeElement(pickedSeq);\r
-        else\r
+         selectedSequenceGroup.deleteSequence(pickedSeq);\r
+       }\r
+       else\r
+       {\r
          av.getSelection().addElement(pickedSeq);\r
+         if(selectedSequenceGroup==null)\r
+         {\r
+           selectedSequenceGroup = new SequenceGroup();\r
+           av.alignment.addGroup( selectedSequenceGroup );\r
+           selectedSequenceGroup.setStartRes(0);\r
+           selectedSequenceGroup.setEndRes( pickedSeq.getSequence().length());\r
+         }\r
+\r
+         selectedSequenceGroup.addSequence( pickedSeq );\r
+       }\r
 \r
      }\r
 \r
+     alignPanel.seqPanel.seqCanvas.paintFlag=true;\r
+     alignPanel.repaint();\r
      repaint();\r
 \r
    }\r
@@ -117,6 +133,8 @@ public class IdPanel extends JPanel implements MouseListener, MouseMotionListene
       }\r
       else\r
       {\r
+        selectedSequenceGroup =  av.alignment.findGroup(seq);\r
+\r
         if (seq != -1)\r
           selectSeqs(seq,seq);\r
 \r
@@ -129,5 +147,6 @@ public class IdPanel extends JPanel implements MouseListener, MouseMotionListene
   {\r
     lastid = -1;\r
     PaintRefresher.Refresh(this);\r
+    selectedSequenceGroup = null;\r
   }\r
 }\r