From b80f2b5a1dfd131a26248204083e948ac5dc0160 Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 9 Jun 2010 12:09:07 +0000 Subject: [PATCH] paste menu display on OSX Leopard * JAL-557 --- src/jalview/gui/Desktop.java | 82 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 79 insertions(+), 3 deletions(-) diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 67729bc..d32b901 100755 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -70,7 +70,84 @@ public class Desktop extends jalview.jbgui.GDesktop implements public static boolean internalCopy = false; static int fileLoadingCount = 0; - + class MyDesktopManager implements DesktopManager { + + private DesktopManager delegate; + + public MyDesktopManager(DesktopManager delegate) { + this.delegate = delegate; + } + + public void activateFrame(JInternalFrame f) { + try { + delegate.activateFrame(f); + } catch (NullPointerException npe) { + Point p = getMousePosition(); + instance.showPasteMenu(p.x,p.y); + } + } + + public void beginDraggingFrame(JComponent f) { + delegate.beginDraggingFrame(f); + } + + public void beginResizingFrame(JComponent f, int direction) { + delegate.beginResizingFrame(f, direction); + } + + public void closeFrame(JInternalFrame f) { + delegate.closeFrame(f); + } + + public void deactivateFrame(JInternalFrame f) { + delegate.deactivateFrame(f); + } + + public void deiconifyFrame(JInternalFrame f) { + delegate.deiconifyFrame(f); + } + + public void dragFrame(JComponent f, int newX, int newY) { + delegate.dragFrame(f, newX, newY); + } + + public void endDraggingFrame(JComponent f) { + delegate.endDraggingFrame(f); + } + + public void endResizingFrame(JComponent f) { + delegate.endResizingFrame(f); + } + + public void iconifyFrame(JInternalFrame f) { + delegate.iconifyFrame(f); + } + + public void maximizeFrame(JInternalFrame f) { + delegate.maximizeFrame(f); + } + + public void minimizeFrame(JInternalFrame f) { + delegate.minimizeFrame(f); + } + + public void openFrame(JInternalFrame f) { + delegate.openFrame(f); + } + + public void resizeFrame(JComponent f, int newX, int newY, int newWidth, + int newHeight) { + delegate.resizeFrame(f, newX, newY, newWidth, newHeight); + } + + public void setBoundsForFrame(JComponent f, int newX, int newY, + int newWidth, int newHeight) { + delegate.setBoundsForFrame(f, newX, newY, newWidth, newHeight); + } + + // All other methods, simply delegate + + } /** * Creates a new Desktop object. */ @@ -100,8 +177,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements // This line prevents Windows Look&Feel resizing all new windows to maximum // if previous window was maximised - desktop.setDesktopManager(new DefaultDesktopManager()); - + desktop.setDesktopManager(new MyDesktopManager(new DefaultDesktopManager())); Rectangle dims = getLastKnownDimensions(""); if (dims != null) { -- 1.7.10.2