new String[] { (viewport.cursorMode ? "on" : "off") }));
if (viewport.cursorMode)
{
- alignPanel.seqPanel.seqCanvas.cursorX = viewport.startRes;
- alignPanel.seqPanel.seqCanvas.cursorY = viewport.startSeq;
+ alignPanel.seqPanel.seqCanvas.cursorX = viewport.getStartRes();
+ alignPanel.seqPanel.seqCanvas.cursorY = viewport.getStartSeq();
}
break;
}
else
{
- alignPanel.setScrollValues(viewport.startRes, viewport.startSeq
- - viewport.endSeq + viewport.startSeq);
+ alignPanel.setScrollValues(viewport.getStartRes(),
+ 2 * viewport.getStartSeq() - viewport.getEndSeq());
}
break;
}
else
{
- alignPanel.setScrollValues(viewport.startRes, viewport.startSeq
- + viewport.endSeq - viewport.startSeq);
+ alignPanel.setScrollValues(viewport.getStartRes(),
+ viewport.getEndSeq());
}
break;
// This is to maintain viewport position on first residue
// of first sequence
SequenceI seq = viewport.getAlignment().getSequenceAt(0);
- int startRes = seq.findPosition(viewport.startRes);
+ int startRes = seq.findPosition(viewport.getStartRes());
// ShiftList shifts;
// viewport.getAlignment().removeGaps(shifts=new ShiftList());
// edit.alColumnChanges=shifts.getInverse();
// This is to maintain viewport position on first residue
// of first sequence
SequenceI seq = viewport.getAlignment().getSequenceAt(0);
- int startRes = seq.findPosition(viewport.startRes);
+ int startRes = seq.findPosition(viewport.getStartRes());
addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end,
viewport.getAlignment()));
alignment = al;
// we always pad gaps
this.setPadGaps(true);
- this.startRes = 0;
- this.endRes = al.getWidth() - 1;
- this.startSeq = 0;
- this.endSeq = al.getHeight() - 1;
+ this.setStartRes(0);
+ this.setEndRes(al.getWidth() - 1);
+ this.setStartSeq(0);
+ this.setEndSeq(al.getHeight() - 1);
if (applet != null)
{
// get the width and height scaling factors if they were specified
if (res <= av.getStartRes() || res >= (av.getStartRes() + cwidth))
{
vscroll.setValue(res / cwidth);
- av.startRes = vscroll.getValue() * cwidth;
+ av.setStartRes(vscroll.getValue() * cwidth);
}
}
public void setWrapAlignment(boolean wrap)
{
- av.startSeq = 0;
- av.startRes = 0;
+ av.setStartSeq(0);
+ av.setStartRes(0);
scalePanelHolder.setVisible(!wrap);
hscroll.setVisible(!wrap);
overviewPanel.setBoxPosition();
}
- int scrollX = av.startRes - oldX;
- int scrollY = av.startSeq - oldY;
+ int scrollX = av.getStartRes() - oldX;
+ int scrollY = av.getStartSeq() - oldY;
if (av.getWrapAlignment() || !fastPaint || av.MAC)
{
{
// Make sure we're not trying to draw a panel
// larger than the visible window
- if (scrollX > av.endRes - av.startRes)
+ if (scrollX > av.getEndRes() - av.getStartRes())
{
- scrollX = av.endRes - av.startRes;
+ scrollX = av.getEndRes() - av.getStartRes();
}
- else if (scrollX < av.startRes - av.endRes)
+ else if (scrollX < av.getStartRes() - av.getEndRes())
{
- scrollX = av.startRes - av.endRes;
+ scrollX = av.getStartRes() - av.getEndRes();
}
idPanel.idCanvas.fastPaint(scrollY);
private void sendViewPosition()
{
StructureSelectionManager.getStructureSelectionManager(av.applet)
- .sendViewPosition(this, av.startRes, av.endRes, av.startSeq,
- av.endSeq);
+ .sendViewPosition(this, av.getStartRes(), av.getEndRes(),
+ av.getStartSeq(), av.getEndSeq());
}
/**
gg.setColor(Color.white);
gg.fillRect(0, 0, getSize().width, getSize().height);
- drawComponent(gg, av.startRes, av.endRes + 1);
+ drawComponent(gg, av.getStartRes(), av.getEndRes() + 1);
g.drawImage(image, 0, 0, this);
}
gg.copyArea(0, 0, imgWidth, getSize().height,
-horizontal * av.getCharWidth(), 0);
- int sr = av.startRes, er = av.endRes + 1, transX = 0;
+ int sr = av.getStartRes(), er = av.getEndRes() + 1, transX = 0;
if (horizontal > 0) // scrollbar pulled right, image to the left
{
gg.copyArea(0, 0, getSize().width, imgHeight, 0,
-vertical * av.getCharHeight());
- int ss = av.startSeq, es = av.endSeq, transY = 0;
+ int ss = av.getStartSeq(), es = av.getEndSeq(), transY = 0;
if (vertical > 0) // scroll down
{
ss = es - vertical;
- if (ss < av.startSeq) // ie scrolling too fast, more than a page at a time
+ if (ss < av.getStartSeq()) // ie scrolling too fast, more than a page at a
+ // time
{
- ss = av.startSeq;
+ ss = av.getStartSeq();
}
else
{
else if (vertical < 0)
{
es = ss - vertical;
- if (es > av.endSeq)
+ if (es > av.getEndSeq())
{
- es = av.endSeq;
+ es = av.getEndSeq();
}
}
gg.setFont(italic);
gg.fillRect(0, 0, getSize().width, getSize().height);
- drawIds(av.startSeq, av.endSeq);
+ drawIds(av.getStartSeq(), av.getEndSeq());
g.drawImage(image, 0, 0, this);
}
int rowSize = av.getEndRes() - av.getStartRes();
// Draw the rest of the panels
- for (int ypos = hgap, row = av.startRes; (ypos <= getSize().height)
+ for (int ypos = hgap, row = av.getStartRes(); (ypos <= getSize().height)
&& (row < maxwidth); ypos += cHeight, row += rowSize)
{
for (int i = starty; i < alheight; i++)
if ((int) (row * sampleRow) == lastrow)
{
sameRow++;
- continue;
}
else
{
hiddenRow = false;
if (hasHiddenRows)
{
+ // look for sequence in hidden rows
seq = av.getAlignment().getHiddenSequences()
.getHiddenSequence(lastrow);
if (seq == null)
{
+ // didn't find in hidden rows, adjust the index and retrieve from
+ // full row set
int index = av.getAlignment().getHiddenSequences()
.findIndexWithoutHiddenSeqs(lastrow);
}
else
{
+ // found in hidden rows, ergo this row is hidden
hiddenRow = true;
}
}
// Its possible on certain browsers that the call to fastpaint
// is faster than it can paint, so this check here catches
// this possibility
- if (lastsr + horizontal != av.startRes)
+ if (lastsr + horizontal != av.getStartRes())
{
- horizontal = av.startRes - lastsr;
+ horizontal = av.getStartRes() - lastsr;
}
- lastsr = av.startRes;
+ lastsr = av.getStartRes();
fastPaint = true;
gg.copyArea(horizontal * avcharWidth, vertical * avcharHeight, imgWidth
imgHeight - vertical * avcharHeight, -horizontal * avcharWidth,
-vertical * avcharHeight);
- int sr = av.startRes, er = av.endRes, ss = av.startSeq, es = av.endSeq, transX = 0, transY = 0;
+ int sr = av.getStartRes(), er = av.getEndRes(), ss = av.getStartSeq(), es = av
+ .getEndSeq(), transX = 0, transY = 0;
if (horizontal > 0) // scrollbar pulled right, image to the left
{
else if (vertical > 0) // scroll down
{
ss = es - vertical;
- if (ss < av.startSeq) // ie scrolling too fast, more than a page at a time
+ if (ss < av.getStartSeq()) // ie scrolling too fast, more than a page at a
+ // time
{
- ss = av.startSeq;
+ ss = av.getStartSeq();
}
else
{
else if (vertical < 0)
{
es = ss - vertical;
- if (es > av.endSeq)
+ if (es > av.getEndSeq())
{
- es = av.endSeq;
+ es = av.getEndSeq();
}
}
if (av.getWrapAlignment())
{
- drawWrappedPanel(gg, imgWidth, imgHeight, av.startRes);
+ drawWrappedPanel(gg, imgWidth, imgHeight, av.getStartRes());
}
else
{
- drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq, 0);
+ drawPanel(gg, av.getStartRes(), av.getEndRes(), av.getStartSeq(),
+ av.getEndSeq(), 0);
}
g.drawImage(img, 0, 0, this);
av.setWrappedWidth(cWidth);
- av.endRes = av.startRes + cWidth;
+ av.setEndRes(av.getStartRes() + cWidth);
int endx;
int ypos = hgap;
}
else
{
- while (seqCanvas.cursorY < av.startSeq)
+ while (seqCanvas.cursorY < av.getStartSeq())
{
ap.scrollUp(true);
}
- while (seqCanvas.cursorY + 1 > av.endSeq)
+ while (seqCanvas.cursorY + 1 > av.getEndSeq())
{
ap.scrollUp(false);
}
while (seqCanvas.cursorX < av.getColumnSelection()
- .adjustForHiddenColumns(av.startRes))
+ .adjustForHiddenColumns(av.getStartRes()))
{
if (!ap.scrollRight(false))
}
}
while (seqCanvas.cursorX > av.getColumnSelection()
- .adjustForHiddenColumns(av.endRes))
+ .adjustForHiddenColumns(av.getEndRes()))
{
if (!ap.scrollRight(true))
{
oldSeq = -1;
}
- if (res > av.endRes || res < av.startRes || y < av.startSeq
- || y > av.endSeq)
+ if (res > av.getEndRes() || res < av.getStartRes()
+ || y < av.getStartSeq() || y > av.getEndSeq())
{
mouseExited(evt);
}
public void scrollTo(int row, int column)
{
- row = row < 0 ? ap.av.startSeq : row;
- column = column < 0 ? ap.av.startRes : column;
+ row = row < 0 ? ap.av.getStartSeq() : row;
+ column = column < 0 ? ap.av.getStartRes() : column;
ap.scrollTo(column, column, row, true, true);
}
public void scrollToRow(int row)
{
- row = row < 0 ? ap.av.startSeq : row;
- ap.scrollTo(ap.av.startRes, ap.av.startRes, row, true, true);
+ row = row < 0 ? ap.av.getStartSeq() : row;
+ ap.scrollTo(ap.av.getStartRes(), ap.av.getStartRes(), row, true, true);
}
/**
public void scrollToColumn(int column)
{
- column = column < 0 ? ap.av.startRes : column;
- ap.scrollTo(column, column, ap.av.startSeq, true, true);
+ column = column < 0 ? ap.av.getStartRes() : column;
+ ap.scrollTo(column, column, ap.av.getStartSeq(), true, true);
}
/**
new String[] { (viewport.cursorMode ? "on" : "off") }));
if (viewport.cursorMode)
{
- alignPanel.getSeqPanel().seqCanvas.cursorX = viewport.startRes;
- alignPanel.getSeqPanel().seqCanvas.cursorY = viewport.startSeq;
+ alignPanel.getSeqPanel().seqCanvas.cursorX = viewport
+ .getStartRes();
+ alignPanel.getSeqPanel().seqCanvas.cursorY = viewport
+ .getStartSeq();
}
alignPanel.getSeqPanel().seqCanvas.repaint();
break;
}
else
{
- alignPanel.setScrollValues(viewport.startRes, viewport.startSeq
- - viewport.endSeq + viewport.startSeq);
+ alignPanel.setScrollValues(viewport.getStartRes(),
+ 2 * viewport.getStartSeq() - viewport.getEndSeq());
}
break;
case KeyEvent.VK_PAGE_DOWN:
}
else
{
- alignPanel.setScrollValues(viewport.startRes, viewport.startSeq
- + viewport.endSeq - viewport.startSeq);
+ alignPanel.setScrollValues(viewport.getStartRes(),
+ viewport.getEndSeq());
}
break;
}
// This is to maintain viewport position on first residue
// of first sequence
SequenceI seq = viewport.getAlignment().getSequenceAt(0);
- int startRes = seq.findPosition(viewport.startRes);
+ int startRes = seq.findPosition(viewport.getStartRes());
// ShiftList shifts;
// viewport.getAlignment().removeGaps(shifts=new ShiftList());
// edit.alColumnChanges=shifts.getInverse();
// This is to maintain viewport position on first residue
// of first sequence
SequenceI seq = viewport.getAlignment().getSequenceAt(0);
- int startRes = seq.findPosition(viewport.startRes);
+ int startRes = seq.findPosition(viewport.getStartRes());
addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end,
viewport.getAlignment()));
void init()
{
- this.startRes = 0;
- this.endRes = alignment.getWidth() - 1;
- this.startSeq = 0;
- this.endSeq = alignment.getHeight() - 1;
+ setStartRes(0);
+ setEndRes(alignment.getWidth() - 1);
+ setStartSeq(0);
+ setEndSeq(alignment.getHeight() - 1);
applyViewProperties();
String fontName = Cache.getDefault("FONT_NAME", "SansSerif");
if (res < av.getStartRes() || res >= (av.getStartRes() + cwidth))
{
vscroll.setValue((res / cwidth));
- av.startRes = vscroll.getValue() * cwidth;
+ av.setStartRes(vscroll.getValue() * cwidth);
}
}
fontChanged();
setAnnotationVisible(av.isShowAnnotation());
boolean wrap = av.getWrapAlignment();
- av.startSeq = 0;
+ av.setStartSeq(0);
scalePanelHolder.setVisible(!wrap);
hscroll.setVisible(!wrap);
idwidthAdjuster.setVisible(!wrap);
overviewPanel.setBoxPosition();
}
- int scrollX = av.startRes - oldX;
- int scrollY = av.startSeq - oldY;
+ int scrollX = av.getStartRes() - oldX;
+ int scrollY = av.getStartSeq() - oldY;
if (av.getWrapAlignment() || !fastPaint)
{
{
// Make sure we're not trying to draw a panel
// larger than the visible window
- if (scrollX > av.endRes - av.startRes)
+ if (scrollX > av.getEndRes() - av.getStartRes())
{
- scrollX = av.endRes - av.startRes;
+ scrollX = av.getEndRes() - av.getStartRes();
}
- else if (scrollX < av.startRes - av.endRes)
+ else if (scrollX < av.getStartRes() - av.getEndRes())
{
- scrollX = av.startRes - av.endRes;
+ scrollX = av.getStartRes() - av.getEndRes();
}
if (scrollX != 0 || scrollY != 0)
import javax.swing.JColorChooser;
import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.Scrollable;
return;
}
}
- imgWidth = (av.endRes - av.startRes + 1) * av.getCharWidth();
+ imgWidth = (av.getEndRes() - av.getStartRes() + 1) * av.getCharWidth();
if (imgWidth < 1)
{
return;
imageFresh = true;
}
- drawComponent(gg, av.startRes, av.endRes + 1);
+ drawComponent(gg, av.getStartRes(), av.getEndRes() + 1);
imageFresh = false;
g.drawImage(image, 0, 0, this);
}
gg.copyArea(0, 0, imgWidth, getHeight(),
-horizontal * av.getCharWidth(), 0);
long mtime = System.currentTimeMillis();
- int sr = av.startRes;
- int er = av.endRes + 1;
+ int sr = av.getStartRes();
+ int er = av.getEndRes() + 1;
int transX = 0;
if (horizontal > 0) // scrollbar pulled right, image to the left
gg.copyArea(0, 0, getWidth(), imgHeight, 0,
-vertical * av.getCharHeight());
- int ss = av.startSeq;
- int es = av.endSeq;
+ int ss = av.getStartSeq();
+ int es = av.getEndSeq();
int transY = 0;
if (vertical > 0) // scroll down
{
ss = es - vertical;
- if (ss < av.startSeq)
+ if (ss < av.getStartSeq())
{ // ie scrolling too fast, more than a page at a time
- ss = av.startSeq;
+ ss = av.getStartSeq();
}
else
{
{
es = ss - vertical;
- if (es > av.endSeq)
+ if (es > av.getEndSeq())
{
- es = av.endSeq;
+ es = av.getEndSeq();
}
}
gg.setColor(Color.white);
gg.fillRect(0, 0, getWidth(), imgHeight);
- drawIds(av.getStartSeq(), av.endSeq);
+ drawIds(av.getStartSeq(), av.getEndSeq());
g.drawImage(image, 0, 0, this);
}
int rowSize = av.getEndRes() - av.getStartRes();
// Draw the rest of the panels
- for (int ypos = hgap, row = av.startRes; (ypos <= getHeight())
+ for (int ypos = hgap, row = av.getStartRes(); (ypos <= getHeight())
&& (row < maxwidth); ypos += cHeight, row += rowSize)
{
for (int i = starty; i < alheight; i++)
view.setWidth(size.width);
view.setHeight(size.height);
- view.setStartRes(av.startRes);
- view.setStartSeq(av.startSeq);
+ view.setStartRes(av.getStartRes());
+ view.setStartSeq(av.getStartSeq());
if (av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme)
{
gg.copyArea(horizontal * charWidth, vertical * charHeight, imgWidth,
imgHeight, -horizontal * charWidth, -vertical * charHeight);
- int sr = av.startRes;
- int er = av.endRes;
- int ss = av.startSeq;
- int es = av.endSeq;
+ int sr = av.getStartRes();
+ int er = av.getEndRes();
+ int ss = av.getStartSeq();
+ int es = av.getEndSeq();
int transX = 0;
int transY = 0;
{
ss = es - vertical;
- if (ss < av.startSeq)
+ if (ss < av.getStartSeq())
{ // ie scrolling too fast, more than a page at a time
- ss = av.startSeq;
+ ss = av.getStartSeq();
}
else
{
{
es = ss - vertical;
- if (es > av.endSeq)
+ if (es > av.getEndSeq())
{
- es = av.endSeq;
+ es = av.getEndSeq();
}
}
if (av.getWrapAlignment())
{
- drawWrappedPanel(gg, getWidth(), getHeight(), av.startRes);
+ drawWrappedPanel(gg, getWidth(), getHeight(), av.getStartRes());
}
else
{
- drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq, 0);
+ drawPanel(gg, av.getStartRes(), av.getEndRes(), av.getStartSeq(),
+ av.getEndSeq(), 0);
}
g.drawImage(lcimg, 0, 0, this);
av.setWrappedWidth(cWidth);
- av.endRes = av.startRes + cWidth;
+ av.setEndRes(av.getStartRes() + cWidth);
int endx;
int ypos = hgap;
}
else
{
- while (seqCanvas.cursorY < av.startSeq)
+ while (seqCanvas.cursorY < av.getStartSeq())
{
ap.scrollUp(true);
}
- while (seqCanvas.cursorY + 1 > av.endSeq)
+ while (seqCanvas.cursorY + 1 > av.getEndSeq())
{
ap.scrollUp(false);
}
if (!av.getWrapAlignment())
{
while (seqCanvas.cursorX < av.getColumnSelection()
- .adjustForHiddenColumns(av.startRes))
+ .adjustForHiddenColumns(av.getStartRes()))
{
if (!ap.scrollRight(false))
{
}
}
while (seqCanvas.cursorX > av.getColumnSelection()
- .adjustForHiddenColumns(av.endRes))
+ .adjustForHiddenColumns(av.getEndRes()))
{
if (!ap.scrollRight(true))
{
*/
private boolean followHighlight = true;
- // TODO private with getters and setters?
- public int startRes;
+ private int startRes;
- public int endRes;
+ private int endRes;
- public int startSeq;
+ private int startSeq;
- public int endSeq;
+ private int endSeq;
/**
* Property change listener for changes in alignment