JAL-1153 new runtime property set to first non-null annotation element colour
[jalview.git] / src / jalview / gui / AlignmentPanel.java
index f5a6e1e..8f2dd04 100644 (file)
@@ -920,10 +920,14 @@ public class AlignmentPanel extends GAlignmentPanel implements
 
     if (av.showAnnotation && (endSeq == av.getAlignment().getHeight()))
     {
+      // draw annotation - need to offset for current scroll position
+      int offset=-alabels.scrollOffset;
+      pg.translate(0, offset);
       pg.translate(-idWidth - 3, (endSeq - startSeq) * av.charHeight + 3);
       alabels.drawComponent((Graphics2D) pg, idWidth);
       pg.translate(idWidth + 3, 0);
       annotationPanel.renderer.drawComponent(annotationPanel, av, (Graphics2D) pg, -1, startRes, endRes + 1);
+      pg.translate(0, -offset);
     }
 
     return Printable.PAGE_EXISTS;
@@ -1071,6 +1075,11 @@ public class AlignmentPanel extends GAlignmentPanel implements
 
   void makeAlignmentImage(int type, File file)
   {
+    long progress=System.currentTimeMillis();
+    if (alignFrame!=null) {
+      alignFrame.setProgressBar("Saving "+(type == jalview.util.ImageMaker.PNG ? "PNG image":"EPS file") , progress);
+    }
+    try {
     int maxwidth = av.getAlignment().getWidth();
     if (av.hasHiddenColumns())
     {
@@ -1109,19 +1118,17 @@ public class AlignmentPanel extends GAlignmentPanel implements
     {
 
       jalview.util.ImageMaker im;
+      final String imageAction,imageTitle;
       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());
+      imageAction="Create PNG image from alignment";
+      imageTitle=null;
+      } else {
+        imageAction="Create EPS file from alignment";
+        imageTitle=alignFrame.getTitle();
       }
-
+      im = new jalview.util.ImageMaker(this, type, imageAction, width, height, file,
+                imageTitle);
       if (av.getWrapAlignment())
       {
         if (im.getGraphics() != null)
@@ -1149,6 +1156,13 @@ public class AlignmentPanel extends GAlignmentPanel implements
     {
       ex.printStackTrace();
     }
+    }
+    finally {
+      if (alignFrame!=null)
+      {
+        alignFrame.setProgressBar("Export complete.", progress);
+      }
+    }
   }
 
   /**