Changeset 15445 in josm for trunk/src


Ignore:
Timestamp:
2019-10-08T23:08:20+02:00 (5 years ago)
Author:
Don-vip
Message:

fix #18210 - fix mode menu (add items properly to display shortcuts) and fix definition of lasso mode to consider it a traditional mapmode

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectLassoAction.java

    r15444 r15445  
    11// License: GPL. For details, see LICENSE file.
    2 package org.openstreetmap.josm.actions;
     2package org.openstreetmap.josm.actions.mapmode;
    33
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import org.openstreetmap.josm.actions.mapmode.MapMode;
     6import java.awt.event.KeyEvent;
     7
    78import org.openstreetmap.josm.gui.MainApplication;
    89import org.openstreetmap.josm.gui.MapFrame;
    910import org.openstreetmap.josm.gui.layer.Layer;
    1011import org.openstreetmap.josm.tools.ImageProvider;
     12import org.openstreetmap.josm.tools.Shortcut;
    1113
    1214/**
     
    1416 * @since 5152
    1517 */
    16 public class LassoModeAction extends MapMode {
     18public class SelectLassoAction extends MapMode {
    1719
    1820    /**
    19      * Constructs a new {@code LassoModeAction}.
     21     * Constructs a new {@code SelectLassoAction}.
    2022     */
    21     public LassoModeAction() {
     23    public SelectLassoAction() {
    2224        super(tr("Lasso Mode"),
    2325                /* ICON(mapmode/) */ "rope",
    2426                tr("Lasso selection mode: select objects within a hand-drawn region"),
     27                Shortcut.registerShortcut("mapmode:lasso", tr("Mode: {0}", tr("Lasso Mode")), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE),
    2528                ImageProvider.getCursor("normal", "rope"));
    2629    }
  • trunk/src/org/openstreetmap/josm/gui/MainMenu.java

    r15438 r15445  
    344344     * modeMenu contains map modes
    345345     */
    346     public final JMenu modeMenu = addMenu("Mode", /* I18N: mnemonic: M */ trc("menu", "Mode"), KeyEvent.VK_M, 3, ht("/Menu/Mode"));
     346    public final JMenu modeMenu = addMenu(new ModeMenu(), /* I18N: mnemonic: M */ trc("menu", "Mode"), KeyEvent.VK_M, 3, ht("/Menu/Mode"));
    347347    /**
    348348     * toolsMenu contains different geometry manipulation actions from JOSM core (most used)
  • trunk/src/org/openstreetmap/josm/gui/MapFrame.java

    r15438 r15445  
    4444import javax.swing.plaf.basic.BasicSplitPaneUI;
    4545
    46 import org.openstreetmap.josm.actions.LassoModeAction;
    4746import org.openstreetmap.josm.actions.mapmode.DeleteAction;
    4847import org.openstreetmap.josm.actions.mapmode.DrawAction;
     
    5251import org.openstreetmap.josm.actions.mapmode.ParallelWayAction;
    5352import org.openstreetmap.josm.actions.mapmode.SelectAction;
     53import org.openstreetmap.josm.actions.mapmode.SelectLassoAction;
    5454import org.openstreetmap.josm.actions.mapmode.ZoomAction;
    5555import org.openstreetmap.josm.data.ViewportData;
     
    176176    public final DeleteAction mapModeDelete;
    177177    /** Select Lasso mode */
    178     public LassoModeAction mapModeSelectLasso;
     178    public final SelectLassoAction mapModeSelectLasso;
    179179
    180180    private final transient Map<Layer, MapMode> lastMapMode = new HashMap<>();
     
    241241        // toolBarActions, map mode buttons
    242242        mapModeSelect = new SelectAction(this);
    243         mapModeSelectLasso = new LassoModeAction();
     243        mapModeSelectLasso = new SelectLassoAction();
    244244        mapModeDraw = new DrawAction();
    245245        mapModeZoom = new ZoomAction(this);
     
    439439        if (!(b.getAction() instanceof MapMode))
    440440            throw new IllegalArgumentException("MapMode action must be subclass of MapMode");
    441         MainApplication.getMenu().modeMenu.add(new JCheckBoxMenuItem(b.getAction()));
     441        MainMenu.add(MainApplication.getMenu().modeMenu, (MapMode) b.getAction());
    442442        allMapModeButtons.add(b);
    443443        toolBarActionsGroup.add(b);
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r15371 r15445  
    3636import javax.swing.JOptionPane;
    3737
    38 import org.openstreetmap.josm.actions.LassoModeAction;
    3938import org.openstreetmap.josm.actions.RenameLayerAction;
     39import org.openstreetmap.josm.actions.mapmode.SelectLassoAction;
    4040import org.openstreetmap.josm.actions.mapmode.MapMode;
    4141import org.openstreetmap.josm.actions.mapmode.SelectAction;
     
    787787    /**
    788788     * Determines if the functionality of this layer is available in
    789      * the specified map mode. {@link SelectAction} and {@link LassoModeAction} are supported by default,
     789     * the specified map mode. {@link SelectAction} and {@link SelectLassoAction} are supported by default,
    790790     * other map modes can be registered.
    791791     * @param mapMode Map mode to be checked
     
    794794     */
    795795    private static boolean isSupportedMapMode(MapMode mapMode) {
    796         if (mapMode instanceof SelectAction || mapMode instanceof LassoModeAction) {
     796        if (mapMode instanceof SelectAction || mapMode instanceof SelectLassoAction) {
    797797            return true;
    798798        }
Note: See TracChangeset for help on using the changeset viewer.