source: josm/trunk/src/org/openstreetmap/josm/actions/ZoomInAction.java@ 11288

Last change on this file since 11288 was 10318, checked in by Don-vip, 8 years ago

fix #12906 - Change Actions to use LayerManager (patch by michael2402)

  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions;
3
4import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
5import static org.openstreetmap.josm.tools.I18n.tr;
6
7import java.awt.event.ActionEvent;
8import java.awt.event.KeyEvent;
9
10import org.openstreetmap.josm.Main;
11import org.openstreetmap.josm.tools.Shortcut;
12
13/**
14 * Zoom in map.
15 * @since 770
16 */
17public final class ZoomInAction extends JosmAction {
18
19 /**
20 * Constructs a new {@code ZoomInAction}.
21 */
22 public ZoomInAction() {
23 super(
24 tr("Zoom In"),
25 "dialogs/zoomin",
26 tr("Zoom In"),
27 // Although it might be possible on few custom keyboards, the vast majority of layouts do not have a direct '+' key, see below
28 Shortcut.registerShortcut("view:zoomin", tr("View: {0}", tr("Zoom In")), KeyEvent.VK_PLUS, Shortcut.DIRECT),
29 true
30 );
31 putValue("help", ht("/Action/ZoomIn"));
32 // On standard QWERTY, AZERTY and other common layouts the '+' key is obtained with Shift+EQUALS
33 Main.registerActionShortcut(this,
34 Shortcut.registerShortcut("view:zoominbis", tr("View: {0}", tr("Zoom In")),
35 KeyEvent.VK_EQUALS, Shortcut.SHIFT));
36 // But on some systems (Belgian keyboard under Ubuntu) it seems not to work, so use also EQUALS
37 Main.registerActionShortcut(this,
38 Shortcut.registerShortcut("view:zoominter", tr("View: {0}", tr("Zoom In")),
39 KeyEvent.VK_EQUALS, Shortcut.DIRECT));
40 // make numpad + behave like +
41 Main.registerActionShortcut(this,
42 Shortcut.registerShortcut("view:zoominkeypad", tr("View: {0}", tr("Zoom In (Keypad)")),
43 KeyEvent.VK_ADD, Shortcut.DIRECT));
44 }
45
46 @Override
47 public void actionPerformed(ActionEvent e) {
48 if (!Main.isDisplayingMapView()) return;
49 Main.map.mapView.zoomIn();
50 }
51
52 @Override
53 protected void updateEnabledState() {
54 setEnabled(!Main.getLayerManager().getLayers().isEmpty());
55 }
56
57}
Note: See TracBrowser for help on using the repository browser.