X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FDesktop.java;h=d3b8afc948f58c4a1f190e22c7a31525f3218618;hb=d616b0e1ac213a82591cece50ea25c5bfbfa865f;hp=270805a32bba31c64342d3a9193361f74be415ca;hpb=4d7f98a6dd54d9863ba449ec79dcd95d25ed863d;p=jalview.git diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 270805a..d3b8afc 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -23,6 +23,7 @@ package jalview.gui; import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; import jalview.bin.Cache; +import jalview.bin.Jalview; import jalview.io.FileLoader; import jalview.io.FormatAdapter; import jalview.io.IdentifyFile; @@ -33,6 +34,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 +307,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 +756,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 @@ -2371,6 +2382,12 @@ public class Desktop extends jalview.jbgui.GDesktop implements */ public static AlignFrame[] getAlignFrames() { + if (Jalview.isHeadlessMode()) + { + // Desktop.desktop is null in headless mode + return new AlignFrame[] { currentAlignFrame }; + } + JInternalFrame[] frames = Desktop.desktop.getAllFrames(); if (frames == null) @@ -2933,7 +2950,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements } /** - * Explode the views in the given frame into separate AlignFrame windows. + * Explode the views in the given SplitFrame into separate SplitFrame windows. + * This respects (remembers) any previous 'exploded geometry' i.e. the size + * and location last time the view was expanded (if any). However it does not + * remember the split pane divider location - this is set to match the + * 'exploding' frame. * * @param sf */ @@ -2962,27 +2983,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(new Dimension(AlignFrame.DEFAULT_WIDTH, - AlignFrame.DEFAULT_HEIGHT)); + 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(new Dimension(AlignFrame.DEFAULT_WIDTH, - AlignFrame.DEFAULT_HEIGHT)); + 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); } @@ -3005,10 +3038,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(); @@ -3033,10 +3074,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); }