paste menu display on OSX Leopard * JAL-557
authorjprocter <Jim Procter>
Wed, 9 Jun 2010 12:09:08 +0000 (12:09 +0000)
committerjprocter <Jim Procter>
Wed, 9 Jun 2010 12:09:08 +0000 (12:09 +0000)
src/jalview/gui/Desktop.java

index 7a972a1..87a79b1 100755 (executable)
@@ -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)
     {