//Used For mouse Dragging and resizing graphs\r
int graphStretch = -1;\r
int graphStretchY = -1;\r
+ int min; //used by mouseDragged to see if user\r
+ int max; //used by mouseDragged to see if user\r
+ boolean mouseDragging = false;\r
\r
/**\r
* Creates a new AnnotationPanel object.\r
\r
int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
\r
- if (evt.isShiftDown())\r
- {\r
- /*int start = Integer.parseInt(activeRes.get(activeRes.size() -\r
- 1).toString());\r
- int end = res;\r
-\r
- if (end < start)\r
- {\r
- int temp = end;\r
- end = start;\r
- start = temp;\r
- }\r
+ min = res;\r
+ max = res;\r
\r
- for (int n = start; n <= end; n++)\r
- {\r
- addEditableColumn(n);\r
- } */\r
- }\r
+ if (av.getColumnSelection().contains(res))\r
+ av.getColumnSelection().removeElement(res);\r
else\r
{\r
- if (av.getColumnSelection().contains(res))\r
- av.getColumnSelection().removeElement(res);\r
- else\r
av.getColumnSelection().addElement(res);\r
+ SequenceGroup sg = new SequenceGroup();\r
\r
- ap.repaint();\r
+ for (int i = 0; i < av.alignment.getSequences().size(); i++)\r
+ {\r
+ sg.addSequence(av.alignment.getSequenceAt(i), false);\r
+ }\r
\r
+ sg.setStartRes(res);\r
+ sg.setEndRes(res);\r
+ av.setSelectionGroup(sg);\r
}\r
+\r
+ ap.repaint();\r
+\r
}\r
\r
/**\r
{\r
graphStretch = -1;\r
graphStretchY = -1;\r
+ mouseDragging = false;\r
}\r
\r
/**\r
*/\r
public void mouseEntered(MouseEvent evt)\r
{\r
+ if(mouseDragging)\r
+ ap.seqPanel.scrollCanvas(null);\r
}\r
\r
/**\r
*/\r
public void mouseExited(MouseEvent evt)\r
{\r
+ if(mouseDragging)\r
+ ap.seqPanel.scrollCanvas(evt);\r
}\r
\r
+\r
/**\r
* DOCUMENT ME!\r
*\r
adjustPanelHeight();\r
ap.repaint();\r
}\r
+ else\r
+ {\r
+ mouseDragging = true;\r
+\r
+ int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
+\r
+ SequenceGroup sg = av.getSelectionGroup();\r
+\r
+ if (res < min)\r
+ {\r
+ min = res;\r
+ }\r
+\r
+ if (res > max)\r
+ {\r
+ max = res;\r
+ }\r
+\r
+ if (sg != null)\r
+ {\r
+ if (!av.getColumnSelection().contains(res))\r
+ {\r
+ av.getColumnSelection().addElement(res);\r
+ }\r
+\r
+ if (res > sg.getStartRes())\r
+ {\r
+ sg.setEndRes(res);\r
+ }\r
+ else if (res < sg.getStartRes())\r
+ {\r
+ sg.setStartRes(res);\r
+ }\r
+\r
+ for (int i = min; i <= max; i++)\r
+ {\r
+ if ((i < sg.getStartRes()) || (i > sg.getEndRes()))\r
+ {\r
+ av.getColumnSelection().removeElement(i);\r
+ }\r
+ else\r
+ {\r
+ av.getColumnSelection().addElement(i);\r
+ }\r
+ }\r
+\r
+ ap.repaint();\r
+ }\r
+\r
+ }\r
}\r
\r
/**\r
boolean stretchingGroup = false;\r
int min; //used by mouseDragged to see if user\r
int max; //used by mouseDragged to see if user\r
+ boolean mouseDragging = false;\r
\r
// wants to delete columns\r
public ScalePanel(AlignViewport av, AlignmentPanel ap)\r
min = res;\r
max = res;\r
\r
- if(reveal != null && SwingUtilities.isRightMouseButton(evt))\r
+ /* if(reveal != null && SwingUtilities.isRightMouseButton(evt))\r
{\r
JPopupMenu pop = new JPopupMenu();\r
JMenuItem item = new JMenuItem("Reveal");\r
pop.show(this, evt.getX(), evt.getY());\r
\r
}\r
- else if (av.getColumnSelection().contains(res))\r
+ else*/\r
+ if (av.getColumnSelection().contains(res))\r
{\r
- if( SwingUtilities.isRightMouseButton(evt))\r
+ /* if( SwingUtilities.isRightMouseButton(evt))\r
{\r
JPopupMenu pop = new JPopupMenu();\r
JMenuItem item = new JMenuItem("Hide Columns");\r
pop.show(this, evt.getX(), evt.getY());\r
\r
}\r
- else\r
+ else*/\r
{\r
av.getColumnSelection().removeElement(res);\r
av.setSelectionGroup(null);\r
*/\r
public void mouseReleased(MouseEvent evt)\r
{\r
+ mouseDragging = false;\r
+\r
int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
\r
if(av.hasHiddenColumns)\r
*/\r
public void mouseDragged(MouseEvent evt)\r
{\r
+ mouseDragging = true;\r
+\r
int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
\r
if(av.hasHiddenColumns)\r
max = res;\r
}\r
\r
+\r
SequenceGroup sg = av.getSelectionGroup();\r
\r
if (sg != null)\r
{\r
sg.setEndRes(res);\r
}\r
- else if (res < sg.getStartRes())\r
+ if (res < sg.getStartRes())\r
{\r
sg.setStartRes(res);\r
}\r
}\r
}\r
\r
- public void mouseEntered(MouseEvent evt){}\r
- public void mouseExited(MouseEvent evt){}\r
+ public void mouseEntered(MouseEvent evt)\r
+ {\r
+ if(mouseDragging)\r
+ ap.seqPanel.scrollCanvas(null);\r
+ }\r
+\r
+ public void mouseExited(MouseEvent evt)\r
+ {\r
+ if(mouseDragging)\r
+ ap.seqPanel.scrollCanvas(evt);\r
+ }\r
+\r
public void mouseClicked(MouseEvent evt){}\r
\r
public void mouseMoved(MouseEvent evt)\r