addMouseMotionListener( new MouseMotionAdapter()\r
{\r
public void mouseMoved(MouseEvent evt)\r
- { doMouseMoved(evt); }\r
+ { doMouseMoved(evt); }\r
+\r
public void mouseDragged(MouseEvent evt)\r
{\r
if(av.groupDefiningMode)\r
\r
res = (int)((y/chunkHeight)*(getWidth()/av.charWidth)) + x/av.getCharWidth() + av.getStartRes();\r
\r
- System.out.println( ((y/chunkHeight)*(getWidth()/av.charWidth)) +" "+((x / av.getCharWidth()) + av.getStartRes()) );\r
y %= chunkHeight;\r
seq = y / av.getCharHeight() + av.getStartSeq();\r
\r
\r
void updateConservation(int i)\r
{\r
- Alignment al = (Alignment) av.getAlignment();\r
+ /* Alignment al = (Alignment) av.getAlignment();\r
SequenceGroup sg = av.alignment.findGroup( al.getSequenceAt(i));\r
if(sg==null || !(sg.cs instanceof ConservationColourScheme))\r
return;\r
c.verdict(false, 100);\r
sg.setConservation(c);\r
ConservationColourScheme ccs = (ConservationColourScheme)sg.cs;\r
- ccs.conserve = c;\r
+ ccs.conserve = c;*/\r
}\r
\r
+ int oldSeq = -1;\r
\r
public void doMousePressedDefineMode(MouseEvent evt)\r
{\r
int res = evt.getX()/av.getCharWidth() + av.getStartRes();\r
int seq = evt.getY()/av.getCharHeight() + av.getStartSeq();\r
+ oldSeq = seq;\r
\r
stretchGroup = av.getRubberbandGroup();\r
+\r
if(stretchGroup == null)\r
stretchGroup = av.alignment.findGroup((Sequence)av.getAlignment().getSequenceAt(seq));\r
- else if(!stretchGroup.sequences.contains((Sequence)av.getAlignment().getSequenceAt(seq))\r
- || stretchGroup.getStartRes()<res\r
- || stretchGroup.getEndRes()>res)\r
+\r
+ else if(!stretchGroup.sequences.contains((Sequence)av.getAlignment().getSequenceAt(seq))\r
+ || stretchGroup.getStartRes()>res\r
+ || stretchGroup.getEndRes()<res)\r
{\r
- System.out.println(stretchGroup.getStartRes()+" "+stretchGroup.getEndRes()+" "+res);\r
stretchGroup = null;\r
}\r
\r
-\r
-\r
if(stretchGroup==null)\r
{\r
// define a new group here\r
sg.addSequence( (Sequence)av.getAlignment().getSequenceAt(seq) );\r
av.setRubberbandGroup( sg );\r
stretchGroup = sg;\r
- System.out.println("new rubberband group");\r
}\r
else if( javax.swing.SwingUtilities.isRightMouseButton(evt))\r
{\r
- // edit the properties of existing group\r
+ jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu( av , this);\r
+ pop.show(this, evt.getX(), evt.getY());\r
+\r
+ // edit the properties of existing group\r
}\r
\r
if(stretchGroup!=null && stretchGroup.getEndRes()==res)\r
- {\r
// Edit end res position of selected group\r
changeEndRes = true;\r
- }\r
- if(stretchGroup!=null && stretchGroup.getStartRes()==res)\r
- {\r
+\r
+ else if(stretchGroup!=null && stretchGroup.getStartRes()==res)\r
// Edit end res position of selected group\r
changeStartRes = true;\r
- }\r
+\r
\r
seqCanvas.paintFlag = true;\r
repaint();\r
boolean changeStartRes = false;\r
SequenceGroup stretchGroup = null;\r
\r
-\r
public void doMouseReleasedDefineMode(MouseEvent evt)\r
{\r
changeEndRes = false;\r
stretchGroup = null;\r
}\r
\r
+\r
+ boolean remove = false;\r
public void doMouseDraggedDefineMode(MouseEvent evt)\r
{\r
int res = evt.getX()/av.getCharWidth() + av.getStartRes();\r
- Sequence seq = (Sequence)av.getAlignment().getSequenceAt(\r
- evt.getY()/av.getCharHeight() + av.getStartSeq());\r
+ int y = evt.getY()/av.getCharHeight() + av.getStartSeq();\r
+\r
+\r
+ if(stretchGroup.getEndRes()==res)\r
+ // Edit end res position of selected group\r
+ changeEndRes = true;\r
+\r
+ else if(stretchGroup.getStartRes()==res)\r
+ // Edit end res position of selected group\r
+ changeStartRes = true;\r
\r
- // SequenceGroup newSeqGroup = av.alignment.findGroup(seq);\r
\r
if(res<av.getStartRes())\r
res = av.getStartRes();\r
stretchGroup.setStartRes( res );\r
}\r
\r
- /* if(newSeqGroup != stretchGroup)\r
+\r
+ int dragDirection = 0;\r
+ if (y > oldSeq)\r
+ dragDirection = 1;\r
+ else if (y < oldSeq)\r
+ dragDirection = -1;\r
+\r
+ while (y != oldSeq)\r
{\r
- if(newSeqGroup !=null)\r
- av.getAlignment().removeFromGroup(newSeqGroup, seq );\r
+ // This routine ensures we don't skip any sequences, as the\r
+ // selection is quite slow.\r
+ Sequence seq = (Sequence) av.getAlignment().getSequenceAt(oldSeq);\r
\r
- if(stretchGroup!=null)\r
- stretchGroup.addSequence( seq );\r
- }*/\r
+ oldSeq += dragDirection;\r
+ Sequence nextSeq = (Sequence) av.getAlignment().getSequenceAt(oldSeq);\r
+\r
+ if (stretchGroup.sequences.contains(nextSeq))\r
+ {\r
+ stretchGroup.deleteSequence(seq);\r
+ stretchGroup.deleteSequence(nextSeq);\r
+ }\r
+ else\r
+ {\r
+ stretchGroup.addSequence(seq);\r
+ stretchGroup.addSequence(nextSeq);\r
+ }\r
+ }\r
+ oldSeq = y;\r
\r
seqCanvas.paintFlag = true;\r
repaint();\r
-\r
}\r
\r
+\r
}\r
\r
\r