X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FDesktop.java;h=ba7665b45217f922683daf6ac61719486ae595ca;hb=a5928e2c1b9e2cea8d9c43f3d03f9cce2604f3b2;hp=dfef0d2c9e15fc56fbf53272c9e67b0a3303e0b2;hpb=0d37fef8a89c67845c14f2383e89003c9a2c5b62;p=jalview.git diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index dfef0d2..ba7665b 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -102,6 +102,7 @@ import org.stackoverflowusers.file.WindowsShortcut; import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; +import jalview.api.structures.JalviewStructureDisplayI; import jalview.bin.Cache; import jalview.bin.Jalview; import jalview.gui.ImageExporter.ImageWriterI; @@ -191,6 +192,16 @@ public class Desktop extends jalview.jbgui.GDesktop public static HashMap savingFiles = new HashMap(); + private static int DRAG_MODE = JDesktopPane.OUTLINE_DRAG_MODE; + + public static void setLiveDragMode(boolean b) + { + DRAG_MODE = b ? JDesktopPane.LIVE_DRAG_MODE + : JDesktopPane.OUTLINE_DRAG_MODE; + if (desktop != null) + desktop.setDragMode(DRAG_MODE); + } + private JalviewChangeSupport changeSupport = new JalviewChangeSupport(); public static boolean nosplash = false; @@ -487,16 +498,20 @@ public class Desktop extends jalview.jbgui.GDesktop } getContentPane().add(desktop, BorderLayout.CENTER); - desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); + desktop.setDragMode(DRAG_MODE); // This line prevents Windows Look&Feel resizing all new windows to maximum // if previous window was maximised desktop.setDesktopManager(new MyDesktopManager( - (Platform.isWindowsAndNotJS() ? new DefaultDesktopManager() - : Platform.isAMacAndNotJS() - ? new AquaInternalFrameManager( - desktop.getDesktopManager()) - : desktop.getDesktopManager()))); + Platform.isJS() ? desktop.getDesktopManager() + : new DefaultDesktopManager())); + /* + (Platform.isWindowsAndNotJS() ? new DefaultDesktopManager() + : Platform.isAMacAndNotJS() + ? new AquaInternalFrameManager( + desktop.getDesktopManager()) + : desktop.getDesktopManager()))); + */ Rectangle dims = getLastKnownDimensions(""); if (dims != null) @@ -1365,7 +1380,17 @@ public class Desktop extends jalview.jbgui.GDesktop if (jvnews != null) { storeLastKnownDimensions("JALVIEW_RSS_WINDOW_", jvnews.getBounds()); + } + + // Frames should all close automatically. Keeping external + // viewers open should already be decided by user. + closeAll_actionPerformed(null); + // check for aborted quit + if (QuitHandler.quitCancelled()) + { + jalview.bin.Console.debug("Desktop aborting quit"); + return null; } if (dialogExecutor != null) @@ -1373,8 +1398,6 @@ public class Desktop extends jalview.jbgui.GDesktop dialogExecutor.shutdownNow(); } - closeAll_actionPerformed(null); - if (groovyConsole != null) { // suppress a possible repeat prompt to save script @@ -1413,6 +1436,7 @@ public class Desktop extends jalview.jbgui.GDesktop // this will run the shutdownHook but QuitHandler.getQuitResponse() should // not run a second time if gotQuitResponse flag has been set (i.e. user // confirmed quit of some kind). + System.out.println("Desktop exiting."); System.exit(0); } @@ -1559,6 +1583,22 @@ public class Desktop extends jalview.jbgui.GDesktop } } + public int structureViewersStillRunningCount() + { + int count = 0; + JInternalFrame[] frames = desktop.getAllFrames(); + for (int i = 0; i < frames.length; i++) + { + if (frames[i] != null + && frames[i] instanceof JalviewStructureDisplayI) + { + if (((JalviewStructureDisplayI) frames[i]).stillRunning()) + count++; + } + } + return count; + } + @Override public void raiseRelated_actionPerformed(ActionEvent e) { @@ -2960,7 +3000,7 @@ public class Desktop extends jalview.jbgui.GDesktop /** * single thread that handles display of dialogs to user. */ - ExecutorService dialogExecutor = Executors.newSingleThreadExecutor(); + ExecutorService dialogExecutor = Executors.newFixedThreadPool(3); /** * flag indicating if dialogExecutor should try to acquire a permit