X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FIdCanvas.java;fp=src%2Fjalview%2Fgui%2FIdCanvas.java;h=35a932d7534b151f6183bb1ffb0b70c117a28631;hb=refs%2Fheads%2Ftrial_merge%2Fdevelop%2Fbug%2FJAL-247autoIdWidthSeqMarker;hp=a925227f2e1e60a3c0303ee5969abeae8d17108b;hpb=288103669810b098b56bcb4ae68f0d03d0ad36c2;p=jalview.git diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java index a925227..35a932d 100755 --- 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! + * DOCUMENT ME! * @param hiddenRows - * true - check and display hidden row marker if need be + * true - check and display hidden row marker if need be * @param s - * DOCUMENT ME! + * DOCUMENT ME! * @param i - * DOCUMENT ME! + * DOCUMENT ME! * @param starty - * DOCUMENT ME! + * DOCUMENT ME! * @param ypos - * DOCUMENT ME! + * DOCUMENT ME! + * @param idWidth */ 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(); @@ -139,7 +140,7 @@ public class IdCanvas extends JPanel implements ViewportListenerI if (hiddenRows && av.getShowHiddenMarkers()) { - 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); - drawIds(gg, av, ss, es, searchResults); + drawIds(gg, av, ss, es, searchResults, getWidth()); 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); - 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); } @@ -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 - * 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 idWidth */ void drawIds(Graphics2D g, AlignViewport alignViewport, final int startSeq, - final int endSeq, List selection) + final int endSeq, List selection, int idWidth) { Font font = alignViewport.getFont(); if (alignViewport.isSeqNameItalics()) @@ -299,7 +301,7 @@ public class IdCanvas extends JPanel implements ViewportListenerI if (alignViewport.getWrapAlignment()) { - drawIdsWrapped(g, alignViewport, startSeq, getHeight()); + drawIdsWrapped(g, alignViewport, startSeq, getHeight(), getWidth()); return; } @@ -361,7 +363,7 @@ public class IdCanvas extends JPanel implements ViewportListenerI if (hasHiddenRows && av.getShowHiddenMarkers()) { - drawMarker(g, alignViewport, i, startSeq, 0); + drawMarker(g, alignViewport, i, startSeq, 0, idWidth); } } } @@ -373,9 +375,10 @@ public class IdCanvas extends JPanel implements ViewportListenerI * @param g * @param alignViewport * @param startSeq + * @param idWidth */ 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(); @@ -418,7 +421,7 @@ public class IdCanvas extends JPanel implements ViewportListenerI { g.setFont(getIdfont()); } - drawIdString(g, hasHiddenRows, s, i, 0, ypos); + drawIdString(g, hasHiddenRows, s, i, 0, ypos, idWidth); } if (labels != null && alignViewport.isShowAnnotation()) @@ -434,16 +437,17 @@ public class IdCanvas extends JPanel implements ViewportListenerI } /** - * 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 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; @@ -486,9 +490,8 @@ public class IdCanvas extends JPanel implements ViewportListenerI /* * 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)