git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-2388 Applied ViewportRanges to code
[jalview.git]
/
src
/
jalview
/
gui
/
IdCanvas.java
diff --git
a/src/jalview/gui/IdCanvas.java
b/src/jalview/gui/IdCanvas.java
index
fe42e1e
..
aad0776
100755
(executable)
--- a/
src/jalview/gui/IdCanvas.java
+++ b/
src/jalview/gui/IdCanvas.java
@@
-21,6
+21,7
@@
package jalview.gui;
import jalview.datamodel.SequenceI;
package jalview.gui;
import jalview.datamodel.SequenceI;
+import jalview.viewmodel.ViewportRanges;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.BorderLayout;
import java.awt.Color;
@@
-98,8
+99,7
@@
public class IdCanvas extends JPanel
* DOCUMENT ME!
*/
public void drawIdString(Graphics2D gg, boolean hiddenRows, SequenceI s,
* DOCUMENT ME!
*/
public void drawIdString(Graphics2D gg, boolean hiddenRows, SequenceI s,
- int i, int starty,
- int ypos)
+ int i, int starty, int ypos)
{
int xPos = 0;
int panelWidth = getWidth();
{
int xPos = 0;
int panelWidth = getWidth();
@@
-159,33
+159,35
@@
public class IdCanvas extends JPanel
return;
}
return;
}
+ ViewportRanges ranges = av.getRanges();
+
gg.copyArea(0, 0, getWidth(), imgHeight, 0,
-vertical * av.getCharHeight());
gg.copyArea(0, 0, getWidth(), imgHeight, 0,
-vertical * av.getCharHeight());
- int ss = av.startSeq;
- int es = av.endSeq;
+ int ss = ranges.getStartSeq();
+ int es = ranges.getEndSeq();
int transY = 0;
if (vertical > 0) // scroll down
{
ss = es - vertical;
int transY = 0;
if (vertical > 0) // scroll down
{
ss = es - vertical;
- if (ss < av.startSeq)
+ if (ss < ranges.getStartSeq())
{ // ie scrolling too fast, more than a page at a time
{ // ie scrolling too fast, more than a page at a time
- ss = av.startSeq;
+ ss = ranges.getStartSeq();
}
else
{
}
else
{
- transY = imgHeight - (vertical * av.getCharHeight());
+ transY = imgHeight - ((vertical + 1) * av.getCharHeight());
}
}
}
}
- else if (vertical < 0)
+ else if (vertical < 0) // scroll up
{
es = ss - vertical;
{
es = ss - vertical;
- if (es > av.endSeq)
+ if (es > ranges.getEndSeq())
{
{
- es = av.endSeq;
+ es = ranges.getEndSeq();
}
}
}
}
@@
-205,6
+207,7
@@
public class IdCanvas extends JPanel
* @param g
* DOCUMENT ME!
*/
* @param g
* DOCUMENT ME!
*/
+ @Override
public void paintComponent(Graphics g)
{
g.setColor(Color.white);
public void paintComponent(Graphics g)
{
g.setColor(Color.white);
@@
-240,7
+243,7
@@
public class IdCanvas extends JPanel
gg.setColor(Color.white);
gg.fillRect(0, 0, getWidth(), imgHeight);
gg.setColor(Color.white);
gg.fillRect(0, 0, getWidth(), imgHeight);
- drawIds(av.getStartSeq(), av.endSeq);
+ drawIds(av.getRanges().getStartSeq(), av.getRanges().getEndSeq());
g.drawImage(image, 0, 0, this);
}
g.drawImage(image, 0, 0, this);
}
@@
-314,10
+317,11
@@
public class IdCanvas extends JPanel
int cHeight = alheight * av.getCharHeight() + hgap + annotationHeight;
int cHeight = alheight * av.getCharHeight() + hgap + annotationHeight;
- int rowSize = av.getEndRes() - av.getStartRes();
+ int rowSize = av.getRanges().getEndRes()
+ - av.getRanges().getStartRes();
// Draw the rest of the panels
// Draw the rest of the panels
- for (int ypos = hgap, row = av.startRes; (ypos <= getHeight())
+ for (int ypos = hgap, row = av.getRanges().getStartRes(); (ypos <= getHeight())
&& (row < maxwidth); ypos += cHeight, row += rowSize)
{
for (int i = starty; i < alheight; i++)
&& (row < maxwidth); ypos += cHeight, row += rowSize)
{
for (int i = starty; i < alheight; i++)
@@
-354,7
+358,7
@@
public class IdCanvas extends JPanel
SequenceI sequence;
// Now draw the id strings
SequenceI sequence;
// Now draw the id strings
- for (int i = starty; i < endy; i++)
+ for (int i = starty; i <= endy; i++)
{
sequence = av.getAlignment().getSequenceAt(i);
{
sequence = av.getAlignment().getSequenceAt(i);
@@
-453,11
+457,9
@@
public class IdCanvas extends JPanel
if (below)
{
gg.fillPolygon(
if (below)
{
gg.fillPolygon(
- new int[]
- { getWidth() - av.getCharHeight(),
- getWidth() - av.getCharHeight(),
- getWidth() }, new int[]
- {
+ new int[] { getWidth() - av.getCharHeight(),
+ getWidth() - av.getCharHeight(), getWidth() },
+ new int[] {
(i - starty) * av.getCharHeight() + yoffset,
(i - starty) * av.getCharHeight() + yoffset
+ av.getCharHeight() / 4,
(i - starty) * av.getCharHeight() + yoffset,
(i - starty) * av.getCharHeight() + yoffset
+ av.getCharHeight() / 4,
@@
-466,11
+468,9
@@
public class IdCanvas extends JPanel
if (above)
{
gg.fillPolygon(
if (above)
{
gg.fillPolygon(
- new int[]
- { getWidth() - av.getCharHeight(),
- getWidth() - av.getCharHeight(),
- getWidth() }, new int[]
- {
+ new int[] { getWidth() - av.getCharHeight(),
+ getWidth() - av.getCharHeight(), getWidth() },
+ new int[] {
(i - starty + 1) * av.getCharHeight() + yoffset,
(i - starty + 1) * av.getCharHeight() + yoffset
- av.getCharHeight() / 4,
(i - starty + 1) * av.getCharHeight() + yoffset,
(i - starty + 1) * av.getCharHeight() + yoffset
- av.getCharHeight() / 4,
@@
-484,7
+484,7
@@
public class IdCanvas extends JPanel
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.isHiddenRepSequence(seq))
+ if (av.isReferenceSeq(seq) || av.isHiddenRepSequence(seq))
{
gg.setFont(bold);
}
{
gg.setFont(bold);
}