Changeset 3347 in osm for applications/editors
- Timestamp:
- 2007-06-25T19:16:56+02:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorShowAction.java
r2946 r3347 7 7 8 8 import java.awt.event.ActionEvent; 9 import java.awt.event.KeyEvent; 9 10 import java.io.BufferedReader; 10 11 import java.io.FileInputStream; … … 17 18 18 19 import javax.swing.AbstractAction; 20 import javax.swing.ActionMap; 21 import javax.swing.InputMap; 19 22 import javax.swing.JFrame; 20 23 import javax.swing.JOptionPane; 24 import javax.swing.KeyStroke; 21 25 22 26 import livegps.LiveGpsPlugin; … … 31 35 */ 32 36 public class SurveyorShowAction extends AbstractAction { 37 private static final long serialVersionUID = 2184570223633094734L; 33 38 private static final String DEFAULT_SOURCE = "resource://surveyor.xml"; 34 39 private JFrame surveyorFrame; … … 67 72 // add component as gps event listener: 68 73 gpsPlugin.addPropertyChangeListener(comp); 74 75 // add some hotkeys to the component: 76 ActionMap actionMap = comp.getActionMap(); 77 InputMap inputMap = comp.getInputMap(); 78 // zoomout: 79 actionMap.put("zoomout", new AbstractAction() { 80 public void actionPerformed(ActionEvent e) { 81 if(Main.map != null && Main.map.mapView != null) { 82 Main.map.mapView.zoomTo(Main.map.mapView.getCenter(), Main.map.mapView.getScale()*2); 83 } 84 } 85 }); 86 inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), "zoomout"); 87 // zoomin: 88 actionMap.put("zoomin", new AbstractAction() { 89 public void actionPerformed(ActionEvent e) { 90 if(Main.map != null && Main.map.mapView != null) { 91 Main.map.mapView.zoomTo(Main.map.mapView.getCenter(), Main.map.mapView.getScale()/2); 92 } 93 } 94 }); 95 inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), "zoomin"); 96 // autocenter: 97 actionMap.put("autocenter", new AbstractAction() { 98 public void actionPerformed(ActionEvent e) { 99 // toggle autocenter 100 gpsPlugin.setAutoCenter(!gpsPlugin.isAutoCenter()); 101 } 102 }); 103 inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0), "autocenter"); 104 69 105 surveyorFrame.add(comp); 70 106 surveyorFrame.pack();
Note:
See TracChangeset
for help on using the changeset viewer.