\r
\r
// use aa to see if the mouse pointer is on a\r
- if (av.showSequenceFeatures && sequence.getSequenceFeatures()!=null)\r
+ if (av.showSequenceFeatures\r
+ && sequence.getSequenceFeatures()!=null\r
+ && av.featuresDisplayed!=null)\r
{\r
int index = 0;\r
sequence.getSequenceFeatures();\r
}\r
else\r
{\r
-\r
+ if(scrollThread!=null)\r
+ {\r
+ scrollThread.running = false;\r
+ scrollThread = null;\r
+ }\r
break;\r
}\r
}\r
}\r
}\r
\r
+ mouseDragging = true;\r
+ if (res > av.endRes || res < av.startRes)\r
+ {\r
+ mouseExited(evt);\r
+ }\r
+\r
+ if (scrollThread != null)\r
+ scrollThread.setEvent(evt);\r
+\r
+\r
endEdit = res;\r
lastres = res;\r
seqCanvas.repaint();\r
}\r
\r
- public void drawChars(int seqstart, int seqend, int start)\r
- {\r
- seqCanvas.drawPanel(seqCanvas.gg, start, av.getEndRes(), seqstart, seqend, 0);\r
- seqCanvas.repaint();\r
- }\r
-\r
public void insertChar(int j, int seq)\r
{\r
av.alignment.getSequenceAt(seq).insertCharAt(j, av.getGapCharacter());\r
int oldSeq = -1;\r
public void doMousePressedDefineMode(MouseEvent evt)\r
{\r
+ if (scrollThread != null)\r
+ {\r
+ scrollThread.running = false;\r
+ scrollThread = null;\r
+ }\r
+\r
int res = findRes(evt);\r
int seq = findSeq(evt);\r
oldSeq = seq;\r
\r
public void doMouseReleasedDefineMode(MouseEvent evt)\r
{\r
- if(mouseDragging)\r
- {\r
- stretchGroup.recalcConservation();\r
- mouseDragging = false;\r
- }\r
-\r
if (stretchGroup == null)\r
{\r
- return;\r
+ return;\r
}\r
\r
if(stretchGroup.cs!=null)\r
{\r
+ if (stretchGroup.cs instanceof ClustalxColourScheme)\r
+ {\r
+ ( (ClustalxColourScheme) stretchGroup.cs).resetClustalX(stretchGroup.\r
+ sequences,\r
+ stretchGroup.getWidth());\r
+ }\r
+\r
if (stretchGroup.cs.conservationApplied())\r
{\r
SliderPanel.setConservationSlider(ap, stretchGroup.cs,\r
stretchGroup.getName());\r
+ stretchGroup.recalcConservation();\r
}\r
else\r
{\r
changeEndRes = false;\r
changeStartRes = false;\r
stretchGroup = null;\r
- seqCanvas.repaint();\r
+ PaintRefresher.Refresh(av.alignment);\r
ap.repaint();\r
}\r
\r
- boolean remove = false;\r
public void doMouseDraggedDefineMode(MouseEvent evt)\r
{\r
int res = findRes(evt);\r
int y = findSeq(evt);\r
\r
if(wrappedBlock!=startWrapBlock)\r
- return;\r
+ return;\r
\r
- if(y>=av.alignment.getHeight())\r
- y = av.alignment.getHeight()-1;\r
+ if (stretchGroup == null)\r
+ {\r
+ return;\r
+ }\r
\r
- if (stretchGroup == null)\r
- {\r
- return;\r
- }\r
+ mouseDragging = true;\r
\r
- if (res > av.alignment.getWidth())\r
- {\r
- res = av.alignment.getWidth() - 1;\r
- }\r
\r
- if (stretchGroup.getEndRes() == res)\r
- {\r
- // Edit end res position of selected group\r
- changeEndRes = true;\r
- }\r
+ if(y > av.alignment.getHeight())\r
+ {\r
+ y = av.alignment.getHeight() -1;\r
+ }\r
\r
- else if (stretchGroup.getStartRes() == res)\r
- {\r
- // Edit start res position of selected group\r
- changeStartRes = true;\r
- }\r
+ if(res>av.alignment.getWidth())\r
+ res = av.alignment.getWidth()-1;\r
\r
- if (res < av.getStartRes())\r
- {\r
- res = av.getStartRes();\r
- }\r
- else if (res > av.getEndRes() && !av.getWrapAlignment())\r
- {\r
- res = av.getEndRes();\r
- }\r
+ if (stretchGroup.getEndRes() == res)\r
+ {\r
+ // Edit end res position of selected group\r
+ changeEndRes = true;\r
+ }\r
+ else if (stretchGroup.getStartRes() == res)\r
+ {\r
+ // Edit start res position of selected group\r
+ changeStartRes = true;\r
+ }\r
\r
- if (changeEndRes)\r
- {\r
- if (res > stretchGroup.getStartRes() - 1)\r
+ if (res < 0)\r
{\r
- stretchGroup.setEndRes(res);\r
+ res = 0;\r
}\r
- }\r
- else if (changeStartRes)\r
- {\r
- if (res < stretchGroup.getEndRes() + 1)\r
+\r
+ if (changeEndRes)\r
{\r
- stretchGroup.setStartRes(res);\r
+ if (res > (stretchGroup.getStartRes() - 1))\r
+ {\r
+ stretchGroup.setEndRes(res);\r
+ }\r
+ }\r
+ else if (changeStartRes)\r
+ {\r
+ if (res < (stretchGroup.getEndRes() + 1))\r
+ {\r
+ stretchGroup.setStartRes(res);\r
+ }\r
}\r
- }\r
\r
- int dragDirection = 0;\r
- if (y > oldSeq)\r
- {\r
- dragDirection = 1;\r
- }\r
- else if (y < oldSeq)\r
- {\r
- dragDirection = -1;\r
- }\r
+ int dragDirection = 0;\r
\r
- while (y != oldSeq && oldSeq > 0 && y < av.alignment.getHeight())\r
- {\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
+ if (y > oldSeq)\r
+ {\r
+ dragDirection = 1;\r
+ }\r
+ else if (y < oldSeq)\r
+ {\r
+ dragDirection = -1;\r
+ }\r
+\r
+\r
+ while ((y != oldSeq) && (oldSeq > -1) && (y < av.alignment.getHeight()))\r
+ {\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
+ oldSeq += dragDirection;\r
+\r
+ if(oldSeq<0)\r
+ break;\r
+\r
+ Sequence nextSeq = (Sequence) av.getAlignment().getSequenceAt(oldSeq);\r
+\r
+ if (stretchGroup.sequences.contains(nextSeq))\r
+ {\r
+ stretchGroup.deleteSequence(seq, false);\r
+ }\r
+ else\r
+ {\r
+ if (seq != null)\r
+ {\r
+ stretchGroup.addSequence(seq, false);\r
+ }\r
+\r
+ stretchGroup.addSequence(nextSeq, false);\r
+ }\r
+ }\r
\r
- oldSeq += dragDirection;\r
- Sequence nextSeq = (Sequence) av.getAlignment().getSequenceAt(oldSeq);\r
+ if(oldSeq < 0)\r
+ oldSeq = -1;\r
\r
- if (stretchGroup.sequences.contains(nextSeq))\r
+\r
+ if(res>av.endRes || res<av.startRes\r
+ || y<av.startSeq || y>av.endSeq)\r
{\r
- stretchGroup.deleteSequence(seq, false);\r
+ mouseExited(evt);\r
}\r
- else\r
+\r
+ if (scrollThread != null)\r
{\r
- if (seq != null)\r
- {\r
- stretchGroup.addSequence(seq, false);\r
- }\r
- stretchGroup.addSequence(nextSeq, false);\r
+ scrollThread.setEvent(evt);\r
}\r
+\r
+ seqCanvas.repaint();\r
}\r
- oldSeq = y;\r
- mouseDragging = true;\r
- if (scrollThread != null)\r
+\r
+ public void mouseEntered(MouseEvent e)\r
{\r
- scrollThread.setEvent(evt);\r
- }\r
+ if (oldSeq < 0)\r
+ oldSeq = 0;\r
\r
- seqCanvas.repaint();\r
- }\r
+ if (scrollThread != null)\r
+ {\r
+ scrollThread.running = false;\r
+ scrollThread = null;\r
+ }\r
+ }\r
\r
- public void mouseEntered(MouseEvent e)\r
+ public void mouseExited(MouseEvent e)\r
{\r
- if (editingSeqs && scrollThread != null)\r
+ if (av.getWrapAlignment())\r
{\r
- scrollThread.running = false;\r
+ return;\r
}\r
- }\r
\r
- public void mouseExited(MouseEvent e)\r
- {\r
- if (mouseDragging)\r
+ if (mouseDragging && scrollThread==null)\r
{\r
scrollThread = new ScrollThread();\r
}\r
running = true;\r
while (running)\r
{\r
+\r
if (evt != null)\r
{\r
\r