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-247 pass idwidth parameter to IdCanvas.drawMarker
[jalview.git]
/
src
/
jalview
/
gui
/
IdCanvas.java
diff --git
a/src/jalview/gui/IdCanvas.java
b/src/jalview/gui/IdCanvas.java
index
951db78
..
b408c1b
100755
(executable)
--- a/
src/jalview/gui/IdCanvas.java
+++ b/
src/jalview/gui/IdCanvas.java
@@
-85,20
+85,21
@@
public class IdCanvas extends JPanel implements ViewportListenerI
* DOCUMENT ME!
*
* @param g
* DOCUMENT ME!
*
* @param g
- * DOCUMENT ME!
+ * DOCUMENT ME!
* @param hiddenRows
* @param hiddenRows
- * true - check and display hidden row marker if need be
+ * true - check and display hidden row marker if need be
* @param s
* @param s
- * DOCUMENT ME!
+ * DOCUMENT ME!
* @param i
* @param i
- * DOCUMENT ME!
+ * DOCUMENT ME!
* @param starty
* @param starty
- * DOCUMENT ME!
+ * DOCUMENT ME!
* @param ypos
* @param ypos
- * DOCUMENT ME!
+ * DOCUMENT ME!
+ * @param idWidth
*/
public void drawIdString(Graphics2D g, boolean hiddenRows, SequenceI s,
*/
public void drawIdString(Graphics2D g, boolean hiddenRows, SequenceI s,
- int i, int starty, int ypos)
+ int i, int starty, int ypos, int idWidth)
{
int xPos = 0;
int panelWidth = getWidth();
{
int xPos = 0;
int panelWidth = getWidth();
@@
-139,7
+140,7
@@
public class IdCanvas extends JPanel implements ViewportListenerI
if (hiddenRows)
{
if (hiddenRows)
{
- drawMarker(g, av, i, starty, ypos);
+ drawMarker(g, av, i, starty, ypos, idWidth);
}
}
}
}
@@
-196,7
+197,7
@@
public class IdCanvas extends JPanel implements ViewportListenerI
gg.translate(0, transY);
gg.translate(0, transY);
- drawIds(gg, av, ss, es, searchResults);
+ drawIds(gg, av, ss, es, searchResults, getWidth());
gg.translate(0, -transY);
gg.translate(0, -transY);
@@
-252,7
+253,7
@@
public class IdCanvas extends JPanel implements ViewportListenerI
gg.setColor(Color.white);
gg.fillRect(0, 0, getWidth(), imgHeight);
gg.setColor(Color.white);
gg.fillRect(0, 0, getWidth(), imgHeight);
- drawIds(gg, av, av.getRanges().getStartSeq(), av.getRanges().getEndSeq(), searchResults);
+ drawIds(gg, av, av.getRanges().getStartSeq(), av.getRanges().getEndSeq(), searchResults, getWidth());
g.drawImage(image, 0, 0, this);
}
g.drawImage(image, 0, 0, this);
}
@@
-260,17
+261,18
@@
public class IdCanvas extends JPanel implements ViewportListenerI
/**
* Draws sequence ids from sequence index startSeq to endSeq (inclusive), with
* the font and other display settings configured on the viewport. Ids of
/**
* Draws sequence ids from sequence index startSeq to endSeq (inclusive), with
* the font and other display settings configured on the viewport. Ids of
- * sequences included in the selection are coloured grey, otherwise the
- * current id colour for the sequence id is used.
+ * sequences included in the selection are coloured grey, otherwise the current
+ * id colour for the sequence id is used.
*
* @param g
* @param alignViewport
* @param startSeq
* @param endSeq
* @param selection
*
* @param g
* @param alignViewport
* @param startSeq
* @param endSeq
* @param selection
+ * @param idWidth
*/
void drawIds(Graphics2D g, AlignViewport alignViewport, final int startSeq,
*/
void drawIds(Graphics2D g, AlignViewport alignViewport, final int startSeq,
- final int endSeq, List<SequenceI> selection)
+ final int endSeq, List<SequenceI> selection, int idWidth)
{
Font font = alignViewport.getFont();
if (alignViewport.isSeqNameItalics())
{
Font font = alignViewport.getFont();
if (alignViewport.isSeqNameItalics())
@@
-299,7
+301,7
@@
public class IdCanvas extends JPanel implements ViewportListenerI
if (alignViewport.getWrapAlignment())
{
if (alignViewport.getWrapAlignment())
{
- drawIdsWrapped(g, alignViewport, startSeq, getHeight());
+ drawIdsWrapped(g, alignViewport, startSeq, getHeight(), getWidth());
return;
}
return;
}
@@
-361,7
+363,7
@@
public class IdCanvas extends JPanel implements ViewportListenerI
if (hasHiddenRows)
{
if (hasHiddenRows)
{
- drawMarker(g, alignViewport, i, startSeq, 0);
+ drawMarker(g, alignViewport, i, startSeq, 0, idWidth);
}
}
}
}
}
}
@@
-373,39
+375,28
@@
public class IdCanvas extends JPanel implements ViewportListenerI
* @param g
* @param alignViewport
* @param startSeq
* @param g
* @param alignViewport
* @param startSeq
+ * @param idWidth
*/
void drawIdsWrapped(Graphics2D g, AlignViewport alignViewport,
*/
void drawIdsWrapped(Graphics2D g, AlignViewport alignViewport,
- int startSeq, int pageHeight)
+ int startSeq, int pageHeight, int idWidth)
{
int alignmentWidth = alignViewport.getAlignment().getWidth();
final int alheight = alignViewport.getAlignment().getHeight();
{
int alignmentWidth = alignViewport.getAlignment().getWidth();
final int alheight = alignViewport.getAlignment().getHeight();
- int annotationHeight = 0;
+ /*
+ * assumption: SeqCanvas.calculateWrappedGeometry has been called
+ */
+ SeqCanvas seqCanvas = alignViewport.getAlignPanel()
+ .getSeqPanel().seqCanvas;
+
+ final int charHeight = alignViewport.getCharHeight();
AnnotationLabels labels = null;
if (alignViewport.isShowAnnotation())
{
AnnotationLabels labels = null;
if (alignViewport.isShowAnnotation())
{
- if (ap == null)
- {
- ap = new AnnotationPanel(alignViewport);
- }
- annotationHeight = ap.adjustPanelHeight();
labels = new AnnotationLabels(alignViewport);
}
labels = new AnnotationLabels(alignViewport);
}
- final int charHeight = alignViewport.getCharHeight();
- int hgap = charHeight;
- if (alignViewport.getScaleAboveWrapped())
- {
- hgap += charHeight;
- }
-
- /*
- * height of alignment + gap + annotations (if shown)
- */
- int cHeight = alheight * charHeight + hgap
- + annotationHeight;
-
ViewportRanges ranges = alignViewport.getRanges();
int rowSize = ranges.getViewportWidth();
ViewportRanges ranges = alignViewport.getRanges();
int rowSize = ranges.getViewportWidth();
@@
-415,7
+406,7
@@
public class IdCanvas extends JPanel implements ViewportListenerI
* out of visible space, whichever comes first
*/
boolean hasHiddenRows = alignViewport.hasHiddenRows();
* out of visible space, whichever comes first
*/
boolean hasHiddenRows = alignViewport.hasHiddenRows();
- int ypos = hgap;
+ int ypos = seqCanvas.wrappedSpaceAboveAlignment;
int rowStartRes = ranges.getStartRes();
while ((ypos <= pageHeight) && (rowStartRes < alignmentWidth))
{
int rowStartRes = ranges.getStartRes();
while ((ypos <= pageHeight) && (rowStartRes < alignmentWidth))
{
@@
-430,7
+421,7
@@
public class IdCanvas extends JPanel implements ViewportListenerI
{
g.setFont(getIdfont());
}
{
g.setFont(getIdfont());
}
- drawIdString(g, hasHiddenRows, s, i, 0, ypos);
+ drawIdString(g, hasHiddenRows, s, i, 0, ypos, idWidth);
}
if (labels != null && alignViewport.isShowAnnotation())
}
if (labels != null && alignViewport.isShowAnnotation())
@@
-440,22
+431,23
@@
public class IdCanvas extends JPanel implements ViewportListenerI
g.translate(0, -ypos - (alheight * charHeight));
}
g.translate(0, -ypos - (alheight * charHeight));
}
- ypos += cHeight;
+ ypos += seqCanvas.wrappedRepeatHeightPx;
rowStartRes += rowSize;
}
}
/**
rowStartRes += rowSize;
}
}
/**
- * Draws a marker (a blue right-pointing triangle) between sequences to
- * indicate hidden sequences.
+ * Draws a marker (a blue right-pointing triangle) between sequences to indicate
+ * hidden sequences.
*
* @param g
* @param alignViewport
* @param seqIndex
* @param starty
* @param yoffset
*
* @param g
* @param alignViewport
* @param seqIndex
* @param starty
* @param yoffset
+ * @param idWidth
*/
*/
- void drawMarker(Graphics2D g, AlignViewport alignViewport, int seqIndex, int starty, int yoffset)
+ void drawMarker(Graphics2D g, AlignViewport alignViewport, int seqIndex, int starty, int yoffset, int idWidth)
{
SequenceI[] hseqs = alignViewport.getAlignment()
.getHiddenSequences().hiddenSequences;
{
SequenceI[] hseqs = alignViewport.getAlignment()
.getHiddenSequences().hiddenSequences;
@@
-498,9
+490,8
@@
public class IdCanvas extends JPanel implements ViewportListenerI
/*
* vertices of the triangle, below or above hidden seqs
*/
/*
* vertices of the triangle, below or above hidden seqs
*/
- int[] xPoints = new int[]
- { getWidth() - charHeight,
- getWidth() - charHeight, getWidth() };
+ int[] xPoints = new int[] { idWidth - charHeight, idWidth - charHeight,
+ idWidth };
int yShift = seqIndex - starty;
if (below)
int yShift = seqIndex - starty;
if (below)