list)
{
- searchResults = found;
+ searchResults = list;
repaint();
}
void drawMarker(int i, int starty, int yoffset)
{
- SequenceI[] hseqs = av.alignment.getHiddenSequences().hiddenSequences;
- //Use this method here instead of calling hiddenSeq adjust
- //3 times.
+ SequenceI[] hseqs = av.getAlignment()
+ .getHiddenSequences().hiddenSequences;
+ // Use this method here instead of calling hiddenSeq adjust
+ // 3 times.
int hSize = hseqs.length;
int hiddenIndex = i;
int lastIndex = i - 1;
int nextIndex = i + 1;
-
for (int j = 0; j < hSize; j++)
{
if (hseqs[j] != null)
@@ -340,45 +381,75 @@ public class IdCanvas
gg.setColor(Color.blue);
if (below)
{
- gg.fillPolygon(new int[]
- {getSize().width - av.charHeight,
- getSize().width - av.charHeight,
- getSize().width},
- new int[]
- {
- (i - starty) * av.charHeight + yoffset,
- (i - starty) * av.charHeight + yoffset + av.charHeight / 4,
- (i - starty) * av.charHeight + yoffset
- }, 3);
+ gg.fillPolygon(
+ new int[]
+ { getSize().width - avcharHeight,
+ getSize().width - avcharHeight, getSize().width },
+ new int[]
+ { (i - starty) * avcharHeight + yoffset,
+ (i - starty) * avcharHeight + yoffset + avcharHeight / 4,
+ (i - starty) * avcharHeight + yoffset },
+ 3);
}
if (above)
{
- gg.fillPolygon(new int[]
- {getSize().width - av.charHeight,
- getSize().width - av.charHeight,
- getSize().width},
- new int[]
- {
- (i - starty + 1) * av.charHeight + yoffset,
- (i - starty + 1) * av.charHeight + yoffset -
- av.charHeight / 4,
- (i - starty + 1) * av.charHeight + yoffset
- }, 3);
+ gg.fillPolygon(
+ new int[]
+ { getSize().width - avcharHeight,
+ getSize().width - avcharHeight, getSize().width },
+ new int[]
+ { (i - starty + 1) * avcharHeight + yoffset,
+ (i - starty + 1) * avcharHeight + yoffset
+ - avcharHeight / 4,
+ (i - starty + 1) * avcharHeight + yoffset },
+ 3);
}
}
+
boolean setHiddenFont(SequenceI seq)
{
- Font bold = new Font(av.getFont().getName(), Font.BOLD
- ,
- av.getFont().getSize());
+ Font bold = new Font(av.getFont().getName(), Font.BOLD,
+ av.getFont().getSize());
- if (av.hiddenRepSequences != null &&
- av.hiddenRepSequences.containsKey(seq))
+ if (av.isReferenceSeq(seq) || av.isHiddenRepSequence(seq))
{
gg.setFont(bold);
return true;
}
return false;
}
+
+ /**
+ * Respond to viewport range changes (e.g. alignment panel was scrolled). Both
+ * scrolling and resizing change viewport ranges. Scrolling changes both start
+ * and end points, but resize only changes end values. Here we only want to
+ * fastpaint on a scroll, with resize using a normal paint, so scroll events
+ * are identified as changes to the horizontal or vertical start value.
+ *
+ * In unwrapped mode, only responds to a vertical scroll, as horizontal scroll
+ * leaves sequence ids unchanged. In wrapped mode, only vertical scroll is
+ * provided, but it generates a change of "startres" which does require an
+ * update here.
+ */
+ @Override
+ public void propertyChange(PropertyChangeEvent evt)
+ {
+ String propertyName = evt.getPropertyName();
+ if (propertyName.equals(ViewportRanges.STARTSEQ)
+ || (av.getWrapAlignment()
+ && propertyName.equals(ViewportRanges.STARTRES)))
+ {
+ fastPaint((int) evt.getNewValue() - (int) evt.getOldValue());
+ }
+ else if (propertyName.equals(ViewportRanges.STARTRESANDSEQ))
+ {
+ fastPaint(((int[]) evt.getNewValue())[1]
+ - ((int[]) evt.getOldValue())[1]);
+ }
+ else if (propertyName.equals(ViewportRanges.MOVE_VIEWPORT))
+ {
+ repaint();
+ }
+ }
}