Changeset 5286 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2012-06-19T23:49:52+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/FullscreenToggleAction.java
r5078 r5286 27 27 public class FullscreenToggleAction extends JosmAction { 28 28 private final List<ButtonModel> buttonModels = new ArrayList<ButtonModel>(); 29 private boolean selected; 29 30 private GraphicsDevice gd; 30 31 private Rectangle prevBounds; … … 42 43 Main.toolbar.register(this); 43 44 gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); 44 putValue(SELECTED_KEY, Main.pref.getBoolean("draw.fullscreen", false));45 selected = Main.pref.getBoolean("draw.fullscreen", false); 45 46 notifySelectedState(); 46 47 } … … 60 61 protected void notifySelectedState() { 61 62 for (ButtonModel model: buttonModels) { 62 if (model.isSelected() != isSelected()) {63 model.setSelected( isSelected());63 if (model.isSelected() != selected) { 64 model.setSelected(selected); 64 65 } 65 66 } … … 67 68 68 69 protected void toggleSelectedState() { 69 putValue(SELECTED_KEY, !isSelected());70 Main.pref.put("draw.fullscreen", isSelected());70 selected = !selected; 71 Main.pref.put("draw.fullscreen", selected); 71 72 notifySelectedState(); 72 73 setMode(); … … 74 75 75 76 public void initial() { 76 if (isSelected()) {77 if(selected) 77 78 setMode(); 78 }79 79 } 80 80 … … 91 91 92 92 frame.dispose(); 93 frame.setUndecorated( isSelected());93 frame.setUndecorated(selected); 94 94 95 if ( isSelected()) {95 if (selected) { 96 96 prevBounds = frame.getBounds(); 97 97 frame.setBounds(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize())); … … 99 99 100 100 // we cannot use hw-exclusive fullscreen mode in MS-Win, as long 101 // as josm throws out modal dialogs, see here: 102 // http://forums.sun.com/thread.jspa?threadID=5351882 FIXME this url does not work anymore 101 // as josm throws out modal dialogs. 103 102 // 104 103 // the good thing is: fullscreen works without exclusive mode, … … 107 106 String exclusive = Main.pref.get("draw.fullscreen.exclusive-mode", "auto"); 108 107 if ("true".equals(exclusive) || ("auto".equals(exclusive) && !(Main.platform instanceof PlatformHookWindows))) { 109 gd.setFullScreenWindow( isSelected()? frame : null);108 gd.setFullScreenWindow(selected ? frame : null); 110 109 } 111 110 112 if (! isSelected()&& prevBounds != null) {111 if (!selected && prevBounds != null) { 113 112 frame.setBounds(prevBounds); 114 113 } … … 117 116 wind.setVisible(true); 118 117 } 119 118 120 119 // Free F10 key to allow it to be used by plugins, even after full screen (see #7502) 121 frame.getJMenuBar().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F10, 0), "none"); 120 frame.getJMenuBar().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F10, 0), "none"); 122 121 } 123 122 … … 125 124 toggleSelectedState(); 126 125 } 127 128 public final boolean isSelected() {129 return (Boolean)getValue(SELECTED_KEY);130 }131 126 }
Note:
See TracChangeset
for help on using the changeset viewer.