Changeset 2533 in josm for trunk


Ignore:
Timestamp:
2009-11-28T16:01:05+01:00 (15 years ago)
Author:
Gubaer
Message:

applied #4033: patch by avar: "Fullscreen View" should be turned into a JosmAction

Location:
trunk/src/org/openstreetmap/josm
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainMenu.java

    r2530 r2533  
    77import static org.openstreetmap.josm.tools.I18n.tr;
    88
    9 import java.awt.Frame;
    10 import java.awt.GraphicsDevice;
    11 import java.awt.GraphicsEnvironment;
    129import java.awt.event.ActionEvent;
    1310import java.awt.event.ActionListener;
     
    6966import org.openstreetmap.josm.actions.UploadSelectionAction;
    7067import org.openstreetmap.josm.actions.WireframeToggleAction;
     68import org.openstreetmap.josm.actions.FullscreenToggleAction;
    7169import org.openstreetmap.josm.actions.ZoomInAction;
    7270import org.openstreetmap.josm.actions.ZoomOutAction;
     
    8179import org.openstreetmap.josm.gui.layer.Layer;
    8280import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener;
    83 import org.openstreetmap.josm.tools.PlatformHookUnixoid;
    8481import org.openstreetmap.josm.tools.Shortcut;
    8582/**
     
    254251        }
    255252
    256         //
    257         // Full Screen action
    258         //
    259         final GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
    260 
    261         if (Main.platform instanceof PlatformHookUnixoid && gd.isFullScreenSupported()) {
    262             final JCheckBoxMenuItem fullscreen = new JCheckBoxMenuItem(tr("Full Screen"));
    263             fullscreen.setSelected(Main.pref.getBoolean("draw.fullscreen", false));
    264             fullscreen.setAccelerator(Shortcut.registerShortcut("menu:view:fullscreen", tr("Toggle Full Screen view"),
    265                     KeyEvent.VK_F11, Shortcut.GROUP_DIRECT).getKeyStroke());
    266 
    267             fullscreen.addActionListener(new ActionListener() {
    268                 public void actionPerformed(ActionEvent ev) {
    269                     Main.pref.put("draw.fullscreen", fullscreen.isSelected());
    270 
    271                     if (Main.pref.getBoolean("draw.fullscreen")) {
    272                         Frame frame = (Frame)Main.parent;
    273                         gd.setFullScreenWindow(frame);
    274                     } else {
    275                         gd.setFullScreenWindow(null);
    276                     }
    277                 }
    278             });
     253        // -- fullscreen toggle action
     254        FullscreenToggleAction fullscreenToggleAction = new FullscreenToggleAction();
     255        if (fullscreenToggleAction.canFullscreen()) {
     256            final JCheckBoxMenuItem fullscreen = new JCheckBoxMenuItem(fullscreenToggleAction);
    279257            viewMenu.addSeparator();
    280258            viewMenu.add(fullscreen);
     259            fullscreen.setAccelerator(fullscreenToggleAction.getShortcut().getKeyStroke());
     260            fullscreenToggleAction.addButtonModel(fullscreen.getModel());
    281261        }
    282262
Note: See TracChangeset for help on using the changeset viewer.