// TODO consider using getSequenceSelection instead here
cap.setText(new jalview.io.AppletFormatAdapter().formatSequences(
- e.getActionCommand(),
- ap.av.showJVSuffix, ap.av, true));
+ e.getActionCommand(), ap.av.getShowJVSuffix(), ap.av, true));
}
viewport.updateConservation(alignPanel);
viewport.updateConsensus(alignPanel);
- annotationPanelMenuItem.setState(viewport.showAnnotation);
+ annotationPanelMenuItem.setState(viewport.isShowAnnotation());
displayNonconservedMenuItem.setState(viewport.getShowUnconserved());
followMouseOverFlag.setState(viewport.getFollowHighlight());
showGroupConsensus.setState(viewport.isShowGroupConsensus());
normSequenceLogo.setState(viewport.isNormaliseSequenceLogo());
applyToAllGroups.setState(viewport.getColourAppliesToAllGroups());
- seqLimits.setState(viewport.showJVSuffix);
+ seqLimits.setState(viewport.getShowJVSuffix());
if (applet != null)
{
}
case KeyEvent.VK_PAGE_UP:
- if (viewport.wrapAlignment)
+ if (viewport.getWrapAlignment())
{
alignPanel.scrollUp(true);
}
break;
case KeyEvent.VK_PAGE_DOWN:
- if (viewport.wrapAlignment)
+ if (viewport.getWrapAlignment())
{
alignPanel.scrollUp(false);
}
{ e.getActionCommand() }), 600, 500);
cap.setText(new AppletFormatAdapter().formatSequences(
e.getActionCommand(), viewport.getAlignment(),
- viewport.showJVSuffix));
+ viewport.getShowJVSuffix()));
}
public void loadAnnotations()
protected void displayNonconservedMenuItem_actionPerformed()
{
- viewport.setShowunconserved(displayNonconservedMenuItem.getState());
+ viewport.setShowUnconserved(displayNonconservedMenuItem.getState());
alignPanel.paintAlignment(true);
}
sequenceHolderPanel.add(annotationPanelHolder, BorderLayout.SOUTH);
alabels = new AnnotationLabels(this);
- setAnnotationVisible(av.showAnnotation);
+ setAnnotationVisible(av.isShowAnnotation());
idPanelHolder.add(idPanel, BorderLayout.CENTER);
idSpaceFillerPanel1.add(idwidthAdjuster, BorderLayout.CENTER);
idPanel.idCanvas.image = null;
FontMetrics fm = getFontMetrics(av.getFont());
- scalePanel.setSize(new Dimension(10, av.charHeight + fm.getDescent()));
- idwidthAdjuster.setSize(new Dimension(10, av.charHeight
+ scalePanel.setSize(new Dimension(10, av.getCharHeight()
+ + fm.getDescent()));
+ idwidthAdjuster.setSize(new Dimension(10, av.getCharHeight()
+ fm.getDescent()));
av.updateSequenceIdColours();
annotationPanel.image = null;
{
start = ostart;
}
- if (!av.wrapAlignment)
+ if (!av.getWrapAlignment())
{
/*
* int spos=av.getStartRes(),sqpos=av.getStartSeq(); if ((startv =
public void setAnnotationVisible(boolean b)
{
- if (!av.wrapAlignment)
+ if (!av.getWrapAlignment())
{
annotationSpaceFillerHolder.setVisible(b);
annotationPanelHolder.setVisible(b);
annotationPanelHolder.setVisible(false);
annotationSpaceFillerHolder.setVisible(false);
}
- else if (av.showAnnotation)
+ else if (av.isShowAnnotation())
{
annotationPanelHolder.setVisible(true);
annotationSpaceFillerHolder.setVisible(true);
}
;
- hextent = seqPanel.seqCanvas.getSize().width / av.charWidth;
- vextent = seqPanel.seqCanvas.getSize().height / av.charHeight;
+ hextent = seqPanel.seqCanvas.getSize().width / av.getCharWidth();
+ vextent = seqPanel.seqCanvas.getSize().height / av.getCharHeight();
if (hextent > width)
{
av.setEndSeq(endSeq);
av.setStartRes(x);
- av.setEndRes((x + (seqPanel.seqCanvas.getSize().width / av.charWidth)) - 1);
+ av.setEndRes((x + (seqPanel.seqCanvas.getSize().width / av
+ .getCharWidth())) - 1);
hscroll.setValues(x, hextent, 0, width);
vscroll.setValues(y, vextent, 0, height);
seqPanel.seqCanvas.fastPaint(scrollX, scrollY);
scalePanel.repaint();
- if (av.getShowAnnotation())
+ if (av.isShowAnnotation())
{
annotationPanel.fastPaint(av.getStartRes() - oldX);
}
seqPanel.seqCanvas.repaint();
idPanel.idCanvas.repaint();
- if (!av.wrapAlignment)
+ if (!av.getWrapAlignment())
{
- if (av.showAnnotation)
+ if (av.isShowAnnotation())
{
alabels.repaint();
annotationPanel.repaint();
.getSize(), f = ap.seqPanelHolder.getSize();
int dif = evt.getY() - oldY;
- dif /= ap.av.charHeight;
- dif *= ap.av.charHeight;
+ dif /= ap.av.getCharHeight();
+ dif *= ap.av.getCharHeight();
if ((d.height - dif) > 20 && (f.height + dif) > 20)
{
}
else
{
- ap.av.setIgnoreGapsConsensus(cbmi.getState());
+ ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap);
}
ap.paintAlignment(true);
}
dragEvent.getY());
}
- if (!av.wrapAlignment && ((aa == null) || (aa.length < 1)))
+ if (!av.getWrapAlignment() && ((aa == null) || (aa.length < 1)))
{
g.setColor(Color.black);
g.drawString(MessageManager.getString("label.right_click"), 2, 8);
return;
}
- gg.copyArea(0, 0, imgWidth, getSize().height, -horizontal
- * av.charWidth, 0);
+ gg.copyArea(0, 0, imgWidth, getSize().height,
+ -horizontal * av.getCharWidth(), 0);
int sr = av.startRes, er = av.endRes + 1, transX = 0;
if (horizontal > 0) // scrollbar pulled right, image to the left
{
- transX = (er - sr - horizontal) * av.charWidth;
+ transX = (er - sr - horizontal) * av.getCharWidth();
sr = er - horizontal;
}
else if (horizontal < 0)
g.setFont(ofont);
g.setColor(Color.white);
- g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getSize().height);
+ g.fillRect(0, 0, (endRes - startRes) * av.getCharWidth(),
+ getSize().height);
if (fm == null)
{
((i - starty) * charHeight) + ypos + charHeight
- (charHeight / 5));
- if (av.hasHiddenRows() && av.showHiddenMarkers)
+ if (av.hasHiddenRows() && av.getShowHiddenMarkers())
{
drawMarker(i, starty, ypos);
}
return;
}
- gg.copyArea(0, 0, getSize().width, imgHeight, 0, -vertical
- * av.charHeight);
+ gg.copyArea(0, 0, getSize().width, imgHeight, 0,
+ -vertical * av.getCharHeight());
int ss = av.startSeq, es = av.endSeq, transY = 0;
if (vertical > 0) // scroll down
}
else
{
- transY = imgHeight - vertical * av.charHeight;
+ transY = imgHeight - vertical * av.getCharHeight();
}
}
else if (vertical < 0)
}
imgHeight = getSize().height;
- imgHeight -= imgHeight % av.charHeight;
+ imgHeight -= imgHeight % av.getCharHeight();
if (imgHeight < 1)
{
g.drawImage(image, 0, 0, this);
}
+ /**
+ * local copy of av.getCharHeight set at top of drawIds
+ */
+ private int avcharHeight;
void drawIds(int starty, int endy)
{
+ // hardwired italic IDs in applet currently
Font italic = new Font(av.getFont().getName(), Font.ITALIC, av
.getFont().getSize());
+ // temp variable for speed
+ avcharHeight = av.getCharHeight();
gg.setFont(italic);
int annotationHeight = 0;
AnnotationLabels labels = null;
- if (av.showAnnotation)
+ if (av.isShowAnnotation())
{
AnnotationPanel ap = new AnnotationPanel(av);
annotationHeight = ap.adjustPanelHeight();
labels = new AnnotationLabels(av);
}
-
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = avcharHeight;
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += avcharHeight;
}
- int cHeight = alheight * av.charHeight + hgap + annotationHeight;
+ int cHeight = alheight * avcharHeight + hgap + annotationHeight;
int rowSize = av.getEndRes() - av.getStartRes();
if (labels != null)
{
- gg.translate(0, ypos + (alheight * av.charHeight));
+ gg.translate(0, ypos + (alheight * avcharHeight));
labels.drawComponent(gg, getSize().width);
- gg.translate(0, -ypos - (alheight * av.charHeight));
+ gg.translate(0, -ypos - (alheight * avcharHeight));
}
}
gg.setColor(currentColor);
// TODO: isrep could be used to highlight the representative in a
// different way
- gg.fillRect(0, (i - starty) * av.charHeight, getSize().width,
- av.charHeight);
+ gg.fillRect(0, (i - starty) * avcharHeight, getSize().width,
+ avcharHeight);
gg.setColor(currentTextColor);
gg.drawString(seq.getDisplayId(av.getShowJVSuffix()), 0,
- (((i - starty) * av.charHeight) + av.charHeight)
- - (av.charHeight / 5));
+ (((i - starty) * avcharHeight) + avcharHeight)
+ - (avcharHeight / 5));
- if (av.hasHiddenRows() && av.showHiddenMarkers)
+ if (av.hasHiddenRows() && av.getShowHiddenMarkers())
{
drawMarker(i, starty, 0);
}
if (below)
{
gg.fillPolygon(new int[]
- { getSize().width - av.charHeight, getSize().width - av.charHeight,
+ { getSize().width - avcharHeight, getSize().width - avcharHeight,
getSize().width }, new int[]
- { (i - starty) * av.charHeight + yoffset,
- (i - starty) * av.charHeight + yoffset + av.charHeight / 4,
- (i - starty) * av.charHeight + yoffset }, 3);
+ { (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 - avcharHeight, getSize().width - avcharHeight,
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);
+ { (i - starty + 1) * avcharHeight + yoffset,
+ (i - starty + 1) * avcharHeight + yoffset - avcharHeight / 4,
+ (i - starty + 1) * avcharHeight + yoffset }, 3);
}
}
int y = e.getY();
if (av.getWrapAlignment())
{
- y -= 2 * av.charHeight;
+ y -= 2 * av.getCharHeight();
}
int seq = alignPanel.seqPanel.findSeq(e);
// Fill the selected columns
ColumnSelection cs = av.getColumnSelection();
gg.setColor(new Color(220, 0, 0));
-
+ int avcharWidth = av.getCharWidth(), avcharHeight = av.getCharHeight();
for (int i = 0; i < cs.size(); i++)
{
int sel = cs.columnAt(i);
if ((sel >= startx) && (sel <= endx))
{
- gg.fillRect((sel - startx) * av.charWidth, 0, av.charWidth,
+ gg.fillRect((sel - startx) * avcharWidth, 0, avcharWidth,
getSize().height);
}
}
int scalestartx = (startx / 10) * 10;
FontMetrics fm = gg.getFontMetrics(av.getFont());
- int y = av.charHeight - fm.getDescent();
+ int y = avcharHeight - fm.getDescent();
if ((scalestartx % 10) == 0)
{
{
string = String.valueOf(av.getColumnSelection()
.adjustForHiddenColumns(i));
- if ((i - startx - 1) * av.charWidth > maxX)
+ if ((i - startx - 1) * avcharWidth > maxX)
{
- gg.drawString(string, (i - startx - 1) * av.charWidth, y);
- maxX = (i - startx + 1) * av.charWidth + fm.stringWidth(string);
+ gg.drawString(string, (i - startx - 1) * avcharWidth, y);
+ maxX = (i - startx + 1) * avcharWidth + fm.stringWidth(string);
}
gg.drawLine(
- ((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
+((i - startx - 1) * avcharWidth) + (avcharWidth / 2),
y + 2,
- ((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
+ ((i - startx - 1) * avcharWidth) + (avcharWidth / 2),
y + (fm.getDescent() * 2));
}
else
{
gg.drawLine(
- ((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
+((i - startx - 1) * avcharWidth) + (avcharWidth / 2),
y + fm.getDescent(),
- ((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
+ ((i - startx - 1) * avcharWidth)
+ + (avcharWidth / 2),
y + (fm.getDescent() * 2));
}
}
}
gg.fillPolygon(new int[]
- { res * av.charWidth - av.charHeight / 4,
- res * av.charWidth + av.charHeight / 4, res * av.charWidth },
+ { res * avcharWidth - avcharHeight / 4,
+ res * avcharWidth + avcharHeight / 4, res * avcharWidth },
new int[]
- { y - av.charHeight / 2, y - av.charHeight / 2, y + 8 },
+ { y - avcharHeight / 2, y - avcharHeight / 2, y + 8 },
3);
}
if (reveal != null && reveal[0] > startx && reveal[0] < endx)
{
gg.drawString(MessageManager.getString("label.reveal_columns"),
- reveal[0] * av.charWidth, 0);
+ reveal[0] * avcharWidth, 0);
}
}
fr = new FeatureRenderer(av);
sr = new SequenceRenderer(av);
PaintRefresher.Register(this, av.getSequenceSetId());
+ updateViewport();
+ }
+
+ int avcharHeight = 0, avcharWidth = 0;
+
+ private void updateViewport()
+ {
+ avcharHeight = av.getCharHeight();
+ avcharWidth = av.getCharWidth();
}
public AlignViewport getViewport()
return sr;
}
- void drawNorthScale(Graphics g, int startx, int endx, int ypos)
+ private void drawNorthScale(Graphics g, int startx, int endx, int ypos)
{
int scalestartx = startx - startx % 10 + 10;
value = av.getColumnSelection().adjustForHiddenColumns(value);
}
- g.drawString(String.valueOf(value), (i - startx - 1) * av.charWidth,
- ypos - (av.charHeight / 2));
+ g.drawString(String.valueOf(value), (i - startx - 1) * avcharWidth,
+ ypos - (avcharHeight / 2));
- g.drawLine(((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
- (ypos + 2) - (av.charHeight / 2),
- ((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
+ g.drawLine(((i - startx - 1) * avcharWidth) + (avcharWidth / 2),
+ (ypos + 2) - (avcharHeight / 2),
+ ((i - startx - 1) * avcharWidth) + (avcharWidth / 2),
ypos - 2);
}
}
- void drawWestScale(Graphics g, int startx, int endx, int ypos)
+ private void drawWestScale(Graphics g, int startx, int endx, int ypos)
{
FontMetrics fm = getFontMetrics(av.getFont());
- ypos += av.charHeight;
+ ypos += avcharHeight;
if (av.hasHiddenColumns())
{
startx = av.getColumnSelection().adjustForHiddenColumns(startx);
if (value != -1)
{
int x = LABEL_WEST - fm.stringWidth(String.valueOf(value))
- - av.charWidth / 2;
- g.drawString(value + "", x, (ypos + (i * av.charHeight))
- - (av.charHeight / 5));
+ - avcharWidth / 2;
+ g.drawString(value + "", x, (ypos + (i * avcharHeight))
+ - (avcharHeight / 5));
}
}
}
- void drawEastScale(Graphics g, int startx, int endx, int ypos)
+ private void drawEastScale(Graphics g, int startx, int endx, int ypos)
{
- ypos += av.charHeight;
+ ypos += avcharHeight;
if (av.hasHiddenColumns())
{
if (value != -1)
{
- g.drawString(String.valueOf(value), 0, (ypos + (i * av.charHeight))
- - (av.charHeight / 5));
+ g.drawString(String.valueOf(value), 0, (ypos + (i * avcharHeight))
+ - (avcharHeight / 5));
}
}
}
return;
}
+ updateViewport();
+
// Its possible on certain browsers that the call to fastpaint
// is faster than it can paint, so this check here catches
// this possibility
lastsr = av.startRes;
fastPaint = true;
- gg.copyArea(horizontal * av.charWidth, vertical * av.charHeight,
- imgWidth - horizontal * av.charWidth, imgHeight - vertical
- * av.charHeight, -horizontal * av.charWidth, -vertical
- * av.charHeight);
+ gg.copyArea(horizontal * avcharWidth, vertical * avcharHeight, imgWidth
+ - horizontal * avcharWidth,
+ imgHeight - vertical * avcharHeight, -horizontal * avcharWidth,
+ -vertical * avcharHeight);
int sr = av.startRes, er = av.endRes, ss = av.startSeq, es = av.endSeq, transX = 0, transY = 0;
if (horizontal > 0) // scrollbar pulled right, image to the left
{
- transX = (er - sr - horizontal) * av.charWidth;
+ transX = (er - sr - horizontal) * avcharWidth;
sr = er - horizontal;
}
else if (horizontal < 0)
}
else
{
- transY = imgHeight - vertical * av.charHeight;
+ transY = imgHeight - vertical * avcharHeight;
}
}
else if (vertical < 0)
return;
}
+ updateViewport();
// this draws the whole of the alignment
imgWidth = this.getSize().width;
imgHeight = this.getSize().height;
- imgWidth -= imgWidth % av.charWidth;
- imgHeight -= imgHeight % av.charHeight;
+ imgWidth -= imgWidth % avcharWidth;
+ imgHeight -= imgHeight % avcharHeight;
if (imgWidth < 1 || imgHeight < 1)
{
public int getWrappedCanvasWidth(int cwidth)
{
- cwidth -= cwidth % av.charWidth;
+ cwidth -= cwidth % av.getCharWidth();
FontMetrics fm = getFontMetrics(av.getFont());
LABEL_EAST = 0;
LABEL_WEST = 0;
- if (av.scaleRightWrapped)
+ if (av.getScaleRightWrapped())
{
LABEL_EAST = fm.stringWidth(getMask());
}
- if (av.scaleLeftWrapped)
+ if (av.getScaleLeftWrapped())
{
LABEL_WEST = fm.stringWidth(getMask());
}
- return (cwidth - LABEL_EAST - LABEL_WEST) / av.charWidth;
+ return (cwidth - LABEL_EAST - LABEL_WEST) / av.getCharWidth();
}
/**
return mask;
}
- public void drawWrappedPanel(Graphics g, int canvasWidth,
+ private void drawWrappedPanel(Graphics g, int canvasWidth,
int canvasHeight, int startRes)
{
AlignmentI al = av.getAlignment();
FontMetrics fm = getFontMetrics(av.getFont());
- if (av.scaleRightWrapped)
+ if (av.getScaleRightWrapped())
{
LABEL_EAST = fm.stringWidth(getMask());
}
- if (av.scaleLeftWrapped)
+ if (av.getScaleLeftWrapped())
{
LABEL_WEST = fm.stringWidth(getMask());
}
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = avcharHeight;
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += avcharHeight;
}
- int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / av.charWidth;
- int cHeight = av.getAlignment().getHeight() * av.charHeight;
+ int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / avcharWidth;
+ int cHeight = av.getAlignment().getHeight() * avcharHeight;
av.setWrappedWidth(cWidth);
g.setColor(Color.black);
- if (av.scaleLeftWrapped)
+ if (av.getScaleLeftWrapped())
{
drawWestScale(g, startRes, endx, ypos);
}
- if (av.scaleRightWrapped)
+ if (av.getScaleRightWrapped())
{
g.translate(canvasWidth - LABEL_EAST, 0);
drawEastScale(g, startRes, endx, ypos);
g.translate(LABEL_WEST, 0);
- if (av.scaleAboveWrapped)
+ if (av.getScaleAboveWrapped())
{
drawNorthScale(g, startRes, endx, ypos);
}
- if (av.hasHiddenColumns() && av.showHiddenMarkers)
+ if (av.hasHiddenColumns() && av.getShowHiddenMarkers())
{
g.setColor(Color.blue);
int res;
}
gg.fillPolygon(new int[]
- { res * av.charWidth - av.charHeight / 4,
- res * av.charWidth + av.charHeight / 4, res * av.charWidth },
+ { res * avcharWidth - avcharHeight / 4,
+ res * avcharWidth + avcharHeight / 4, res * avcharWidth },
new int[]
- { ypos - (av.charHeight / 2), ypos - (av.charHeight / 2),
- ypos - (av.charHeight / 2) + 8 }, 3);
+ { ypos - (avcharHeight / 2), ypos - (avcharHeight / 2),
+ ypos - (avcharHeight / 2) + 8 }, 3);
}
}
if (g.getClip() == null)
{
- g.setClip(0, 0, cWidth * av.charWidth, canvasHeight);
+ g.setClip(0, 0, cWidth * avcharWidth, canvasHeight);
}
drawPanel(g, startRes, endx, 0, al.getHeight(), ypos);
g.setClip(null);
- if (av.showAnnotation)
+ if (av.isShowAnnotation())
{
g.translate(0, cHeight + ypos + 4);
if (annotations == null)
int getAnnotationHeight()
{
- if (!av.showAnnotation)
+ if (!av.isShowAnnotation())
{
return 0;
}
return annotations.adjustPanelHeight();
}
- void drawPanel(Graphics g1, int startRes, int endRes, int startSeq,
+ private void drawPanel(Graphics g1, int startRes, int endRes,
+ int startSeq,
int endSeq, int offset)
{
blockEnd = hideStart - 1;
- g1.translate(screenY * av.charWidth, 0);
+ g1.translate(screenY * avcharWidth, 0);
draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);
if (av.getShowHiddenMarkers())
{
g1.setColor(Color.blue);
- g1.drawLine((blockEnd - blockStart + 1) * av.charWidth - 1,
- 0 + offset, (blockEnd - blockStart + 1) * av.charWidth
- - 1, (endSeq - startSeq) * av.charHeight
+ g1.drawLine((blockEnd - blockStart + 1) * avcharWidth - 1,
+ 0 + offset, (blockEnd - blockStart + 1) * avcharWidth
+ - 1, (endSeq - startSeq) * avcharHeight
+ offset);
}
- g1.translate(-screenY * av.charWidth, 0);
+ g1.translate(-screenY * avcharWidth, 0);
screenY += blockEnd - blockStart + 1;
blockStart = hideEnd + 1;
}
if (screenY <= (endRes - startRes))
{
blockEnd = blockStart + (endRes - startRes) - screenY;
- g1.translate(screenY * av.charWidth, 0);
+ g1.translate(screenY * avcharWidth, 0);
draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);
- g1.translate(-screenY * av.charWidth, 0);
+ g1.translate(-screenY * avcharWidth, 0);
}
}
int offset)
{
g.setFont(av.getFont());
- sr.prepare(g, av.renderGaps);
-
+ sr.prepare(g, av.isRenderGaps());
+ updateViewport();
SequenceI nextSeq;
// / First draw the sequences
}
sr.drawSequence(nextSeq, av.getAlignment().findAllGroups(nextSeq),
- startRes, endRes, offset + ((i - startSeq) * av.charHeight));
+ startRes, endRes, offset + ((i - startSeq) * avcharHeight));
if (av.isShowSequenceFeatures())
{
fr.drawSequence(g, nextSeq, startRes, endRes, offset
- + ((i - startSeq) * av.charHeight));
+ + ((i - startSeq) * avcharHeight));
}
// / Highlight search Results once all sequences have been drawn
{
sr.drawHighlightedText(nextSeq, visibleResults[r],
visibleResults[r + 1], (visibleResults[r] - startRes)
- * av.charWidth, offset
- + ((i - startSeq) * av.charHeight));
+ * avcharWidth, offset
+ + ((i - startSeq) * avcharHeight));
}
}
}
if (av.cursorMode && cursorY == i && cursorX >= startRes
&& cursorX <= endRes)
{
- sr.drawCursor(nextSeq, cursorX,
- (cursorX - startRes) * av.charWidth, offset
- + ((i - startSeq) * av.charHeight));
+ sr.drawCursor(nextSeq, cursorX, (cursorX - startRes) * avcharWidth,
+ offset + ((i - startSeq) * avcharHeight));
}
}
}
- void drawGroupsBoundaries(Graphics g, int startRes, int endRes,
+ private void drawGroupsBoundaries(Graphics g, int startRes, int endRes,
int startSeq, int endSeq, int offset)
{
//
for (i = startSeq; i < endSeq; i++)
{
- sx = (group.getStartRes() - startRes) * av.charWidth;
- sy = offset + ((i - startSeq) * av.charHeight);
- ex = (((group.getEndRes() + 1) - group.getStartRes()) * av.charWidth) - 1;
+ sx = (group.getStartRes() - startRes) * avcharWidth;
+ sy = offset + ((i - startSeq) * avcharHeight);
+ ex = (((group.getEndRes() + 1) - group.getStartRes()) * avcharWidth) - 1;
if (sx + ex < 0 || sx > imgWidth)
{
continue;
}
- if ((sx <= (endRes - startRes) * av.charWidth)
+ if ((sx <= (endRes - startRes) * avcharWidth)
&& group.getSequences(null).contains(
av.getAlignment().getSequenceAt(i)))
{
.contains(
av.getAlignment().getSequenceAt(i + 1))))
{
- bottom = sy + av.charHeight;
+ bottom = sy + avcharHeight;
}
if (!inGroup)
ex = imgWidth;
}
- else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)
+ else if (sx + ex >= (endRes - startRes + 1) * avcharWidth)
{
- ex = (endRes - startRes + 1) * av.charWidth;
+ ex = (endRes - startRes + 1) * avcharWidth;
}
if (top != -1)
if (inGroup)
{
- sy = offset + ((i - startSeq) * av.charHeight);
+ sy = offset + ((i - startSeq) * avcharHeight);
if (sx >= 0 && sx < imgWidth)
{
g.drawLine(sx, oldY, sx, sy);
{
ex = imgWidth;
}
- else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)
+ else if (sx + ex >= (endRes - startRes + 1) * avcharWidth)
{
- ex = (endRes - startRes + 1) * av.charWidth;
+ ex = (endRes - startRes + 1) * avcharWidth;
}
if (top != -1)
}
endEditing();
- if (av.wrapAlignment)
+ if (av.getWrapAlignment())
{
ap.scrollToWrappedVisible(seqCanvas.cursorX);
}
int res = 0;
int x = evt.getX();
- if (av.wrapAlignment)
+ if (av.getWrapAlignment())
{
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = av.getCharHeight();
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += av.getCharHeight();
}
- int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap
+ int cHeight = av.getAlignment().getHeight() * av.getCharHeight()
+ + hgap
+ seqCanvas.getAnnotationHeight();
int y = evt.getY();
int seq = 0;
int y = evt.getY();
- if (av.wrapAlignment)
+ if (av.getWrapAlignment())
{
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = av.getCharHeight();
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += av.getCharHeight();
}
- int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap
+ int cHeight = av.getAlignment().getHeight() * av.getCharHeight()
+ + hgap
+ seqCanvas.getAnnotationHeight();
y -= hgap;
{
if (mouseWheelPressed)
{
- int oldWidth = av.charWidth;
+ int oldWidth = av.getCharWidth();
// Which is bigger, left-right or up-down?
if (Math.abs(evt.getY() - lastMousePress.y) > Math.abs(evt.getX()
{
int fontSize = av.font.getSize();
- if (evt.getY() < lastMousePress.y && av.charHeight > 1)
+ if (evt.getY() < lastMousePress.y && av.getCharHeight() > 1)
{
fontSize--;
}
}
av.setFont(new Font(av.font.getName(), av.font.getStyle(), fontSize));
- av.charWidth = oldWidth;
+ av.setCharWidth(oldWidth);
}
else
{
- if (evt.getX() < lastMousePress.x && av.charWidth > 1)
+ if (evt.getX() < lastMousePress.x && av.getCharWidth() > 1)
{
- av.charWidth--;
+ av.setCharWidth(av.getCharWidth() - 1);
}
else if (evt.getX() > lastMousePress.x)
{
- av.charWidth++;
+ av.setCharWidth(av.getCharWidth() + 1);
}
- if (av.charWidth < 1)
+ if (av.getCharWidth() < 1)
{
- av.charWidth = 1;
+ av.setCharWidth(1);
}
}
ap.fontChanged();
FontMetrics fm = getFontMetrics(av.getFont());
- av.validCharWidth = fm.charWidth('M') <= av.charWidth;
+ av.validCharWidth = fm.charWidth('M') <= av.getCharWidth();
lastMousePress = evt.getPoint();
int length = seq.getLength();
int curStart = -1;
- int curWidth = av.charWidth;
+ int curWidth = av.getCharWidth(), avCharWidth = av.getCharWidth(), avCharHeight = av
+ .getCharHeight();
Color tempColour = null;
while (i <= end)
{
if (tempColour != null)
{
- graphics.fillRect(av.charWidth * (curStart - start), y1,
- curWidth, av.charHeight);
+ graphics.fillRect(avCharWidth * (curStart - start), y1, curWidth,
+ avCharHeight);
}
graphics.setColor(resBoxColour);
curStart = i;
- curWidth = av.charWidth;
+ curWidth = avCharWidth;
tempColour = resBoxColour;
}
else
{
- curWidth += av.charWidth;
+ curWidth += avCharWidth;
}
i++;
}
- graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth,
- av.charHeight);
+ graphics.fillRect(avCharWidth * (curStart - start), y1, curWidth,
+ avCharHeight);
}
public void drawText(SequenceI seq, int start, int end, int y1)
{
+ int avCharWidth = av.getCharWidth(), avCharHeight = av.getCharHeight();
Font boldFont = null;
boolean bold = false;
- if (av.upperCasebold)
+ if (av.isUpperCasebold())
{
- boldFont = new Font(av.getFont().getName(), Font.BOLD, av.charHeight);
+ boldFont = new Font(av.getFont().getName(), Font.BOLD, avCharHeight);
graphics.setFont(av.getFont());
}
- y1 += av.charHeight - av.charHeight / 5; // height/5 replaces pady
+ y1 += avCharHeight - avCharHeight / 5; // height/5 replaces pady
int charOffset = 0;
}
}
- if (av.upperCasebold)
+ if (av.isUpperCasebold())
{
fm = graphics.getFontMetrics();
if ('A' <= s && s <= 'Z')
}
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;
- graphics.drawString(String.valueOf(s), charOffset + av.charWidth
+ charOffset = (avCharWidth - fm.charWidth(s)) / 2;
+ graphics.drawString(String.valueOf(s), charOffset + avCharWidth
* (i - start), y1);
}
public void drawHighlightedText(SequenceI seq, int start, int end,
int x1, int y1)
{
- int pady = av.charHeight / 5;
+ int avCharWidth = av.getCharWidth(), avCharHeight = av.getCharHeight();
+ int pady = avCharHeight / 5;
int charOffset = 0;
graphics.setColor(Color.black);
- graphics.fillRect(x1, y1, av.charWidth * (end - start + 1),
- av.charHeight);
+ graphics.fillRect(x1, y1, avCharWidth * (end - start + 1), avCharHeight);
graphics.setColor(Color.white);
char s = '~';
s = seq.getCharAt(i);
}
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;
+ charOffset = (avCharWidth - fm.charWidth(s)) / 2;
graphics.drawString(String.valueOf(s), charOffset + x1
- + av.charWidth * (i - start), y1 + av.charHeight - pady);
+ + avCharWidth * (i - start), y1 + avCharHeight - pady);
}
}
}
public void drawCursor(SequenceI seq, int res, int x1, int y1)
{
- int pady = av.charHeight / 5;
+ int pady = av.getCharHeight() / 5;
int charOffset = 0;
graphics.setColor(Color.black);
- graphics.fillRect(x1, y1, av.charWidth, av.charHeight);
+ graphics.fillRect(x1, y1, av.getCharWidth(), av.getCharHeight());
graphics.setColor(Color.white);
graphics.setColor(Color.white);
if (av.validCharWidth)
{
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;
+ charOffset = (av.getCharWidth() - fm.charWidth(s)) / 2;
graphics.drawString(String.valueOf(s), charOffset + x1,
- (y1 + av.charHeight) - pady);
+ (y1 + av.getCharHeight()) - pady);
}
}
buildSortByAnnotationScoresMenu();
buildTreeMenu();
- if (viewport.wrapAlignment)
+ if (viewport.getWrapAlignment())
{
wrapMenuItem_actionPerformed(null);
}
break;
}
case KeyEvent.VK_PAGE_UP:
- if (viewport.wrapAlignment)
+ if (viewport.getWrapAlignment())
{
alignPanel.scrollUp(true);
}
}
break;
case KeyEvent.VK_PAGE_DOWN:
- if (viewport.wrapAlignment)
+ if (viewport.getWrapAlignment())
{
alignPanel.scrollUp(false);
}
void setMenusFromViewport(AlignViewport av)
{
padGapsMenuitem.setSelected(av.isPadGaps());
- colourTextMenuItem.setSelected(av.showColourText);
+ colourTextMenuItem.setSelected(av.isShowColourText());
abovePIDThreshold.setSelected(av.getAbovePIDThreshold());
conservationMenuItem.setSelected(av.getConservationSelected());
seqLimits.setSelected(av.getShowJVSuffix());
idRightAlign.setSelected(av.isRightAlignIds());
centreColumnLabelsMenuItem.setState(av.centreColumnLabels);
- renderGapsMenuItem.setSelected(av.renderGaps);
- wrapMenuItem.setSelected(av.wrapAlignment);
- scaleAbove.setVisible(av.wrapAlignment);
- scaleLeft.setVisible(av.wrapAlignment);
- scaleRight.setVisible(av.wrapAlignment);
+ renderGapsMenuItem.setSelected(av.isRenderGaps());
+ wrapMenuItem.setSelected(av.getWrapAlignment());
+ scaleAbove.setVisible(av.getWrapAlignment());
+ scaleLeft.setVisible(av.getWrapAlignment());
+ scaleRight.setVisible(av.getWrapAlignment());
annotationPanelMenuItem.setState(av.isShowAnnotation());
/*
* Show/hide annotations only enabled if annotation panel is shown
hideAllSeqAnnotations.setEnabled(annotationPanelMenuItem.getState());
showAllAlAnnotations.setEnabled(annotationPanelMenuItem.getState());
hideAllAlAnnotations.setEnabled(annotationPanelMenuItem.getState());
- viewBoxesMenuItem.setSelected(av.showBoxes);
- viewTextMenuItem.setSelected(av.showText);
+ viewBoxesMenuItem.setSelected(av.getShowBoxes());
+ viewTextMenuItem.setSelected(av.getShowText());
showNonconservedMenuItem.setSelected(av.getShowUnconserved());
showGroupConsensus.setSelected(av.isShowGroupConsensus());
showGroupConservation.setSelected(av.isShowGroupConservation());
.getGlobalColourScheme()));
showSeqFeatures.setSelected(av.isShowSequenceFeatures());
- hiddenMarkers.setState(av.showHiddenMarkers);
+ hiddenMarkers.setState(av.getShowHiddenMarkers());
applyToAllGroups.setState(av.getColourAppliesToAllGroups());
showNpFeatsMenuitem.setSelected(av.isShowNpFeats());
showDbRefsMenuitem.setSelected(av.isShowDbRefs());
// to prevent drawing old image
FontMetrics fm = getFontMetrics(av.getFont());
- scalePanelHolder.setPreferredSize(new Dimension(10, av.charHeight
+ scalePanelHolder.setPreferredSize(new Dimension(10, av.getCharHeight()
+ fm.getDescent()));
- idSpaceFillerPanel1.setPreferredSize(new Dimension(10, av.charHeight
+ idSpaceFillerPanel1.setPreferredSize(new Dimension(10, av
+ .getCharHeight()
+ fm.getDescent()));
getIdPanel().getIdCanvas().gg = null;
}
}
}
- if (!av.wrapAlignment)
+ if (!av.getWrapAlignment())
{
if ((startv = av.getStartRes()) >= start)
{
*/
public void setAnnotationVisible(boolean b)
{
- if (!av.wrapAlignment)
+ if (!av.getWrapAlignment())
{
annotationSpaceFillerHolder.setVisible(b);
annotationScroller.setVisible(b);
width = av.getColumnSelection().findColumnPosition(width);
}
- av.setEndRes((x + (getSeqPanel().seqCanvas.getWidth() / av.charWidth)) - 1);
+ av.setEndRes((x + (getSeqPanel().seqCanvas.getWidth() / av
+ .getCharWidth())) - 1);
- hextent = getSeqPanel().seqCanvas.getWidth() / av.charWidth;
- vextent = getSeqPanel().seqCanvas.getHeight() / av.charHeight;
+ hextent = getSeqPanel().seqCanvas.getWidth() / av.getCharWidth();
+ vextent = getSeqPanel().seqCanvas.getHeight() / av.getCharHeight();
if (hextent > width)
{
{
int idWidth = getVisibleIdWidth(false);
FontMetrics fm = getFontMetrics(av.getFont());
- int scaleHeight = av.charHeight + fm.getDescent();
+ int scaleHeight = av.getCharHeight() + fm.getDescent();
pg.setColor(Color.white);
pg.fillRect(0, 0, pwidth, pheight);
}
pg.setColor(currentColor);
- pg.fillRect(0, (i - startSeq) * av.charHeight, idWidth,
+ pg.fillRect(0, (i - startSeq) * av.getCharHeight(), idWidth,
av.getCharHeight());
pg.setColor(currentTextColor);
pg.drawString(
seq.getDisplayId(av.getShowJVSuffix()),
xPos,
- (((i - startSeq) * av.charHeight) + av.getCharHeight())
+ (((i - startSeq) * av.getCharHeight()) + av.getCharHeight())
- (av.getCharHeight() / 5));
}
// draw annotation - need to offset for current scroll position
int offset = -getAlabels().getScrollOffset();
pg.translate(0, offset);
- pg.translate(-idWidth - 3, (endSeq - startSeq) * av.charHeight + 3);
+ pg.translate(-idWidth - 3, (endSeq - startSeq) * av.getCharHeight()
+ + 3);
getAlabels().drawComponent(pg, idWidth);
pg.translate(idWidth + 3, 0);
getAnnotationPanel().renderer.drawComponent(getAnnotationPanel(), av,
labels = new AnnotationLabels(av);
}
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = av.getCharHeight();
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += av.getCharHeight();
}
- int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap
+ int cHeight = av.getAlignment().getHeight() * av.getCharHeight() + hgap
+ annotationHeight;
int idWidth = getVisibleIdWidth(false);
xPos = idWidth - fm.stringWidth(string) - 4;
}
pg.drawString(string, xPos,
- ((i * av.charHeight) + ypos + av.charHeight)
- - (av.charHeight / 5));
+ ((i * av.getCharHeight()) + ypos + av.getCharHeight())
+ - (av.getCharHeight() / 5));
}
if (labels != null)
{
pg.translate(-3, ypos
- + (av.getAlignment().getHeight() * av.charHeight));
+ + (av.getAlignment().getHeight() * av.getCharHeight()));
pg.setFont(av.getFont());
labels.drawComponent(pg, idWidth);
pg.translate(+3, -ypos
- - (av.getAlignment().getHeight() * av.charHeight));
+ - (av.getAlignment().getHeight() * av
+ .getCharHeight()));
}
ypos += cHeight;
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth);
}
- int height = ((av.getAlignment().getHeight() + 1) * av.charHeight)
+ int height = ((av.getAlignment().getHeight() + 1) * av.getCharHeight())
+ getScalePanel().getHeight();
- int width = getVisibleIdWidth(false) + (maxwidth * av.charWidth);
+ int width = getVisibleIdWidth(false) + (maxwidth * av.getCharWidth());
if (av.getWrapAlignment())
{
// ////////////////////////////////////////////
int idWidth = getVisibleIdWidth(false);
FontMetrics fm = getFontMetrics(av.getFont());
- int scaleHeight = av.charHeight + fm.getDescent();
+ int scaleHeight = av.getCharHeight() + fm.getDescent();
// Gen image map
// ////////////////////////////////
for (s = 0; s < sSize; s++)
{
- sy = s * av.charHeight + scaleHeight;
+ sy = s * av.getCharHeight() + scaleHeight;
SequenceI seq = av.getAlignment().getSequenceAt(s);
SequenceFeature[] features = seq.getDatasetSequence()
if (text.length() < 1)
{
text.append("<area shape=\"rect\" coords=\""
- + (idWidth + res * av.charWidth) + "," + sy + ","
- + (idWidth + (res + 1) * av.charWidth) + ","
- + (av.charHeight + sy) + "\""
+ + (idWidth + res * av.getCharWidth()) + "," + sy
+ + "," + (idWidth + (res + 1) * av.getCharWidth())
+ + ","
+ + (av.getCharHeight() + sy) + "\""
+ " onMouseOver=\"toolTip('" + alIndex + " "
+ triplet);
}
if (text.length() < 1)
{
text.append("<area shape=\"rect\" coords=\""
- + (idWidth + res * av.charWidth) + "," + sy + ","
- + (idWidth + (res + 1) * av.charWidth) + ","
- + (av.charHeight + sy) + "\""
+ + (idWidth + res * av.getCharWidth()) + "," + sy
+ + "," + (idWidth + (res + 1) * av.getCharWidth())
+ + ","
+ + (av.getCharHeight() + sy) + "\""
+ " onMouseOver=\"toolTip('" + alIndex + " "
+ triplet);
}
int chunkWidth = getSeqPanel().seqCanvas
.getWrappedCanvasWidth(seqPanelWidth);
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = av.getCharHeight();
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += av.getCharHeight();
}
int annotationHeight = 0;
annotationHeight = getAnnotationPanel().adjustPanelHeight();
}
- int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap
+ int cHeight = av.getAlignment().getHeight() * av.getCharHeight() + hgap
+ annotationHeight;
int maxwidth = av.getAlignment().getWidth();
Dimension d = ap.annotationScroller.getPreferredSize();
int dif = evt.getY() - oldY;
- dif /= ap.av.charHeight;
- dif *= ap.av.charHeight;
+ dif /= ap.av.getCharHeight();
+ dif *= ap.av.getCharHeight();
if ((d.height - dif) > 20)
{
dragEvent.getY() - getScrollOffset());
}
- if (!av.wrapAlignment && ((aa == null) || (aa.length < 1)))
+ if (!av.getWrapAlignment() && ((aa == null) || (aa.length < 1)))
{
g.drawString(MessageManager.getString("label.right_click"), 2, 8);
g.drawString(MessageManager.getString("label.to_add_annotation"), 2,
public void drawCursor(Graphics graphics, SequenceI seq, int res, int x1,
int y1)
{
- int pady = av.charHeight / 5;
+ int pady = av.getCharHeight() / 5;
int charOffset = 0;
graphics.setColor(Color.black);
- graphics.fillRect(x1, y1, av.charWidth, av.charHeight);
+ graphics.fillRect(x1, y1, av.getCharWidth(), av.getCharHeight());
if (av.validCharWidth)
{
char s = seq.getCharAt(res);
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;
+ charOffset = (av.getCharWidth() - fm.charWidth(s)) / 2;
graphics.drawString(String.valueOf(s), charOffset + x1,
- (y1 + av.charHeight) - pady);
+ (y1 + av.getCharHeight()) - pady);
}
}
return;
}
}
- imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;
+ imgWidth = (av.endRes - av.startRes + 1) * av.getCharWidth();
if (imgWidth < 1)
{
return;
return;
}
long stime = System.currentTimeMillis();
- gg.copyArea(0, 0, imgWidth, getHeight(), -horizontal * av.charWidth, 0);
+ gg.copyArea(0, 0, imgWidth, getHeight(),
+ -horizontal * av.getCharWidth(), 0);
long mtime = System.currentTimeMillis();
int sr = av.startRes;
int er = av.endRes + 1;
if (horizontal > 0) // scrollbar pulled right, image to the left
{
- transX = (er - sr - horizontal) * av.charWidth;
+ transX = (er - sr - horizontal) * av.getCharWidth();
sr = er - horizontal;
}
else if (horizontal < 0)
}
g.setColor(Color.white);
- g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight());
+ g.fillRect(0, 0, (endRes - startRes) * av.getCharWidth(), getHeight());
g.setFont(av.getFont());
if (fm == null)
{
int xPos = 0;
int panelWidth = getWidth();
- int charHeight = av.charHeight;
+ int charHeight = av.getCharHeight();
if ((searchResults != null) && searchResults.contains(s))
{
gg.drawString(s.getDisplayId(av.getShowJVSuffix()), xPos,
(((i - starty + 1) * charHeight) + ypos) - (charHeight / 5));
- if (av.hasHiddenRows() && av.showHiddenMarkers)
+ if (av.hasHiddenRows() && av.getShowHiddenMarkers())
{
drawMarker(i, starty, ypos);
}
return;
}
- gg.copyArea(0, 0, getWidth(), imgHeight, 0, -vertical * av.charHeight);
+ gg.copyArea(0, 0, getWidth(), imgHeight, 0,
+ -vertical * av.getCharHeight());
int ss = av.startSeq;
int es = av.endSeq;
}
else
{
- transY = imgHeight - (vertical * av.charHeight);
+ transY = imgHeight - (vertical * av.getCharHeight());
}
}
else if (vertical < 0)
int oldHeight = imgHeight;
imgHeight = getHeight();
- imgHeight -= (imgHeight % av.charHeight);
+ imgHeight -= (imgHeight % av.getCharHeight());
if (imgHeight < 1)
{
*/
void drawIds(int starty, int endy)
{
- if (av.seqNameItalics)
+ if (av.isSeqNameItalics())
{
setIdfont(new Font(av.getFont().getName(), Font.ITALIC, av.getFont()
.getSize()));
}
}
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = av.getCharHeight();
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += av.getCharHeight();
}
- int cHeight = alheight * av.charHeight + hgap + annotationHeight;
+ int cHeight = alheight * av.getCharHeight() + hgap + annotationHeight;
int rowSize = av.getEndRes() - av.getStartRes();
if (labels != null && av.isShowAnnotation())
{
- gg.translate(0, ypos + (alheight * av.charHeight));
+ gg.translate(0, ypos + (alheight * av.getCharHeight()));
labels.drawComponent(gg, getWidth());
- gg.translate(0, -ypos - (alheight * av.charHeight));
+ gg.translate(0, -ypos - (alheight * av.getCharHeight()));
}
}
}
gg.setColor(currentColor);
- gg.fillRect(0, (i - starty) * av.charHeight, getWidth(),
- av.charHeight);
+ gg.fillRect(0, (i - starty) * av.getCharHeight(), getWidth(),
+ av.getCharHeight());
gg.setColor(currentTextColor);
}
gg.drawString(string, xPos,
- (((i - starty) * av.charHeight) + av.charHeight)
- - (av.charHeight / 5));
+ (((i - starty) * av.getCharHeight()) + av.getCharHeight())
+ - (av.getCharHeight() / 5));
- if (av.hasHiddenRows() && av.showHiddenMarkers)
+ if (av.hasHiddenRows() && av.getShowHiddenMarkers())
{
drawMarker(i, starty, 0);
}
{
gg.fillPolygon(
new int[]
- { getWidth() - av.charHeight, getWidth() - av.charHeight,
+ { getWidth() - av.getCharHeight(),
+ getWidth() - av.getCharHeight(),
getWidth() }, new int[]
{
- (i - starty) * av.charHeight + yoffset,
- (i - starty) * av.charHeight + yoffset + av.charHeight
- / 4, (i - starty) * av.charHeight + yoffset }, 3);
+ (i - starty) * av.getCharHeight() + yoffset,
+ (i - starty) * av.getCharHeight() + yoffset
+ + av.getCharHeight() / 4,
+ (i - starty) * av.getCharHeight() + yoffset }, 3);
}
if (above)
{
gg.fillPolygon(
new int[]
- { getWidth() - av.charHeight, getWidth() - av.charHeight,
+ { getWidth() - av.getCharHeight(),
+ getWidth() - av.getCharHeight(),
getWidth() }, new int[]
{
- (i - starty + 1) * av.charHeight + yoffset,
- (i - starty + 1) * av.charHeight + yoffset
- - av.charHeight / 4,
- (i - starty + 1) * av.charHeight + yoffset }, 3);
+ (i - starty + 1) * av.getCharHeight() + yoffset,
+ (i - starty + 1) * av.getCharHeight() + yoffset
+ - av.getCharHeight() / 4,
+ (i - starty + 1) * av.getCharHeight() + yoffset }, 3);
}
}
view.setFontName(av.font.getName());
view.setFontSize(av.font.getSize());
view.setFontStyle(av.font.getStyle());
- view.setRenderGaps(av.renderGaps);
+ view.setRenderGaps(av.isRenderGaps());
view.setShowAnnotation(av.isShowAnnotation());
view.setShowBoxes(av.getShowBoxes());
view.setShowColourText(av.getColourText());
view.setShowText(av.getShowText());
view.setShowUnconserved(av.getShowUnconserved());
view.setWrapAlignment(av.getWrapAlignment());
- view.setTextCol1(av.textColour.getRGB());
- view.setTextCol2(av.textColour2.getRGB());
- view.setTextColThreshold(av.thresholdTextColour);
+ view.setTextCol1(av.getTextColour().getRGB());
+ view.setTextCol2(av.getTextColour2().getRGB());
+ view.setTextColThreshold(av.getThresholdTextColour());
view.setShowConsensusHistogram(av.isShowConsensusHistogram());
view.setShowSequenceLogo(av.isShowSequenceLogo());
view.setNormaliseSequenceLogo(av.isNormaliseSequenceLogo());
af.viewport.setShowText(view.getShowText());
- af.viewport.textColour = new java.awt.Color(view.getTextCol1());
- af.viewport.textColour2 = new java.awt.Color(view.getTextCol2());
- af.viewport.thresholdTextColour = view.getTextColThreshold();
+ af.viewport.setTextColour(new java.awt.Color(view.getTextCol1()));
+ af.viewport.setTextColour2(new java.awt.Color(view.getTextCol2()));
+ af.viewport.setThresholdTextColour(view.getTextColThreshold());
af.viewport.setShowUnconserved(view.hasShowUnconserved() ? view
.isShowUnconserved() : false);
af.viewport.setStartRes(view.getStartRes());
@Override
public void mouseDragged(MouseEvent evt)
{
- if (!av.wrapAlignment)
+ if (!av.getWrapAlignment())
{
// TODO: feature: jv2.5 detect shift drag and update selection from
// it.
@Override
public void mousePressed(MouseEvent evt)
{
- if (!av.wrapAlignment)
+ if (!av.getWrapAlignment())
{
boxX = evt.getX();
boxY = evt.getY();
// Fill the selected columns
ColumnSelection cs = av.getColumnSelection();
+ int avCharWidth = av.getCharWidth(), avCharHeight = av.getCharHeight();
+
int s;
if (cs != null)
{
if ((sel >= startx) && (sel <= endx))
{
- gg.fillRect((sel - startx) * av.charWidth, 0, av.charWidth,
+ gg.fillRect((sel - startx) * avCharWidth, 0, avCharWidth,
getHeight());
}
}
int scalestartx = (startx / 10) * 10;
FontMetrics fm = gg.getFontMetrics(av.getFont());
- int y = av.charHeight - fm.getDescent();
+ int y = avCharHeight - fm.getDescent();
if ((scalestartx % 10) == 0)
{
{
string = String.valueOf(av.getColumnSelection()
.adjustForHiddenColumns(i));
- if ((i - startx - 1) * av.charWidth > maxX)
+ if ((i - startx - 1) * avCharWidth > maxX)
{
- gg.drawString(string, (i - startx - 1) * av.charWidth, y);
- maxX = (i - startx + 1) * av.charWidth + fm.stringWidth(string);
+ gg.drawString(string, (i - startx - 1) * avCharWidth, y);
+ maxX = (i - startx + 1) * avCharWidth + fm.stringWidth(string);
}
gg.drawLine(
- ((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
+((i - startx - 1) * avCharWidth) + (avCharWidth / 2),
y + 2,
- ((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
+ ((i - startx - 1) * avCharWidth) + (avCharWidth / 2),
y + (fm.getDescent() * 2));
}
else
{
gg.drawLine(
- ((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
+((i - startx - 1) * avCharWidth) + (avCharWidth / 2),
y + fm.getDescent(),
- ((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
+ ((i - startx - 1) * avCharWidth)
+ + (avCharWidth / 2),
y + (fm.getDescent() * 2));
}
}
}
gg.fillPolygon(new int[]
- { res * av.charWidth - av.charHeight / 4,
- res * av.charWidth + av.charHeight / 4, res * av.charWidth },
+ { res * avCharWidth - avCharHeight / 4,
+ res * avCharWidth + avCharHeight / 4, res * avCharWidth },
new int[]
- { y - av.charHeight / 2, y - av.charHeight / 2, y + 8 },
+ { y - avCharHeight / 2, y - avCharHeight / 2, y + 8 },
3);
}
if (reveal != null && reveal[0] > startx && reveal[0] < endx)
{
gg.drawString(MessageManager.getString("label.reveal_columns"),
- reveal[0] * av.charWidth, 0);
+ reveal[0] * avCharWidth, 0);
}
}
public SeqCanvas(AlignmentPanel ap)
{
this.av = ap.av;
+ updateViewport();
fr = new FeatureRenderer(ap);
sr = new SequenceRenderer(av);
setLayout(new BorderLayout());
return fr;
}
+ int charHeight = 0, charWidth = 0;
+
+ private void updateViewport()
+ {
+ charHeight = av.getCharHeight();
+ charWidth = av.getCharWidth();
+ }
/**
* DOCUMENT ME!
*
* @param ypos
* DOCUMENT ME!
*/
- void drawNorthScale(Graphics g, int startx, int endx, int ypos)
+ private void drawNorthScale(Graphics g, int startx, int endx, int ypos)
{
+ updateViewport();
int scalestartx = startx - (startx % 10) + 10;
g.setColor(Color.black);
-
// NORTH SCALE
for (int i = scalestartx; i < endx; i += 10)
{
value = av.getColumnSelection().adjustForHiddenColumns(value);
}
- g.drawString(String.valueOf(value), (i - startx - 1) * av.charWidth,
- ypos - (av.charHeight / 2));
+ g.drawString(String.valueOf(value), (i - startx - 1) * charWidth,
+ ypos - (charHeight / 2));
- g.drawLine(((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
- (ypos + 2) - (av.charHeight / 2),
- ((i - startx - 1) * av.charWidth) + (av.charWidth / 2),
+ g.drawLine(((i - startx - 1) * charWidth) + (charWidth / 2),
+ (ypos + 2) - (charHeight / 2), ((i - startx - 1) * charWidth)
+ + (charWidth / 2),
ypos - 2);
}
}
void drawWestScale(Graphics g, int startx, int endx, int ypos)
{
FontMetrics fm = getFontMetrics(av.getFont());
- ypos += av.charHeight;
+ ypos += charHeight;
if (av.hasHiddenColumns())
{
if (value != -1)
{
int x = LABEL_WEST - fm.stringWidth(String.valueOf(value))
- - av.charWidth / 2;
- g.drawString(value + "", x, (ypos + (i * av.charHeight))
- - (av.charHeight / 5));
+ - charWidth / 2;
+ g.drawString(value + "", x, (ypos + (i * charHeight))
+ - (charHeight / 5));
}
}
}
*/
void drawEastScale(Graphics g, int startx, int endx, int ypos)
{
- ypos += av.charHeight;
+ ypos += charHeight;
if (av.hasHiddenColumns())
{
if (value != -1)
{
- g.drawString(String.valueOf(value), 0, (ypos + (i * av.charHeight))
- - (av.charHeight / 5));
+ g.drawString(String.valueOf(value), 0, (ypos + (i * charHeight))
+ - (charHeight / 5));
}
}
}
}
fastpainting = true;
fastPaint = true;
-
- gg.copyArea(horizontal * av.charWidth, vertical * av.charHeight,
- imgWidth, imgHeight, -horizontal * av.charWidth, -vertical
- * av.charHeight);
+ updateViewport();
+ gg.copyArea(horizontal * charWidth, vertical * charHeight, imgWidth,
+ imgHeight, -horizontal * charWidth, -vertical * charHeight);
int sr = av.startRes;
int er = av.endRes;
if (horizontal > 0) // scrollbar pulled right, image to the left
{
er++;
- transX = (er - sr - horizontal) * av.charWidth;
+ transX = (er - sr - horizontal) * charWidth;
sr = er - horizontal;
}
else if (horizontal < 0)
}
else
{
- transY = imgHeight - (vertical * av.charHeight);
+ transY = imgHeight - (vertical * charHeight);
}
}
else if (vertical < 0)
// Set this to false to force a full panel paint
public void paintComponent(Graphics g)
{
+ updateViewport();
BufferedImage lcimg = img; // take reference since other threads may null
// img and call later.
super.paintComponent(g);
imgWidth = getWidth();
imgHeight = getHeight();
- imgWidth -= (imgWidth % av.charWidth);
- imgHeight -= (imgHeight % av.charHeight);
+ imgWidth -= (imgWidth % charWidth);
+ imgHeight -= (imgHeight % charHeight);
if ((imgWidth < 1) || (imgHeight < 1))
{
LABEL_EAST = 0;
LABEL_WEST = 0;
- if (av.scaleRightWrapped)
+ if (av.getScaleRightWrapped())
{
LABEL_EAST = fm.stringWidth(getMask());
}
- if (av.scaleLeftWrapped)
+ if (av.getScaleLeftWrapped())
{
LABEL_WEST = fm.stringWidth(getMask());
}
- return (cwidth - LABEL_EAST - LABEL_WEST) / av.charWidth;
+ return (cwidth - LABEL_EAST - LABEL_WEST) / charWidth;
}
/**
public void drawWrappedPanel(Graphics g, int canvasWidth,
int canvasHeight, int startRes)
{
+ updateViewport();
AlignmentI al = av.getAlignment();
FontMetrics fm = getFontMetrics(av.getFont());
- if (av.scaleRightWrapped)
+ if (av.getScaleRightWrapped())
{
LABEL_EAST = fm.stringWidth(getMask());
}
- if (av.scaleLeftWrapped)
+ if (av.getScaleLeftWrapped())
{
LABEL_WEST = fm.stringWidth(getMask());
}
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = charHeight;
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += charHeight;
}
- int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / av.charWidth;
- int cHeight = av.getAlignment().getHeight() * av.charHeight;
+ int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / charWidth;
+ int cHeight = av.getAlignment().getHeight() * charHeight;
av.setWrappedWidth(cWidth);
g.setFont(av.getFont());
g.setColor(Color.black);
- if (av.scaleLeftWrapped)
+ if (av.getScaleLeftWrapped())
{
drawWestScale(g, startRes, endx, ypos);
}
- if (av.scaleRightWrapped)
+ if (av.getScaleRightWrapped())
{
g.translate(canvasWidth - LABEL_EAST, 0);
drawEastScale(g, startRes, endx, ypos);
g.translate(LABEL_WEST, 0);
- if (av.scaleAboveWrapped)
+ if (av.getScaleAboveWrapped())
{
drawNorthScale(g, startRes, endx, ypos);
}
- if (av.hasHiddenColumns() && av.showHiddenMarkers)
+ if (av.hasHiddenColumns() && av.getShowHiddenMarkers())
{
g.setColor(Color.blue);
int res;
}
gg.fillPolygon(new int[]
- { res * av.charWidth - av.charHeight / 4,
- res * av.charWidth + av.charHeight / 4, res * av.charWidth },
+ { res * charWidth - charHeight / 4,
+ res * charWidth + charHeight / 4, res * charWidth },
new int[]
- { ypos - (av.charHeight / 2), ypos - (av.charHeight / 2),
- ypos - (av.charHeight / 2) + 8 }, 3);
+ { ypos - (charHeight / 2), ypos - (charHeight / 2),
+ ypos - (charHeight / 2) + 8 }, 3);
}
}
if (clip == null)
{
- g.setClip(0, 0, cWidth * av.charWidth, canvasHeight);
+ g.setClip(0, 0, cWidth * charWidth, canvasHeight);
}
else
{
- g.setClip(0, (int) clip.getBounds().getY(), cWidth * av.charWidth,
+ g.setClip(0, (int) clip.getBounds().getY(), cWidth * charWidth,
(int) clip.getBounds().getHeight());
}
int startSeq,
int endSeq, int offset)
{
+ updateViewport();
if (!av.hasHiddenColumns())
{
draw(g1, startRes, endRes, startSeq, endSeq, offset);
blockEnd = hideStart - 1;
- g1.translate(screenY * av.charWidth, 0);
+ g1.translate(screenY * charWidth, 0);
draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);
{
g1.setColor(Color.blue);
- g1.drawLine((blockEnd - blockStart + 1) * av.charWidth - 1,
- 0 + offset, (blockEnd - blockStart + 1) * av.charWidth
- - 1, (endSeq - startSeq) * av.charHeight + offset);
+ g1.drawLine((blockEnd - blockStart + 1) * charWidth - 1,
+ 0 + offset, (blockEnd - blockStart + 1) * charWidth - 1,
+ (endSeq - startSeq) * charHeight + offset);
}
- g1.translate(-screenY * av.charWidth, 0);
+ g1.translate(-screenY * charWidth, 0);
screenY += blockEnd - blockStart + 1;
blockStart = hideEnd + 1;
}
if (screenY <= (endRes - startRes))
{
blockEnd = blockStart + (endRes - startRes) - screenY;
- g1.translate(screenY * av.charWidth, 0);
+ g1.translate(screenY * charWidth, 0);
draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);
- g1.translate(-screenY * av.charWidth, 0);
+ g1.translate(-screenY * charWidth, 0);
}
}
// int startRes, int endRes, int startSeq, int endSeq, int x, int y,
// int x1, int x2, int y1, int y2, int startx, int starty,
- void draw(Graphics g, int startRes, int endRes, int startSeq, int endSeq,
+ private void draw(Graphics g, int startRes, int endRes, int startSeq,
+ int endSeq,
int offset)
{
g.setFont(av.getFont());
- sr.prepare(g, av.renderGaps);
+ sr.prepare(g, av.isRenderGaps());
SequenceI nextSeq;
continue;
}
sr.drawSequence(nextSeq, av.getAlignment().findAllGroups(nextSeq),
- startRes, endRes, offset + ((i - startSeq) * av.charHeight));
+ startRes, endRes, offset + ((i - startSeq) * charHeight));
if (av.isShowSequenceFeatures())
{
fr.drawSequence(g, nextSeq, startRes, endRes, offset
- + ((i - startSeq) * av.charHeight));
+ + ((i - startSeq) * charHeight));
}
// / Highlight search Results once all sequences have been drawn
{
sr.drawHighlightedText(nextSeq, visibleResults[r],
visibleResults[r + 1], (visibleResults[r] - startRes)
- * av.charWidth, offset
- + ((i - startSeq) * av.charHeight));
+ * charWidth, offset
+ + ((i - startSeq) * charHeight));
}
}
}
if (av.cursorMode && cursorY == i && cursorX >= startRes
&& cursorX <= endRes)
{
- sr.drawCursor(nextSeq, cursorX,
- (cursorX - startRes) * av.charWidth, offset
- + ((i - startSeq) * av.charHeight));
+ sr.drawCursor(nextSeq, cursorX, (cursorX - startRes) * charWidth,
+ offset + ((i - startSeq) * charHeight));
}
}
int sy = -1;
int ex = -1;
int groupIndex = -1;
- int visWidth = (endRes - startRes + 1) * av.charWidth;
+ int visWidth = (endRes - startRes + 1) * charWidth;
if ((group == null) && (av.getAlignment().getGroups().size() > 0))
{
for (i = startSeq; i < endSeq; i++)
{
- sx = (group.getStartRes() - startRes) * av.charWidth;
- sy = offset + ((i - startSeq) * av.charHeight);
- ex = (((group.getEndRes() + 1) - group.getStartRes()) * av.charWidth) - 1;
+ sx = (group.getStartRes() - startRes) * charWidth;
+ sy = offset + ((i - startSeq) * charHeight);
+ ex = (((group.getEndRes() + 1) - group.getStartRes()) * charWidth) - 1;
if (sx + ex < 0 || sx > visWidth)
{
continue;
}
- if ((sx <= (endRes - startRes) * av.charWidth)
+ if ((sx <= (endRes - startRes) * charWidth)
&& group.getSequences(null).contains(
av.getAlignment().getSequenceAt(i)))
{
&& !group.getSequences(null).contains(
av.getAlignment().getSequenceAt(i + 1)))
{
- bottom = sy + av.charHeight;
+ bottom = sy + charHeight;
}
if (!inGroup)
ex = visWidth;
}
- else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)
+ else if (sx + ex >= (endRes - startRes + 1) * charWidth)
{
- ex = (endRes - startRes + 1) * av.charWidth;
+ ex = (endRes - startRes + 1) * charWidth;
}
if (top != -1)
if (inGroup)
{
- sy = offset + ((i - startSeq) * av.charHeight);
+ sy = offset + ((i - startSeq) * charHeight);
if (sx >= 0 && sx < visWidth)
{
g.drawLine(sx, oldY, sx, sy);
{
ex = visWidth;
}
- else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)
+ else if (sx + ex >= (endRes - startRes + 1) * charWidth)
{
- ex = (endRes - startRes + 1) * av.charWidth;
+ ex = (endRes - startRes + 1) * charWidth;
}
if (top != -1)
int res = 0;
int x = evt.getX();
- if (av.wrapAlignment)
+ if (av.getWrapAlignment())
{
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = av.getCharHeight();
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += av.getCharHeight();
}
- int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap
+ int cHeight = av.getAlignment().getHeight() * av.getCharHeight()
+ + hgap
+ seqCanvas.getAnnotationHeight();
int y = evt.getY();
int seq = 0;
int y = evt.getY();
- if (av.wrapAlignment)
+ if (av.getWrapAlignment())
{
- int hgap = av.charHeight;
- if (av.scaleAboveWrapped)
+ int hgap = av.getCharHeight();
+ if (av.getScaleAboveWrapped())
{
- hgap += av.charHeight;
+ hgap += av.getCharHeight();
}
- int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap
+ int cHeight = av.getAlignment().getHeight() * av.getCharHeight()
+ + hgap
+ seqCanvas.getAnnotationHeight();
y -= hgap;
}
endEditing();
- if (av.wrapAlignment)
+ if (av.getWrapAlignment())
{
ap.scrollToWrappedVisible(seqCanvas.cursorX);
}
{
ap.scrollUp(false);
}
- if (!av.wrapAlignment)
+ if (!av.getWrapAlignment())
{
while (seqCanvas.cursorX < av.getColumnSelection()
.adjustForHiddenColumns(av.startRes))
{
if (mouseWheelPressed)
{
- int oldWidth = av.charWidth;
+ int oldWidth = av.getCharWidth();
// Which is bigger, left-right or up-down?
if (Math.abs(evt.getY() - lastMousePress.getY()) > Math.abs(evt
}
av.setFont(new Font(av.font.getName(), av.font.getStyle(), fontSize));
- av.charWidth = oldWidth;
+ av.setCharWidth(oldWidth);
ap.fontChanged();
}
else
{
- if (evt.getX() < lastMousePress.getX() && av.charWidth > 1)
+ if (evt.getX() < lastMousePress.getX() && av.getCharWidth() > 1)
{
- av.charWidth--;
+ av.setCharWidth(av.getCharWidth() - 1);
}
else if (evt.getX() > lastMousePress.getX())
{
- av.charWidth++;
+ av.setCharWidth(av.getCharWidth() + 1);
}
ap.paintAlignment(false);
}
FontMetrics fm = getFontMetrics(av.getFont());
- av.validCharWidth = fm.charWidth('M') <= av.charWidth;
+ av.validCharWidth = fm.charWidth('M') <= av.getCharWidth();
lastMousePress = evt.getPoint();
startWrapBlock = wrappedBlock;
- if (av.wrapAlignment && seq > av.getAlignment().getHeight())
+ if (av.getWrapAlignment() && seq > av.getAlignment().getHeight())
{
JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager
.getString("label.cannot_edit_annotations_in_wrapped_view"),
// If EPS graphics, stringWidth will be a double, not an int
double dwidth = fm.getStringBounds("M", g).getWidth();
- monospacedFont = (dwidth == fm.getStringBounds("|", g).getWidth() && av.charWidth == dwidth);
+ monospacedFont = (dwidth == fm.getStringBounds("|", g).getWidth() && av
+ .getCharWidth() == dwidth);
this.renderGaps = renderGaps;
}
int length = seq.getLength();
int curStart = -1;
- int curWidth = av.charWidth;
+ int curWidth = av.getCharWidth(), avWidth = av.getCharWidth(), avHeight = av
+ .getCharHeight();
Color tempColour = null;
{
if (tempColour != null)
{
- graphics.fillRect(av.charWidth * (curStart - start), y1,
- curWidth, av.charHeight);
+ graphics.fillRect(avWidth * (curStart - start), y1, curWidth,
+ avHeight);
}
graphics.setColor(resBoxColour);
curStart = i;
- curWidth = av.charWidth;
+ curWidth = avWidth;
tempColour = resBoxColour;
}
else
{
- curWidth += av.charWidth;
+ curWidth += avWidth;
}
i++;
}
- graphics.fillRect(av.charWidth * (curStart - start), y1, curWidth,
- av.charHeight);
+ graphics.fillRect(avWidth * (curStart - start), y1, curWidth, avHeight);
}
*/
public void drawText(SequenceI seq, int start, int end, int y1)
{
- y1 += av.charHeight - av.charHeight / 5; // height/5 replaces pady
+ y1 += av.getCharHeight() - av.getCharHeight() / 5; // height/5 replaces pady
int charOffset = 0;
char s;
{
end = seq.getLength() - 1;
}
- graphics.setColor(av.textColour);
+ graphics.setColor(av.getTextColour());
- if (monospacedFont && av.showText && allGroups.length == 0
- && !av.getColourText() && av.thresholdTextColour == 0)
+ if (monospacedFont && av.getShowText() && allGroups.length == 0
+ && !av.getColourText() && av.getThresholdTextColour() == 0)
{
- if (av.renderGaps)
+ if (av.isRenderGaps())
{
graphics.drawString(seq.getSequenceAsString(start, end + 1), 0, y1);
}
boolean getboxColour = false;
for (int i = start; i <= end; i++)
{
- graphics.setColor(av.textColour);
+ graphics.setColor(av.getTextColour());
getboxColour = false;
s = seq.getCharAt(i);
if (!renderGaps && jalview.util.Comparison.isGap(s))
}
}
- if (av.thresholdTextColour > 0)
+ if (av.getThresholdTextColour() > 0)
{
if (!getboxColour)
{
}
if (resBoxColour.getRed() + resBoxColour.getBlue()
- + resBoxColour.getGreen() < av.thresholdTextColour)
+ + resBoxColour.getGreen() < av.getThresholdTextColour())
{
- graphics.setColor(av.textColour2);
+ graphics.setColor(av.getTextColour2());
}
}
if (av.getShowUnconserved())
}
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;
- graphics.drawString(String.valueOf(s), charOffset + av.charWidth
+ charOffset = (av.getCharWidth() - fm.charWidth(s)) / 2;
+ graphics.drawString(String.valueOf(s),
+ charOffset + av.getCharWidth()
* (i - start), y1);
}
public void drawHighlightedText(SequenceI seq, int start, int end,
int x1, int y1)
{
- int pady = av.charHeight / 5;
+ int pady = av.getCharHeight() / 5;
int charOffset = 0;
graphics.setColor(Color.BLACK);
- graphics.fillRect(x1, y1, av.charWidth * (end - start + 1),
- av.charHeight);
+ graphics.fillRect(x1, y1, av.getCharWidth() * (end - start + 1),
+ av.getCharHeight());
graphics.setColor(Color.white);
char s = '~';
s = seq.getCharAt(i);
}
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;
- graphics.drawString(String.valueOf(s), charOffset + x1
- + (av.charWidth * (i - start)), (y1 + av.charHeight) - pady);
+ charOffset = (av.getCharWidth() - fm.charWidth(s)) / 2;
+ graphics.drawString(String.valueOf(s),
+ charOffset + x1 + (av.getCharWidth() * (i - start)),
+ (y1 + av.getCharHeight()) - pady);
}
}
}
public void drawCursor(SequenceI seq, int res, int x1, int y1)
{
- int pady = av.charHeight / 5;
+ int pady = av.getCharHeight() / 5;
int charOffset = 0;
graphics.setColor(Color.black);
- graphics.fillRect(x1, y1, av.charWidth, av.charHeight);
+ graphics.fillRect(x1, y1, av.getCharWidth(), av.getCharHeight());
if (av.validCharWidth)
{
char s = seq.getCharAt(res);
- charOffset = (av.charWidth - fm.charWidth(s)) / 2;
+ charOffset = (av.getCharWidth() - fm.charWidth(s)) / 2;
graphics.drawString(String.valueOf(s), charOffset + x1,
- (y1 + av.charHeight) - pady);
+ (y1 + av.getCharHeight()) - pady);
}
}
int original1, original2, originalThreshold;
if (sg == null)
{
- original1 = ap.av.textColour.getRGB();
- original2 = ap.av.textColour2.getRGB();
- originalThreshold = ap.av.thresholdTextColour;
+ original1 = ap.av.getTextColour().getRGB();
+ original2 = ap.av.getTextColour2().getRGB();
+ originalThreshold = ap.av.getThresholdTextColour();
}
else
{
{
if (sg == null)
{
- ap.av.textColour = new Color(original1);
- ap.av.textColour2 = new Color(original2);
- ap.av.thresholdTextColour = originalThreshold;
+ ap.av.setTextColour(new Color(original1));
+ ap.av.setTextColour2(new Color(original2));
+ ap.av.setThresholdTextColour(originalThreshold);
}
else
{
{
if (sg == null)
{
- ap.av.textColour = col;
+ ap.av.setTextColour(col);
if (ap.av.getColourAppliesToAllGroups())
{
setGroupTextColour();
{
if (sg == null)
{
- ap.av.textColour2 = col;
+ ap.av.setTextColour2(col);
if (ap.av.getColourAppliesToAllGroups())
{
setGroupTextColour();
{
if (sg == null)
{
- ap.av.thresholdTextColour = value;
+ ap.av.setThresholdTextColour(value);
if (ap.av.getColourAppliesToAllGroups())
{
setGroupTextColour();
for (SequenceGroup sg : ap.av.getAlignment().getGroups())
{
- sg.textColour = ap.av.textColour;
- sg.textColour2 = ap.av.textColour2;
- sg.thresholdTextColour = ap.av.thresholdTextColour;
+ sg.textColour = ap.av.getTextColour();
+ sg.textColour2 = ap.av.getTextColour2();
+ sg.thresholdTextColour = ap.av.getThresholdTextColour();
}
}