merge
[jalview.git] / src / jalview / gui / Desktop.java
index d03e3f2..c957444 100644 (file)
@@ -33,6 +33,7 @@ import jalview.jbgui.GStructureViewer;
 import jalview.structure.StructureSelectionManager;
 import jalview.util.ImageMaker;
 import jalview.util.MessageManager;
+import jalview.util.Platform;
 import jalview.viewmodel.AlignmentViewport;
 import jalview.ws.params.ParamManager;
 
@@ -305,6 +306,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     boolean showjconsole = jalview.bin.Cache.getDefault(
             "SHOW_JAVA_CONSOLE", false);
     desktop = new MyDesktopPane(selmemusage);
+    if (Platform.isAMac())
+    {
+      desktop.setDoubleBuffered(false);
+    }
     showMemusage.setSelected(selmemusage);
     desktop.setBackground(Color.white);
     getContentPane().setLayout(new BorderLayout());
@@ -750,8 +755,13 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     frame.setResizable(resizable);
     frame.setMaximizable(resizable);
     frame.setIconifiable(resizable);
-    frame.setFrameIcon(null);
-
+    if (Platform.isAMac())
+    {
+      frame.setIconifiable(false);
+      frame.setFrameIcon(null);
+      // frame.setDesktopIcon(null);
+      frame.setDoubleBuffered(false);
+    }
     if (frame.getX() < 1 && frame.getY() < 1)
     {
       frame.setLocation(xOffset * openFrameCount, yOffset
@@ -2966,25 +2976,39 @@ public class Desktop extends jalview.jbgui.GDesktop implements
        * AlignmentPanel objects, including their AlignmentViewports, so the
        * cdna/protein relationships between the viewports is carried over to the
        * new split frames.
+       * 
+       * explodedGeometry holds the (x, y) position of the previously exploded
+       * SplitFrame, and the (width, height) of the AlignFrame component
        */
       AlignmentPanel topPanel = (AlignmentPanel) topPanels.get(i);
       AlignFrame newTopFrame = new AlignFrame(topPanel);
       newTopFrame.setSize(oldTopFrame.getSize());
       newTopFrame.setVisible(true);
+      Rectangle geometry = ((AlignViewport) topPanel.getAlignViewport())
+              .getExplodedGeometry();
+      if (geometry != null)
+      {
+        newTopFrame.setSize(geometry.getSize());
+      }
+
       AlignmentPanel bottomPanel = (AlignmentPanel) bottomPanels.get(i);
       AlignFrame newBottomFrame = new AlignFrame(bottomPanel);
       newBottomFrame.setSize(oldBottomFrame.getSize());
       newBottomFrame.setVisible(true);
+      geometry = ((AlignViewport) bottomPanel.getAlignViewport())
+              .getExplodedGeometry();
+      if (geometry != null)
+      {
+        newBottomFrame.setSize(geometry.getSize());
+      }
+
       topPanel.av.setGatherViewsHere(false);
       bottomPanel.av.setGatherViewsHere(false);
       JInternalFrame splitFrame = new SplitFrame(newTopFrame,
               newBottomFrame);
-      // either panel may hold previous exploded frame geometry
-      Rectangle geometry = ((AlignViewport) topPanel.getAlignViewport())
-              .getExplodedGeometry();
       if (geometry != null)
       {
-        splitFrame.setBounds(geometry);
+        splitFrame.setLocation(geometry.getLocation());
       }
       Desktop.addInternalFrame(splitFrame, sf.getTitle(), -1, -1);
     }
@@ -3007,10 +3031,18 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    */
   public void gatherViews(GSplitFrame source)
   {
+    /*
+     * special handling of explodedGeometry for a view within a SplitFrame: - it
+     * holds the (x, y) position of the enclosing SplitFrame, and the (width,
+     * height) of the AlignFrame component
+     */
     AlignFrame myTopFrame = (AlignFrame) source.getTopFrame();
     AlignFrame myBottomFrame = (AlignFrame) source.getBottomFrame();
-    myTopFrame.viewport.setExplodedGeometry(source.getBounds());
-    myBottomFrame.viewport.setExplodedGeometry(source.getBounds());
+    myTopFrame.viewport.setExplodedGeometry(new Rectangle(source.getX(),
+            source.getY(), myTopFrame.getWidth(), myTopFrame.getHeight()));
+    myBottomFrame.viewport.setExplodedGeometry(new Rectangle(source.getX(),
+            source.getY(), myBottomFrame.getWidth(), myBottomFrame
+                    .getHeight()));
     myTopFrame.viewport.setGatherViewsHere(true);
     myBottomFrame.viewport.setGatherViewsHere(true);
     String topViewId = myTopFrame.viewport.getSequenceSetId();
@@ -3035,10 +3067,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements
             gatherThis = true;
             topPanel.av.setGatherViewsHere(false);
             bottomPanel.av.setGatherViewsHere(false);
-            // both panels refer to the same split frame geometry
-            Rectangle position = sf.getBounds();
-            topPanel.av.setExplodedGeometry(position);
-            bottomPanel.av.setExplodedGeometry(position);
+            topPanel.av.setExplodedGeometry(new Rectangle(sf.getLocation(),
+                    topFrame.getSize()));
+            bottomPanel.av.setExplodedGeometry(new Rectangle(sf
+                    .getLocation(), bottomFrame.getSize()));
             myTopFrame.addAlignmentPanel(topPanel, false);
             myBottomFrame.addAlignmentPanel(bottomPanel, false);
           }