Changeset 5427 in osm for applications
- Timestamp:
- 2007-11-10T12:42:58+01:00 (17 years ago)
- Location:
- applications/editors/josm/plugins/livegps
- Files:
-
- 3 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/livegps/livegps/LiveGpsPlugin.java
r5424 r5427 20 20 import org.openstreetmap.josm.gui.layer.RawGpsLayer.GpsPoint; 21 21 import org.openstreetmap.josm.plugins.Plugin; 22 import org.openstreetmap.josm.actions.JosmAction; 22 23 23 24 public class LiveGpsPlugin extends Plugin … … 35 36 private LiveGpsLayer lgpslayer; 36 37 38 39 public class CaptureAction extends JosmAction { 40 public CaptureAction() { 41 super(tr("Capture GPS Track"), "capturemenu", tr("Connect to gpsd server and show current position in LiveGPS layer."), KeyEvent.VK_R, KeyEvent.ALT_MASK, true); 42 } 43 44 public void actionPerformed(ActionEvent e) { 45 enableTracking(lgpscapture.isSelected()); 46 } 47 } 48 49 public class CenterAction extends JosmAction { 50 public CenterAction() { 51 super(tr("Center Once"), "centermenu", tr("Center the LiveGPS layer to current position."), KeyEvent.VK_C, 0, true); 52 } 53 54 public void actionPerformed(ActionEvent e) { 55 if(lgpslayer != null) { 56 lgpslayer.center(); 57 } 58 } 59 } 60 61 public class AutoCenterAction extends JosmAction { 62 public AutoCenterAction() { 63 super(tr("Auto-Center"), "autocentermenu", tr("Continuously center the LiveGPS layer to current position."), KeyEvent.VK_HOME, 0, true); 64 } 65 66 public void actionPerformed(ActionEvent e) { 67 if(lgpslayer != null) { 68 lgpslayer.center(); 69 } 70 } 71 } 72 37 73 public LiveGpsPlugin() 38 74 { … … 42 78 menu.add(lgpsmenu, 5); 43 79 44 lgpscapture = new JCheckBoxMenuItem(tr("Capture GPS Track")); 45 lgpscapture.setSelected(false); 46 lgpscapture.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, KeyEvent.VK_ALT)); 47 lgpscapture.addActionListener(new ActionListener() { 48 public void actionPerformed(ActionEvent ev) { 49 enableTracking(lgpscapture.isSelected()); 50 } 51 }); 52 lgpscapture.setToolTipText("Connect to gpsd server and show current position in LiveGPS layer"); 53 lgpsmenu.add(lgpscapture); 80 JosmAction captureAction = new CaptureAction(); 81 JCheckBoxMenuItem captureMenu = new JCheckBoxMenuItem(captureAction); 82 lgpsmenu.add(captureMenu); 83 captureMenu.setAccelerator(captureAction.shortCut); 54 84 55 lgpscenter = new JMenuItem(tr("Center Once")); 56 lgpscenter.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, 0)); 57 lgpscenter.addActionListener(new ActionListener() { 58 public void actionPerformed(ActionEvent ev) { 59 if(lgpslayer != null) { 60 lgpslayer.center(); 61 } 62 } 63 }); 64 lgpscenter.setToolTipText("Center the LiveGPS layer to current position"); 65 lgpsmenu.add(lgpscenter); 66 67 68 lgpsautocenter = new JCheckBoxMenuItem(tr("Auto-Center")); 69 lgpsautocenter.setSelected(true); 70 lgpsautocenter.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0)); 71 lgpsautocenter.addActionListener(new ActionListener() { 72 public void actionPerformed(ActionEvent ev) { 73 setAutoCenter(lgpsautocenter.isSelected()); 74 } 75 }); 76 lgpsautocenter.setToolTipText("Continuously center the LiveGPS layer to current position"); 77 lgpsmenu.add(lgpsautocenter); 85 JosmAction centerAction = new CenterAction(); 86 JMenuItem centerMenu = new JMenuItem(centerAction); 87 lgpsmenu.add(centerMenu); 88 centerMenu.setAccelerator(centerAction.shortCut); 89 90 JosmAction autoCenterAction = new AutoCenterAction(); 91 JCheckBoxMenuItem autoCenterMenu = new JCheckBoxMenuItem(autoCenterAction); 92 lgpsmenu.add(autoCenterMenu); 93 autoCenterMenu.setAccelerator(autoCenterAction.shortCut); 78 94 } 79 95
Note:
See TracChangeset
for help on using the changeset viewer.