Minor updates
[jalview.git] / src / jalview / gui / AlignFrame.java
index d87f0f0..6d5a0eb 100644 (file)
@@ -35,6 +35,7 @@ import jalview.api.AlignViewportI;
 import jalview.api.AlignmentViewPanel;
 //from JalviewLite imports import jalview.api.FeatureRenderer;
 import jalview.api.FeatureSettingsControllerI;
+import jalview.api.FeatureSettingsModelI;
 import jalview.api.SplitContainerI;
 import jalview.api.ViewStyleI;
 import jalview.api.analysis.SimilarityParamsI;
@@ -107,6 +108,7 @@ import jalview.ws.seqfetcher.DbSourceProxy;
 import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Component;
+import java.awt.Dimension;
 import java.awt.Rectangle;
 import java.awt.Toolkit;
 import java.awt.datatransfer.Clipboard;
@@ -165,8 +167,8 @@ import ext.vamsas.ServiceHandle;
  */
 @SuppressWarnings("serial")
 public class AlignFrame extends GAlignFrame
-        implements AlignFrameI, DropTargetListener,
-        IProgressIndicator, AlignViewControllerGuiI, ColourChangeListener
+        implements AlignFrameI, DropTargetListener, IProgressIndicator,
+        AlignViewControllerGuiI, ColourChangeListener
 {
 
   public static final int DEFAULT_WIDTH = 700;
@@ -299,9 +301,6 @@ public class AlignFrame extends GAlignFrame
 
     viewport = new AlignViewport(al, hiddenColumns, sequenceSetId, viewId);
 
-    alignPanel = new AlignmentPanel(this, viewport);
-
-    addAlignmentPanel(alignPanel, true);
     init();
   }
 
@@ -321,8 +320,6 @@ public class AlignFrame extends GAlignFrame
     {
       viewport.hideSequence(hiddenSeqs);
     }
-    alignPanel = new AlignmentPanel(this, viewport);
-    addAlignmentPanel(alignPanel, true);
     init();
   }
 
@@ -338,7 +335,6 @@ public class AlignFrame extends GAlignFrame
   {
     viewport = ap.av;
     alignPanel = ap;
-    addAlignmentPanel(ap, false);
     init();
   }
 
@@ -348,11 +344,33 @@ public class AlignFrame extends GAlignFrame
    */
   void init()
   {
-//       setBackground(Color.white); // BH 2019
-                 
+    boolean newPanel = (alignPanel == null);
+    viewport.setShowAutocalculatedAbove(isShowAutoCalculatedAbove());
+    if (newPanel)
+    {
+      if (Platform.isJS())
+      {
+        // need to set this up front if NOANNOTATION is
+        // used in conjunction with SHOWOVERVIEW.
+
+        // I have not determined if this is appropriate for
+        // Jalview/Java, as it means we are setting this flag
+        // for all subsequent AlignFrames. For now, at least,
+        // I am setting it to be JalviewJS-only.
+
+        boolean showAnnotation = Jalview.getInstance().getShowAnnotation();
+        viewport.setShowAnnotation(showAnnotation);
+      }
+      alignPanel = new AlignmentPanel(this, viewport);
+    }
+    addAlignmentPanel(alignPanel, newPanel);
+
+    // setBackground(Color.white); // BH 2019
+
     if (!Jalview.isHeadlessMode())
     {
       progressBar = new ProgressBar(this.statusPanel, this.statusBar);
+      // JalviewJS options
       statusPanel.setVisible(Jalview.getInstance().getShowStatus());
       alignFrameMenuBar.setVisible(Jalview.getInstance().getAllowMenuBar());
     }
@@ -381,14 +399,12 @@ public class AlignFrame extends GAlignFrame
       sortPairwiseMenuItem_actionPerformed(null);
     }
 
-    this.alignPanel.av
-            .setShowAutocalculatedAbove(isShowAutoCalculatedAbove());
-
     setMenusFromViewport(viewport);
     buildSortByAnnotationScoresMenu();
     calculateTree.addActionListener(new ActionListener()
     {
 
+      
       @Override
       public void actionPerformed(ActionEvent e)
       {
@@ -427,6 +443,7 @@ public class AlignFrame extends GAlignFrame
             new ViewSetProvider()
             {
 
+              
               @Override
               public AlignmentPanel[] getAllAlignmentPanels()
               {
@@ -441,6 +458,7 @@ public class AlignFrame extends GAlignFrame
             }, selviews, new ItemListener()
             {
 
+              
               @Override
               public void itemStateChanged(ItemEvent e)
               {
@@ -496,6 +514,7 @@ public class AlignFrame extends GAlignFrame
     }
     addFocusListener(new FocusAdapter()
     {
+      
       @Override
       public void focusGained(FocusEvent e)
       {
@@ -540,6 +559,7 @@ public class AlignFrame extends GAlignFrame
   {
     addKeyListener(new KeyAdapter()
     {
+      
       @Override
       public void keyPressed(KeyEvent evt)
       {
@@ -556,9 +576,9 @@ public class AlignFrame extends GAlignFrame
         switch (evt.getKeyCode())
         {
 
-        case 27: // escape key
-          deselectAllSequenceMenuItem_actionPerformed(null);
-
+        case KeyEvent.VK_ESCAPE: // escape key
+                                 // alignPanel.deselectAllSequences();
+          alignPanel.deselectAllSequences();
           break;
 
         case KeyEvent.VK_DOWN:
@@ -732,6 +752,7 @@ public class AlignFrame extends GAlignFrame
         }
       }
 
+      
       @Override
       public void keyReleased(KeyEvent evt)
       {
@@ -826,6 +847,7 @@ public class AlignFrame extends GAlignFrame
     Desktop.getInstance().addJalviewPropertyChangeListener("services",
             thisListener = new java.beans.PropertyChangeListener()
             {
+              
               @Override
               public void propertyChange(PropertyChangeEvent evt)
               {
@@ -835,6 +857,7 @@ public class AlignFrame extends GAlignFrame
                   SwingUtilities.invokeLater(new Runnable()
                   {
 
+                    
                     @Override
                     public void run()
                     {
@@ -849,19 +872,21 @@ public class AlignFrame extends GAlignFrame
             });
     addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
     {
+      
       @Override
       public void internalFrameClosed(
               javax.swing.event.InternalFrameEvent evt)
       {
         // System.out.println("deregistering discoverer listener");
-        Desktop.getInstance().removeJalviewPropertyChangeListener("services",
-                thisListener);
+        Desktop.getInstance().removeJalviewPropertyChangeListener(
+                "services", thisListener);
         closeMenuItem_actionPerformed(true);
       }
     });
     // Finally, build the menu once to get current service state
     new Thread(new Runnable()
     {
+      
       @Override
       public void run()
       {
@@ -898,6 +923,7 @@ public class AlignFrame extends GAlignFrame
    * operation that affects the data in the current view (selection changed,
    * etc) to update the menus to reflect the new state.
    */
+  
   @Override
   public void setMenusForViewport()
   {
@@ -928,11 +954,8 @@ public class AlignFrame extends GAlignFrame
     scaleLeft.setVisible(av.getWrapAlignment());
     scaleRight.setVisible(av.getWrapAlignment());
     annotationPanelMenuItem.setState(av.isShowAnnotation());
-    /*
-     * Show/hide annotations only enabled if annotation panel is shown
-     */
-    syncAnnotationMenuItems();
-
+    // Show/hide annotations only enabled if annotation panel is shown
+    syncAnnotationMenuItems(av.isShowAnnotation());
     viewBoxesMenuItem.setSelected(av.getShowBoxes());
     viewTextMenuItem.setSelected(av.getShowText());
     showNonconservedMenuItem.setSelected(av.getShowUnconserved());
@@ -950,7 +973,8 @@ public class AlignFrame extends GAlignFrame
     applyToAllGroups.setState(av.getColourAppliesToAllGroups());
     showNpFeatsMenuitem.setSelected(av.isShowNPFeats());
     showDbRefsMenuitem.setSelected(av.isShowDBRefs());
-    autoCalculate.setSelected(av.getAutoCalculateConsensusAndConservation());
+    autoCalculate
+            .setSelected(av.getAutoCalculateConsensusAndConservation());
     sortByTree.setSelected(av.sortByTree);
     listenToViewSelections.setSelected(av.followSelection);
 
@@ -977,12 +1001,14 @@ public class AlignFrame extends GAlignFrame
    * 
    * @see jalview.gui.IProgressIndicator#setProgressBar(java.lang.String, long)
    */
+  
   @Override
   public void setProgressBar(String message, long id)
   {
     progressBar.setProgressBar(message, id);
   }
 
+  
   @Override
   public void registerHandler(final long id,
           final IProgressIndicatorHandler handler)
@@ -994,6 +1020,7 @@ public class AlignFrame extends GAlignFrame
    * 
    * @return true if any progress bars are still active
    */
+  
   @Override
   public boolean operationInProgress()
   {
@@ -1005,6 +1032,7 @@ public class AlignFrame extends GAlignFrame
    * will cause the status bar to be hidden, with possibly undesirable flicker
    * of the screen layout.
    */
+  
   @Override
   public void setStatus(String text)
   {
@@ -1024,101 +1052,109 @@ public class AlignFrame extends GAlignFrame
     return alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer();
   }
 
+  
   @Override
   public void fetchSequence_actionPerformed()
   {
     new SequenceFetcher(this);
   }
 
+  
   @Override
   public void addFromFile_actionPerformed(ActionEvent e)
   {
     Desktop.getInstance().inputLocalFileMenuItem_actionPerformed(viewport);
   }
 
+  
   @Override
   public void reload_actionPerformed(ActionEvent e)
   {
-    if (fileName != null)
+    if (fileName == null)
     {
-      // TODO: JAL-1108 - ensure all associated frames are closed regardless of
-      // originating file's format
-      // TODO: work out how to recover feature settings for correct view(s) when
-      // file is reloaded.
-      if (FileFormat.Jalview.equals(currentFileFormat))
+      return;
+    }
+    // TODO: JAL-1108 - ensure all associated frames are closed regardless of
+    // originating file's format
+    // TODO: work out how to recover feature settings for correct view(s) when
+    // file is reloaded.
+    if (FileFormat.Jalview.equals(currentFileFormat))
+    {
+      JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames();
+      for (int i = 0; i < frames.length; i++)
       {
-        JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames();
-        for (int i = 0; i < frames.length; i++)
+        if (frames[i] instanceof AlignFrame && frames[i] != this
+                && ((AlignFrame) frames[i]).fileName != null
+                && ((AlignFrame) frames[i]).fileName.equals(fileName))
         {
-          if (frames[i] instanceof AlignFrame && frames[i] != this
-                  && ((AlignFrame) frames[i]).fileName != null
-                  && ((AlignFrame) frames[i]).fileName.equals(fileName))
+          try
+          {
+            frames[i].setSelected(true);
+            Desktop.getInstance().closeAssociatedWindows();
+          } catch (java.beans.PropertyVetoException ex)
           {
-            try
-            {
-              frames[i].setSelected(true);
-              Desktop.getInstance().closeAssociatedWindows();
-            } catch (java.beans.PropertyVetoException ex)
-            {
-            }
           }
-
         }
-        Desktop.getInstance().closeAssociatedWindows();
 
-        FileLoader loader = new FileLoader();
-        DataSourceType protocol = fileName.startsWith("http:")
-                ? DataSourceType.URL
-                : DataSourceType.FILE;
-        loader.loadFile(viewport, fileName, protocol, currentFileFormat);
       }
-      else
-      {
-        Rectangle bounds = this.getBounds();
+      Desktop.getInstance().closeAssociatedWindows();
 
-        FileLoader loader = new FileLoader();
+      FileLoader loader = new FileLoader();
+      DataSourceType protocol = fileName.startsWith("http:")
+              ? DataSourceType.URL
+              : DataSourceType.FILE;
+      loader.loadFile(viewport,
+              (fileObject == null ? fileName : fileObject), protocol,
+              currentFileFormat);
+    }
+    else
+    {
+      Rectangle bounds = this.getBounds();
 
-        AlignFrame newframe = null;
+      FileLoader loader = new FileLoader();
 
-        if (fileObject == null)
-        {
+      AlignFrame newframe = null;
 
-          DataSourceType protocol = (fileName.startsWith("http:")
-                  ? DataSourceType.URL
-                  : DataSourceType.FILE);
-          newframe = loader.loadFileWaitTillLoaded(fileName, protocol,
-                  currentFileFormat);
-        }
-        else
-        {
-          newframe = loader.loadFileWaitTillLoaded(fileObject,
-                  DataSourceType.FILE, currentFileFormat);
-        }
+      if (fileObject == null)
+      {
 
-        newframe.setBounds(bounds);
-        if (featureSettings != null && featureSettings.isShowing())
+        DataSourceType protocol = (fileName.startsWith("http:")
+                ? DataSourceType.URL
+                : DataSourceType.FILE);
+        newframe = loader.loadFileWaitTillLoaded(fileName, protocol,
+                currentFileFormat);
+      }
+      else
+      {
+        newframe = loader.loadFileWaitTillLoaded(fileObject,
+                DataSourceType.FILE, currentFileFormat);
+      }
+
+      newframe.setBounds(bounds);
+      if (featureSettings != null && featureSettings.isShowing())
+      {
+        final Rectangle fspos = featureSettings.frame.getBounds();
+        // TODO: need a 'show feature settings' function that takes bounds -
+        // need to refactor Desktop.addFrame
+        newframe.featureSettings_actionPerformed(null);
+        final FeatureSettings nfs = newframe.featureSettings;
+        SwingUtilities.invokeLater(new Runnable()
         {
-          final Rectangle fspos = featureSettings.frame.getBounds();
-          // TODO: need a 'show feature settings' function that takes bounds -
-          // need to refactor Desktop.addFrame
-          newframe.featureSettings_actionPerformed(null);
-          final FeatureSettings nfs = newframe.featureSettings;
-          SwingUtilities.invokeLater(new Runnable()
+          
+          @Override
+          public void run()
           {
-            @Override
-            public void run()
-            {
-              nfs.frame.setBounds(fspos);
-            }
-          });
-          this.featureSettings.close();
-          this.featureSettings = null;
-        }
-        this.closeMenuItem_actionPerformed(true);
+            nfs.frame.setBounds(fspos);
+          }
+        });
+        this.featureSettings.close();
+        this.featureSettings = null;
       }
+      this.closeMenuItem_actionPerformed(true);
     }
   }
 
+  
   @Override
   public void addFromText_actionPerformed(ActionEvent e)
   {
@@ -1126,12 +1162,14 @@ public class AlignFrame extends GAlignFrame
             .inputTextboxMenuItem_actionPerformed(viewport.getAlignPanel());
   }
 
+  
   @Override
   public void addFromURL_actionPerformed(ActionEvent e)
   {
     Desktop.getInstance().inputURLMenuItem_actionPerformed(viewport);
   }
 
+  
   @Override
   public void save_actionPerformed(ActionEvent e)
   {
@@ -1150,6 +1188,7 @@ public class AlignFrame extends GAlignFrame
    * Saves the alignment to a file with a name chosen by the user, if necessary
    * warning if a file would be overwritten
    */
+  
   @Override
   public void saveAs_actionPerformed()
   {
@@ -1247,21 +1286,23 @@ public class AlignFrame extends GAlignFrame
       String shortName = title;
       if (shortName.indexOf(File.separatorChar) > -1)
       {
-        shortName = shortName.substring(
-                shortName.lastIndexOf(File.separatorChar) + 1);
+        shortName = shortName
+                .substring(shortName.lastIndexOf(File.separatorChar) + 1);
       }
-      lastSaveSuccessful = new Jalview2XML().saveAlignment(this, file, shortName);
-      
+      lastSaveSuccessful = new Jalview2XML().saveAlignment(this, file,
+              shortName);
+
       statusBar.setText(MessageManager.formatMessage(
               "label.successfully_saved_to_file_in_format", new Object[]
               { fileName, format }));
-      
+
       return;
     }
 
     AlignExportSettingsI options = new AlignExportSettingsAdapter(false);
     Runnable cancelAction = new Runnable()
     {
+      
       @Override
       public void run()
       {
@@ -1270,6 +1311,7 @@ public class AlignFrame extends GAlignFrame
     };
     Runnable outputAction = new Runnable()
     {
+      
       @Override
       public void run()
       {
@@ -1292,16 +1334,17 @@ public class AlignFrame extends GAlignFrame
           BackupFiles backupfiles = doBackup ? new BackupFiles(file) : null;
           try
           {
-            String tempFilePath = doBackup ? backupfiles.getTempFilePath() : file;
-                       PrintWriter out = new PrintWriter(
-                    new FileWriter(tempFilePath));
+            String tempFilePath = doBackup ? backupfiles.getTempFilePath()
+                    : file;
+            PrintWriter out = new PrintWriter(new FileWriter(tempFilePath));
 
             out.print(output);
             out.close();
             AlignFrame.this.setTitle(file);
             statusBar.setText(MessageManager.formatMessage(
-                  "label.successfully_saved_to_file_in_format", new Object[]
-                  { fileName, format.getName() }));
+                    "label.successfully_saved_to_file_in_format",
+                    new Object[]
+                    { fileName, format.getName() }));
             lastSaveSuccessful = true;
           } catch (Exception ex)
           {
@@ -1343,6 +1386,7 @@ public class AlignFrame extends GAlignFrame
    * 
    * @param fileFormatName
    */
+  
   @Override
   protected void outputText_actionPerformed(String fileFormatName)
   {
@@ -1351,6 +1395,7 @@ public class AlignFrame extends GAlignFrame
     AlignExportSettingsI options = new AlignExportSettingsAdapter(false);
     Runnable outputAction = new Runnable()
     {
+      
       @Override
       public void run()
       {
@@ -1401,6 +1446,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   protected void htmlMenuItem_actionPerformed(ActionEvent e)
   {
@@ -1408,6 +1454,7 @@ public class AlignFrame extends GAlignFrame
     htmlSVG.exportHTML(null);
   }
 
+  
   @Override
   public void bioJSMenuItem_actionPerformed(ActionEvent e)
   {
@@ -1426,6 +1473,7 @@ public class AlignFrame extends GAlignFrame
    * 
    * @param f
    */
+  
   @Override
   public void createPNG(File f)
   {
@@ -1438,6 +1486,7 @@ public class AlignFrame extends GAlignFrame
    * 
    * @param f
    */
+  
   @Override
   public void createEPS(File f)
   {
@@ -1450,12 +1499,14 @@ public class AlignFrame extends GAlignFrame
    * 
    * @param f
    */
+  
   @Override
   public void createSVG(File f)
   {
     alignPanel.makeAlignmentImage(TYPE.SVG, f);
   }
 
+  
   @Override
   public void pageSetup_actionPerformed(ActionEvent e)
   {
@@ -1469,6 +1520,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void printMenuItem_actionPerformed(ActionEvent e)
   {
@@ -1477,30 +1529,34 @@ public class AlignFrame extends GAlignFrame
     thread.start();
   }
 
+  
   @Override
   public void exportFeatures_actionPerformed(ActionEvent e)
   {
     new AnnotationExporter(alignPanel).exportFeatures();
   }
 
+  
   @Override
   public void exportAnnotations_actionPerformed(ActionEvent e)
   {
     new AnnotationExporter(alignPanel).exportAnnotations();
   }
 
+  
   @Override
   public void associatedData_actionPerformed(ActionEvent e)
   {
     final JalviewFileChooser chooser = new JalviewFileChooser(
             jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
     chooser.setFileView(new JalviewFileView());
-    chooser.setDialogTitle(
-            MessageManager.getString("label.load_jalview_annotations"));
-    chooser.setToolTipText(
-            MessageManager.getString("label.load_jalview_annotations"));
+    String tooltip = MessageManager
+            .getString("label.load_jalview_annotations");
+    chooser.setDialogTitle(tooltip);
+    chooser.setToolTipText(tooltip);
     chooser.setResponseHandler(0, new Runnable()
     {
+      
       @Override
       public void run()
       {
@@ -1519,6 +1575,7 @@ public class AlignFrame extends GAlignFrame
    * 
    * @param closeAllTabs
    */
+  
   @Override
   public void closeMenuItem_actionPerformed(boolean closeAllTabs)
   {
@@ -1552,6 +1609,13 @@ public class AlignFrame extends GAlignFrame
 
       if (closeAllTabs)
       {
+        // JalviewJS-develop only
+        //
+        // if (featureSettings != null && featureSettings.isOpen())
+        // {
+        // featureSettings.close();
+        // featureSettings = null;
+        // }
         /*
          * this will raise an INTERNAL_FRAME_CLOSED event and this method will
          * be called recursively, with the frame now in 'closed' state
@@ -1625,6 +1689,7 @@ public class AlignFrame extends GAlignFrame
     }
   }
 
+  
   @Override
   public void addHistoryItem(CommandI command)
   {
@@ -1670,6 +1735,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   protected void undoMenuItem_actionPerformed(ActionEvent e)
   {
@@ -1708,6 +1774,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   protected void redoMenuItem_actionPerformed(ActionEvent e)
   {
@@ -1914,6 +1981,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   protected void copy_actionPerformed()
   {
@@ -1979,6 +2047,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   protected void pasteNew_actionPerformed(ActionEvent e)
   {
@@ -1991,6 +2060,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   protected void pasteThis_actionPerformed(ActionEvent e)
   {
@@ -2167,7 +2237,7 @@ public class AlignFrame extends GAlignFrame
                     newGraphGroups.add(q, null);
                   }
                   newGraphGroups.set(newann.graphGroup,
-                          new Integer(++fgroup));
+                          Integer.valueOf(++fgroup));
                 }
                 newann.graphGroup = newGraphGroups.get(newann.graphGroup)
                         .intValue();
@@ -2214,7 +2284,7 @@ public class AlignFrame extends GAlignFrame
                     newGraphGroups.add(q, null);
                   }
                   newGraphGroups.set(newann.graphGroup,
-                          new Integer(++fgroup));
+                          Integer.valueOf(++fgroup));
                 }
                 newann.graphGroup = newGraphGroups.get(newann.graphGroup)
                         .intValue();
@@ -2336,6 +2406,7 @@ public class AlignFrame extends GAlignFrame
 
   }
 
+  
   @Override
   protected void expand_newalign(ActionEvent e)
   {
@@ -2390,6 +2461,7 @@ public class AlignFrame extends GAlignFrame
   /**
    * Action Cut (delete and copy) the selected region
    */
+  
   @Override
   protected void cut_actionPerformed()
   {
@@ -2400,6 +2472,7 @@ public class AlignFrame extends GAlignFrame
   /**
    * Performs menu option to Delete the currently selected region
    */
+  
   @Override
   protected void delete_actionPerformed()
   {
@@ -2410,56 +2483,63 @@ public class AlignFrame extends GAlignFrame
       return;
     }
 
-    Runnable okAction = new Runnable() 
-    {
-               @Override
-               public void run() 
-               {
-                   SequenceI[] cut = sg.getSequences()
-                           .toArray(new SequenceI[sg.getSize()]);
-
-                   addHistoryItem(new EditCommand(
-                           MessageManager.getString("label.cut_sequences"), Action.CUT,
-                           cut, sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,
-                           viewport.getAlignment()));
-
-                   viewport.setSelectionGroup(null);
-                   viewport.sendSelection();
-                   viewport.getAlignment().deleteGroup(sg);
-
-                   viewport.firePropertyChange("alignment", null,
-                           viewport.getAlignment().getSequences());
-                   if (viewport.getAlignment().getHeight() < 1)
-                   {
-                     try
-                     {
-                       AlignFrame.this.setClosed(true);
-                     } catch (Exception ex)
-                     {
-                     }
-                   }
-               }};
+    Runnable okAction = new Runnable()
+    {
+      
+      @Override
+      public void run()
+      {
+        SequenceI[] cut = sg.getSequences()
+                .toArray(new SequenceI[sg.getSize()]);
+
+        addHistoryItem(new EditCommand(
+                MessageManager.getString("label.cut_sequences"), Action.CUT,
+                cut, sg.getStartRes(),
+                sg.getEndRes() - sg.getStartRes() + 1,
+                viewport.getAlignment()));
+
+        viewport.setSelectionGroup(null);
+        viewport.sendSelection();
+        viewport.getAlignment().deleteGroup(sg);
+
+        viewport.firePropertyChange("alignment", null,
+                viewport.getAlignment().getSequences());
+        if (viewport.getAlignment().getHeight() < 1)
+        {
+          try
+          {
+            AlignFrame.this.setClosed(true);
+          } catch (Exception ex)
+          {
+          }
+        }
+      }
+    };
 
     /*
      * If the cut affects all sequences, prompt for confirmation
      */
-    boolean wholeHeight = sg.getSize() == viewport.getAlignment().getHeight();
+    boolean wholeHeight = sg.getSize() == viewport.getAlignment()
+            .getHeight();
     boolean wholeWidth = (((sg.getEndRes() - sg.getStartRes())
             + 1) == viewport.getAlignment().getWidth()) ? true : false;
-       if (wholeHeight && wholeWidth)
-       {
-           JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.getDesktopPane());
-               dialog.setResponseHandler(0, okAction); // 0 = OK_OPTION
-           Object[] options = new Object[] { MessageManager.getString("action.ok"),
-                   MessageManager.getString("action.cancel") };
-               dialog.showDialog(MessageManager.getString("warn.delete_all"),
-                   MessageManager.getString("label.delete_all"),
-                   JvOptionPane.DEFAULT_OPTION, JvOptionPane.PLAIN_MESSAGE, null,
-                   options, options[0]);
-       } else 
-       {
-               okAction.run();
-       }
+    if (wholeHeight && wholeWidth)
+    {
+      JvOptionPane dialog = JvOptionPane
+              .newOptionDialog(Desktop.getDesktopPane());
+      dialog.setResponseHandler(0, okAction); // 0 = OK_OPTION
+      Object[] options = new Object[] {
+          MessageManager.getString("action.ok"),
+          MessageManager.getString("action.cancel") };
+      dialog.showDialog(MessageManager.getString("warn.delete_all"),
+              MessageManager.getString("label.delete_all"),
+              JvOptionPane.DEFAULT_OPTION, JvOptionPane.PLAIN_MESSAGE, null,
+              options, options[0]);
+    }
+    else
+    {
+      okAction.run();
+    }
   }
 
   /**
@@ -2468,6 +2548,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   protected void deleteGroups_actionPerformed(ActionEvent e)
   {
@@ -2485,21 +2566,23 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)
   {
-    SequenceGroup sg = new SequenceGroup(
-            viewport.getAlignment().getSequences());
-
-    sg.setEndRes(viewport.getAlignment().getWidth() - 1);
-    viewport.setSelectionGroup(sg);
-    viewport.isSelectionGroupChanged(true);
-    viewport.sendSelection();
-    // JAL-2034 - should delegate to
-    // alignPanel to decide if overview needs
-    // updating.
-    alignPanel.paintAlignment(false, false);
-    PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
+    // SequenceGroup sg = new SequenceGroup(
+    // viewport.getAlignment().getSequences());
+    //
+    // sg.setEndRes(viewport.getAlignment().getWidth() - 1);
+    // viewport.setSelectionGroup(sg);
+    // viewport.isSelectionGroupChanged(true);
+    // viewport.sendSelection();
+    // // JAL-2034 - should delegate to
+    // // alignPanel to decide if overview needs
+    // // updating.
+    // alignPanel.paintAlignment(false, false);
+    // PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
+    alignPanel.selectAllSequences();
   }
 
   /**
@@ -2508,24 +2591,26 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)
   {
-    if (viewport.cursorMode)
-    {
-      alignPanel.getSeqPanel().keyboardNo1 = null;
-      alignPanel.getSeqPanel().keyboardNo2 = null;
-    }
-    viewport.setSelectionGroup(null);
-    viewport.getColumnSelection().clear();
-    viewport.setSelectionGroup(null);
-    alignPanel.getIdPanel().getIdCanvas().searchResults = null;
-    // JAL-2034 - should delegate to
-    // alignPanel to decide if overview needs
-    // updating.
-    alignPanel.paintAlignment(false, false);
-    PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
-    viewport.sendSelection();
+    alignPanel.deselectAllSequences();
+    // if (viewport.cursorMode)
+    // {
+    // alignPanel.getSeqPanel().keyboardNo1 = null;
+    // alignPanel.getSeqPanel().keyboardNo2 = null;
+    // }
+    // viewport.setSelectionGroup(null);
+    // viewport.getColumnSelection().clear();
+    // viewport.setSelectionGroup(null);
+    // alignPanel.getIdPanel().getIdCanvas().searchResults = null;
+    // // JAL-2034 - should delegate to
+    // // alignPanel to decide if overview needs
+    // // updating.
+    // alignPanel.paintAlignment(false, false);
+    // PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
+    // viewport.sendSelection();
   }
 
   /**
@@ -2534,6 +2619,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void invertSequenceMenuItem_actionPerformed(ActionEvent e)
   {
@@ -2541,7 +2627,7 @@ public class AlignFrame extends GAlignFrame
 
     if (sg == null)
     {
-      selectAllSequenceMenuItem_actionPerformed(null);
+      alignPanel.selectAllSequences();
 
       return;
     }
@@ -2559,6 +2645,7 @@ public class AlignFrame extends GAlignFrame
     viewport.sendSelection();
   }
 
+  
   @Override
   public void invertColSel_actionPerformed(ActionEvent e)
   {
@@ -2573,6 +2660,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void remove2LeftMenuItem_actionPerformed(ActionEvent e)
   {
@@ -2585,6 +2673,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void remove2RightMenuItem_actionPerformed(ActionEvent e)
   {
@@ -2631,8 +2720,8 @@ public class AlignFrame extends GAlignFrame
                 column, viewport.getAlignment());
       }
 
-      setStatus(MessageManager
-              .formatMessage("label.removed_columns", new String[]
+      setStatus(MessageManager.formatMessage("label.removed_columns",
+              new String[]
               { Integer.valueOf(trimRegion.getSize()).toString() }));
 
       addHistoryItem(trimRegion);
@@ -2657,6 +2746,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)
   {
@@ -2681,8 +2771,8 @@ public class AlignFrame extends GAlignFrame
 
     addHistoryItem(removeGapCols);
 
-    setStatus(MessageManager
-            .formatMessage("label.removed_empty_columns", new Object[]
+    setStatus(MessageManager.formatMessage("label.removed_empty_columns",
+            new Object[]
             { Integer.valueOf(removeGapCols.getSize()).toString() }));
 
     // This is to maintain viewport position on first residue
@@ -2707,6 +2797,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void removeAllGapsMenuItem_actionPerformed(ActionEvent e)
   {
@@ -2746,6 +2837,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void padGapsMenuitem_actionPerformed(ActionEvent e)
   {
@@ -2760,6 +2852,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void findMenuItem_actionPerformed(ActionEvent e)
   {
@@ -2769,6 +2862,7 @@ public class AlignFrame extends GAlignFrame
   /**
    * Create a new view of the current alignment.
    */
+  
   @Override
   public void newView_actionPerformed(ActionEvent e)
   {
@@ -2804,8 +2898,8 @@ public class AlignFrame extends GAlignFrame
 
     if (viewport.getViewName() == null)
     {
-      viewport.setViewName(MessageManager
-              .getString("label.view_name_original"));
+      viewport.setViewName(
+              MessageManager.getString("label.view_name_original"));
     }
 
     /*
@@ -2910,6 +3004,7 @@ public class AlignFrame extends GAlignFrame
   /**
    * Explode tabbed views into separate windows.
    */
+  
   @Override
   public void expandViews_actionPerformed(ActionEvent e)
   {
@@ -2919,6 +3014,7 @@ public class AlignFrame extends GAlignFrame
   /**
    * Gather views in separate windows back into a tabbed presentation.
    */
+  
   @Override
   public void gatherViews_actionPerformed(ActionEvent e)
   {
@@ -2931,6 +3027,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void font_actionPerformed(ActionEvent e)
   {
@@ -2943,6 +3040,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   protected void seqLimit_actionPerformed(ActionEvent e)
   {
@@ -2953,6 +3051,7 @@ public class AlignFrame extends GAlignFrame
     alignPanel.paintAlignment(true, false);
   }
 
+  
   @Override
   public void idRightAlign_actionPerformed(ActionEvent e)
   {
@@ -2960,6 +3059,7 @@ public class AlignFrame extends GAlignFrame
     alignPanel.paintAlignment(false, false);
   }
 
+  
   @Override
   public void centreColumnLabels_actionPerformed(ActionEvent e)
   {
@@ -2972,6 +3072,7 @@ public class AlignFrame extends GAlignFrame
    * 
    * @see jalview.jbgui.GAlignFrame#followHighlight_actionPerformed()
    */
+  
   @Override
   protected void followHighlight_actionPerformed()
   {
@@ -2993,6 +3094,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   protected void colourTextMenuItem_actionPerformed(ActionEvent e)
   {
@@ -3006,6 +3108,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void wrapMenuItem_actionPerformed(ActionEvent e)
   {
@@ -3016,12 +3119,14 @@ public class AlignFrame extends GAlignFrame
     alignPanel.updateLayout();
   }
 
+  
   @Override
   public void showAllSeqs_actionPerformed(ActionEvent e)
   {
     viewport.showAllHiddenSeqs();
   }
 
+  
   @Override
   public void showAllColumns_actionPerformed(ActionEvent e)
   {
@@ -3030,6 +3135,7 @@ public class AlignFrame extends GAlignFrame
     viewport.sendSelection();
   }
 
+  
   @Override
   public void hideSelSequences_actionPerformed(ActionEvent e)
   {
@@ -3109,6 +3215,7 @@ public class AlignFrame extends GAlignFrame
    * jalview.jbgui.GAlignFrame#hideAllButSelection_actionPerformed(java.awt.
    * event.ActionEvent)
    */
+  
   @Override
   public void hideAllButSelection_actionPerformed(ActionEvent e)
   {
@@ -3123,6 +3230,7 @@ public class AlignFrame extends GAlignFrame
    * jalview.jbgui.GAlignFrame#hideAllSelection_actionPerformed(java.awt.event
    * .ActionEvent)
    */
+  
   @Override
   public void hideAllSelection_actionPerformed(ActionEvent e)
   {
@@ -3142,6 +3250,7 @@ public class AlignFrame extends GAlignFrame
    * jalview.jbgui.GAlignFrame#showAllhidden_actionPerformed(java.awt.event.
    * ActionEvent)
    */
+  
   @Override
   public void showAllhidden_actionPerformed(ActionEvent e)
   {
@@ -3151,6 +3260,7 @@ public class AlignFrame extends GAlignFrame
     viewport.sendSelection();
   }
 
+  
   @Override
   public void hideSelColumns_actionPerformed(ActionEvent e)
   {
@@ -3160,6 +3270,7 @@ public class AlignFrame extends GAlignFrame
     viewport.sendSelection();
   }
 
+  
   @Override
   public void hiddenMarkers_actionPerformed(ActionEvent e)
   {
@@ -3173,6 +3284,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   protected void scaleAbove_actionPerformed(ActionEvent e)
   {
@@ -3187,6 +3299,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   protected void scaleLeft_actionPerformed(ActionEvent e)
   {
@@ -3201,6 +3314,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   protected void scaleRight_actionPerformed(ActionEvent e)
   {
@@ -3215,6 +3329,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void viewBoxesMenuItem_actionPerformed(ActionEvent e)
   {
@@ -3228,6 +3343,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void viewTextMenuItem_actionPerformed(ActionEvent e)
   {
@@ -3241,6 +3357,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   protected void renderGapsMenuItem_actionPerformed(ActionEvent e)
   {
@@ -3250,18 +3367,26 @@ public class AlignFrame extends GAlignFrame
 
   public FeatureSettings featureSettings;
 
+  
   @Override
   public FeatureSettingsControllerI getFeatureSettingsUI()
   {
     return featureSettings;
   }
 
+  
   @Override
   public void featureSettings_actionPerformed(ActionEvent e)
   {
+    showFeatureSettingsUI();
+  }
+
+  
+  public FeatureSettingsControllerI showFeatureSettingsUI()
+  {
     if (featureSettings != null)
     {
-      featureSettings.close();
+      // featureSettings.closeOldSettings();
       featureSettings = null;
     }
     if (!showSeqFeatures.isSelected())
@@ -3271,6 +3396,7 @@ public class AlignFrame extends GAlignFrame
       showSeqFeatures_actionPerformed(null);
     }
     featureSettings = new FeatureSettings(this);
+    return featureSettings;
   }
 
   /**
@@ -3279,6 +3405,7 @@ public class AlignFrame extends GAlignFrame
    * @param evt
    *          DOCUMENT ME!
    */
+  
   @Override
   public void showSeqFeatures_actionPerformed(ActionEvent evt)
   {
@@ -3295,25 +3422,25 @@ public class AlignFrame extends GAlignFrame
    * 
    * @param e
    */
+  
   @Override
   public void annotationPanelMenuItem_actionPerformed(ActionEvent e)
   {
     final boolean setVisible = annotationPanelMenuItem.isSelected();
     viewport.setShowAnnotation(setVisible);
-    syncAnnotationMenuItems();
+    syncAnnotationMenuItems(setVisible);
     alignPanel.updateLayout();
   }
 
-  private void syncAnnotationMenuItems()
+  private void syncAnnotationMenuItems(boolean setVisible)
   {
-    final boolean setVisible = annotationPanelMenuItem.isSelected();
     showAllSeqAnnotations.setEnabled(setVisible);
     hideAllSeqAnnotations.setEnabled(setVisible);
     showAllAlAnnotations.setEnabled(setVisible);
     hideAllAlAnnotations.setEnabled(setVisible);
   }
 
-
+  
   @Override
   public void alignmentProperties()
   {
@@ -3331,7 +3458,7 @@ public class AlignFrame extends GAlignFrame
       JLabel textLabel = new JLabel();
       textLabel.setText(content);
       textLabel.setBackground(Color.WHITE);
-      
+
       pane = new JPanel(new BorderLayout());
       ((JPanel) pane).setOpaque(true);
       pane.setBackground(Color.WHITE);
@@ -3365,6 +3492,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void overviewMenuItem_actionPerformed(ActionEvent e)
   {
@@ -3374,17 +3502,42 @@ public class AlignFrame extends GAlignFrame
     }
 
     JInternalFrame frame = new JInternalFrame();
-    final OverviewPanel overview = new OverviewPanel(alignPanel);
+
+    // BH 2019.07.26 we allow for an embedded
+    // undecorated overview with defined size
+    frame.setName(Jalview.getAppID("overview"));
+    //
+    Dimension dim = Platform.getDimIfEmbedded(frame, -1, -1);
+    if (dim != null && dim.width == 0)
+    {
+      dim = null; // hidden, not embedded
+    }
+    OverviewPanel overview = new OverviewPanel(alignPanel, dim);
+
     frame.setContentPane(overview);
+    if (dim == null)
+    {
+      dim = new Dimension();
+      // was frame.getSize(), but that is 0,0 at this point;
+    }
+    else
+    {
+      // we are imbedding, and so we have an undecorated frame
+      // and we can set the the frame dimensions accordingly.
+    }
+    // allowing for unresizable option using, style="resize:none"
+    boolean resizable = (Platform.getEmbeddedAttribute(frame,
+            "resize") != "none");
     Desktop.addInternalFrame(frame, MessageManager
             .formatMessage("label.overview_params", new Object[]
-            { this.getTitle() }), true, frame.getWidth(), frame.getHeight(),
-            true, true, "overview");
+            { this.getTitle() }), true, dim.width, dim.height, resizable,
+            true);
     frame.pack();
     frame.setLayer(JLayeredPane.PALETTE_LAYER);
     frame.addInternalFrameListener(
             new javax.swing.event.InternalFrameAdapter()
             {
+              
               @Override
               public void internalFrameClosed(
                       javax.swing.event.InternalFrameEvent evt)
@@ -3401,6 +3554,7 @@ public class AlignFrame extends GAlignFrame
     alignPanel.setOverviewPanel(overview);
   }
 
+  
   @Override
   public void textColour_actionPerformed()
   {
@@ -3413,12 +3567,14 @@ public class AlignFrame extends GAlignFrame
    * CovariationColourScheme(viewport.getAlignment().getAlignmentAnnotation
    * ()[0])); }
    */
+  
   @Override
   public void annotationColour_actionPerformed()
   {
     new AnnotationColourChooser(viewport, alignPanel);
   }
 
+  
   @Override
   public void annotationColumn_actionPerformed(ActionEvent e)
   {
@@ -3432,6 +3588,7 @@ public class AlignFrame extends GAlignFrame
    * 
    * @param selected
    */
+  
   @Override
   public void applyToAllGroups_actionPerformed(boolean selected)
   {
@@ -3444,6 +3601,7 @@ public class AlignFrame extends GAlignFrame
    * @param name
    *          the name (not the menu item label!) of the colour scheme
    */
+  
   @Override
   public void changeColour_actionPerformed(String name)
   {
@@ -3461,8 +3619,8 @@ public class AlignFrame extends GAlignFrame
      * otherwise set the chosen colour scheme (or null for 'None')
      */
     ColourSchemeI cs = ColourSchemes.getInstance().getColourScheme(name,
-            viewport,
-            viewport.getAlignment(), viewport.getHiddenRepSequences());
+            viewport, viewport.getAlignment(),
+            viewport.getHiddenRepSequences());
     changeColour(cs);
   }
 
@@ -3471,6 +3629,7 @@ public class AlignFrame extends GAlignFrame
    * 
    * @param cs
    */
+  
   @Override
   public void changeColour(ColourSchemeI cs)
   {
@@ -3485,6 +3644,7 @@ public class AlignFrame extends GAlignFrame
   /**
    * Show the PID threshold slider panel
    */
+  
   @Override
   protected void modifyPID_actionPerformed()
   {
@@ -3496,6 +3656,7 @@ public class AlignFrame extends GAlignFrame
   /**
    * Show the Conservation slider panel
    */
+  
   @Override
   protected void modifyConservation_actionPerformed()
   {
@@ -3507,6 +3668,7 @@ public class AlignFrame extends GAlignFrame
   /**
    * Action on selecting or deselecting (Colour) By Conservation
    */
+  
   @Override
   public void conservationMenuItem_actionPerformed(boolean selected)
   {
@@ -3528,6 +3690,7 @@ public class AlignFrame extends GAlignFrame
   /**
    * Action on selecting or deselecting (Colour) Above PID Threshold
    */
+  
   @Override
   public void abovePIDThreshold_actionPerformed(boolean selected)
   {
@@ -3556,6 +3719,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void sortPairwiseMenuItem_actionPerformed(ActionEvent e)
   {
@@ -3573,6 +3737,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void sortIDMenuItem_actionPerformed(ActionEvent e)
   {
@@ -3589,6 +3754,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void sortLengthMenuItem_actionPerformed(ActionEvent e)
   {
@@ -3605,6 +3771,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void sortGroupMenuItem_actionPerformed(ActionEvent e)
   {
@@ -3622,6 +3789,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void removeRedundancyMenuItem_actionPerformed(ActionEvent e)
   {
@@ -3634,6 +3802,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)
   {
@@ -3656,10 +3825,12 @@ public class AlignFrame extends GAlignFrame
     }
   }
 
+  
   @Override
   public void autoCalculate_actionPerformed(ActionEvent e)
   {
-    viewport.setAutoCalculateConsensusAndConservation(autoCalculate.isSelected());
+    viewport.setAutoCalculateConsensusAndConservation(
+            autoCalculate.isSelected());
     if (viewport.getAutoCalculateConsensusAndConservation())
     {
       viewport.firePropertyChange("alignment", null,
@@ -3667,12 +3838,14 @@ public class AlignFrame extends GAlignFrame
     }
   }
 
+  
   @Override
   public void sortByTreeOption_actionPerformed(ActionEvent e)
   {
     viewport.sortByTree = sortByTree.isSelected();
   }
 
+  
   @Override
   protected void listenToViewSelections_actionPerformed(ActionEvent e)
   {
@@ -3738,7 +3911,8 @@ public class AlignFrame extends GAlignFrame
 
     frameTitle += this.title;
 
-    Desktop.addInternalFrame(tp, frameTitle, 600, 500);
+    Dimension dim = Platform.getDimIfEmbedded(tp, 600, 500);
+    Desktop.addInternalFrame(tp, frameTitle, dim.width, dim.height);
   }
 
   /**
@@ -3758,6 +3932,7 @@ public class AlignFrame extends GAlignFrame
     sort.add(item);
     item.addActionListener(new java.awt.event.ActionListener()
     {
+      
       @Override
       public void actionPerformed(ActionEvent e)
       {
@@ -3791,6 +3966,7 @@ public class AlignFrame extends GAlignFrame
     sort.add(item);
     item.addActionListener(new java.awt.event.ActionListener()
     {
+      
       @Override
       public void actionPerformed(ActionEvent e)
       {
@@ -3816,6 +3992,7 @@ public class AlignFrame extends GAlignFrame
    * rebuilding in subsequence calls.
    * 
    */
+  
   @Override
   public void buildSortByAnnotationScoresMenu()
   {
@@ -3845,8 +4022,7 @@ public class AlignFrame extends GAlignFrame
       Enumeration<String> labels = scoreSorts.keys();
       while (labels.hasMoreElements())
       {
-        addSortByAnnotScoreMenuItem(sortByAnnotScore,
-                labels.nextElement());
+        addSortByAnnotScoreMenuItem(sortByAnnotScore, labels.nextElement());
       }
       sortByAnnotScore.setVisible(scoreSorts.size() > 0);
       scoreSorts.clear();
@@ -3863,6 +4039,7 @@ public class AlignFrame extends GAlignFrame
    * closed, and adjust the tree leaf to sequence mapping when the alignment is
    * modified.
    */
+  
   @Override
   public void buildTreeSortMenu()
   {
@@ -3892,6 +4069,7 @@ public class AlignFrame extends GAlignFrame
       final JMenuItem item = new JMenuItem(tp.getTitle());
       item.addActionListener(new java.awt.event.ActionListener()
       {
+        
         @Override
         public void actionPerformed(ActionEvent e)
         {
@@ -4001,6 +4179,7 @@ public class AlignFrame extends GAlignFrame
    * @param e
    *          DOCUMENT ME!
    */
+  
   @Override
   protected void loadTreeMenuItem_actionPerformed(ActionEvent e)
   {
@@ -4013,8 +4192,9 @@ public class AlignFrame extends GAlignFrame
     chooser.setToolTipText(
             MessageManager.getString("label.load_tree_file"));
 
-    chooser.setResponseHandler(0,new Runnable()
+    chooser.setResponseHandler(0, new Runnable()
     {
+      
       @Override
       public void run()
       {
@@ -4028,7 +4208,8 @@ public class AlignFrame extends GAlignFrame
           viewport.setCurrentTree(showNewickTree(fin, filePath).getTree());
         } catch (Exception ex)
         {
-          JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), ex.getMessage(),
+          JvOptionPane.showMessageDialog(Desktop.getDesktopPane(),
+                  ex.getMessage(),
                   MessageManager
                           .getString("label.problem_reading_tree_file"),
                   JvOptionPane.WARNING_MESSAGE);
@@ -4090,15 +4271,24 @@ public class AlignFrame extends GAlignFrame
       if (nf.getTree() != null)
       {
         tp = new TreePanel(alignPanel, nf, treeTitle, input);
-
-        tp.setSize(w, h);
+        Dimension dim = Platform.getDimIfEmbedded(tp, -1, -1);
+        if (dim == null)
+        {
+          dim = new Dimension(w, h);
+        }
+        else
+        {
+          // no offset, either
+          x = 0;
+        }
+        tp.setSize(dim.width, dim.height);
 
         if (x > 0 && y > 0)
         {
           tp.setLocation(x, y);
         }
 
-        Desktop.addInternalFrame(tp, treeTitle, w, h);
+        Desktop.addInternalFrame(tp, treeTitle, dim.width, dim.height);
       }
     } catch (Exception ex)
     {
@@ -4130,6 +4320,7 @@ public class AlignFrame extends GAlignFrame
     buildingMenu = true;
     new Thread(new Runnable()
     {
+      
       @Override
       public void run()
       {
@@ -4164,11 +4355,11 @@ public class AlignFrame extends GAlignFrame
           final JMenu dismenu = new JMenu("Protein Disorder");
           // JAL-940 - only show secondary structure prediction services from
           // the legacy server
-          Hashtable<String, Vector<ServiceHandle>> services = Discoverer
+          Hashtable<String, Vector<ServiceHandle>> ds = Discoverer
                   .getInstance().getServices();
           if (// Cache.getDefault("SHOW_JWS1_SERVICES", true)
           // &&
-          services != null && (services.size() > 0))
+          ds != null && (ds.size() > 0))
           {
             // TODO: refactor to allow list of AbstractName/Handler bindings to
             // be
@@ -4176,14 +4367,13 @@ public class AlignFrame extends GAlignFrame
             // No MSAWS used any more:
             // Vector msaws = null; // (Vector)
             // Discoverer.services.get("MsaWS");
-            Vector<ServiceHandle> secstrpr = services.get("SecStrPred");
+            Vector<ServiceHandle> secstrpr = ds.get("SecStrPred");
             if (secstrpr != null)
             {
               // Add any secondary structure prediction services
               for (int i = 0, j = secstrpr.size(); i < j; i++)
               {
-                final ext.vamsas.ServiceHandle sh = secstrpr
-                        .get(i);
+                final ext.vamsas.ServiceHandle sh = secstrpr.get(i);
                 jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer
                         .getServiceClient(sh);
                 int p = secstrmenu.getItemCount();
@@ -4208,6 +4398,7 @@ public class AlignFrame extends GAlignFrame
 
           javax.swing.SwingUtilities.invokeLater(new Runnable()
           {
+            
             @Override
             public void run()
             {
@@ -4300,7 +4491,7 @@ public class AlignFrame extends GAlignFrame
      * JMenuItem testAlView = new JMenuItem("Test AlignmentView"); final
      * AlignFrame af = this; testAlView.addActionListener(new ActionListener() {
      * 
-     * @Override public void actionPerformed(ActionEvent e) {
+     *  public void actionPerformed(ActionEvent e) {
      * jalview.datamodel.AlignmentView
      * .testSelectionViews(af.viewport.getAlignment(),
      * af.viewport.getColumnSelection(), af.viewport.selectionGroup); }
@@ -4356,6 +4547,7 @@ public class AlignFrame extends GAlignFrame
         JMenuItem xtype = new JMenuItem(source);
         xtype.addActionListener(new ActionListener()
         {
+          
           @Override
           public void actionPerformed(ActionEvent e)
           {
@@ -4399,6 +4591,7 @@ public class AlignFrame extends GAlignFrame
    * Construct and display a new frame containing the translation of this
    * frame's DNA sequences to their aligned protein (amino acid) equivalents.
    */
+  
   @Override
   public void showTranslation_actionPerformed(GeneticCodeI codeTable)
   {
@@ -4417,8 +4610,8 @@ public class AlignFrame extends GAlignFrame
       final String errorTitle = MessageManager
               .getString("label.implementation_error")
               + MessageManager.getString("label.translation_failed");
-      JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msg, errorTitle,
-              JvOptionPane.ERROR_MESSAGE);
+      JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msg,
+              errorTitle, JvOptionPane.ERROR_MESSAGE);
       return;
     }
     if (al == null || al.getHeight() == 0)
@@ -4427,8 +4620,8 @@ public class AlignFrame extends GAlignFrame
               "label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation");
       final String errorTitle = MessageManager
               .getString("label.translation_failed");
-      JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msg, errorTitle,
-              JvOptionPane.WARNING_MESSAGE);
+      JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msg,
+              errorTitle, JvOptionPane.WARNING_MESSAGE);
     }
     else
     {
@@ -4478,6 +4671,7 @@ public class AlignFrame extends GAlignFrame
 
   }
 
+  
   @Override
   public void refreshFeatureUI(boolean enableIfNecessary)
   {
@@ -4492,26 +4686,31 @@ public class AlignFrame extends GAlignFrame
 
   }
 
+  
   @Override
   public void dragEnter(DropTargetDragEvent evt)
   {
   }
 
+  
   @Override
   public void dragExit(DropTargetEvent evt)
   {
   }
 
+  
   @Override
   public void dragOver(DropTargetDragEvent evt)
   {
   }
 
+  
   @Override
   public void dropActionChanged(DropTargetDragEvent evt)
   {
   }
 
+  
   @Override
   public void drop(DropTargetDropEvent evt)
   {
@@ -4520,24 +4719,34 @@ public class AlignFrame extends GAlignFrame
     evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
     Transferable t = evt.getTransferable();
 
-    final AlignFrame thisaf = this;
     final List<Object> files = new ArrayList<>();
     List<DataSourceType> protocols = new ArrayList<>();
 
     try
     {
       Desktop.transferFromDropTarget(files, protocols, evt, t);
-    } catch (Exception e)
-    {
-      e.printStackTrace();
-    }
-    if (files != null)
+      if (files.size() > 0)
     {
       new Thread(new Runnable()
       {
+        
         @Override
         public void run()
         {
+            loadDroppedFiles(files, protocols, evt, t);
+          }
+        }).start();
+      }
+    } catch (Exception e)
+    {
+      e.printStackTrace();
+    }
+  }
+
+  protected void loadDroppedFiles(List<Object> files,
+          List<DataSourceType> protocols, DropTargetDropEvent evt,
+          Transferable t)
+  {
           try
           {
             // check to see if any of these files have names matching sequences
@@ -4562,10 +4771,13 @@ public class AlignFrame extends GAlignFrame
               if (protocol == DataSourceType.FILE)
               {
                 File fl;
-                if (file instanceof File) {
+                if (file instanceof File)
+                {
                   fl = (File) file;
                   Platform.cacheFileData(fl);
-                } else {
+                }
+                else
+                {
                   fl = new File(fileName);
                 }
                 pdbfn = fl.getName();
@@ -4616,8 +4828,8 @@ public class AlignFrame extends GAlignFrame
             int assocfiles = 0;
             if (filesmatched.size() > 0)
             {
-              boolean autoAssociate = Cache
-                      .getDefault(Preferences.AUTOASSOCIATE_PDBANDSEQS, false);
+              boolean autoAssociate = Cache.getDefault(
+                      Preferences.AUTOASSOCIATE_PDBANDSEQS, false);
               if (!autoAssociate)
               {
                 String msg = MessageManager.formatMessage(
@@ -4627,8 +4839,8 @@ public class AlignFrame extends GAlignFrame
                                 .toString() });
                 String ttl = MessageManager.getString(
                         "label.automatically_associate_structure_files_by_name");
-                int choice = JvOptionPane.showConfirmDialog(thisaf, msg,
-                        ttl, JvOptionPane.YES_NO_OPTION);
+          int choice = JvOptionPane.showConfirmDialog(this, msg, ttl,
+                  JvOptionPane.YES_NO_OPTION);
                 autoAssociate = choice == JvOptionPane.YES_OPTION;
               }
               if (autoAssociate)
@@ -4669,9 +4881,9 @@ public class AlignFrame extends GAlignFrame
             }
             if (filesnotmatched.size() > 0)
             {
-              if (assocfiles > 0 && (Cache.getDefault(
-                      "AUTOASSOCIATE_PDBANDSEQS_IGNOREOTHERS", false)
-                      || JvOptionPane.showConfirmDialog(thisaf,
+        if (assocfiles > 0 && (Cache
+                .getDefault("AUTOASSOCIATE_PDBANDSEQS_IGNOREOTHERS", false)
+                || JvOptionPane.showConfirmDialog(this,
                               "<html>" + MessageManager.formatMessage(
                                       "label.ignore_unmatched_dropped_files_info",
                                       new Object[]
@@ -4696,9 +4908,6 @@ public class AlignFrame extends GAlignFrame
             ex.printStackTrace();
           }
         }
-      }).start();
-    }
-  }
 
   /**
    * Attempt to load a "dropped" file or URL string, by testing in turn for
@@ -4807,9 +5016,17 @@ public class AlignFrame extends GAlignFrame
           {
             if (parseFeaturesFile(file, sourceType))
             {
+              SplitFrame splitFrame = (SplitFrame) getSplitViewContainer();
+              if (splitFrame != null)
+              {
+                splitFrame.repaint();
+              }
+              else
+              {
               alignPanel.paintAlignment(true, true);
             }
           }
+          }
           else
           {
             new FileLoader().loadFile(viewport, file, sourceType, format);
@@ -4859,9 +5076,37 @@ public class AlignFrame extends GAlignFrame
   }
 
   /**
+   * Change the display state for the given feature groups -- Added by BH from
+   * JalviewLite
+   * 
+   * @param groups
+   *          list of group strings
+   * @param state
+   *          visible or invisible
+   */
+  
+  public void setFeatureGroupState(String[] groups, boolean state)
+  {
+    jalview.api.FeatureRenderer fr = null;
+    viewport.setShowSequenceFeatures(true);
+    if (alignPanel != null
+            && (fr = alignPanel.getFeatureRenderer()) != null)
+    {
+
+      fr.setGroupVisibility(Arrays.asList(groups), state);
+      alignPanel.getSeqPanel().seqCanvas.repaint();
+      if (alignPanel.overviewPanel != null)
+      {
+        alignPanel.overviewPanel.updateOverviewImage();
+      }
+    }
+  }
+
+  /**
    * Method invoked by the ChangeListener on the tabbed pane, in other words
    * when a different tabbed pane is selected by the user or programmatically.
    */
+  
   @Override
   public void tabSelectionChanged(int index)
   {
@@ -4871,6 +5116,21 @@ public class AlignFrame extends GAlignFrame
       viewport = alignPanel.av;
       avc.setViewportAndAlignmentPanel(viewport, alignPanel);
       setMenusFromViewport(viewport);
+      if (featureSettings != null// && featureSettings.isOpen()
+              && featureSettings.fr.getViewport() != viewport)
+      {
+        if (viewport.isShowSequenceFeatures())
+        {
+          // refresh the featureSettings to reflect UI change
+          showFeatureSettingsUI();
+        }
+        else
+        {
+          // close feature settings for this view.
+          featureSettings.close();
+        }
+      }
+
     }
 
     /*
@@ -4917,6 +5177,7 @@ public class AlignFrame extends GAlignFrame
   /**
    * On right mouse click on view tab, prompt for and set new view name.
    */
+  
   @Override
   public void tabbedPane_mousePressed(MouseEvent e)
   {
@@ -4941,34 +5202,9 @@ public class AlignFrame extends GAlignFrame
   }
 
   /**
-   * Change the display state for the given feature groups -- Added by BH from
-   * JalviewLite
-   * 
-   * @param groups
-   *          list of group strings
-   * @param state
-   *          visible or invisible
-   */
-  public void setFeatureGroupState(String[] groups, boolean state)
-  {
-    jalview.api.FeatureRenderer fr = null;
-    viewport.setShowSequenceFeatures(true);
-    if (alignPanel != null
-            && (fr = alignPanel.getFeatureRenderer()) != null)
-    {
-
-      fr.setGroupVisibility(Arrays.asList(groups), state);
-      alignPanel.getSeqPanel().seqCanvas.repaint();
-      if (alignPanel.overviewPanel != null)
-      {
-        alignPanel.overviewPanel.updateOverviewImage();
-      }
-    }
-  }
-
-  /**
    * Open the dialog for regex description parsing.
    */
+  
   @Override
   protected void extractScores_actionPerformed(ActionEvent e)
   {
@@ -4992,6 +5228,7 @@ public class AlignFrame extends GAlignFrame
    * jalview.jbgui.GAlignFrame#showDbRefs_actionPerformed(java.awt.event.ActionEvent
    * )
    */
+  
   @Override
   protected void showDbRefs_actionPerformed(ActionEvent e)
   {
@@ -5004,6 +5241,7 @@ public class AlignFrame extends GAlignFrame
    * @seejalview.jbgui.GAlignFrame#showNpFeats_actionPerformed(java.awt.event.
    * ActionEvent)
    */
+  
   @Override
   protected void showNpFeats_actionPerformed(ActionEvent e)
   {
@@ -5059,6 +5297,7 @@ public class AlignFrame extends GAlignFrame
             Cache.getDefault(DBRefFetcher.TRIM_RETRIEVED_SEQUENCES, true));
     trimrs.addActionListener(new ActionListener()
     {
+      
       @Override
       public void actionPerformed(ActionEvent e)
       {
@@ -5075,11 +5314,13 @@ public class AlignFrame extends GAlignFrame
     fetchr.addActionListener(new ActionListener()
     {
 
+      
       @Override
       public void actionPerformed(ActionEvent e)
       {
         new Thread(new Runnable()
         {
+          
           @Override
           public void run()
           {
@@ -5091,9 +5332,17 @@ public class AlignFrame extends GAlignFrame
                     alignPanel.alignFrame.featureSettings, isNucleotide);
             dbRefFetcher.addListener(new FetchFinishedListenerI()
             {
+              
               @Override
               public void finished()
               {
+                //
+                // for (FeatureSettingsModelI srcSettings : dbRefFetcher
+                // .getFeatureSettingsModels())
+                // {
+                //
+                // alignPanel.av.mergeFeaturesStyle(srcSettings);
+                // }
                 AlignFrame.this.setMenusForViewport();
               }
             });
@@ -5107,16 +5356,19 @@ public class AlignFrame extends GAlignFrame
     rfetch.add(fetchr);
     new Thread(new Runnable()
     {
+      
       @Override
       public void run()
       {
         javax.swing.SwingUtilities.invokeLater(new Runnable()
         {
+          
           @Override
           public void run()
           {
-            String[] dbclasses = jalview.ws.SequenceFetcher.getInstance()
-                    .getNonAlignmentSources();
+                 jalview.ws.SequenceFetcher
+                 sf = jalview.ws.SequenceFetcher.getInstance();
+            String[] dbclasses = sf.getNonAlignmentSources();
             List<DbSourceProxy> otherdb;
             JMenu dfetch = new JMenu();
             JMenu ifetch = new JMenu();
@@ -5126,8 +5378,7 @@ public class AlignFrame extends GAlignFrame
             int dbi = 0;
             for (String dbclass : dbclasses)
             {
-              otherdb = jalview.ws.SequenceFetcher.getInstance()
-                      .getSourceProxy(dbclass);
+              otherdb = sf.getSourceProxy(dbclass);
               // add a single entry for this class, or submenu allowing 'fetch
               // all' or pick one
               if (otherdb == null || otherdb.size() < 1)
@@ -5141,18 +5392,19 @@ public class AlignFrame extends GAlignFrame
               if (otherdb.size() == 1)
               {
                 DbSourceProxy src = otherdb.get(0);
-                DbSourceProxy[] dassource = new DbSourceProxy[] {
-                    src };
+                DbSourceProxy[] dassource = new DbSourceProxy[] { src };
                 fetchr = new JMenuItem(src.getDbSource());
                 fetchr.addActionListener(new ActionListener()
                 {
 
+                  
                   @Override
                   public void actionPerformed(ActionEvent e)
                   {
                     new Thread(new Runnable()
                     {
 
+                      
                       @Override
                       public void run()
                       {
@@ -5167,9 +5419,14 @@ public class AlignFrame extends GAlignFrame
                         dbRefFetcher
                                 .addListener(new FetchFinishedListenerI()
                                 {
+                                  
                                   @Override
                                   public void finished()
                                   {
+                                    FeatureSettingsModelI srcSettings = dassource[0]
+                                            .getFeatureColourScheme();
+                                    // alignPanel.av.mergeFeaturesStyle(
+                                    // srcSettings);
                                     AlignFrame.this.setMenusForViewport();
                                   }
                                 });
@@ -5197,12 +5454,14 @@ public class AlignFrame extends GAlignFrame
                         { src.getDbSource() }));
                 fetchr.addActionListener(new ActionListener()
                 {
+                  
                   @Override
                   public void actionPerformed(ActionEvent e)
                   {
                     new Thread(new Runnable()
                     {
 
+                      
                       @Override
                       public void run()
                       {
@@ -5217,6 +5476,7 @@ public class AlignFrame extends GAlignFrame
                         dbRefFetcher
                                 .addListener(new FetchFinishedListenerI()
                                 {
+                                  
                                   @Override
                                   public void finished()
                                   {
@@ -5265,12 +5525,14 @@ public class AlignFrame extends GAlignFrame
                   fetchr.addActionListener(new ActionListener()
                   {
 
+                    
                     @Override
                     public void actionPerformed(ActionEvent e)
                     {
                       new Thread(new Runnable()
                       {
 
+                        
                         @Override
                         public void run()
                         {
@@ -5285,6 +5547,7 @@ public class AlignFrame extends GAlignFrame
                           dbRefFetcher
                                   .addListener(new FetchFinishedListenerI()
                                   {
+                                    
                                     @Override
                                     public void finished()
                                     {
@@ -5336,6 +5599,7 @@ public class AlignFrame extends GAlignFrame
   /**
    * Left justify the whole alignment.
    */
+  
   @Override
   protected void justifyLeftMenuItem_actionPerformed(ActionEvent e)
   {
@@ -5347,6 +5611,7 @@ public class AlignFrame extends GAlignFrame
   /**
    * Right justify the whole alignment.
    */
+  
   @Override
   protected void justifyRightMenuItem_actionPerformed(ActionEvent e)
   {
@@ -5355,6 +5620,7 @@ public class AlignFrame extends GAlignFrame
     viewport.firePropertyChange("alignment", null, al);
   }
 
+  
   @Override
   public void setShowSeqFeatures(boolean b)
   {
@@ -5369,6 +5635,7 @@ public class AlignFrame extends GAlignFrame
    * jalview.jbgui.GAlignFrame#showUnconservedMenuItem_actionPerformed(java.
    * awt.event.ActionEvent)
    */
+  
   @Override
   protected void showUnconservedMenuItem_actionPerformed(ActionEvent e)
   {
@@ -5383,6 +5650,7 @@ public class AlignFrame extends GAlignFrame
    * jalview.jbgui.GAlignFrame#showGroupConsensus_actionPerformed(java.awt.event
    * .ActionEvent)
    */
+  
   @Override
   protected void showGroupConsensus_actionPerformed(ActionEvent e)
   {
@@ -5398,6 +5666,7 @@ public class AlignFrame extends GAlignFrame
    * jalview.jbgui.GAlignFrame#showGroupConservation_actionPerformed(java.awt
    * .event.ActionEvent)
    */
+  
   @Override
   protected void showGroupConservation_actionPerformed(ActionEvent e)
   {
@@ -5412,6 +5681,7 @@ public class AlignFrame extends GAlignFrame
    * jalview.jbgui.GAlignFrame#showConsensusHistogram_actionPerformed(java.awt
    * .event.ActionEvent)
    */
+  
   @Override
   protected void showConsensusHistogram_actionPerformed(ActionEvent e)
   {
@@ -5426,6 +5696,7 @@ public class AlignFrame extends GAlignFrame
    * jalview.jbgui.GAlignFrame#showConsensusProfile_actionPerformed(java.awt
    * .event.ActionEvent)
    */
+  
   @Override
   protected void showSequenceLogo_actionPerformed(ActionEvent e)
   {
@@ -5433,6 +5704,7 @@ public class AlignFrame extends GAlignFrame
     alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
   }
 
+  
   @Override
   protected void normaliseSequenceLogo_actionPerformed(ActionEvent e)
   {
@@ -5442,6 +5714,7 @@ public class AlignFrame extends GAlignFrame
     alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
   }
 
+  
   @Override
   protected void applyAutoAnnotationSettings_actionPerformed(ActionEvent e)
   {
@@ -5455,6 +5728,7 @@ public class AlignFrame extends GAlignFrame
    * jalview.jbgui.GAlignFrame#makeGrpsFromSelection_actionPerformed(java.awt
    * .event.ActionEvent)
    */
+  
   @Override
   protected void makeGrpsFromSelection_actionPerformed(ActionEvent e)
   {
@@ -5479,6 +5753,7 @@ public class AlignFrame extends GAlignFrame
     }
   }
 
+  
   @Override
   protected void createGroup_actionPerformed(ActionEvent e)
   {
@@ -5492,6 +5767,7 @@ public class AlignFrame extends GAlignFrame
     }
   }
 
+  
   @Override
   protected void unGroup_actionPerformed(ActionEvent e)
   {
@@ -5530,6 +5806,7 @@ public class AlignFrame extends GAlignFrame
    * @param forAlignment
    *          update non-sequence-related annotations
    */
+  
   @Override
   protected void setAnnotationsVisibility(boolean visible,
           boolean forSequences, boolean forAlignment)
@@ -5563,6 +5840,7 @@ public class AlignFrame extends GAlignFrame
   /**
    * Store selected annotation sort order for the view and repaint.
    */
+  
   @Override
   protected void sortAnnotations_actionPerformed()
   {
@@ -5637,6 +5915,7 @@ public class AlignFrame extends GAlignFrame
    * 
    * @param show
    */
+  
   @Override
   protected void showComplement_actionPerformed(boolean show)
   {
@@ -5651,6 +5930,7 @@ public class AlignFrame extends GAlignFrame
    * Generate the reverse (optionally complemented) of the selected sequences,
    * and add them to the alignment
    */
+  
   @Override
   protected void showReverse_actionPerformed(boolean complement)
   {
@@ -5676,6 +5956,7 @@ public class AlignFrame extends GAlignFrame
    * AlignFrame is set as currentAlignFrame in Desktop, to allow the script to
    * be targeted at this alignment.
    */
+  
   @Override
   protected void runGroovy_actionPerformed()
   {
@@ -5726,6 +6007,7 @@ public class AlignFrame extends GAlignFrame
     return false;
   }
 
+  
   @Override
   protected void selectHighlightedColumns_actionPerformed(
           ActionEvent actionEvent)
@@ -5776,6 +6058,7 @@ public class AlignFrame extends GAlignFrame
     }
   }
 
+  
   @Override
   protected void loadVcf_actionPerformed()
   {
@@ -5787,6 +6070,7 @@ public class AlignFrame extends GAlignFrame
     final AlignFrame us = this;
     chooser.setResponseHandler(0, new Runnable()
     {
+      
       @Override
       public void run()
       {
@@ -5800,6 +6084,38 @@ public class AlignFrame extends GAlignFrame
 
   }
 
+  private Rectangle lastFeatureSettingsBounds = null;
+
+  
+  public void setFeatureSettingsGeometry(Rectangle bounds)
+  {
+    lastFeatureSettingsBounds = bounds;
+  }
+
+  
+  public Rectangle getFeatureSettingsGeometry()
+  {
+    return lastFeatureSettingsBounds;
+  }
+
+  
+  public void scrollTo(int row, int column)
+  {
+    alignPanel.getSeqPanel().scrollTo(row, column);
+  }
+
+  
+  public void scrollToRow(int row)
+  {
+    alignPanel.getSeqPanel().scrollToRow(row);
+  }
+
+  
+  public void scrollToColumn(int column)
+  {
+    alignPanel.getSeqPanel().scrollToColumn(column);
+  }
+
   /**
    * BH 2019 from JalviewLite
    * 
@@ -5813,8 +6129,7 @@ public class AlignFrame extends GAlignFrame
   {
     jalview.api.FeatureRenderer fr = null;
     if (alignPanel != null
-            && (fr = alignPanel
-                    .getFeatureRenderer()) != null)
+            && (fr = alignPanel.getFeatureRenderer()) != null)
     {
       List<String> gps = fr.getGroups(visible);
       String[] _gps = gps.toArray(new String[gps.size()]);
@@ -5823,21 +6138,6 @@ public class AlignFrame extends GAlignFrame
     return null;
   }
 
-  public void scrollTo(int row, int column)
-  {
-    alignPanel.getSeqPanel().scrollTo(row, column);
-  }
-
-  public void scrollToRow(int row)
-  {
-    alignPanel.getSeqPanel().scrollToRow(row);
-  }
-
-  public void scrollToColumn(int column)
-  {
-    alignPanel.getSeqPanel().scrollToColumn(column);
-  }
-
   /**
    * 
    * @return list of feature groups on the view