Changeset 2550 in josm for trunk/src/org


Ignore:
Timestamp:
2009-11-29T14:44:17+01:00 (12 years ago)
Author:
Gubaer
Message:

fixed #2669: Problem with zoom keys
fixed #3269: Plus/minus buttons don't work
Couldn't get '+' to work on a swiss german keyboard (don't know why) but 'numpad +' and 'numpad -' now zoom in and zoom out too

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
2 edited

Legend:

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

    r2343 r2550  
    22package org.openstreetmap.josm.actions;
    33
     4import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    45import static org.openstreetmap.josm.tools.I18n.tr;
    5 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    66
    77import java.awt.event.ActionEvent;
    88import java.awt.event.KeyEvent;
     9
     10import javax.swing.JComponent;
     11import javax.swing.KeyStroke;
    912
    1013import org.openstreetmap.josm.Main;
     
    1417
    1518    public ZoomInAction() {
    16         super(tr("Zoom In"), "dialogs/zoomin", tr("Zoom In"),
    17                 Shortcut.registerShortcut("view:zoomin", tr("View: {0}", tr("Zoom In")), KeyEvent.VK_PLUS, Shortcut.GROUP_DIRECT), true);
     19        super(
     20                tr("Zoom In"),
     21                "dialogs/zoomin",
     22                tr("Zoom In"),
     23                Shortcut.registerShortcut("view:zoomin", tr("View: {0}", tr("Zoom In")),KeyEvent.VK_PLUS, Shortcut.GROUP_DIRECT),
     24                true
     25        );
    1826        putValue("help", ht("/Action/ZoomIn"));
     27        // make numpad + behave like + (action is already registred)
     28        Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD,0), tr("Zoom In"));
    1929    }
    2030
    2131    public void actionPerformed(ActionEvent e) {
     32        Object name = Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).get(KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, 0));
     33        Main.contentPane.getActionMap().put(name, this);
     34
    2235        if (!Main.isDisplayingMapView()) return;
    2336        Main.map.mapView.zoomToFactor(0.9);
  • trunk/src/org/openstreetmap/josm/actions/ZoomOutAction.java

    r2343 r2550  
    22package org.openstreetmap.josm.actions;
    33
     4import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    45import static org.openstreetmap.josm.tools.I18n.tr;
    5 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    66
    77import java.awt.event.ActionEvent;
    88import java.awt.event.KeyEvent;
     9
     10import javax.swing.JComponent;
     11import javax.swing.KeyStroke;
    912
    1013import org.openstreetmap.josm.Main;
     
    1720                Shortcut.registerShortcut("view:zoomout", tr("View: {0}", tr("Zoom Out")), KeyEvent.VK_MINUS, Shortcut.GROUP_DIRECT), true);
    1821        putValue("help", ht("/Action/ZoomOut"));
     22        // make numpad - behave like -
     23        Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT,0), tr("Zoom Out"));
    1924    }
    2025
Note: See TracChangeset for help on using the changeset viewer.