X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fgui%2FAlignmentPanel.java;h=b11838ce2473dbee03b7add60370998a907b96ec;hb=29f633ca27df2db2790b81b1ca346d6692d4936c;hp=13582572fee1f4955f04cb6c61e97e249cddce01;hpb=98eb909d0a4fe04ff6ad93f71086f1127fe4a530;p=jalview.git
diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java
index 1358257..b11838c 100755
--- a/src/jalview/gui/AlignmentPanel.java
+++ b/src/jalview/gui/AlignmentPanel.java
@@ -1,6 +1,6 @@
/*
* Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -18,25 +18,17 @@
*/
package jalview.gui;
-import jalview.datamodel.*;
-
-import jalview.jbgui.*;
-
-import jalview.schemes.*;
-
-import org.jibble.epsgraphics.*;
+import java.beans.*;
+import java.io.*;
import java.awt.*;
import java.awt.event.*;
-import java.awt.image.*;
import java.awt.print.*;
-
-import java.io.*;
-
-import javax.imageio.*;
-
import javax.swing.*;
+import jalview.datamodel.*;
+import jalview.jbgui.*;
+import jalview.schemes.*;
/**
* DOCUMENT ME!
@@ -44,1044 +36,1172 @@ import javax.swing.*;
* @author $author$
* @version $Revision$
*/
-public class AlignmentPanel extends GAlignmentPanel
- implements AdjustmentListener, Printable
+public class AlignmentPanel
+ extends GAlignmentPanel implements AdjustmentListener, Printable
{
- AlignViewport av;
- OverviewPanel overviewPanel;
- SeqPanel seqPanel;
- IdPanel idPanel;
- IdwidthAdjuster idwidthAdjuster;
-
- /** DOCUMENT ME!! */
- public AlignFrame alignFrame;
- ScalePanel scalePanel;
- AnnotationPanel annotationPanel;
- AnnotationLabels alabels;
-
- // this value is set false when selection area being dragged
- boolean fastPaint = true;
- int hextent = 0;
- int vextent = 0;
-
- /**
- * Creates a new AlignmentPanel object.
- *
- * @param af DOCUMENT ME!
- * @param av DOCUMENT ME!
- */
- public AlignmentPanel(AlignFrame af, final AlignViewport av)
+ public AlignViewport av;
+ OverviewPanel overviewPanel;
+ SeqPanel seqPanel;
+ IdPanel idPanel;
+ IdwidthAdjuster idwidthAdjuster;
+
+ /** DOCUMENT ME!! */
+ public AlignFrame alignFrame;
+ ScalePanel scalePanel;
+ AnnotationPanel annotationPanel;
+ AnnotationLabels alabels;
+
+ // this value is set false when selection area being dragged
+ boolean fastPaint = true;
+ int hextent = 0;
+ int vextent = 0;
+
+ /**
+ * Creates a new AlignmentPanel object.
+ *
+ * @param af DOCUMENT ME!
+ * @param av DOCUMENT ME!
+ */
+ public AlignmentPanel(AlignFrame af, final AlignViewport av)
+ {
+ alignFrame = af;
+ this.av = av;
+ seqPanel = new SeqPanel(av, this);
+ idPanel = new IdPanel(av, this);
+
+ scalePanel = new ScalePanel(av, this);
+
+ idPanelHolder.add(idPanel, BorderLayout.CENTER);
+ idwidthAdjuster = new IdwidthAdjuster(this);
+ idSpaceFillerPanel1.add(idwidthAdjuster, BorderLayout.CENTER);
+
+ annotationPanel = new AnnotationPanel(this);
+ alabels = new AnnotationLabels(this);
+
+ annotationScroller.setViewportView(annotationPanel);
+ annotationSpaceFillerHolder.add(alabels, BorderLayout.CENTER);
+
+ scalePanelHolder.add(scalePanel, BorderLayout.CENTER);
+ seqPanelHolder.add(seqPanel, BorderLayout.CENTER);
+
+ setScrollValues(0, 0);
+
+ setAnnotationVisible(av.getShowAnnotation());
+
+ hscroll.addAdjustmentListener(this);
+ vscroll.addAdjustmentListener(this);
+
+ final AlignmentPanel ap = this;
+ av.addPropertyChangeListener(new PropertyChangeListener()
{
- alignFrame = af;
- this.av = av;
- seqPanel = new SeqPanel(av, this);
- idPanel = new IdPanel(av, this);
+ public void propertyChange(PropertyChangeEvent evt)
+ {
+ if (evt.getPropertyName().equals("alignment"))
+ {
+ PaintRefresher.Refresh(ap,
+ av.getSequenceSetId(),
+ true,
+ true);
+ alignmentChanged();
+ }
+ }
+ });
- scalePanel = new ScalePanel(av, this);
+ fontChanged();
+ adjustAnnotationHeight();
- idPanelHolder.add(idPanel, BorderLayout.CENTER);
- idwidthAdjuster = new IdwidthAdjuster(this);
- idSpaceFillerPanel1.add(idwidthAdjuster, BorderLayout.CENTER);
+ }
- annotationPanel = new AnnotationPanel(this);
- alabels = new AnnotationLabels(this);
+ public void alignmentChanged()
+ {
+ av.alignmentChanged(this);
- annotationSpaceFillerHolder.setPreferredSize(annotationPanel.getPreferredSize());
- annotationScroller.setPreferredSize(annotationPanel.getPreferredSize());
- annotationScroller.setViewportView(annotationPanel);
- annotationSpaceFillerHolder.add(alabels, BorderLayout.CENTER);
+ alignFrame.updateEditMenuBar();
- fontChanged();
+ paintAlignment(true);
- scalePanelHolder.add(scalePanel, BorderLayout.CENTER);
- seqPanelHolder.add(seqPanel, BorderLayout.CENTER);
+ }
- setScrollValues(0, 0);
+ /**
+ * DOCUMENT ME!
+ */
+ public void fontChanged()
+ {
+ // set idCanvas bufferedImage to null
+ // to prevent drawing old image
+ FontMetrics fm = getFontMetrics(av.getFont());
- hscroll.addAdjustmentListener(this);
- vscroll.addAdjustmentListener(this);
+ scalePanelHolder.setPreferredSize(new Dimension(10,
+ av.charHeight + fm.getDescent()));
+ idSpaceFillerPanel1.setPreferredSize(new Dimension(10,
+ av.charHeight + fm.getDescent()));
- setFocusable(true);
- addKeyListener(new KeyAdapter()
- {
- public void keyPressed(KeyEvent evt)
- {
- switch (evt.getKeyCode())
- {
- case 27: // escape key
- av.setSelectionGroup(null);
- repaint();
+ idPanel.idCanvas.gg = null;
+ seqPanel.seqCanvas.img = null;
+ annotationPanel.adjustPanelHeight();
- break;
+ Dimension d = calculateIdWidth();
+ d.setSize(d.width + 4, d.height);
+ idPanel.idCanvas.setPreferredSize(d);
+ hscrollFillerPanel.setPreferredSize(d);
- case KeyEvent.VK_DOWN:
- alignFrame.moveSelectedSequences(false);
+ if (overviewPanel != null)
+ {
+ overviewPanel.setBoxPosition();
+ }
- break;
+ repaint();
+ }
- case KeyEvent.VK_UP:
- alignFrame.moveSelectedSequences(true);
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Dimension calculateIdWidth()
+ {
+ Container c = new Container();
- break;
+ FontMetrics fm = c.getFontMetrics(
+ new Font(av.font.getName(), Font.ITALIC, av.font.getSize()));
- case KeyEvent.VK_BACK_SPACE:
- case KeyEvent.VK_DELETE:
- alignFrame.cut_actionPerformed(null);
- break;
- }
+ AlignmentI al = av.getAlignment();
- }
- });
- }
+ int i = 0;
+ int idWidth = 0;
+ String id;
- /**
- * DOCUMENT ME!
- */
- public void fontChanged()
+ while ( (i < al.getHeight()) && (al.getSequenceAt(i) != null))
{
- // set idCanvas bufferedImage to null
- // to prevent drawing old image
- FontMetrics fm = getFontMetrics(av.getFont());
-
- scalePanelHolder.setPreferredSize(new Dimension(10,
- av.charHeight + fm.getDescent()));
- idSpaceFillerPanel1.setPreferredSize(new Dimension(10,
- av.charHeight + fm.getDescent()));
+ SequenceI s = al.getSequenceAt(i);
- idPanel.idCanvas.gg = null;
- seqPanel.seqCanvas.img = null;
- annotationPanel.adjustPanelHeight();
-
- Dimension d = calculateIdWidth();
- d.setSize(d.width + 4, d.height);
- idPanel.idCanvas.setPreferredSize(d);
- hscrollFillerPanel.setPreferredSize(d);
-
- if (av.getWrapAlignment())
- {
- int max = av.alignment.getWidth() /
- seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth());
- vscroll.setMaximum(max);
- vscroll.setUnitIncrement(1);
- vscroll.setVisibleAmount(1);
- }
- else
- {
- setScrollValues(av.getStartRes(), av.getStartSeq());
- }
+ id = s.getDisplayId(av.getShowJVSuffix());
- if(overviewPanel!=null)
- overviewPanel.setBoxPosition();
+ if (fm.stringWidth(id) > idWidth)
+ {
+ idWidth = fm.stringWidth(id);
+ }
- repaint();
+ i++;
}
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public Dimension calculateIdWidth()
- {
- Container c = new Container();
+ // Also check annotation label widths
+ i = 0;
- FontMetrics fm = c.getFontMetrics(av.font);
- AlignmentI al = av.getAlignment();
+ if (al.getAlignmentAnnotation() != null)
+ {
+ fm = c.getFontMetrics(alabels.getFont());
- int i = 0;
- int idWidth = 0;
- String id;
+ while (i < al.getAlignmentAnnotation().length)
+ {
+ String label = al.getAlignmentAnnotation()[i].label;
- while ((i < al.getHeight()) && (al.getSequenceAt(i) != null))
+ if (fm.stringWidth(label) > idWidth)
{
- SequenceI s = al.getSequenceAt(i);
-
- if (av.getShowFullId())
- {
- id = s.getDisplayId();
- }
- else
- {
- id = s.getName();
- }
-
- if (fm.stringWidth(id) > idWidth)
- {
- idWidth = fm.stringWidth(id);
- }
-
- i++;
+ idWidth = fm.stringWidth(label);
}
- // Also check annotation label widths
- i = 0;
-
- if (al.getAlignmentAnnotation() != null)
- {
- fm = c.getFontMetrics(alabels.getFont());
-
- while (i < al.getAlignmentAnnotation().length)
- {
- String label = al.getAlignmentAnnotation()[i].label;
-
- if (fm.stringWidth(label) > idWidth)
- {
- idWidth = fm.stringWidth(label);
- }
+ i++;
+ }
+ }
- i++;
- }
- }
+ return new Dimension(idWidth, 12);
+ }
- return new Dimension(idWidth, 12);
- }
+ /**
+ * DOCUMENT ME!
+ *
+ * @param results DOCUMENT ME!
+ */
+ public void highlightSearchResults(SearchResults results)
+ {
+ seqPanel.seqCanvas.highlightSearchResults(results);
- /**
- * DOCUMENT ME!
- *
- * @param results DOCUMENT ME!
- */
- public void highlightSearchResults(int[] results)
+ // do we need to scroll the panel?
+ if (results != null)
{
- seqPanel.seqCanvas.highlightSearchResults(results);
+ SequenceI seq = results.getResultSequence(0);
+ int seqIndex = av.alignment.findIndex(seq);
+ int start = seq.findIndex(results.getResultStart(0)) - 1;
+ int end = seq.findIndex(results.getResultEnd(0)) - 1;
- // do we need to scroll the panel?
- if (results != null)
+ if (!av.wrapAlignment)
+ {
+ if ( (av.getStartRes() > end) || (av.getEndRes() < start) ||
+ ( (av.getStartSeq() > seqIndex) || (av.getEndSeq() < seqIndex)))
{
- SequenceI seq = av.alignment.getSequenceAt(results[0]);
- int start = seq.findIndex(results[1]) - 1;
- int end = seq.findIndex(results[2]) - 1;
-
- if ((av.getStartRes() > start) || (av.getEndRes() < end) ||
- ((av.getStartSeq() > results[0]) ||
- (av.getEndSeq() < results[0])))
- {
- setScrollValues(start, results[0]);
- }
+ setScrollValues(start, seqIndex);
}
+ }
+ else
+ {
+ scrollToWrappedVisible(start);
+ }
}
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public OverviewPanel getOverviewPanel()
+ paintAlignment(true);
+ }
+
+ void scrollToWrappedVisible(int res)
+ {
+ int cwidth = seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.
+ getWidth());
+ if (res <= av.getStartRes() || res >= (av.getStartRes() + cwidth))
{
- return overviewPanel;
+ vscroll.setValue(res / cwidth);
+ av.startRes = vscroll.getValue() * cwidth;
}
-
- /**
- * DOCUMENT ME!
- *
- * @param op DOCUMENT ME!
- */
- public void setOverviewPanel(OverviewPanel op)
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public OverviewPanel getOverviewPanel()
+ {
+ return overviewPanel;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param op DOCUMENT ME!
+ */
+ public void setOverviewPanel(OverviewPanel op)
+ {
+ overviewPanel = op;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param b DOCUMENT ME!
+ */
+ public void setAnnotationVisible(boolean b)
+ {
+ if (!av.wrapAlignment)
{
- overviewPanel = op;
+ annotationSpaceFillerHolder.setVisible(b);
+ annotationScroller.setVisible(b);
}
+ repaint();
+ }
- /**
- * DOCUMENT ME!
- *
- * @param b DOCUMENT ME!
- */
- public void setAnnotationVisible(boolean b)
+ public void adjustAnnotationHeight()
+ {
+ if (alignFrame.getHeight() == 0)
{
- annotationSpaceFillerHolder.setVisible(b);
- annotationScroller.setVisible(b);
+ System.out.println("NEEDS FIXING");
}
- /**
- * DOCUMENT ME!
- *
- * @param wrap DOCUMENT ME!
- */
- public void setWrapAlignment(boolean wrap)
+ int height = annotationPanel.adjustPanelHeight();
+
+ if (hscroll.isVisible())
{
- av.startSeq = 0;
- scalePanelHolder.setVisible(!wrap);
- hscroll.setVisible(!wrap);
- idwidthAdjuster.setVisible(!wrap);
-
- if(wrap)
- {
- annotationScroller.setVisible(false);
- annotationSpaceFillerHolder.setVisible(false);
- }
- else if(av.showAnnotation)
- {
- annotationScroller.setVisible(true);
- annotationSpaceFillerHolder.setVisible(true);
- }
-
- idSpaceFillerPanel1.setVisible(!wrap);
-
- repaint();
+ height += hscroll.getPreferredSize().height;
+ }
+ if (height > alignFrame.getHeight() / 2)
+ {
+ height = alignFrame.getHeight() / 2;
}
+ hscroll.addNotify();
- // return value is true if the scroll is valid
- public boolean scrollUp(boolean up)
- {
- if (up)
- {
- if (vscroll.getValue() < 1)
- {
- return false;
- }
+ annotationScroller.setPreferredSize(
+ new Dimension(annotationScroller.getWidth(), height));
- fastPaint = false;
- vscroll.setValue(vscroll.getValue() - 1);
- }
- else
- {
- if ((vextent + vscroll.getValue()) >= av.getAlignment().getHeight())
- {
- return false;
- }
- fastPaint = false;
- vscroll.setValue(vscroll.getValue() + 1);
- }
+ annotationSpaceFillerHolder.setPreferredSize(new Dimension(
+ annotationSpaceFillerHolder.getWidth(),
+ height));
- fastPaint = true;
+ repaint();
+ }
- return true;
- }
+ /**
+ * DOCUMENT ME!
+ *
+ * @param wrap DOCUMENT ME!
+ */
+ public void setWrapAlignment(boolean wrap)
+ {
+ av.startSeq = 0;
+ scalePanelHolder.setVisible(!wrap);
+ hscroll.setVisible(!wrap);
+ idwidthAdjuster.setVisible(!wrap);
- /**
- * DOCUMENT ME!
- *
- * @param right DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public boolean scrollRight(boolean right)
+ if (wrap)
{
- if (right)
- {
- if (hscroll.getValue() < 1)
- {
- return false;
- }
+ annotationScroller.setVisible(false);
+ annotationSpaceFillerHolder.setVisible(false);
+ }
+ else if (av.showAnnotation)
+ {
+ annotationScroller.setVisible(true);
+ annotationSpaceFillerHolder.setVisible(true);
+ }
- fastPaint = false;
- hscroll.setValue(hscroll.getValue() - 1);
- }
- else
- {
- if ((hextent + hscroll.getValue()) >= av.getAlignment().getWidth())
- {
- return false;
- }
+ idSpaceFillerPanel1.setVisible(!wrap);
- fastPaint = false;
- hscroll.setValue(hscroll.getValue() + 1);
- }
+ repaint();
+ }
+
+ // return value is true if the scroll is valid
+ public boolean scrollUp(boolean up)
+ {
+ if (up)
+ {
+ if (vscroll.getValue() < 1)
+ {
+ return false;
+ }
- fastPaint = true;
+ fastPaint = false;
+ vscroll.setValue(vscroll.getValue() - 1);
+ }
+ else
+ {
+ if ( (vextent + vscroll.getValue()) >= av.getAlignment().getHeight())
+ {
+ return false;
+ }
- return true;
+ fastPaint = false;
+ vscroll.setValue(vscroll.getValue() + 1);
}
- /**
- * DOCUMENT ME!
- *
- * @param x DOCUMENT ME!
- * @param y DOCUMENT ME!
- */
- public void setScrollValues(int x, int y)
+ fastPaint = true;
+
+ return true;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param right DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public boolean scrollRight(boolean right)
+ {
+ if (!right)
{
- av.setEndRes((x + (seqPanel.seqCanvas.getWidth() / av.getCharWidth())) -
- 1);
+ if (hscroll.getValue() < 1)
+ {
+ return false;
+ }
- hextent = seqPanel.seqCanvas.getWidth() / av.charWidth;
- vextent = seqPanel.seqCanvas.getHeight() / av.charHeight;
+ fastPaint = false;
+ hscroll.setValue(hscroll.getValue() - 1);
+ }
+ else
+ {
+ if ( (hextent + hscroll.getValue()) >= av.getAlignment().getWidth())
+ {
+ return false;
+ }
- if (hextent > av.alignment.getWidth())
- {
- hextent = av.alignment.getWidth();
- }
+ fastPaint = false;
+ hscroll.setValue(hscroll.getValue() + 1);
+ }
- if (vextent > av.alignment.getHeight())
- {
- vextent = av.alignment.getHeight();
- }
+ fastPaint = true;
- if ((hextent + x) > av.getAlignment().getWidth())
- {
- x = av.getAlignment().getWidth() - hextent;
- }
+ return true;
+ }
- if ((vextent + y) > av.getAlignment().getHeight())
- {
- y = av.getAlignment().getHeight() - vextent;
- }
+ /**
+ * DOCUMENT ME!
+ *
+ * @param x DOCUMENT ME!
+ * @param y DOCUMENT ME!
+ */
+ public void setScrollValues(int x, int y)
+ {
- if (y < 0)
- {
- y = 0;
- }
+ int width = av.alignment.getWidth();
+ int height = av.alignment.getHeight();
- if (x < 0)
- {
- x = 0;
- }
+ if (av.hasHiddenColumns)
+ {
+ width = av.getColumnSelection().findColumnPosition(width);
+ }
- hscroll.setValues(x, hextent, 0, av.getAlignment().getWidth());
- vscroll.setValues(y, vextent, 0, av.getAlignment().getHeight());
+ av.setEndRes( (x + (seqPanel.seqCanvas.getWidth() / av.charWidth)) - 1);
+
+ hextent = seqPanel.seqCanvas.getWidth() / av.charWidth;
+ vextent = seqPanel.seqCanvas.getHeight() / av.charHeight;
+
+ if (hextent > width)
+ {
+ hextent = width;
}
+ if (vextent > height)
+ {
+ vextent = height;
+ }
- /**
- * DOCUMENT ME!
- *
- * @param evt DOCUMENT ME!
- */
- public void adjustmentValueChanged(AdjustmentEvent evt)
+ if ( (hextent + x) > width)
{
+ x = width - hextent;
+ }
- int oldX = av.getStartRes();
- int oldY = av.getStartSeq();
+ if ( (vextent + y) > height)
+ {
+ y = height - vextent;
+ }
- if (evt.getSource() == hscroll)
- {
- int x = hscroll.getValue();
- av.setStartRes(x);
- av.setEndRes((x +
- (seqPanel.seqCanvas.getWidth() / av.getCharWidth())) - 1);
- }
+ if (y < 0)
+ {
+ y = 0;
+ }
- if (evt.getSource() == vscroll)
- {
- int offy = vscroll.getValue();
+ if (x < 0)
+ {
+ x = 0;
+ }
- if (av.getWrapAlignment())
- {
- int rowSize = seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth());
- av.setStartRes(vscroll.getValue() * rowSize);
- av.setEndRes((vscroll.getValue() + 1) * rowSize);
- }
- else
- {
- av.setStartSeq(offy);
- av.setEndSeq(offy +
- (seqPanel.seqCanvas.getHeight() / av.getCharHeight()));
- }
- }
+ hscroll.setValues(x, hextent, 0, width);
+ vscroll.setValues(y, vextent, 0, height);
+ }
- if (overviewPanel != null)
- {
- overviewPanel.setBoxPosition();
- }
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void adjustmentValueChanged(AdjustmentEvent evt)
+ {
+
+ int oldX = av.getStartRes();
+ int oldY = av.getStartSeq();
- int xShift = av.getStartRes() - oldX;
- int yShift = av.getStartSeq() - oldY;
+ if (evt.getSource() == hscroll)
+ {
+ int x = hscroll.getValue();
+ av.setStartRes(x);
+ av.setEndRes( (x +
+ (seqPanel.seqCanvas.getWidth() / av.getCharWidth())) - 1);
+ }
+
+ if (evt.getSource() == vscroll)
+ {
+ int offy = vscroll.getValue();
- if ( (xShift != 0 && yShift != 0) ||
- (Math.abs(xShift) > av.getEndRes() - av.getStartRes()
- || Math.abs(yShift) > av.getEndSeq() - av.getStartSeq())
- || av.getWrapAlignment()
- || !fastPaint)
+ if (av.getWrapAlignment())
+ {
+ if (offy > -1)
{
- // Either no shift at all, or shift greater than visible amount
- repaint();
+ int rowSize = seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.
+ seqCanvas.getWidth());
+ av.setStartRes(offy * rowSize);
+ av.setEndRes( (offy + 1) * rowSize);
}
else
{
- idPanel.idCanvas.fastPaint(yShift);
- seqPanel.seqCanvas.fastPaint(xShift, yShift);
-
- scalePanel.repaint();
-
- if (av.getShowAnnotation())
+ //This is only called if file loaded is a jar file that
+ //was wrapped when saved and user has wrap alignment true
+ //as preference setting
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
{
- annotationPanel.fastPaint(xShift);
+ setScrollValues(av.getStartRes(), av.getStartSeq());
}
+ });
}
+ }
+ else
+ {
+ av.setStartSeq(offy);
+ av.setEndSeq(offy +
+ (seqPanel.seqCanvas.getHeight() / av.getCharHeight()));
+ }
}
- /**
- * DOCUMENT ME!
- *
- * @param g DOCUMENT ME!
- */
- public void paintComponent(Graphics g)
+ if (overviewPanel != null)
{
- invalidate();
+ overviewPanel.setBoxPosition();
+ }
- Dimension d = idPanel.idCanvas.getPreferredSize();
- idPanelHolder.setPreferredSize(d);
- hscrollFillerPanel.setPreferredSize(new Dimension(d.width, 12));
- validate();
+ int scrollX = av.startRes - oldX;
+ int scrollY = av.startSeq - oldY;
- if (av.getWrapAlignment())
- {
- int max = av.alignment.getWidth() / seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth());
- vscroll.setMaximum(max);
- vscroll.setUnitIncrement(1);
- vscroll.setVisibleAmount(1);
- }
- else
- {
- setScrollValues(av.getStartRes(), av.getStartSeq());
- }
+ if (av.getWrapAlignment() || !fastPaint)
+ {
+ repaint();
}
-
- /**
- * DOCUMENT ME!
- *
- * @param pg DOCUMENT ME!
- * @param pf DOCUMENT ME!
- * @param pi DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws PrinterException DOCUMENT ME!
- */
- public int print(Graphics pg, PageFormat pf, int pi)
- throws PrinterException
+ else
{
- pg.translate((int) pf.getImageableX(), (int) pf.getImageableY());
+ // Make sure we're not trying to draw a panel
+ // larger than the visible window
+ if (scrollX > av.endRes - av.startRes)
+ {
+ scrollX = av.endRes - av.startRes;
+ }
+ else if (scrollX < av.startRes - av.endRes)
+ {
+ scrollX = av.startRes - av.endRes;
+ }
- int pwidth = (int) pf.getImageableWidth();
- int pheight = (int) pf.getImageableHeight();
+ if (scrollX != 0 || scrollY != 0)
+ {
+ idPanel.idCanvas.fastPaint(scrollY);
+ seqPanel.seqCanvas.fastPaint(scrollX,
+ scrollY);
+ scalePanel.repaint();
- if (av.getWrapAlignment())
- {
- return printWrappedAlignment(pg, pwidth, pheight, pi);
- }
- else
+ if (av.getShowAnnotation())
{
- return printUnwrapped(pg, pwidth, pheight, pi);
+ annotationPanel.fastPaint(scrollX);
}
+ }
}
+ }
- /**
- * DOCUMENT ME!
- *
- * @param pg DOCUMENT ME!
- * @param pwidth DOCUMENT ME!
- * @param pheight DOCUMENT ME!
- * @param pi DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws PrinterException DOCUMENT ME!
- */
- public int printUnwrapped(Graphics pg, int pwidth, int pheight, int pi)
- throws PrinterException
+ public void paintAlignment(boolean updateOverview)
+ {
+ repaint();
+
+ if(updateOverview)
{
- int idWidth = calculateIdWidth().width + 4;
- FontMetrics fm = getFontMetrics(av.getFont());
- int scaleHeight = av.charHeight + fm.getDescent();
+ jalview.structure.StructureSelectionManager.getStructureSelectionManager()
+ .sequenceColoursChanged(this);
- pg.setColor(Color.white);
- pg.fillRect(0, 0, pwidth, pheight);
- pg.setFont(av.getFont());
+ if (overviewPanel != null)
+ {
+ overviewPanel.updateOverviewImage();
+ }
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param g DOCUMENT ME!
+ */
+ public void paintComponent(Graphics g)
+ {
+ invalidate();
+
+ Dimension d = idPanel.idCanvas.getPreferredSize();
+ idPanelHolder.setPreferredSize(d);
+ hscrollFillerPanel.setPreferredSize(new Dimension(d.width, 12));
+ validate();
+
+ if (av.getWrapAlignment())
+ {
+ int maxwidth = av.alignment.getWidth();
- ////////////////////////////////////
- /// How many sequences and residues can we fit on a printable page?
- int totalRes = (pwidth - idWidth) / av.getCharWidth();
+ if (av.hasHiddenColumns)
+ {
+ maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
+ }
- int totalSeq = (int) ((pheight - scaleHeight) / av.getCharHeight()) -
+ int canvasWidth = seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.
+ seqCanvas.getWidth());
+ if (canvasWidth > 0)
+ {
+ int max = maxwidth /
+ seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.
+ getWidth()) +
1;
+ vscroll.setMaximum(max);
+ vscroll.setUnitIncrement(1);
+ vscroll.setVisibleAmount(1);
+ }
+ }
+ else
+ {
+ setScrollValues(av.getStartRes(), av.getStartSeq());
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param pg DOCUMENT ME!
+ * @param pf DOCUMENT ME!
+ * @param pi DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ *
+ * @throws PrinterException DOCUMENT ME!
+ */
+ public int print(Graphics pg, PageFormat pf, int pi)
+ throws PrinterException
+ {
+ pg.translate( (int) pf.getImageableX(), (int) pf.getImageableY());
+
+ int pwidth = (int) pf.getImageableWidth();
+ int pheight = (int) pf.getImageableHeight();
+
+ if (av.getWrapAlignment())
+ {
+ return printWrappedAlignment(pg, pwidth, pheight, pi);
+ }
+ else
+ {
+ return printUnwrapped(pg, pwidth, pheight, pi);
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param pg DOCUMENT ME!
+ * @param pwidth DOCUMENT ME!
+ * @param pheight DOCUMENT ME!
+ * @param pi DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ *
+ * @throws PrinterException DOCUMENT ME!
+ */
+ public int printUnwrapped(Graphics pg, int pwidth, int pheight, int pi)
+ throws PrinterException
+ {
+ int idWidth = getVisibleIdWidth();
+ FontMetrics fm = getFontMetrics(av.getFont());
+ int scaleHeight = av.charHeight + fm.getDescent();
+
+ pg.setColor(Color.white);
+ pg.fillRect(0, 0, pwidth, pheight);
+ pg.setFont(av.getFont());
+
+ ////////////////////////////////////
+ /// How many sequences and residues can we fit on a printable page?
+ int totalRes = (pwidth - idWidth) / av.getCharWidth();
+
+ int totalSeq = (int) ( (pheight - scaleHeight) / av.getCharHeight()) -
+ 1;
+
+ int pagesWide = (av.getAlignment().getWidth() / totalRes) + 1;
+
+ /////////////////////////////
+ /// Only print these sequences and residues on this page
+ int startRes;
+
+ /////////////////////////////
+ /// Only print these sequences and residues on this page
+ int endRes;
+
+ /////////////////////////////
+ /// Only print these sequences and residues on this page
+ int startSeq;
+
+ /////////////////////////////
+ /// Only print these sequences and residues on this page
+ int endSeq;
+ startRes = (pi % pagesWide) * totalRes;
+ endRes = (startRes + totalRes) - 1;
+
+ if (endRes > (av.getAlignment().getWidth() - 1))
+ {
+ endRes = av.getAlignment().getWidth() - 1;
+ }
- int pagesWide = (av.getAlignment().getWidth() / totalRes) + 1;
-
- /////////////////////////////
- /// Only print these sequences and residues on this page
- int startRes;
+ startSeq = (pi / pagesWide) * totalSeq;
+ endSeq = startSeq + totalSeq;
- /////////////////////////////
- /// Only print these sequences and residues on this page
- int endRes;
+ if (endSeq > av.getAlignment().getHeight())
+ {
+ endSeq = av.getAlignment().getHeight();
+ }
- /////////////////////////////
- /// Only print these sequences and residues on this page
- int startSeq;
+ int pagesHigh = ( (av.alignment.getHeight() / totalSeq) + 1) * pheight;
- /////////////////////////////
- /// Only print these sequences and residues on this page
- int endSeq;
- startRes = (pi % pagesWide) * totalRes;
- endRes = (startRes + totalRes) - 1;
+ if (av.showAnnotation)
+ {
+ pagesHigh += annotationPanel.adjustPanelHeight() + 3;
+ }
- if (endRes > (av.getAlignment().getWidth() - 1))
- {
- endRes = av.getAlignment().getWidth() - 1;
- }
+ pagesHigh /= pheight;
- startSeq = (pi / pagesWide) * totalSeq;
- endSeq = startSeq + totalSeq;
+ if (pi >= (pagesWide * pagesHigh))
+ {
+ return Printable.NO_SUCH_PAGE;
+ }
- if (endSeq > av.getAlignment().getHeight())
- {
- endSeq = av.getAlignment().getHeight();
- }
+ //draw Scale
+ pg.translate(idWidth, 0);
+ scalePanel.drawScale(pg, startRes, endRes, pwidth - idWidth, scaleHeight);
+ pg.translate( -idWidth, scaleHeight);
- int pagesHigh = ((av.alignment.getHeight() / totalSeq) + 1) * pheight;
+ ////////////////
+ // Draw the ids
+ Color currentColor = null;
+ Color currentTextColor = null;
- if (av.showAnnotation)
- {
- pagesHigh += annotationPanel.getHeight();
- }
+ pg.setFont(idPanel.idCanvas.idfont);
- pagesHigh /= pheight;
+ SequenceI seq;
+ for (int i = startSeq; i < endSeq; i++)
+ {
+ seq = av.getAlignment().getSequenceAt(i);
+ if ( (av.getSelectionGroup() != null) &&
+ av.getSelectionGroup().getSequences(null).contains(seq))
+ {
+ currentColor = Color.gray;
+ currentTextColor = Color.black;
+ }
+ else
+ {
+ currentColor = av.getSequenceColour(seq);
+ currentTextColor = Color.black;
+ }
- if (pi >= (pagesWide * pagesHigh))
- {
- return Printable.NO_SUCH_PAGE;
- }
+ pg.setColor(currentColor);
+ pg.fillRect(0, (i - startSeq) * av.charHeight, idWidth,
+ av.getCharHeight());
- //draw Scale
- pg.translate(idWidth, 0);
- scalePanel.drawScale(pg, startRes, endRes, pwidth - idWidth, scaleHeight);
- pg.translate(-idWidth, scaleHeight);
+ pg.setColor(currentTextColor);
- ////////////////
- // Draw the ids
- Color currentColor = null;
- Color currentTextColor = null;
+ int xPos = 0;
+ if (av.rightAlignIds)
+ {
+ fm = pg.getFontMetrics();
+ xPos = idWidth - fm.stringWidth(
+ seq.getDisplayId(av.getShowJVSuffix())
+ ) - 4;
+ }
- for (int i = startSeq; i < endSeq; i++)
- {
- if ((av.getSelectionGroup() != null) &&
- av.getSelectionGroup().sequences.contains(
- av.getAlignment().getSequenceAt(i)))
- {
- currentColor = Color.gray;
- currentTextColor = Color.black;
- }
- else
- {
- currentColor = av.getAlignment().getSequenceAt(i).getColor();
- currentTextColor = Color.black;
- }
+ pg.drawString(seq.getDisplayId(av.getShowJVSuffix()),
+ xPos,
+ ( ( (i - startSeq) * av.charHeight) + av.getCharHeight()) -
+ (av.getCharHeight() / 5));
+ }
- pg.setColor(currentColor);
- pg.fillRect(0, (i-startSeq) * av.charHeight, idWidth,
- av.getCharHeight());
+ pg.setFont(av.getFont());
- pg.setColor(currentTextColor);
+ // draw main sequence panel
+ pg.translate(idWidth, 0);
+ seqPanel.seqCanvas.drawPanel(pg, startRes, endRes, startSeq, endSeq, 0);
- String string = av.getAlignment().getSequenceAt(i).getName();
+ if (av.showAnnotation && (endSeq == av.alignment.getHeight()))
+ {
+ pg.translate( -idWidth - 3, (endSeq - startSeq) * av.charHeight + 3);
+ alabels.drawComponent( (Graphics2D) pg, idWidth);
+ pg.translate(idWidth + 3, 0);
+ annotationPanel.drawComponent( (Graphics2D) pg, startRes, endRes +
+ 1);
+ }
- if (av.getShowFullId())
- {
- string = av.getAlignment().getSequenceAt(i).getDisplayId();
- }
+ return Printable.PAGE_EXISTS;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param pg DOCUMENT ME!
+ * @param pwidth DOCUMENT ME!
+ * @param pheight DOCUMENT ME!
+ * @param pi DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ *
+ * @throws PrinterException DOCUMENT ME!
+ */
+ public int printWrappedAlignment(Graphics pg, int pwidth, int pheight,
+ int pi)
+ throws PrinterException
+ {
+
+ int annotationHeight = 0;
+ AnnotationLabels labels = null;
+ if (av.showAnnotation)
+ {
+ annotationHeight = annotationPanel.adjustPanelHeight();
+ labels = new AnnotationLabels(av);
+ }
- pg.drawString(string, 0,
- (((i-startSeq) * av.charHeight) + av.getCharHeight()) -
- (av.getCharHeight() / 5));
- }
+ int hgap = av.charHeight;
+ if (av.scaleAboveWrapped)
+ {
+ hgap += av.charHeight;
+ }
- // draw main sequence panel
- pg.translate(idWidth, 0);
- seqPanel.seqCanvas.drawPanel(pg, startRes, endRes, startSeq, endSeq,
- startRes, startSeq, 0);
+ int cHeight = av.getAlignment().getHeight() * av.charHeight
+ + hgap
+ + annotationHeight;
- if (av.showAnnotation && (endSeq == av.alignment.getHeight()))
- {
- pg.translate(-idWidth, (endSeq - startSeq) * av.charHeight);
- alabels.drawComponent((Graphics2D) pg);
- pg.translate(idWidth, 0);
- annotationPanel.drawComponent((Graphics2D) pg, startRes, endRes +
- 1);
- }
+ int idWidth = getVisibleIdWidth();
- return Printable.PAGE_EXISTS;
+ int maxwidth = av.alignment.getWidth();
+ if (av.hasHiddenColumns)
+ {
+ maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
- /**
- * DOCUMENT ME!
- *
- * @param pg DOCUMENT ME!
- * @param pwidth DOCUMENT ME!
- * @param pheight DOCUMENT ME!
- * @param pi DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- *
- * @throws PrinterException DOCUMENT ME!
- */
- public int printWrappedAlignment(Graphics pg, int pwidth, int pheight,
- int pi) throws PrinterException
- {
- int idWidth = calculateIdWidth().width + 4;
+ int resWidth = seqPanel.seqCanvas.getWrappedCanvasWidth(pwidth -
+ idWidth);
- int resWidth = seqPanel.seqCanvas.getWrappedCanvasWidth(pwidth -
- idWidth);
- int totalHeight = totalHeight = (av.alignment.getHeight() + 2) * ((av.alignment.getWidth() / resWidth) +
- 1) * av.charHeight;
+ int totalHeight = cHeight * (maxwidth / resWidth + 1);
- pg.setColor(Color.white);
- pg.fillRect(0, 0, pwidth, pheight);
- pg.setFont(av.getFont());
+ pg.setColor(Color.white);
+ pg.fillRect(0, 0, pwidth, pheight);
+ pg.setFont(av.getFont());
- ////////////////
- // Draw the ids
- pg.setColor(Color.black);
+ ////////////////
+ // Draw the ids
+ pg.setColor(Color.black);
- pg.translate(0, -pi * pheight);
+ pg.translate(0, -pi * pheight);
- pg.setClip(0, pi * pheight, pwidth, pheight);
+ pg.setClip(0, pi * pheight, pwidth, pheight);
- int ypos = 2 * av.charHeight;
+ int ypos = hgap;
- do
+ do
+ {
+ for (int i = 0; i < av.alignment.getHeight(); i++)
+ {
+ pg.setFont(idPanel.idCanvas.idfont);
+ SequenceI s = av.alignment.getSequenceAt(i);
+ String string = s.getDisplayId(av.getShowJVSuffix());
+ int xPos = 0;
+ if (av.rightAlignIds)
{
- for (int i = 0; i < av.alignment.getHeight(); i++)
- {
- SequenceI s = av.alignment.getSequenceAt(i);
- String string = s.getName();
+ FontMetrics fm = pg.getFontMetrics();
+ xPos = idWidth - fm.stringWidth(string) - 4;
+ }
+ pg.drawString(string, xPos,
+ ( (i * av.charHeight) + ypos + av.charHeight) -
+ (av.charHeight / 5));
+ }
+ if (labels != null)
+ {
+ pg.translate( -3,
+ ypos +
+ (av.getAlignment().getHeight() * av.charHeight));
- if (av.getShowFullId())
- {
- string = s.getDisplayId();
- }
+ pg.setFont(av.getFont());
+ labels.drawComponent(pg, idWidth);
+ pg.translate( +3,
+ -ypos -
+ (av.getAlignment().getHeight() * av.charHeight));
+ }
- pg.drawString(string, 0,
- ((i * av.charHeight) + ypos + av.charHeight) -
- (av.charHeight / 5));
- }
+ ypos += cHeight;
+ }
+ while (ypos < totalHeight);
- ypos += ((av.alignment.getHeight() + 2) * av.charHeight);
- }
- while (ypos < totalHeight);
+ pg.translate(idWidth, 0);
- pg.translate(idWidth, 0);
+ seqPanel.seqCanvas.drawWrappedPanel(pg, pwidth - idWidth, totalHeight, 0);
- seqPanel.seqCanvas.drawWrappedPanel(pg, pwidth - idWidth, totalHeight, 0);
+ if ( (pi * pheight) < totalHeight)
+ {
+ return Printable.PAGE_EXISTS;
- if ((pi * pheight) < totalHeight)
- {
- return Printable.PAGE_EXISTS;
- }
- else
- {
- return Printable.NO_SUCH_PAGE;
- }
}
-
- /**
- * DOCUMENT ME!
- */
- public void makeEPS(File epsFile)
+ else
{
- boolean accurateText = true;
+ return Printable.NO_SUCH_PAGE;
+ }
+ }
+
+ int getVisibleIdWidth()
+ {
+ return
+ idPanel.getWidth() > 0 ? idPanel.getWidth() :
+ calculateIdWidth().width + 4;
+ }
+
+ void makeAlignmentImage(int type, File file)
+ {
+ int maxwidth = av.alignment.getWidth();
+ if (av.hasHiddenColumns)
+ {
+ maxwidth = av.getColumnSelection().findColumnPosition(maxwidth);
+ }
- String renderStyle = jalview.bin.Cache.getDefault("EPS_RENDERING",
- "Prompt each time");
+ int height = ( (av.alignment.getHeight() + 1) * av.charHeight)
+ + scalePanel.getHeight();
+ int width = getVisibleIdWidth() + (maxwidth * av.charWidth);
- // If we need to prompt, and if the GUI is visible then
- // Prompt for EPS rendering style
- if (renderStyle.equalsIgnoreCase("Prompt each time")
- && !
- (System.getProperty("java.awt.headless") != null
- && System.getProperty("java.awt.headless").equals("true")))
+ if (av.getWrapAlignment())
+ {
+ height = getWrappedHeight();
+ if (System.getProperty("java.awt.headless") != null
+ && System.getProperty("java.awt.headless").equals("true"))
{
- EPSOptions eps = new EPSOptions();
- renderStyle = eps.getValue();
-
- if(eps.cancelled || renderStyle==null)
- return;
-
- renderStyle = eps.getValue();
+ width = alignFrame.getWidth()
+ - vscroll.getPreferredSize().width
+ - alignFrame.getInsets().left
+ - alignFrame.getInsets().right;
}
-
- if (renderStyle.equalsIgnoreCase("text"))
+ else
{
- accurateText = false;
+ width = seqPanel.getWidth() + getVisibleIdWidth();
}
+ }
+ else if (av.getShowAnnotation())
+ {
+ height += annotationPanel.adjustPanelHeight() + 3;
+ }
- if(epsFile == null)
- {
- jalview.io.JalviewFileChooser chooser = new jalview.io.
- JalviewFileChooser(jalview.bin.Cache.getProperty(
- "LAST_DIRECTORY"), new String[]
- {"eps"},
- new String[]
- {"Encapsulated Postscript"},
- "Encapsulated Postscript");
- chooser.setFileView(new jalview.io.JalviewFileView());
- chooser.setDialogTitle("Create EPS file from alignment");
- chooser.setToolTipText("Save");
-
- int value = chooser.showSaveDialog(this);
-
- if (value != jalview.io.JalviewFileChooser.APPROVE_OPTION)
- {
- return;
- }
-
- epsFile = chooser.getSelectedFile();
-
- jalview.bin.Cache.setProperty("LAST_DIRECTORY",
- chooser.getSelectedFile().getParent());
- }
+ try
+ {
- int height = ( (av.alignment.getHeight() + 1) * av.charHeight) + 30;
- int width = idPanel.getWidth() + (av.alignment.getWidth() * av.charWidth);
+ jalview.util.ImageMaker im;
+ if (type == jalview.util.ImageMaker.PNG)
+ {
+ im = new jalview.util.ImageMaker(this,
+ jalview.util.ImageMaker.PNG,
+ "Create PNG image from alignment",
+ width, height, file, null);
+ }
+ else
+ {
+ im = new jalview.util.ImageMaker(this,
+ jalview.util.ImageMaker.EPS,
+ "Create EPS file from alignment",
+ width, height, file,
+ alignFrame.getTitle());
+ }
- if (av.getWrapAlignment())
+ if (av.getWrapAlignment())
+ {
+ if (im.getGraphics() != null)
{
- height = ( (av.alignment.getWidth() / av.getChunkWidth()) + 1) *
- av.chunkHeight;
- width = seqPanel.getWidth() + idPanel.getWidth();
-
+ printWrappedAlignment(im.getGraphics(), width, height, 0);
+ im.writeImage();
}
-
-
- if (av.getShowAnnotation())
+ }
+ else
+ {
+ if (im.getGraphics() != null)
{
- height += annotationPanel.getPreferredSize().height;
+ printUnwrapped(im.getGraphics(), width, height, 0);
+ im.writeImage();
}
+ }
+ }
+ catch (OutOfMemoryError err)
+ {
+ System.out.println("########################\n"
+ + "OUT OF MEMORY " + file + "\n"
+ + "########################");
+
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ "Out of Memory Creating Image!!"
+ +
+ "\nSee help files for increasing Java Virtual Machine memory."
+ , "Out of memory",
+ JOptionPane.WARNING_MESSAGE);
+ System.out.println("Create IMAGE: " + err);
+ System.gc();
- try
- {
- FileOutputStream out = new FileOutputStream(epsFile);
- EpsGraphics2D pg = new EpsGraphics2D("Example", out, 0, 0, width,
- height);
-
- pg.setAccurateTextMode(accurateText);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void makeEPS(File epsFile)
+ {
+ makeAlignmentImage(jalview.util.ImageMaker.EPS, epsFile);
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void makePNG(File pngFile)
+ {
+ makeAlignmentImage(jalview.util.ImageMaker.PNG, pngFile);
+ }
+
+ public void makePNGImageMap(File imgMapFile, String imageName)
+ {
+ ///////ONLY WORKS WITH NONE WRAPPED ALIGNMENTS
+ //////////////////////////////////////////////
+ int idWidth = getVisibleIdWidth();
+ FontMetrics fm = getFontMetrics(av.getFont());
+ int scaleHeight = av.charHeight + fm.getDescent();
+
+ // Gen image map
+ //////////////////////////////////
+ if (imgMapFile != null)
+ {
+ try
+ {
+ int s, sSize = av.alignment.getHeight(),
+ res, alwidth = av.alignment.getWidth(), g, gSize, f, fSize, sy;
+ StringBuffer text = new StringBuffer();
+ PrintWriter out = new PrintWriter(new FileWriter(imgMapFile));
+ out.println(jalview.io.HTMLOutput.getImageMapHTML());
+ out.println("
"
+ + "