X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignmentPanel.java;h=f6e6114c4a7f7762584684d49ff1621603026188;hb=e1124a62486322d2d28482529d2d6b850ce1719b;hp=b3b28651d0ceecc5555bad3c510db8abffb11ad9;hpb=c844ccd6f1f16178f31f1239057326cf8bcee6e3;p=jalview.git diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index b3b2865..f6e6114 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -771,6 +771,33 @@ public class AlignmentPanel extends GAlignmentPanel */ public void makeEPS(File epsFile) { + boolean accurateText = true; + + String renderStyle = jalview.bin.Cache.getDefault("EPS_RENDERING", + "Prompt each time"); + + // 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"))) + { + EPSOptions eps = new EPSOptions(); + renderStyle = eps.getValue(); + + if(eps.cancelled || renderStyle==null) + return; + + renderStyle = eps.getValue(); + } + + if (renderStyle.equalsIgnoreCase("text")) + { + accurateText = false; + } + + if(epsFile == null) { jalview.io.JalviewFileChooser chooser = new jalview.io. @@ -816,12 +843,14 @@ public class AlignmentPanel extends GAlignmentPanel try { - FileOutputStream out = new FileOutputStream(epsFile); - EpsGraphics2D pg = new EpsGraphics2D("Example", out, 0, 0, width, - height); + FileOutputStream out = new FileOutputStream(epsFile); + EpsGraphics2D pg = new EpsGraphics2D("Example", out, 0, 0, width, + height); - if (av.getWrapAlignment()) - { + pg.setAccurateTextMode(accurateText); + + if (av.getWrapAlignment()) + { printWrappedAlignment(pg, width, height, 0); } else @@ -831,7 +860,22 @@ public class AlignmentPanel extends GAlignmentPanel pg.flush(); pg.close(); - } + } + catch (OutOfMemoryError err) + { + System.out.println("########################\n" + + "OUT OF MEMORY " + epsFile + "\n" + + "########################"); + + JOptionPane.showInternalMessageDialog(Desktop.desktop, + "Out of memory creating EPS file!!" + + + "\nSee help files for increasing Java Virtual Machine memory." + , "Out of memory", + JOptionPane.WARNING_MESSAGE); + System.out.println("Create EPS: " + err); + System.gc(); + } catch (Exception ex) { ex.printStackTrace(); @@ -978,11 +1022,21 @@ public class AlignmentPanel extends GAlignmentPanel ImageIO.write(bi, "png", out); out.close(); } - catch(OutOfMemoryError err) + catch (OutOfMemoryError err) { System.out.println("########################\n" - +"OUT OF MEMORY "+pngFile+"\n" - +"########################"); + + "OUT OF MEMORY " + pngFile + "\n" + + "########################"); + + JOptionPane.showInternalMessageDialog(Desktop.desktop, + "Out of memory creating PNG!!" + + + "\nSee help files for increasing Java Virtual Machine memory." + , "Out of memory", + JOptionPane.WARNING_MESSAGE); + System.out.println("Create PNG: " + err); + System.gc(); + } catch (Exception ex) {