import jalview.commands.EditCommand;
import jalview.commands.EditCommand.Action;
import jalview.commands.EditCommand.Edit;
+import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.SearchResults;
import jalview.datamodel.SearchResults.Match;
StructureSelectionManager ssm;
+ SearchResults lastSearchResults;
+
/**
* Creates a new SeqPanel object.
*
int wrappedBlock = -1;
+ /**
+ * Returns the aligned sequence position (base 0) at the mouse position, or
+ * the closest visible one
+ *
+ * @param evt
+ * @return
+ */
int findRes(MouseEvent evt)
{
int res = 0;
}
else
{
- if (x > seqCanvas.getWidth() + seqCanvas.getWidth())
+ if (x > seqCanvas.getX() + seqCanvas.getWidth())
{
// make sure we calculate relative to visible alignment, rather than
// right-hand gutter
x = seqCanvas.getX() + seqCanvas.getWidth();
}
res = (x / av.getCharWidth()) + av.getStartRes();
+ if (res > av.getEndRes())
+ {
+ // moused off right
+ res = av.getEndRes();
+ }
}
if (av.hasHiddenColumns())
lastMessage = tmp;
}
+ /**
+ * Highlight the mapped region described by the search results object (unless
+ * unchanged). This supports highlight of protein while mousing over linked
+ * cDNA and vice versa. The status bar is also updated to show the location of
+ * the start of the highlighted region.
+ */
@Override
public void highlightSequence(SearchResults results)
{
- if (av.followHighlight)
+ if (results == null || results.equals(lastSearchResults)) {
+ return;
+ }
+ lastSearchResults = results;
+
+ if (av.isFollowHighlight())
{
+ /*
+ * if scrollToPosition requires a scroll adjustment, this flag prevents
+ * another scroll event being propagated back to the originator
+ *
+ * @see AlignmentPanel#adjustmentValueChanged
+ */
+ ap.setFollowingComplementScroll(true);
if (ap.scrollToPosition(results, false))
{
seqCanvas.revalidate();
*/
private void setStatusMessage(SearchResults results)
{
- List<Match> matches = results.getResults();
- if (!matches.isEmpty())
+ AlignmentI al = this.av.getAlignment();
+ int sequenceIndex = al.findIndex(results);
+ if (sequenceIndex == -1)
+ {
+ return;
+ }
+ SequenceI ds = al.getSequenceAt(sequenceIndex).getDatasetSequence();
+ for (Match m : results.getResults())
{
- Match m = matches.get(0);
SequenceI seq = m.getSequence();
- int sequenceIndex = this.av.getAlignment().findIndex(seq);
- /*
- * Convert position in sequence (base 1) to sequence character array index
- * (base 0)
- */
- int start = m.getStart() - 1;
- setStatusMessage(seq, start, sequenceIndex);
+ if (seq == ds)
+ {
+ /*
+ * Convert position in sequence (base 1) to sequence character array
+ * index (base 0)
+ */
+ int start = m.getStart() - 1;
+ setStatusMessage(seq, start, sequenceIndex);
+ return;
+ }
}
}