Changeset 158:7342da68aaf1
- 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
| r149 |
r158 |
|
| 314 | 314 | String aa = (String) m.getMainAttributes().get(new Attributes.Name("Field-RedirectionPath")); |
|---|
| 315 | 315 | System.out.println(aa+" "+j); |
|---|
| 316 | | if (aa.endsWith("**")) { |
|---|
| | 316 | |
|---|
| | 317 | if (aa!=null && aa.endsWith("**")) { |
|---|
| 317 | 318 | |
|---|
| 318 | 319 | System.out.println(" adding wildcard path "); |
|---|
| r146 |
r158 |
|
| 17 | 17 | import field.bytecode.protect.annotations.NextUpdate; |
|---|
| 18 | 18 | import field.core.ui.Quaqua15TigerLookAndFeelField.ToolPalette; |
|---|
| | 19 | import field.graphics.windowing.OverlayCanvas.OverlayCanvasFrame; |
|---|
| 19 | 20 | import field.launch.Launcher; |
|---|
| 20 | 21 | import field.launch.iUpdateable; |
|---|
| … | … | |
| 23 | 24 | public class FloatingPalettes { |
|---|
| 24 | 25 | |
|---|
| | 26 | static public boolean disable = false; |
|---|
| | 27 | |
|---|
| 25 | 28 | static List<WeakReference<Frame>> palettes = new ArrayList<WeakReference<Frame>>(); |
|---|
| 26 | 29 | static MutableFloat in = new MutableFloat(0); |
|---|
| … | … | |
| 29 | 32 | |
|---|
| 30 | 33 | static public void registerFloatingPalette(Frame frame) { |
|---|
| | 34 | if (disable) return; |
|---|
| 31 | 35 | if (suspendRegistration) |
|---|
| 32 | 36 | return; |
|---|
| … | … | |
| 73 | 77 | |
|---|
| 74 | 78 | static public void registerWindow(final Frame frame) { |
|---|
| | 79 | if (disable) return; |
|---|
| 75 | 80 | |
|---|
| 76 | 81 | FloatingPalettes.palettes = new ArrayList<WeakReference<Frame>>(); |
|---|
| … | … | |
| 86 | 91 | |
|---|
| 87 | 92 | 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 | |
|---|
| 88 | 98 | if (in.d > 0) { |
|---|
| 89 | 99 | if (!edge) { |
|---|
| … | … | |
| 110 | 120 | @NextUpdate(delay = 2) |
|---|
| 111 | 121 | private void restoreFocus(Component focus2) { |
|---|
| | 122 | |
|---|
| | 123 | System.out.println(" will restore focus to <"+focus2+">"); |
|---|
| | 124 | |
|---|
| 112 | 125 | if (focus2 instanceof Frame) |
|---|
| 113 | 126 | { |
|---|
| … | … | |
| 119 | 132 | final Component f = focus2; |
|---|
| 120 | 133 | |
|---|
| | 134 | System.out.println(" and thus "+f); |
|---|
| 121 | 135 | if (focus2 != null) { |
|---|
| 122 | 136 | // completely crazy! Why do I have to |
|---|
| … | … | |
| 151 | 165 | |
|---|
| 152 | 166 | private Component saveFocus() { |
|---|
| | 167 | |
|---|
| | 168 | Window window = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); |
|---|
| | 169 | if (window instanceof OverlayCanvasFrame) |
|---|
| | 170 | { |
|---|
| | 171 | return ((OverlayCanvasFrame)window).forComponent; |
|---|
| | 172 | } |
|---|
| | 173 | |
|---|
| 153 | 174 | return KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); |
|---|
| 154 | 175 | } |
|---|
| … | … | |
| 162 | 183 | |
|---|
| 163 | 184 | public void windowActivated(WindowEvent e) { |
|---|
| | 185 | |
|---|
| | 186 | System.out.println(" window activated <"+e+">"); |
|---|
| | 187 | |
|---|
| 164 | 188 | if (e.getOppositeWindow() != null && (e.getOppositeWindow().getClass().getName().contains("OverlayCanvas") || e.getOppositeWindow().getClass().getName().contains("PopupInfoWindow"))) { |
|---|
| 165 | 189 | } else if (palletteOf(e.getOppositeWindow(), palettes)) { |
|---|
| … | … | |
| 181 | 205 | |
|---|
| 182 | 206 | public void windowDeactivated(WindowEvent e) { |
|---|
| | 207 | System.out.println(" window de activated <"+e+">"); |
|---|
| 183 | 208 | if (e.getOppositeWindow() != null && (e.getOppositeWindow().getClass().getName().contains("OverlayCanvas") || e.getOppositeWindow().getClass().getName().contains("PopupInfoWindow"))) { |
|---|
| 184 | 209 | } else if (palletteOf(e.getOppositeWindow(), palettes)) { |
|---|
| … | … | |
| 212 | 237 | |
|---|
| 213 | 238 | protected static void moveIn(List<WeakReference<Frame>> palettes) { |
|---|
| | 239 | |
|---|
| 214 | 240 | for (WeakReference<Frame> w : palettes) { |
|---|
| 215 | 241 | Frame f = w.get(); |
|---|
| r81 |
r158 |
|
| 2 | 2 | |
|---|
| 3 | 3 | import java.awt.Dimension; |
|---|
| | 4 | import java.awt.Frame; |
|---|
| 4 | 5 | import java.awt.GraphicsDevice; |
|---|
| 5 | 6 | import java.awt.GraphicsEnvironment; |
|---|
| … | … | |
| 148 | 149 | return !currentsetup.hidden.containsKey(name); |
|---|
| 149 | 150 | } |
|---|
| | 151 | |
|---|
| | 152 | static public void mentionFrame(final Frame window) |
|---|
| | 153 | { |
|---|
| | 154 | currentsetup.framesToSave.put(System.identityHashCode(window)+"", window); |
|---|
| | 155 | } |
|---|
| 150 | 156 | |
|---|
| 151 | 157 | static public Pair<String, SavedFrameSetup> findSetupForWindow(Window w) { |
|---|
| r81 |
r158 |
|
| 3 | 3 | import java.awt.AWTEvent; |
|---|
| 4 | 4 | import java.awt.Color; |
|---|
| | 5 | import java.awt.Component; |
|---|
| 5 | 6 | import java.awt.Frame; |
|---|
| | 7 | import java.awt.HeadlessException; |
|---|
| 6 | 8 | import java.awt.event.ComponentEvent; |
|---|
| 7 | 9 | import java.awt.event.ComponentListener; |
|---|
| … | … | |
| 18 | 20 | import com.sun.opengl.impl.macosx.MacOSXGLContext; |
|---|
| 19 | 21 | |
|---|
| | 22 | import field.core.ui.FloatingPalettes; |
|---|
| | 23 | import field.core.ui.SavedFramePositions; |
|---|
| 20 | 24 | import field.core.windowing.GLComponentWindow; |
|---|
| 21 | 25 | import field.graphics.core.BasicCamera; |
|---|
| … | … | |
| 33 | 37 | public class OverlayCanvas implements iUpdateable { |
|---|
| 34 | 38 | |
|---|
| | 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 | |
|---|
| 35 | 72 | private final Frame inside; |
|---|
| 36 | 73 | |
|---|
| … | … | |
| 61 | 98 | this.share = share; |
|---|
| 62 | 99 | |
|---|
| 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); |
|---|
| 87 | 101 | |
|---|
| 88 | 102 | frame.setUndecorated(true); |
|---|
| 89 | 103 | frame.setBounds(inside.getBounds()); |
|---|
| 90 | 104 | frame.setBackground(new Color(0, 0, 0, 0.0f)); |
|---|
| | 105 | frame.setFocusable(false); |
|---|
| | 106 | |
|---|
| 91 | 107 | GLCapabilities cap = new GLCapabilities(); |
|---|
| 92 | 108 | if (SystemProperties.getIntProperty("needsFSAA", 1) == 1) { |
|---|
| … | … | |
| 178 | 194 | |
|---|
| 179 | 195 | createInitialLists(makeCamera); |
|---|
| | 196 | |
|---|
| | 197 | frame.setFocusable(false); |
|---|
| | 198 | |
|---|
| | 199 | FloatingPalettes.registerFloatingPalette(frame); |
|---|
| | 200 | |
|---|
| | 201 | SavedFramePositions.mentionFrame(frame); |
|---|
| 180 | 202 | } |
|---|
| 181 | 203 | |
|---|