Changeset 3340 in osm for applications/editors/josm
- Timestamp:
- 2007-06-25T19:11:54+02:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/livegps/livegps/LiveGpsPlugin.java
r3076 r3340 1 1 package livegps; 2 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 3 4 import java.awt.event.ActionEvent; 4 5 import java.awt.event.ActionListener; … … 40 41 lgpsmenu.setMnemonic(KeyEvent.VK_G); 41 42 menu.add(lgpsmenu, 2); 42 lgpscapture = new JCheckBoxMenuItem( "Capture GPS Track");43 lgpscapture = new JCheckBoxMenuItem(tr("Capture GPS Track")); 43 44 lgpscapture.setSelected(false); 44 45 lgpscapture.setAccelerator(KeyStroke.getKeyStroke("alt R")); … … 50 51 lgpsmenu.add(lgpscapture); 51 52 52 lgpscenter = new JMenuItem( "Center Once", KeyEvent.VK_C);53 lgpscenter = new JMenuItem(tr("Center Once"), KeyEvent.VK_C); 53 54 lgpscenter.addActionListener(new ActionListener() { 54 55 public void actionPerformed(ActionEvent ev) { 55 lgpslayer.center(); 56 if(lgpslayer != null) { 57 lgpslayer.center(); 58 } 56 59 } 57 60 }); … … 59 62 60 63 61 lgpsautocenter = new JCheckBoxMenuItem("Auto-Center on current position"); 62 lgpsautocenter.setSelected(false); 64 lgpsautocenter = new JCheckBoxMenuItem(tr("Auto-Center on current position")); 65 lgpsautocenter.setSelected(true); 66 lgpsautocenter.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0)); 63 67 lgpsautocenter.addActionListener(new ActionListener() { 64 68 public void actionPerformed(ActionEvent ev) { 65 lgpslayer.setAutoCenter(lgpsautocenter.isSelected()); 66 if (lgpsautocenter.isSelected()) lgpslayer.center(); 69 setAutoCenter(lgpsautocenter.isSelected()); 67 70 } 68 71 }); 69 72 lgpsmenu.add(lgpsautocenter); 73 } 74 75 /** 76 * Set to <code>true</code> if the current position should always be in the center of the map. 77 * @param autoCenter if <code>true</code> the map is always centered. 78 */ 79 public void setAutoCenter(boolean autoCenter) { 80 lgpsautocenter.setSelected(autoCenter); // just in case this method was not called from the menu 81 if(lgpslayer != null) { 82 lgpslayer.setAutoCenter(autoCenter); 83 if (autoCenter) lgpslayer.center(); 84 } 85 } 86 87 /** 88 * Returns <code>true</code> if autocenter is selected. 89 * @return <code>true</code> if autocenter is selected. 90 */ 91 public boolean isAutoCenter() { 92 return lgpsautocenter.isSelected(); 70 93 } 71 94 … … 87 110 lgpslayer = new LiveGpsLayer(data); 88 111 Main.main.addLayer(lgpslayer); 112 lgpslayer.setAutoCenter(isAutoCenter()); 89 113 } 90 114 // connect layer with acquirer:
Note:
See TracChangeset
for help on using the changeset viewer.