JAL-3534 patch for simple case (Protein or Nucleotide, but not linked): transfer...
authorJim Procter <jprocter@issues.jalview.org>
Mon, 17 Feb 2020 15:27:15 +0000 (15:27 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 17 Feb 2020 15:27:15 +0000 (15:27 +0000)
src/jalview/gui/Desktop.java

index 1ec6939..22280ed 100644 (file)
@@ -1923,11 +1923,22 @@ public class Desktop extends jalview.jbgui.GDesktop
       return;
     }
 
+    // FIXME: ideally should use UI interface API
+    FeatureSettings viewFeatureSettings = af.featureSettings;
+    Rectangle fsBounds = af.getFeatureSettingsGeometry();
     for (int i = 0; i < size; i++)
     {
       AlignmentPanel ap = af.alignPanels.get(i);
+
       AlignFrame newaf = new AlignFrame(ap);
 
+      // transfer reference for existing feature settings to new alignFrame
+      if (ap == af.alignPanel)
+      {
+        newaf.featureSettings = viewFeatureSettings;
+        newaf.setFeatureSettingsGeometry(fsBounds);
+      }
+
       /*
        * Restore the view's last exploded frame geometry if known. Multiple
        * views from one exploded frame share and restore the same (frame)
@@ -1964,7 +1975,6 @@ public class Desktop extends jalview.jbgui.GDesktop
     source.viewport.setExplodedGeometry(source.getBounds());
     JInternalFrame[] frames = desktop.getAllFrames();
     String viewId = source.viewport.getSequenceSetId();
-
     for (int t = 0; t < frames.length; t++)
     {
       if (frames[t] instanceof AlignFrame && frames[t] != source)
@@ -1985,6 +1995,21 @@ public class Desktop extends jalview.jbgui.GDesktop
 
         if (gatherThis)
         {
+          if (af.featureSettings != null)
+          {
+            if (source.featureSettings == null)
+            {
+              // preserve the feature settings geometry for this frame
+              source.featureSettings = af.featureSettings;
+              source.setFeatureSettingsGeometry(
+                      af.getFeatureSettingsGeometry());
+            }
+            else
+            {
+              // close it and forget
+              af.featureSettings.close();
+            }
+          }
           af.alignPanels.clear();
           af.closeMenuItem_actionPerformed(true);
         }