Field

Changeset 158:7342da68aaf1

Show
Ignore:
Timestamp:
08/21/2008 11:36:13 PM (5 months ago)
Author:
marc@e0.local
branch:
default
Message:

partial fix to #96

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • development/java/field/bytecode/protect/Trampoline2.java

    r149 r158  
    314314                                        String aa = (String) m.getMainAttributes().get(new Attributes.Name("Field-RedirectionPath")); 
    315315                                        System.out.println(aa+" "+j); 
    316                                         if (aa.endsWith("**")) { 
     316                                         
     317                                        if (aa!=null && aa.endsWith("**")) { 
    317318 
    318319                                                System.out.println(" adding wildcard path "); 
  • development/java/field/core/ui/FloatingPalettes.java

    r146 r158  
    1717import field.bytecode.protect.annotations.NextUpdate; 
    1818import field.core.ui.Quaqua15TigerLookAndFeelField.ToolPalette; 
     19import field.graphics.windowing.OverlayCanvas.OverlayCanvasFrame; 
    1920import field.launch.Launcher; 
    2021import field.launch.iUpdateable; 
     
    2324public class FloatingPalettes { 
    2425 
     26        static public boolean disable = false; 
     27         
    2528        static List<WeakReference<Frame>> palettes = new ArrayList<WeakReference<Frame>>(); 
    2629        static MutableFloat in = new MutableFloat(0); 
     
    2932 
    3033        static public void registerFloatingPalette(Frame frame) { 
     34                if (disable) return; 
    3135                if (suspendRegistration) 
    3236                        return; 
     
    7377 
    7478        static public void registerWindow(final Frame frame) { 
     79                if (disable) return; 
    7580 
    7681                FloatingPalettes.palettes = new ArrayList<WeakReference<Frame>>(); 
     
    8691 
    8792                        public void update() { 
     93                                 
     94                                Component o = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); 
     95//                              System.out.println(" -- focus owner is <"+o+"> <"+KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow()+">"); 
     96//                              System.out.println(in.d+" "+edge); 
     97                                 
    8898                                if (in.d > 0) { 
    8999                                        if (!edge) { 
     
    110120                        @NextUpdate(delay = 2) 
    111121                        private void restoreFocus(Component focus2) { 
     122                                 
     123                                System.out.println(" will restore focus to <"+focus2+">"); 
     124                                 
    112125                                if (focus2 instanceof Frame) 
    113126                                { 
     
    119132                                final Component f = focus2; 
    120133 
     134                                System.out.println(" and thus "+f); 
    121135                                if (focus2 != null) { 
    122136                                        // completely crazy! Why do I have to 
     
    151165 
    152166                        private Component saveFocus() { 
     167                                 
     168                                Window window = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); 
     169                                if (window instanceof OverlayCanvasFrame) 
     170                                { 
     171                                        return ((OverlayCanvasFrame)window).forComponent; 
     172                                } 
     173                                 
    153174                                return KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); 
    154175                        } 
     
    162183 
    163184                        public void windowActivated(WindowEvent e) { 
     185                                 
     186                                System.out.println(" window activated <"+e+">"); 
     187                                 
    164188                                if (e.getOppositeWindow() != null && (e.getOppositeWindow().getClass().getName().contains("OverlayCanvas") || e.getOppositeWindow().getClass().getName().contains("PopupInfoWindow"))) { 
    165189                                } else if (palletteOf(e.getOppositeWindow(), palettes)) { 
     
    181205 
    182206                        public void windowDeactivated(WindowEvent e) { 
     207                                System.out.println(" window de  activated <"+e+">"); 
    183208                                if (e.getOppositeWindow() != null && (e.getOppositeWindow().getClass().getName().contains("OverlayCanvas") || e.getOppositeWindow().getClass().getName().contains("PopupInfoWindow"))) { 
    184209                                } else if (palletteOf(e.getOppositeWindow(), palettes)) { 
     
    212237 
    213238        protected static void moveIn(List<WeakReference<Frame>> palettes) { 
     239                 
    214240                for (WeakReference<Frame> w : palettes) { 
    215241                        Frame f = w.get(); 
  • development/java/field/core/ui/SavedFramePositions.java

    r81 r158  
    22 
    33import java.awt.Dimension; 
     4import java.awt.Frame; 
    45import java.awt.GraphicsDevice; 
    56import java.awt.GraphicsEnvironment; 
     
    148149                return !currentsetup.hidden.containsKey(name); 
    149150        } 
     151         
     152        static public void mentionFrame(final Frame window) 
     153        { 
     154                currentsetup.framesToSave.put(System.identityHashCode(window)+"", window); 
     155        } 
    150156 
    151157        static public Pair<String, SavedFrameSetup> findSetupForWindow(Window w) { 
  • development/java/field/graphics/windowing/OverlayCanvas.java

    r81 r158  
    33import java.awt.AWTEvent; 
    44import java.awt.Color; 
     5import java.awt.Component; 
    56import java.awt.Frame; 
     7import java.awt.HeadlessException; 
    68import java.awt.event.ComponentEvent; 
    79import java.awt.event.ComponentListener; 
     
    1820import com.sun.opengl.impl.macosx.MacOSXGLContext; 
    1921 
     22import field.core.ui.FloatingPalettes; 
     23import field.core.ui.SavedFramePositions; 
    2024import field.core.windowing.GLComponentWindow; 
    2125import field.graphics.core.BasicCamera; 
     
    3337public class OverlayCanvas implements iUpdateable { 
    3438 
     39        public class OverlayCanvasFrame extends JFrame { 
     40                int visibleNum = 0; 
     41                public final Frame forFrame; 
     42                public final Component forComponent; 
     43 
     44                private OverlayCanvasFrame(Frame forFrame, Component forComponent, String title) throws HeadlessException { 
     45                        super(title); 
     46 
     47                        this.forFrame = forFrame; 
     48                        this.forComponent = forComponent; 
     49 
     50                } 
     51 
     52                @Override 
     53                public void setVisible(boolean b) { 
     54                        super.setVisible(b); 
     55 
     56                        enableEvents(AWTEvent.MOUSE_EVENT_MASK); 
     57                        enableEvents(AWTEvent.KEY_EVENT_MASK); 
     58                        enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK); 
     59                } 
     60 
     61                @Override 
     62                protected void processMouseEvent(MouseEvent e) { 
     63                        super.processMouseEvent(e); 
     64                } 
     65 
     66                @Override 
     67                protected void processMouseMotionEvent(MouseEvent e) { 
     68                        super.processMouseMotionEvent(e); 
     69                } 
     70        } 
     71 
    3572        private final Frame inside; 
    3673 
     
    6198                this.share = share; 
    6299 
    63                 frame = new JFrame("banana") { 
    64  
    65                         int visibleNum = 0; 
    66  
    67                         @Override 
    68                         public void setVisible(boolean b) { 
    69                                 super.setVisible(b); 
    70  
    71                                 enableEvents(AWTEvent.MOUSE_EVENT_MASK); 
    72                                 enableEvents(AWTEvent.KEY_EVENT_MASK); 
    73                                 enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK); 
    74                         } 
    75  
    76  
    77                         @Override 
    78                         protected void processMouseEvent(MouseEvent e) { 
    79                                 super.processMouseEvent(e); 
    80                         } 
    81  
    82                         @Override 
    83                         protected void processMouseMotionEvent(MouseEvent e) { 
    84                                 super.processMouseMotionEvent(e); 
    85                         } 
    86                 }; 
     100                frame = new OverlayCanvasFrame(componentWindow.getFrame(), share, "banana"+componentWindow); 
    87101 
    88102                frame.setUndecorated(true); 
    89103                frame.setBounds(inside.getBounds()); 
    90104                frame.setBackground(new Color(0, 0, 0, 0.0f)); 
     105                frame.setFocusable(false); 
     106                 
    91107                GLCapabilities cap = new GLCapabilities(); 
    92108                if (SystemProperties.getIntProperty("needsFSAA", 1) == 1) { 
     
    178194 
    179195                createInitialLists(makeCamera); 
     196                 
     197                frame.setFocusable(false); 
     198 
     199                FloatingPalettes.registerFloatingPalette(frame); 
     200                 
     201                SavedFramePositions.mentionFrame(frame); 
    180202        } 
    181203