JAL-3364 tidy and i18n makeAlignmentImage
[jalview.git] / src / jalview / gui / AlignmentPanel.java
index 4ec71c5..d387540 100644 (file)
  */
 package jalview.gui;
 
+import static jalview.util.ImageMaker.TYPE.EPS;
+import static jalview.util.ImageMaker.TYPE.PNG;
+import static jalview.util.ImageMaker.TYPE.SVG;
+
 import jalview.analysis.AnnotationSorter;
 import jalview.api.AlignViewportI;
 import jalview.api.AlignmentViewPanel;
@@ -1030,6 +1034,11 @@ public class AlignmentPanel extends GAlignmentPanel implements
               alignmentDrawnHeight);
       getAnnotationPanel().renderer.drawComponent(getAnnotationPanel(), av,
               alignmentGraphics, -1, startRes, endRes + 1);
+
+      /*
+       * reset to left margin
+       */
+      alignmentGraphics.translate(-alignmentGraphicsOffset, 0);
     }
 
     return Printable.PAGE_EXISTS;
@@ -1195,24 +1204,11 @@ public class AlignmentPanel extends GAlignmentPanel implements
               + borderBottomOffset;
       final int graphicsWidth = Math.max(dim1.width, dim2.width);
 
-      final String imageAction, imageTitle;
-      if (type == ImageMaker.TYPE.PNG)
-      {
-        imageAction = "Create PNG image from alignment";
-        imageTitle = null;
-      }
-      else if (type == ImageMaker.TYPE.EPS)
-      {
-        imageAction = "Create EPS file from alignment";
-        imageTitle = alignFrame.getTitle();
-      }
-      else
-      {
-        imageAction = "Create SVG file from alignment";
-        imageTitle = alignFrame.getTitle();
-      }
+      final String dialogTitle = MessageManager
+              .formatMessage("label.make_alignment_image", type.getName());
+      String imageTitle = type == PNG ? null : alignFrame.getTitle();
 
-      ImageMaker im = new ImageMaker(this, type, imageAction,
+      ImageMaker im = new ImageMaker(this, type, dialogTitle,
               graphicsWidth, graphicsHeight, file,
               imageTitle, alignFrame, pSessionId, headless);
       Graphics graphics = im.getGraphics();
@@ -1238,6 +1234,13 @@ public class AlignmentPanel extends GAlignmentPanel implements
          * append coding complement image
          */
         graphics.translate(0, dim1.height);
+        boolean test = true;
+        if (test)
+        {
+          graphics.setColor(Color.red);
+          graphics.drawString("Hello world", 0, 0);
+          graphics.setColor(Color.black);
+        }
         if (av.getCodingComplement().getWrapAlignment())
         {
           comp.printWrappedAlignment(dim2.width,
@@ -1322,7 +1325,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
    */
   public void makeEPS(File epsFile, boolean forSplitFrame)
   {
-    makeAlignmentImage(ImageMaker.TYPE.EPS, epsFile, forSplitFrame);
+    makeAlignmentImage(EPS, epsFile, forSplitFrame);
   }
 
   /**
@@ -1334,7 +1337,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
    */
   public void makePNG(File pngFile, boolean forSplitFrame)
   {
-    makeAlignmentImage(ImageMaker.TYPE.PNG, pngFile, forSplitFrame);
+    makeAlignmentImage(PNG, pngFile, forSplitFrame);
   }
 
   /**
@@ -1346,7 +1349,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
    */
   public void makeSVG(File svgFile, boolean forSplitFrame)
   {
-    makeAlignmentImage(ImageMaker.TYPE.SVG, svgFile, forSplitFrame);
+    makeAlignmentImage(SVG, svgFile, forSplitFrame);
   }
 
   public void makePNGImageMap(File imgMapFile, String imageName)