- printUnwrapped(aDimension.getWidth(), aDimension.getHeight(), 0, g1,
- g2);
- FileOutputStream out = new FileOutputStream(file);
-
- String titleSvgData = g1.getSVGDocument();
- String alignSvgData = g2.getSVGDocument();
- String htmlData = getHtml(titleSvgData, alignSvgData);
-
- out.write(htmlData.getBytes());
- out.flush();
- out.close();
- if (!(System.getProperty("java.awt.headless") != null && System
- .getProperty("java.awt.headless").equals("true")))
- {
- jalview.util.BrowserLauncher.openURL("file:///" + file);
- }
- } catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- static JalviewFileChooser getHTMLChooser()
- {
- return new jalview.io.JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "html" }, new String[]
- { "Hypertext Markup Language" }, "Hypertext Markup Language");
- }
-
- public int printUnwrapped(int pwidth, int pheight, int pi, Graphics... pg)
- throws PrinterException
- {
- int idWidth = ap.getVisibleIdWidth(false);
- FontMetrics fm = ap.getFontMetrics(av.getFont());
- int scaleHeight = av.getCharHeight() + fm.getDescent();
-
- pg[0].setColor(Color.white);
- pg[0].fillRect(0, 0, pwidth, pheight);
- pg[0].setFont(av.getFont());
-
- // //////////////////////////////////
- // / How many sequences and residues can we fit on a printable page?
- int totalRes = (pwidth - idWidth) / av.getCharWidth();
- int totalSeq = (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;
- }
- startSeq = (pi / pagesWide) * totalSeq;
- endSeq = startSeq + totalSeq;
- if (endSeq > av.getAlignment().getHeight())
- {
- endSeq = av.getAlignment().getHeight();
- }
- int pagesHigh = ((av.getAlignment().getHeight() / totalSeq) + 1)
- * pheight;
- if (av.isShowAnnotation())
- {
- pagesHigh += ap.getAnnotationPanel().adjustPanelHeight() + 3;
- }
- pagesHigh /= pheight;
- if (pi >= (pagesWide * pagesHigh))
- {
- return Printable.NO_SUCH_PAGE;
- }
-
- // draw Scale
- pg[1].translate(0, 0);
- ap.getScalePanel().drawScale(pg[1], startRes, endRes, pwidth - idWidth,
- scaleHeight);
- pg[1].translate(-idWidth, scaleHeight);
-
- // //////////////
- // Draw the ids
- Color currentColor = null;
- Color currentTextColor = null;
- pg[0].translate(0, scaleHeight);
- pg[0].setFont(ap.getIdPanel().getIdCanvas().getIdfont());
- SequenceI seq;
- for (int i = startSeq; i < endSeq; i++)
- {
- seq = av.getAlignment().getSequenceAt(i);
- if ((av.getSelectionGroup() != null)
- && av.getSelectionGroup().getSequences(null).contains(seq))