JAL-3364 submenu for Export Split Frame Image
[jalview.git] / src / jalview / jbgui / GAlignFrame.java
index 075b490..8e21cbe 100755 (executable)
@@ -42,6 +42,7 @@ import java.awt.event.FocusEvent;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
+import java.io.File;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -207,6 +208,8 @@ public class GAlignFrame extends JInternalFrame
 
   private SplitContainerI splitFrame;
 
+  protected JMenu exportSplitFrameMenu;
+
   public GAlignFrame()
   {
     try
@@ -1035,12 +1038,22 @@ public class GAlignFrame extends JInternalFrame
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        createPNG(null);
+        createPNG(null, false);
       }
     });
     createPNG.setActionCommand(
             MessageManager.getString("label.save_png_image"));
 
+    JMenuItem createSplitFramePNG = new JMenuItem("PNG");
+    createSplitFramePNG.addActionListener(new ActionListener()
+    {
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        createPNG(null, true);
+      }
+    });
+
     JMenuItem font = new JMenuItem(MessageManager.getString("action.font"));
     font.addActionListener(new ActionListener()
     {
@@ -1061,13 +1074,22 @@ public class GAlignFrame extends JInternalFrame
         seqLimit_actionPerformed(e);
       }
     });
-    JMenuItem epsFile = new JMenuItem("EPS");
-    epsFile.addActionListener(new ActionListener()
+    JMenuItem createEPS = new JMenuItem("EPS");
+    createEPS.addActionListener(new ActionListener()
+    {
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        createEPS(null, false);
+      }
+    });
+    JMenuItem createSplitFrameEPS = new JMenuItem("EPS");
+    createEPS.addActionListener(new ActionListener()
     {
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        createEPS(null);
+        createEPS(null, true);
       }
     });
 
@@ -1714,6 +1736,9 @@ public class GAlignFrame extends JInternalFrame
 
     JMenu exportImageMenu = new JMenu(
             MessageManager.getString("label.export_image"));
+    exportSplitFrameMenu = new JMenu(
+            MessageManager.getString("label.export_split_frame"));
+    exportSplitFrameMenu.setVisible(false);
     JMenu fileMenu = new JMenu(MessageManager.getString("action.file"));
     alignFrameMenuBar.add(fileMenu);
     alignFrameMenuBar.add(editMenu);
@@ -1737,6 +1762,7 @@ public class GAlignFrame extends JInternalFrame
     fileMenu.add(printMenuItem);
     fileMenu.addSeparator();
     fileMenu.add(exportImageMenu);
+    fileMenu.add(exportSplitFrameMenu);
     fileMenu.add(exportFeatures);
     fileMenu.add(exportAnnotations);
     fileMenu.add(loadTreeMenuItem);
@@ -1843,10 +1869,12 @@ public class GAlignFrame extends JInternalFrame
             MessageManager.getString("label.no_services"));
     webService.add(webServiceNoServices);
     exportImageMenu.add(htmlMenuItem);
-    exportImageMenu.add(epsFile);
+    exportImageMenu.add(createEPS);
     exportImageMenu.add(createPNG);
     exportImageMenu.add(createBioJS);
     exportImageMenu.add(createSVG);
+    exportSplitFrameMenu.add(createSplitFrameEPS);
+    exportSplitFrameMenu.add(createSplitFramePNG);
     addSequenceMenu.add(addFromFile);
     addSequenceMenu.add(addFromText);
     addSequenceMenu.add(addFromURL);
@@ -2374,7 +2402,7 @@ public class GAlignFrame extends JInternalFrame
   {
   }
 
-  public void createPNG(java.io.File f)
+  public void createPNG(File f, boolean forSplitFrame)
   {
   }
 
@@ -2391,11 +2419,11 @@ public class GAlignFrame extends JInternalFrame
 
   }
 
-  public void createEPS(java.io.File f)
+  public void createEPS(File f, boolean forSplitFrame)
   {
   }
 
-  public void createSVG(java.io.File f)
+  public void createSVG(File f)
   {
 
   }
@@ -2662,8 +2690,9 @@ public class GAlignFrame extends JInternalFrame
   }
 
   /**
-   * Sets a reference to the containing split frame. Also makes the 'toggle
-   * split view' menu item visible and checked.
+   * Sets a reference to the containing split frame. Also makes the 'toggle split
+   * view' menu item visible and checked. Also makes the 'export split frame
+   * image' menu visible.
    * 
    * @param sf
    */
@@ -2674,6 +2703,7 @@ public class GAlignFrame extends JInternalFrame
     {
       this.showComplementMenuItem.setVisible(true);
       this.showComplementMenuItem.setState(true);
+      this.exportSplitFrameMenu.setVisible(true);
     }
   }