{
seqCanvas.calculateWrappedGeometry(seqCanvas.getWidth(),
seqCanvas.getHeight());
- // int gapHeight = charHeight;
- // if (av.getScaleAboveWrapped())
- // {
- // gapHeight += charHeight;
- // }
- //
- // final int alignmentHeightPixels = gapHeight
- // + alignmentHeight * charHeight;
- // int cHeight = alignmentHeightPixels;
- // if (av.isShowAnnotation())
- // {
- // cHeight += (seqCanvas.getAnnotationHeight() +
- // SeqCanvas.SEQS_ANNOTATION_GAP);
- // }
/*
- * yPos modulo repeating width height
+ * yPos modulo height of repeating width
*/
int yOffsetPx = y % seqCanvas.wrappedRepeatHeightPx;
int res = 0;
int x = evt.getX();
- int startRes = av.getRanges().getStartRes();
+ final int startRes = av.getRanges().getStartRes();
+ final int charWidth = av.getCharWidth();
+
if (av.getWrapAlignment())
{
int hgap = av.getCharHeight();
int y = evt.getY();
y = Math.max(0, y - hgap);
- x = Math.max(0, x - seqCanvas.getLabelWidthWest());
+ x -= seqCanvas.getLabelWidthWest();
+ if (x < 0)
+ {
+ // mouse is over left scale
+ return -1;
+ }
int cwidth = seqCanvas.getWrappedCanvasWidth(this.getWidth());
if (cwidth < 1)
{
return 0;
}
+ if (x >= cwidth * charWidth)
+ {
+ // mouse is over right scale
+ return -1;
+ }
wrappedBlock = y / cHeight;
wrappedBlock += startRes / cwidth;
// allow for wrapped view scrolled right (possible from Overview)
int startOffset = startRes % cwidth;
res = wrappedBlock * cwidth + startOffset
- + Math.min(cwidth - 1, x / av.getCharWidth());
+ + Math.min(cwidth - 1, x / charWidth);
}
else
{
* rather than right-hand gutter
*/
x = Math.min(x, seqCanvas.getX() + seqCanvas.getWidth());
- res = (x / av.getCharWidth()) + startRes;
+ res = (x / charWidth) + startRes;
res = Math.min(res, av.getRanges().getEndRes());
}
public void mouseReleased(MouseEvent evt)
{
MousePos pos = findMousePosition(evt);
- if (pos.annotationIndex != -1)
+ if (pos.isOverAnnotation() || pos.seqIndex == -1 || pos.column == -1)
{
- // mouse is over annotation row in wrapped mode
return;
}
{
lastMousePress = evt.getPoint();
MousePos pos = findMousePosition(evt);
- if (pos.annotationIndex != -1)
+ if (pos.isOverAnnotation() || pos.seqIndex == -1 || pos.column == -1)
{
- // mouse is over an annotation row in wrapped mode
return;
}
int seq = pos.seqIndex;
int res = pos.column;
- if (seq < 0 || res < 0)
- {
- return;
- }
-
if ((seq < av.getAlignment().getHeight())
&& (res < av.getAlignment().getSequenceAt(seq).getLength()))
{
lastMousePosition = null;
setToolTipText(null);
lastTooltip = null;
- ap.alignFrame.statusBar.setText("");
+ ap.alignFrame.setStatus("");
return;
}
final int column = pos.column;
final int rowIndex = pos.annotationIndex;
- if (!av.getWrapAlignment() || !av.isShowAnnotation() || rowIndex < 0)
+ if (column < 0 || !av.getWrapAlignment() || !av.isShowAnnotation()
+ || rowIndex < 0)
{
return;
}
String msg = AnnotationPanel.getStatusMessage(av.getAlignment(), column,
anns[rowIndex]);
- ap.alignFrame.statusBar.setText(msg);
+ ap.alignFrame.setStatus(msg);
}
private Point lastp = null;
text.append(" (").append(Integer.toString(residuePos)).append(")");
}
- ap.alignFrame.statusBar.setText(text.toString());
+ ap.alignFrame.setStatus(text.toString());
}
/**
public void mouseDragged(MouseEvent evt)
{
MousePos pos = findMousePosition(evt);
- if (pos.isOverAnnotation())
+ if (pos.isOverAnnotation() || pos.column == -1)
{
- // mouse is over annotation row in wrapped mode
return;
}
if (!editingSeqs)
{
- doMouseDraggedDefineMode(evt);
+ dragStretchGroup(evt);
return;
}
}
message.append(Math.abs(startres - lastres) + " gaps.");
- ap.alignFrame.statusBar.setText(message.toString());
+ ap.alignFrame.setStatus(message.toString());
// Are we editing within a selection group?
if (groupEditing || (sg != null
@Override
public void mouseExited(MouseEvent e)
{
+ ap.alignFrame.setStatus(" ");
if (av.getWrapAlignment())
{
return;
{
SequenceGroup sg = null;
MousePos pos = findMousePosition(evt);
- if (pos.isOverAnnotation())
+ if (pos.isOverAnnotation() || pos.seqIndex == -1 || pos.column == -1)
{
- // mouse is over annotation label in wrapped mode
return;
}
* find features at the position (if not gapped), or straddling
* the position (if at a gap)
*/
- SequenceI sequence = av.getAlignment().getSequenceAt(pos.seqIndex);// findSeq(evt));
+ SequenceI sequence = av.getAlignment().getSequenceAt(pos.seqIndex);
List<SequenceFeature> features = seqCanvas.getFeatureRenderer()
.findFeaturesAtColumn(sequence, column + 1);
*/
protected void doMousePressedDefineMode(MouseEvent evt, MousePos pos)
{
- if (pos.isOverAnnotation())
+ if (pos.isOverAnnotation() || pos.seqIndex == -1 || pos.column == -1)
{
- // JvOptionPane.showInternalMessageDialog(Desktop.desktop,
- // MessageManager.getString(
- // "label.cannot_edit_annotations_in_wrapped_view"),
- // MessageManager.getString("label.wrapped_view_no_edit"),
- // JvOptionPane.WARNING_MESSAGE);
return;
}
startWrapBlock = wrappedBlock;
- if (seq < 0 || res < 0)
- {
- return;
- }
-
SequenceI sequence = av.getAlignment().getSequenceAt(seq);
if ((sequence == null) || (res > sequence.getLength()))
* true if this event is happening after a mouse drag (rather than a
* mouse down)
*/
- public void doMouseReleasedDefineMode(MouseEvent evt, boolean afterDrag)
+ protected void doMouseReleasedDefineMode(MouseEvent evt,
+ boolean afterDrag)
{
if (stretchGroup == null)
{
}
/**
- * DOCUMENT ME!
+ * Resizes the borders of a selection group depending on the direction of
+ * mouse drag
*
* @param evt
- * DOCUMENT ME!
*/
- public void doMouseDraggedDefineMode(MouseEvent evt)
+ protected void dragStretchGroup(MouseEvent evt)
{
+ if (stretchGroup == null)
+ {
+ return;
+ }
+
MousePos pos = findMousePosition(evt);
- if (pos.isOverAnnotation())
+ if (pos.isOverAnnotation() || pos.column == -1 || pos.seqIndex == -1)
{
- // mouse is over annotation in wrapped mode
return;
}
return;
}
- if (stretchGroup == null)
- {
- return;
- }
-
if (res >= av.getAlignment().getWidth())
{
res = av.getAlignment().getWidth() - 1;