[6380] | 1 | // License: GPL. For details, see LICENSE file.
|
---|
[770] | 2 | package org.openstreetmap.josm.actions;
|
---|
| 3 |
|
---|
[2550] | 4 | import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
|
---|
[770] | 5 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
| 6 |
|
---|
| 7 | import java.awt.event.ActionEvent;
|
---|
| 8 | import java.awt.event.KeyEvent;
|
---|
| 9 |
|
---|
| 10 | import org.openstreetmap.josm.Main;
|
---|
[1084] | 11 | import org.openstreetmap.josm.tools.Shortcut;
|
---|
[770] | 12 |
|
---|
[6363] | 13 | /**
|
---|
| 14 | * Zoom out map.
|
---|
| 15 | * @since 770
|
---|
| 16 | */
|
---|
[770] | 17 | public final class ZoomOutAction extends JosmAction {
|
---|
| 18 |
|
---|
[6363] | 19 | /**
|
---|
| 20 | * Constructs a new {@code ZoomOutAction}.
|
---|
| 21 | */
|
---|
[1169] | 22 | public ZoomOutAction() {
|
---|
[1218] | 23 | super(tr("Zoom Out"), "dialogs/zoomout", tr("Zoom Out"),
|
---|
[4982] | 24 | Shortcut.registerShortcut("view:zoomout", tr("View: {0}", tr("Zoom Out")), KeyEvent.VK_MINUS, Shortcut.DIRECT), true);
|
---|
[2323] | 25 | putValue("help", ht("/Action/ZoomOut"));
|
---|
[2550] | 26 | // make numpad - behave like -
|
---|
[4891] | 27 | Main.registerActionShortcut(this,
|
---|
| 28 | Shortcut.registerShortcut("view:zoomoutkeypad", tr("View: {0}", tr("Zoom Out (Keypad)")),
|
---|
[4982] | 29 | KeyEvent.VK_SUBTRACT, Shortcut.DIRECT));
|
---|
[1169] | 30 | }
|
---|
[770] | 31 |
|
---|
[6084] | 32 | @Override
|
---|
[1169] | 33 | public void actionPerformed(ActionEvent e) {
|
---|
[2343] | 34 | if (!Main.isDisplayingMapView()) return;
|
---|
[9818] | 35 | Main.map.mapView.zoomOut();
|
---|
[1169] | 36 | }
|
---|
[1854] | 37 |
|
---|
| 38 | @Override
|
---|
| 39 | protected void updateEnabledState() {
|
---|
[10318] | 40 | setEnabled(!Main.getLayerManager().getLayers().isEmpty());
|
---|
[1854] | 41 | }
|
---|
[770] | 42 | }
|
---|