From ea65828ca48c415700ebd130219c875b2e389dff Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Mon, 11 Sep 2006 11:30:23 +0000 Subject: [PATCH] getVisibleIdWidth() for making images --- src/jalview/gui/AlignmentPanel.java | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index ec5d956..366a36d 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -798,7 +798,7 @@ public class AlignmentPanel extends GAlignmentPanel public int printUnwrapped(Graphics pg, int pwidth, int pheight, int pi) throws PrinterException { - int idWidth = calculateIdWidth().width + 4; + int idWidth = getVisibleIdWidth(); FontMetrics fm = getFontMetrics(av.getFont()); int scaleHeight = av.charHeight + fm.getDescent(); @@ -810,6 +810,8 @@ public class AlignmentPanel extends GAlignmentPanel /// How many sequences and residues can we fit on a printable page? int totalRes = (pwidth - idWidth) / av.getCharWidth(); + System.out.println(totalRes); + int totalSeq = (int) ( (pheight - scaleHeight) / av.getCharHeight()) - 1; @@ -953,7 +955,7 @@ public class AlignmentPanel extends GAlignmentPanel + hgap + annotationHeight; - int idWidth = calculateIdWidth().width + 4; + int idWidth = getVisibleIdWidth(); int maxwidth = av.alignment.getWidth(); if (av.hasHiddenColumns) @@ -1026,6 +1028,13 @@ public class AlignmentPanel extends GAlignmentPanel } } + int getVisibleIdWidth() + { + return + idPanel.getWidth() > 0 ? idPanel.getWidth() : + calculateIdWidth().width + 4; + } + void makeAlignmentImage(int type, File file) { int maxwidth = av.alignment.getWidth(); @@ -1033,11 +1042,7 @@ public class AlignmentPanel extends GAlignmentPanel maxwidth = av.getColumnSelection().findColumnPosition(maxwidth); int height = ( (av.alignment.getHeight() + 1) * av.charHeight) + 30; - int width = idPanel.getWidth() + (maxwidth * av.charWidth); - if (idPanel.getWidth() == 0) - { - width += calculateIdWidth().getWidth() + 4; - } + int width = getVisibleIdWidth() + (maxwidth * av.charWidth); if (av.getWrapAlignment()) { @@ -1048,7 +1053,7 @@ public class AlignmentPanel extends GAlignmentPanel width = alignFrame.getWidth() - 22; } else - width = seqPanel.getWidth() + idPanel.getWidth(); + width = seqPanel.getWidth() + getVisibleIdWidth(); } else if (av.getShowAnnotation()) @@ -1128,7 +1133,7 @@ public class AlignmentPanel extends GAlignmentPanel { ///////ONLY WORKS WITH NONE WRAPPED ALIGNMENTS ////////////////////////////////////////////// - int idWidth = calculateIdWidth().width + 4; + int idWidth = getVisibleIdWidth(); FontMetrics fm = getFontMetrics(av.getFont()); int scaleHeight = av.charHeight + fm.getDescent(); @@ -1258,8 +1263,7 @@ public class AlignmentPanel extends GAlignmentPanel if (System.getProperty("java.awt.headless") != null && System.getProperty("java.awt.headless").equals("true")) { - int idWidth = calculateIdWidth().width + 4; - seqPanelWidth = alignFrame.getWidth() - idWidth; + seqPanelWidth = alignFrame.getWidth() - getVisibleIdWidth(); } int chunkWidth = seqPanel.seqCanvas.getWrappedCanvasWidth( -- 1.7.10.2